26j文档
试一试 →

Gemini Omni 1.1 Flash 视频生成

  • Google 官方 Gemini Omni 1.1 Flash 全能多模态视频生成模型
  • 支持文生视频、图生视频、多主体参考、首尾帧插值、视频编辑与续写
  • 支持 360p / 720p / 1080p / 4K、24fps、3–10 秒,并生成音频
  • 异步任务接口,提交后通过任务 ID 查询生成结果
请求示例
curl --request POST \
  --url https://26j.cn/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-omni-1.1-flash",
    "prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
    "aspect_ratio": "16:9",
    "resolution": "1080p"
  }'
import requests

url = "https://26j.cn/v1/videos/generations"

payload = {
    "model": "gemini-omni-1.1-flash",
    "prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
    "aspect_ratio": "16:9",
    "resolution": "1080p"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://26j.cn/v1/videos/generations";

const payload = {
  model: "gemini-omni-1.1-flash",
  prompt: "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
  aspect_ratio: "16:9",
  resolution: "1080p"
};

const headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
};

fetch(url, {
  method: "POST",
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error("Error:", error));
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://26j.cn/v1/videos/generations"

    payload := map[string]interface{}{
        "model":        "gemini-omni-1.1-flash",
        "prompt":       "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
        "aspect_ratio": "16:9",
        "resolution":   "1080p",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
响应示例
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
    }
  ]
}
{
  "error": {
    "code": 400,
    "message": "请求参数无效",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": 401,
    "message": "身份验证失败,请检查您的API密钥",
    "type": "authentication_error"
  }
}
{
  "error": {
    "code": 402,
    "message": "账户余额不足,请充值后再试",
    "type": "payment_required"
  }
}
{
  "error": {
    "code": 429,
    "message": "请求过于频繁,请稍后再试",
    "type": "rate_limit_error"
  }
}

认证

Authorizationstring必填

所有接口均需要使用 Bearer Token 进行认证。

获取 API Key:

访问 API Key 管理页面 获取您的 API Key。

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

请求参数

modelstring必填

视频生成模型名称,固定为 gemini-omni-1.1-flash。

promptstring

文本指令。文生视频时用于描述场景;图生视频、视频编辑或续写时用于描述动作、风格和编辑要求。

prompt 与素材(image_urls、首尾帧图片或 video_urls)至少提供一项。

resolutionstring默认 720p

输出视频分辨率,不区分大小写。

可选值:

  • 360p
  • 720p(默认)
  • 1080p
  • 4k

2160p 会按 4k 处理。分辨率决定任务的预扣押金档位和主要视频输出成本。

传入不支持的分辨率会返回 invalid_resolution 错误。

aspect_ratiostring默认 16:9

视频宽高比,用于控制横屏或竖屏。

支持:

  • 16:9 - 横屏(默认)
  • 9:16 - 竖屏

其它值按 16:9 处理。

传入 video_urls 后,输出画面比例通常跟随输入视频,aspect_ratio 可能不生效。

image_urlsarray<string>

参考图片数组。仅支持公网可访问的 HTTP/HTTPS URL。

  • 传入 1 张图片:默认作为视频的起始画面
  • 传入多张图片:作为多主体或风格参考图,请在 prompt 中说明各图片的用途和互动关系

image_urls 与首尾帧图片合计最多 10 张。

first_frame_imagestring

首帧图片。仅支持公网可访问的 HTTP/HTTPS URL。

  • 单独传入:以该图片作为视频的起始画面
  • 与 last_frame_image 同时传入:生成从首帧平滑过渡到尾帧的视频
last_frame_imagestring

尾帧图片。仅支持公网可访问的 HTTP/HTTPS URL,且必须与 first_frame_image 同时传入。

只传 last_frame_image 会返回 invalid_frame_images 错误。首尾帧图片建议使用相同比例,并与 aspect_ratio 保持一致。

在首帧或首尾帧场景中,以下两种传参方式效果相同,二选一即可,请勿同时传入:

  • 使用 first_frame_image / last_frame_image
  • 使用 image_with_roles,并将 role 设置为 first_frame / last_frame
image_with_rolesarray<object>

带角色的图片数组,可作为 first_frame_image / last_frame_image 的等价写法,也可以用于声明参考图。

示例:

[
  {"url": "https://example.com/start.jpg", "role": "first_frame"},
  {"url": "https://example.com/end.jpg", "role": "last_frame"}
]

若同时传入 image_urls,参考图以 image_urls 为准,不与 image_with_roles 中的参考图叠加。所有实际使用的图片与首尾帧合计最多 10 张。

video_urlsarray<string>

待编辑或续写的视频数组,当前最多传入 1 段,且视频时长不得超过 10 秒。

仅支持公网可访问的 HTTP/HTTPS 视频直链,不支持 YouTube 链接。

video_urls 与 extend_from_task_id 互斥,二者只能提供一项。

metadataobject

附加参数对象,用于显式指定生成意图。

使用首尾帧插值时,任务类型由模型自动推断,平台不会下发 metadata.task。

extend_from_task_idstring

上一次生成任务的本地 task_id,用于对话式编辑或继续延长视频,无需重新上传上一轮视频。

被引用的任务必须属于当前用户、状态为成功,并且是 Gemini Omni 模型任务。

extend_from_task_id 与 video_urls 互斥,二者只能提供一项。

该模型没有 duration 参数。单次输出时长由模型根据内容自动决定,通常为 3–10 秒。如需控制节奏,请在 prompt 中使用自然语言或时间段描述。

响应

codeinteger

响应状态码,成功时为 200。

dataarray

返回任务数组。

查询任务结果

视频生成为异步任务。提交后会返回 task_id,使用 获取任务状态 接口查询生成进度和结果。

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

建议每 5–10 秒轮询一次,并在状态变为 completed 或 failed 后停止。客户端整体超时建议设置为 10 分钟。

成功结果示例

{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "cost": 1.52,
    "credits_cost": 15.2,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/gemini_omni_xxx.mp4"],
          "expires_at": 1788518400
        }
      ]
    }
  }
}

使用场景

场景 1:文生视频(4K)

{
  "model": "gemini-omni-1.1-flash",
  "prompt": "a blue butterfly landing on a flower, macro, soft light, no dialogue",
  "aspect_ratio": "9:16",
  "resolution": "4k"
}

场景 2:首尾帧插值

{
  "model": "gemini-omni-1.1-flash",
  "prompt": "smooth transition, camera slowly pushes in",
  "first_frame_image": "https://example.com/start.jpg",
  "last_frame_image": "https://example.com/end.jpg",
  "resolution": "720p"
}

场景 3:多主体参考

{
  "model": "gemini-omni-1.1-flash",
  "prompt": "the cat playfully bats at the ball of yarn",
  "image_urls": [
    "https://example.com/cat.png",
    "https://example.com/yarn.png"
  ],
  "resolution": "720p"
}

场景 4:使用图片角色声明首尾帧

{
  "model": "gemini-omni-1.1-flash",
  "prompt": "a smooth cinematic transition from sunrise to a starry night",
  "image_with_roles": [
    {"url": "https://example.com/sunrise.jpg", "role": "first_frame"},
    {"url": "https://example.com/night.jpg", "role": "last_frame"}
  ],
  "resolution": "1080p"
}

场景 5:视频编辑

{
  "model": "gemini-omni-1.1-flash",
  "prompt": "Make the violin invisible. Keep everything else the same.",
  "video_urls": ["https://example.com/clip.mp4"]
}

视频编辑建议使用简短、明确的提示词。若只希望修改某一部分,可在提示词中加入 Keep everything else the same 以增强其余画面的一致性。

场景 6:对话式续写

{
  "model": "gemini-omni-1.1-flash",
  "prompt": "Extend this video: the camera pans across the mountains.",
  "extend_from_task_id": "task_01AAA"
}

This documentation is built and hosted on Mintlify, a developer documentation platform.

© 2026 26j.cn · AI 模型中转站