Skip to content

gemini-omni-1.2-flash-ext Video Generation

gemini-omni-1.2-flash-ext unified video generation model

All documentation
POST/v1/videos/generations
  • Supports Text-to-Video, first-frame Image-to-Video, first-and-last-frame video, multi-image reference, and video editing and extension
  • Supports 360p/720p/1080p/4k resolution and 3–15 second duration, billed per second
  • Asynchronous task API. Submit a task first, then query the result by task ID

Request examples

curl --request POST \
  --url https://openrouterapi.ru/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-omni-1.2-flash-ext",
    "prompt": "Aerial shot over a misty mountain lake at sunrise.",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }'

Authentication

Authorizationstringrequired

All requests require Bearer Token authentication.

Get an API key:

Visit the API Key management page to get your API key.

Add the following header when making requests:

text
Authorization: Bearer YOUR_API_KEY

Request Parameters

modelstringrequired

Video generation model name. Fixed as gemini-omni-1.2-flash-ext.

nsfw_checkbooleandefault: false

Whether to run content moderation before submitting the video task.

  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
promptstringrequired

Video description or editing instruction. It cannot be empty after leading and trailing whitespace is trimmed. For Text-to-Video, describe the scene, characters, actions, camera, and sound; with images or videos, describe the motion, style, or changes you want.

Example: "Aerial shot over a misty mountain lake at sunrise."

Warning

prompt is required in every mode, including first frame, multi-image reference, editing, and extension. A 400 error is returned if it is missing.

durationintegerdefault: 10

Video duration in seconds. Must be an integer.

  • Text-to-Video / first frame / multi-image reference: output duration, 3–15
  • First and last frames: output duration, 3–10
  • Extension (extend): duration of the newly added segment, 3–10
  • Editing (edit): must not be passed; the output duration follows the source video

The alias seconds is also accepted. If both are passed, they must be equal.

Warning

Passing duration / seconds in editing mode returns a video edit does not accept duration error.

resolutionstringdefault: 720p

Video resolution, case-insensitive. It determines the per-second price.

Allowed values:

  • 360p
  • 720p
  • 1080p
  • 4k (2160p is also accepted)

Warning

Any other resolution returns a 400 error.

aspect_ratiostringdefault: 16:9

Only 16:9 (landscape, default) and 9:16 (portrait) are supported; other values return a 400 error.

Extension (extend) always follows the source video’s aspect ratio. Passing aspect_ratio does not change the extension’s ratio.

omni_reference_task_typestring

Task type, specifying how the input material is used.

Allowed values:

  • edit - Edit a video. Use with video_urls or extend_from_task_id
  • extend - Extend a video by appending new content at the end. Use with video_urls or extend_from_task_id
  • reference - Multi-image reference. Use with image_urls
  • text_to_video / image_to_video / reference_to_video - Text-to-Video / first frame / reference images
  • auto - Detected from the input; treated as edit when a video is provided

Optional when no video is provided; the mode is detected from the input.

Warning

When video_urls or extend_from_task_id is passed, a task type is required (omni_reference_task_type, or the compatible field generation_type); omitting it returns a 400 error. Passing edit or extend explicitly is recommended; auto is treated as edit.

generation_typestring

Compatible field, equivalent to omni_reference_task_type. Allowed values: frame (same as image_to_video), reference, edit, extend.

Warning

generation_type and omni_reference_task_type cannot be passed together.

image_urlsarray\

Reference image array for multi-image reference (characters, products, styles, etc.). Supports 1–10 images.

Editing (edit) and extension (extend) can include 1–10 reference images alongside a source specified by video_urls or extend_from_task_id. Use images as character, product, or style references, and refer to them in array order as “the first image” and “the second image” in the prompt.

The aliases images / image_url / image are also accepted and normalized to image_urls.

Only publicly accessible HTTP/HTTPS image URLs are supported. Upload local images first to get a public URL, then pass that URL; Base64 Data URLs are currently not supported and return a 400 error.

With no source video and only 1 image, its use depends on the task type:

  • omni_reference_task_type omitted: used as a reference image
  • omni_reference_task_type is auto or image_to_video: used as the first frame

For first-frame generation, use first_frame_image directly instead of relying on the number of images.

Warning

image_urls cannot be passed with first_frame_image or last_frame_image. In editing and extension, images always remain references, even when only 1 image is provided. With a video, an explicit auto selects editing.

first_frame_imagestring

First-frame image. The first frame of the generated video is this image. Only publicly accessible HTTP/HTTPS image URLs are supported; Base64 Data URLs are not supported.

Passing it together with last_frame_image generates a first-and-last-frame video.

Cannot be combined with video_urls or extend_from_task_id; submission returns HTTP 400.

last_frame_imagestring

Last-frame image for first-and-last-frame generation; the video transitions from the first frame to this image. Only publicly accessible HTTP/HTTPS image URLs are supported; Base64 Data URLs are not supported.

In first-and-last-frame mode:

  • duration supports 3–10; 10 seconds if omitted
  • system_prompt and negative_prompt cannot be passed

Warning

last_frame_image must be passed together with first_frame_image; passing only the last frame returns a last_frame_image requires first_frame_image error. It cannot be passed together with image_urls.

Cannot be combined with video_urls or extend_from_task_id; submission returns HTTP 400.

image_with_rolesarray\

Image array with roles, an equivalent way to write first_frame_image / last_frame_image / image_urls.

For editing or extension, use reference_image, another non-frame role, or omit the role. The total reference image limit is 10. The first_frame / last_frame roles cannot be combined with a source video.

Array item

urlstringrequired

Publicly accessible HTTP/HTTPS image URL. Base64 Data URLs are not supported.

rolestring

first_frame is the first frame and last_frame is the last frame (1 image each); any other value or an empty role is treated as a reference image.

video_urlsarray\

Array of videos to edit or extend. Only 1 video is supported. You can also use the single-value field video_url instead; pass only one of them.

Only publicly accessible HTTP/HTTPS video URLs are supported. Format: MP4 / MOV / WebM, up to 15 seconds and 64 MB.

Editing (edit) and extension (extend) can include 1–10 reference images alongside a source specified by video_urls or extend_from_task_id. Use images as character, product, or style references, and refer to them in array order as “the first image” and “the second image” in the prompt.

Warning

When passing video_urls, a task type is required. omni_reference_task_type set to edit or extend is recommended (auto is treated as edit); omitting it returns a 400 error. Passing 2 or more videos returns a 400 error.

extend_from_task_idstring

A task ID on this platform (task_01…). Continue editing or extending one of your previously completed gemini-omni-1.2-flash-ext tasks without re-uploading the video.

Requirements:

  • The task belongs to the current account
  • The task model is gemini-omni-1.2-flash-ext
  • The task status is completed
  • The model that generated the original task is still available; otherwise 503 source_unavailable is returned
  • The original output is no longer than 15 seconds (applies to both editing and extension); in editing mode, its duration must also be detectable

If the model is unavailable or the original output's duration cannot be detected, download the original output and upload it with video_urls instead. If the original output is longer than 15 seconds, trim it to 15 seconds or less before uploading.

Editing (edit) and extension (extend) can include 1–10 reference images alongside a source specified by video_urls or extend_from_task_id. Use images as character, product, or style references, and refer to them in array order as “the first image” and “the second image” in the prompt.

Warning

extend_from_task_id cannot be passed together with video_urls, and a task type is required. omni_reference_task_type set to edit or extend is recommended (auto is treated as edit).

negative_promptstring

Content you do not want to appear in the video.

Example: "people, cars, color"

Warning

negative_prompt cannot be passed in first-and-last-frame mode.

system_promptstring

System instruction, such as fixing the visual style or forbidding on-screen text. Must be a string.

Example: "Render as a black-and-white silent film."

Warning

system_prompt cannot be passed in first-and-last-frame mode.

Response

codeinteger

Response status code. Successful requests return 200.

dataarray

Returned task array.

Array item

statusstring

Initial task status. It is submitted after successful submission.

task_idstring

Unique task ID for querying task status and result.

Query Task Result

Video generation is asynchronous. After submission, a task_id is returned. Use the Get Task Status API to query generation progress and results.

cURL
curl --request GET \
  --url https://openrouterapi.ru/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
  --header 'Authorization: Bearer <token>'

Poll every 5-10 seconds and set the client timeout to at least 10 minutes. Reference generation times (including queueing): about 46 seconds for a 15-second 360p video, about 99 seconds for 15-second 1080p, and about 4-5 minutes for 15-second 4k. Progress may stay at 10% for a long time until the task completes.

Successful Result Example

json
{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "actual_time": 99,
    "cost": 0.695,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/videos/abc.mp4"]
        }
      ]
    }
  }
}

The video URL is data.result.videos[0].url[0]. data.actual_time is the task processing time in seconds, not the video length. The output is MP4 (H.264, 24fps) with an AAC audio track and an invisible SynthID watermark; 4k outputs occasionally have no audio track.

Failed Result Example

json
{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "failed",
    "progress": 100,
    "cost": 0,
    "error": {
      "code": "task_failed",
      "message": "content_rejected",
      "type": "task_failed"
    }
  }
}

Failed tasks are fully refunded.

Billing

Billed per second: cost = per-second price of the selected resolution × billed seconds. All modes are billed at the requested resolution tier. See the pricing page for actual prices.

ModeBilled seconds
Text-to-Video / first frame / multi-image referenceduration; 10 seconds if omitted
First and last framesduration (up to 10 seconds); 10 seconds if omitted
EditingSource video duration (0.15 seconds of container tolerance is subtracted, then rounded up, minimum 1 second; e.g. 8.019 seconds bills as 8 seconds, 8.3 seconds as 9 seconds)
ExtensionAdded seconds duration; 10 seconds if omitted. The original video is not billed

Reference images add no charge to editing or extension: editing is still billed by source video duration, and extension only by the newly added seconds.

Note

Editing with 6–10 reference images and extension tasks (with or without images) may be more likely to fail when capacity is limited. Failed tasks are fully refunded.

Use Cases

Scenario 1: Text-to-Video

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Aerial shot over a misty mountain lake at sunrise.",
  "duration": 15,
  "resolution": "1080p",
  "aspect_ratio": "9:16"
}

Scenario 2: First-Frame Video

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "The camera slowly pushes in.",
  "duration": 6,
  "aspect_ratio": "9:16",
  "first_frame_image": "https://example.com/start.jpg"
}

Scenario 3: First-and-Last-Frame Video

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "The flower bud slowly opens into full bloom.",
  "duration": 8,
  "aspect_ratio": "16:9",
  "first_frame_image": "https://example.com/bud.jpg",
  "last_frame_image": "https://example.com/bloom.jpg"
}

In first-and-last-frame mode, duration supports 3–10 seconds (10 seconds if omitted), and system_prompt / negative_prompt cannot be passed.

Scenario 4: Multi-Image Reference

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "The cat bats at the ball of yarn.",
  "duration": 8,
  "image_urls": [
    "https://example.com/cat.png",
    "https://example.com/yarn.png"
  ]
}

Scenario 5: Video Editing

The following examples add optional reference images to editing, extension, and an existing task.

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Replace the gray ball with the character from the first reference image, holding the red umbrella from the second reference image. Keep the background and the camera unchanged.",
  "video_urls": [
    "https://example.com/clip.mp4"
  ],
  "image_urls": [
    "https://example.com/character.png",
    "https://example.com/umbrella.png"
  ],
  "omni_reference_task_type": "edit"
}

Do not pass duration / seconds when editing; the output duration follows the source video.

Scenario 6: Video Extension

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Continue: the character from the first reference image walks in and opens the umbrella from the second one.",
  "video_urls": [
    "https://example.com/clip.mp4"
  ],
  "image_urls": [
    "https://example.com/character.png",
    "https://example.com/umbrella.png"
  ],
  "omni_reference_task_type": "extend",
  "duration": 6
}

Extension preserves the original video and appends a new segment. duration / seconds specifies only the added duration: an integer from 3 to 10 seconds, default 10.

Scenario 7: Extend an Existing Task

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Continue: the character from the first reference image walks in and opens the umbrella from the second one.",
  "extend_from_task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
  "omni_reference_task_type": "extend",
  "duration": 6,
  "image_with_roles": [
    {
      "url": "https://example.com/character.png",
      "role": "reference_image"
    },
    {
      "url": "https://example.com/umbrella.png",
      "role": "reference_image"
    }
  ]
}

Scenario 8: System Prompt and Negative Prompt

json
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "A busy city street at noon.",
  "system_prompt": "Render as a black-and-white silent film.",
  "negative_prompt": "people, cars, color",
  "duration": 6
}

Video and Reference Image Constraints

The following requests return HTTP 400 at submission without creating a task or charging. Only 1 source video, up to 15 seconds, is allowed; excessive or undetectable duration is rejected before precharging.

Request issueResolution
Video + reference images without a task typePass omni_reference_task_type: "edit" or "extend"; explicit "auto" means editing. The compatible field generation_type is also accepted, but do not send both type fields
Video + images with reference / image_to_video / text_to_videoUse edit or extend; regenerating a new video with this combination is not supported
Video + first / last framesRemove first_frame_image, last_frame_image, and first_frame / last_frame roles; use reference images only
More than 10 reference imagesReduce to at most 10
Editing with duration / secondsOmit both fields; output duration follows the source
Extension duration out of rangeUse an integer from 3 to 10 seconds, or omit for the default of 10
Both video_urls and extend_from_task_idSend only one

Responses

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
    }
  ]
}

Found a problem in these docs? Email support@openrouterapi.ru.