gemini-omni-1.2-flash-ext Video Generation
gemini-omni-1.2-flash-ext unified video generation model
Tutta la documentazione/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
Esempi di richieste
curl --request POST \
--url https://api.apisea.ai/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
AuthorizationstringrequiredAll 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:
Authorization: Bearer YOUR_API_KEYRequest Parameters
modelstringrequiredVideo generation model name. Fixed as gemini-omni-1.2-flash-ext.
nsfw_checkbooleandefault: falseWhether to run content moderation before submitting the video task.
true: useomni-moderation-latestto review prompts and input imagesfalseor omitted: do not send a moderation request, adding no moderation cost or latency (default)
promptstringrequiredVideo 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
promptis required in every mode, including first frame, multi-image reference, editing, and extension. A 400 error is returned if it is missing.
durationintegerdefault: 10Video 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/secondsin editing mode returns avideo edit does not accept durationerror.
resolutionstringdefault: 720pVideo resolution, case-insensitive. It determines the per-second price.
Allowed values:
360p720p1080p4k(2160pis also accepted)
Warning
Any other resolution returns a 400 error.
aspect_ratiostringdefault: 16:9Only 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_typestringTask type, specifying how the input material is used.
Allowed values:
edit- Edit a video. Use withvideo_urlsorextend_from_task_idextend- Extend a video by appending new content at the end. Use withvideo_urlsorextend_from_task_idreference- Multi-image reference. Use withimage_urlstext_to_video/image_to_video/reference_to_video- Text-to-Video / first frame / reference imagesauto- Detected from the input; treated aseditwhen a video is provided
Optional when no video is provided; the mode is detected from the input.
Warning
When
video_urlsorextend_from_task_idis passed, a task type is required (omni_reference_task_type, or the compatible fieldgeneration_type); omitting it returns a 400 error. Passingeditorextendexplicitly is recommended;autois treated asedit.
generation_typestringCompatible field, equivalent to omni_reference_task_type. Allowed values: frame (same as image_to_video), reference, edit, extend.
Warning
generation_typeandomni_reference_task_typecannot 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_typeomitted: used as a reference imageomni_reference_task_typeisautoorimage_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_urlscannot be passed withfirst_frame_imageorlast_frame_image. In editing and extension, images always remain references, even when only 1 image is provided. With a video, an explicitautoselects editing.
first_frame_imagestringFirst-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_imagestringLast-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:
durationsupports3–10; 10 seconds if omittedsystem_promptandnegative_promptcannot be passed
Warning
last_frame_imagemust be passed together withfirst_frame_image; passing only the last frame returns alast_frame_image requires first_frame_imageerror. It cannot be passed together withimage_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
urlstringrequiredPublicly accessible HTTP/HTTPS image URL. Base64 Data URLs are not supported.
rolestringfirst_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_typeset toeditorextendis recommended (autois treated asedit); omitting it returns a 400 error. Passing 2 or more videos returns a 400 error.
extend_from_task_idstringA 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 channel that generated the original task is still available; otherwise 503
source_channel_unavailableis 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 channel 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_idcannot be passed together withvideo_urls, and a task type is required.omni_reference_task_typeset toeditorextendis recommended (autois treated asedit).
negative_promptstringContent you do not want to appear in the video.
Example: "people, cars, color"
Warning
negative_promptcannot be passed in first-and-last-frame mode.
system_promptstringSystem 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_promptcannot be passed in first-and-last-frame mode.
Response
codeintegerResponse status code. Successful requests return 200.
dataarrayReturned task array.
Array item
statusstringInitial task status. It is submitted after successful submission.
task_idstringUnique 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 --request GET \
--url https://api.apisea.ai/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
{
"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
{
"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.
| Mode | Billed seconds |
|---|---|
| Text-to-Video / first frame / multi-image reference | duration; 10 seconds if omitted |
| First and last frames | duration (up to 10 seconds); 10 seconds if omitted |
| Editing | Source 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) |
| Extension | Added 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 upstream quota is limited. Failed tasks are fully refunded.
Use Cases
Scenario 1: Text-to-Video
{
"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
{
"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
{
"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
{
"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.
{
"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
{
"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
{
"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
{
"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 issue | Resolution |
|---|---|
| Video + reference images without a task type | Pass 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_video | Use edit or extend; regenerating a new video with this combination is not supported |
| Video + first / last frames | Remove first_frame_image, last_frame_image, and first_frame / last_frame roles; use reference images only |
| More than 10 reference images | Reduce to at most 10 |
Editing with duration / seconds | Omit both fields; output duration follows the source |
| Extension duration out of range | Use an integer from 3 to 10 seconds, or omit for the default of 10 |
Both video_urls and extend_from_task_id | Send only one |
Risposte
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}Modelli che usano questo endpoint
Hai trovato un problema in questa documentazione? Scrivi a support@apisea.ai.