MCPcopy Create free account
hub / github.com/OpenRouterTeam/python-sdk / generate

Method generate

src/openrouter/video_generation.py:16–220  ·  view source on GitHub ↗

r"""Submit a video generation request Submits a video generation request and returns a polling URL to check status :param model: :param prompt: :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.

(
        self,
        *,
        model: str,
        prompt: str,
        http_referer: Optional[str] = None,
        x_open_router_title: Optional[str] = None,
        x_open_router_categories: Optional[str] = None,
        aspect_ratio: Optional[components.VideoGenerationRequestAspectRatio] = None,
        callback_url: Optional[str] = None,
        duration: Optional[int] = None,
        frame_images: Optional[
            Union[
                Iterable[components.FrameImage],
                Iterable[components.FrameImageTypedDict],
            ]
        ] = None,
        generate_audio: Optional[bool] = None,
        input_references: Optional[
            Union[
                Iterable[components.InputReference],
                Iterable[components.InputReferenceTypedDict],
            ]
        ] = None,
        provider: Optional[
            Union[
                components.VideoGenerationRequestProvider,
                components.VideoGenerationRequestProviderTypedDict,
            ]
        ] = None,
        resolution: Optional[components.VideoGenerationRequestResolution] = None,
        seed: Optional[int] = None,
        size: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    )

Source from the content-addressed store, hash-verified

14 r"""Video Generation endpoints"""
15
16 def generate(
17 self,
18 *,
19 model: str,
20 prompt: str,
21 http_referer: Optional[str] = None,
22 x_open_router_title: Optional[str] = None,
23 x_open_router_categories: Optional[str] = None,
24 aspect_ratio: Optional[components.VideoGenerationRequestAspectRatio] = None,
25 callback_url: Optional[str] = None,
26 duration: Optional[int] = None,
27 frame_images: Optional[
28 Union[
29 Iterable[components.FrameImage],
30 Iterable[components.FrameImageTypedDict],
31 ]
32 ] = None,
33 generate_audio: Optional[bool] = None,
34 input_references: Optional[
35 Union[
36 Iterable[components.InputReference],
37 Iterable[components.InputReferenceTypedDict],
38 ]
39 ] = None,
40 provider: Optional[
41 Union[
42 components.VideoGenerationRequestProvider,
43 components.VideoGenerationRequestProviderTypedDict,
44 ]
45 ] = None,
46 resolution: Optional[components.VideoGenerationRequestResolution] = None,
47 seed: Optional[int] = None,
48 size: Optional[str] = None,
49 retries: OptionalNullable[utils.RetryConfig] = UNSET,
50 server_url: Optional[str] = None,
51 timeout_ms: Optional[int] = None,
52 http_headers: Optional[Mapping[str, str]] = None,
53 ) -> components.VideoGenerationResponse:
54 r"""Submit a video generation request
55
56 Submits a video generation request and returns a polling URL to check status
57
58 :param model:
59 :param prompt:
60 :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
61 This is used to track API usage per application.
62
63 :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
64
65 :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
66
67 :param aspect_ratio: Aspect ratio of the generated video
68 :param callback_url: URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS.
69 :param duration: Duration of the generated video in seconds
70 :param frame_images: Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame.
71 :param generate_audio: Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set.
72 :param input_references: Reference assets to guide video generation. Accepts image, audio, and video references. Audio and video references are only honored by providers that support them (currently BytePlus Seedance 2.0); other providers use image references and ignore the rest.
73 :param provider: Provider-specific passthrough configuration

Callers

nothing calls this directly

Calls 6

HookContextClass · 0.90
get_security_from_envFunction · 0.90
unmarshal_json_responseFunction · 0.90
_get_urlMethod · 0.80
_build_requestMethod · 0.80
do_requestMethod · 0.80

Tested by

no test coverage detected