> ## 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.

# 生成视频

> 文字 & 图片生成视频

这是 **Grok 视频 API** 的核心生成接口。

如果你想查看完整的接口目录、推荐接入流程和相关能力，请先阅读 [Grok 视频 API 总览](/api/cn/grok)。


## OpenAPI

````yaml openapi/cn/grok.json POST /grok/generations
openapi: 3.1.0
info:
  title: Grok Video DOCS
  version: 1.0.0
  description: Grok Video API 提供高效的视频分析和生成能力，帮助开发者快速集成智能视频功能。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /grok/generations:
    post:
      description: 文字 & 图片生成视频
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    GenerateRequest:
      type: object
      properties:
        model:
          type: string
          description: >-
            模型名称。

            - `grok-imagine-video-1.5-fast`：时长支持 6-30 秒（6 秒、10 秒为标准时长），支持多张垫图（最多
            7 张）

            - `grok-imagine-video`：时长支持 1-15 秒，支持多张垫图（单图最长 15 秒，多图最大 10 秒），仅支持
            720P

            - `grok-imagine-video-1.5`：时长支持 1-15 秒，仅支持单张垫图且必传
          enum:
            - grok-imagine-video-1.5-fast
            - grok-imagine-video
            - grok-imagine-video-1.5
          default: grok-imagine-video-1.5-fast
          example: grok-imagine-video-1.5-fast
        prompt:
          type: string
          description: >-
            提示词。`grok-imagine-video` 和 `grok-imagine-video-1.5` 最大长度为 4096
            字符；`grok-imagine-video-1.5-fast` 支持更长提示词。
        aspect_ratio:
          type: string
          default: '16:9'
          enum:
            - '2:3'
            - '3:2'
            - '1:1'
            - '9:16'
            - '16:9'
          description: 视频宽高比
        video_length:
          type: string
          default: '10'
          description: >-
            视频时长（秒）。`grok-imagine-video-1.5-fast` 取值范围为 6 到 30（6 秒、10
            秒为标准时长）；`grok-imagine-video` 取值范围为 1 到 15（单图最长 15 秒，多图最大 10
            秒）；`grok-imagine-video-1.5` 取值范围为 1 到 15。
        resolution_name:
          type: string
          default: 720p
          enum:
            - 480p
            - 720p
            - 1080p
          description: 输出分辨率。480p 和 720p 支持全部模型；1080P 仅 `grok-imagine-video-1.5` 支持。
        refer_images:
          type: array
          items:
            type: string
          description: >-
            垫图地址。`grok-imagine-video-1.5-fast` 支持多张垫图（最多 7
            张）；`grok-imagine-video` 支持多张垫图（单图最长 15 秒，多图最大 10
            秒）；`grok-imagine-video-1.5`
            仅支持单张且必传。<br/>`['https://cdn.ttapi.io/other/2026-03-13/a86ca2c7-6333-4840-b337-395a5d02a182.png','https://cdn.ttapi.io/other/2026-03-13/64a858ed-6095-45ce-92d5-b515c9864703.png']`
        hook_url:
          type: string
          description: >-
            回调地址，任务完成或失败将通过请地址进行通知，通知数据结构与<a href="fetch"
            target="_self">fetch结构</a>一致。如果未设置，则需要请求<a href="fetch"
            target="_self">fetch接口</a>进行查询
          example: https://example.com/callback
      required:
        - prompt
  responses:
    SuccessResponse:
      description: 请求成功
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            required:
              - status
              - message
              - data
    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 密钥。

````