> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ttapi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 视频生成 API 文档

> 使用 Gemini Video API 提交异步视频生成任务，返回 jobId 后通过查询接口获取结果。

<Note>
  视频生成是异步任务。提交成功后会返回 `jobId`，请通过 [视频结果查询 API](/api/cn/gemini/video-fetch) 获取结果。
</Note>


## OpenAPI

````yaml openapi/cn/gemini.json POST /gemini/video/generations
openapi: 3.1.0
info:
  title: Gemini API DOCS
  version: 1.0.0
  description: TTAPI Gemini API 接口服务，包含 Nano Banana 图片生成和 Gemini 视频生成能力。
servers:
  - url: https://api.ttapi.org
security: []
paths:
  /gemini/video/generations:
    post:
      description: >-
        提交 Gemini 视频生成任务，异步返回 jobId。支持
        omni-flash、veo-3.1-fast、veo-3.1-quality、veo-3.1-lite 模型。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerateRequest'
      responses:
        '200':
          $ref: '#/components/responses/VideoGenerationResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    VideoGenerateRequest:
      type: object
      properties:
        prompt:
          type: string
          description: 视频提示词
          example: A cinematic shot of a futuristic city at sunset
        model:
          type: string
          description: 视频模型
          default: omni-flash
          enum:
            - veo-3.1-fast
            - veo-3.1-quality
            - veo-3.1-lite
            - omni-flash
        aspect_ratio:
          type: string
          description: 视频宽高比，必填。
          enum:
            - '16:9'
            - '9:16'
          example: '16:9'
        resolution:
          type: string
          description: 分辨率
          enum:
            - 720p
            - 1080p
          example: 720p
        duration:
          type: string
          description: >-
            视频时长（秒）。Veo 3.1
            系列（`veo-3.1-fast`、`veo-3.1-quality`、`veo-3.1-lite`）仅支持 `8`。
          enum:
            - '4'
            - '6'
            - '8'
            - '10'
          example: '8'
        generation_type:
          type: string
          description: >-
            视频生成类型。`frame`：帧转视频；`reference`：参考图生视频。不传时根据参考图数量自动判断：2 张为帧转视频，3
            张为参考图生视频。
          enum:
            - frame
            - reference
          example: frame
        reference_images:
          type: array
          description: 参考图，最多 3 张。每项为 http(s):// URL，支持 JPEG / PNG。
          maxItems: 3
          items:
            type: string
          example:
            - https://cdn.ttapi.io/example/reference-image.png
        reference_videos:
          type: array
          description: >-
            参考 / 待编辑视频，最多 1 个（不支持多视频引用）。每项为 http(s):// URL。当前仅 `omni-flash`
            模型可用。
          maxItems: 1
          items:
            type: string
          example:
            - https://cdn.ttapi.io/example/reference-video.mp4
        hookUrl:
          type: string
          description: 任务完成或失败后的回调通知地址
          example: https://example.com/callback
      required:
        - prompt
        - model
        - aspect_ratio
  responses:
    VideoGenerationResponse:
      description: 提交成功
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                description: 任务状态
                example: SUCCESS
              message:
                type: string
                description: 任务消息
                example: success
              data:
                type: object
                properties:
                  jobId:
                    type: string
                    description: 任务 ID
                    example: 0ccf0606-3f32-4090-85bd-1786e4593be5
                required:
                  - jobId
            required:
              - status
              - message
              - data
            example:
              status: SUCCESS
              message: success
              data:
                jobId: 0ccf0606-3f32-4090-85bd-1786e4593be5
    400Response:
      description: 参数错误
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: 授权失败
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````