> ## 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 视频生成接口。grok-imagine-video 支持文生视频（T2V）和图生视频（I2V）；grok-imagine-video-1.5 仅支持图生视频（I2V），必须传入 image。<br/><br/>**注意：同步官方规则，内容审核失败的场景也会扣费。**



## OpenAPI

````yaml openapi/cn/grok_video.json POST /grok/v1/videos/generations
openapi: 3.1.0
info:
  title: Grok Video Official API
  version: 1.0.0
  description: Grok 官方视频生成 API，支持文生视频、图生视频和视频扩展。目前支持 grok-imagine-video 模型。输入视频最大 15 秒。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /grok/v1/videos/generations:
    post:
      description: >-
        Grok 视频生成接口。grok-imagine-video
        支持文生视频（T2V）和图生视频（I2V）；grok-imagine-video-1.5 仅支持图生视频（I2V），必须传入
        image。<br/><br/>**注意：同步官方规则，内容审核失败的场景也会扣费。**
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerateRequest'
      responses:
        '200':
          description: 请求成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                    description: 请求ID
                    example: 41eb9a5f-cbd4-9f21-8d59-79005f1e61b7
                required:
                  - request_id
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    VideoGenerateRequest:
      type: object
      properties:
        prompt:
          type: string
          description: 视频生成提示词。grok-imagine-video 模型支持文生视频时必填；grok-imagine-video-1.5 模型可选。
        model:
          type: string
          description: 使用的模型名称。
          enum:
            - grok-imagine-video
            - grok-imagine-video-1.5
          default: grok-imagine-video-1.5
          example: grok-imagine-video-1.5
        aspect_ratio:
          type: string
          description: 视频宽高比。
          enum:
            - '1:1'
            - '16:9'
            - '9:16'
            - '4:3'
            - '3:4'
            - '3:2'
            - '2:3'
        duration:
          type: integer
          description: 视频时长（秒）。范围：[1, 15]。默认：8。同时接受数字（8）和字符串（"8"）格式。
          default: 8
          minimum: 1
          maximum: 15
        image:
          type: object
          description: >-
            图生视频时使用的图片对象。grok-imagine-video-1.5
            模型必须传入（仅支持图生视频）；grok-imagine-video 模型可选，传入时执行图生视频，不传时执行文生视频。
          properties:
            url:
              type: string
              description: >-
                图片的公开 URL 或 base64 编码的 data URL（支持 JPEG、PNG 或 WebP 格式）。也接受
                `image_url` 作为兼容字段。
        reference_images:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
                description: >-
                  图片的公开 URL 或 base64 编码的 data URL（支持 JPEG、PNG 或 WebP 格式）。也接受
                  `image_url` 作为兼容字段。
          description: 参考生视频（R2V）时使用的参考图片数组。提供这些图片作为风格/内容参考来生成视频。
        resolution:
          type: string
          description: 视频分辨率。
          enum:
            - 480p
            - 720p
            - 1080p
      required:
        - prompt
  responses:
    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 密钥。

````