Skip to content

Add client.videos.generate() for /v1/videos/generations endpoint #9

@flyworker

Description

@flyworker

Context

mega-nova-api is adding POST /v1/videos/generations (MeganovaAI/mega-nova-api#435). The SDK needs a matching client method.

Requirements

  • Create meganova/resources/videos.py with VideosResource
  • Add client.videos.generate() method
  • Support parameters: prompt, model, image (for i2v), duration, aspect_ratio
  • Handle async polling pattern (video gen takes >30s)
    • generate() returns a task/job ID
    • client.videos.get(job_id) polls for completion
    • Optional: generate(wait=True) blocks until done
  • Create Pydantic models in models/videos.py:
    • VideoGenerationRequest
    • VideoGenerationResponse(id, status, video_url, ...)
  • Wire into main MegaNova client class
  • Add example: examples/video_generation.py

Response Model

class GeneratedVideo(BaseModel):
    url: str
    duration: Optional[float]
    model: str

class VideoGenerationResponse(BaseModel):
    id: str
    status: str  # pending, processing, completed, failed
    data: Optional[List[GeneratedVideo]]
    created: int

Depends On

  • mega-nova-api#435 (video endpoint implementation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready for testImplementation complete, ready for QA testing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions