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

# Grok Imagine 图生视频

> Grok Imagine API 可让静态图片动起来，用文本塑造场景，生成 6 秒或 10 秒的视频片段。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)接口获取结果。

使用 Grok Imagine 让静态图片动起来，用文本塑造场景，生成 6 秒或 10 秒的视频片段。

## 模型

* **xai/grok-imagine-video/image-to-video** - 根据输入图片生成视频。

## 功能

* 根据输入图片生成视频。
* `image_urls` 中只接受恰好 1 张图片。

## 时长选项

* **6、10 秒** - 将 `duration` 设为整数。可选，默认 `6`。

## 高级参数

`model` 和可选的 `callback_url` 放在请求根级。所有工作流参数（包括输出选项）都放在 `input` 中。

使用下列 input 字段。参考图请提供可公开访问的 HTTP(S) URL。

### 提示词

* `prompt`：必填。描述场景和期望的运动。长度：**1-5,000 个字符**。

### 图片 URL

* `image_urls`：必填。提供可公开访问的图片 URL。恰好传 1 项，每项必须是 HTTP(S) URL。

### 模式

* `mode`：可选。可选值：`fun`、`normal`、`spicy`。


## OpenAPI

````yaml zh/api-manual/video-series/xai-grok-imagine-video-image-to-video.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Grok Imagine 图生视频
  description: 使用 Grok Imagine 让静态图片动起来，用文本塑造场景，生成 6 秒或 10 秒的视频片段。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Video Series
      summary: Grok Imagine 图生视频
      description: 使用下列参数提交参考图和提示词以生成视频。
      operationId: submit_xai_grok_imagine_video_image_to_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: true
              properties:
                model:
                  type: string
                  example: xai/grok-imagine-video/image-to-video
                input:
                  type: object
                  required:
                    - image_urls
                    - prompt
                  properties:
                    prompt:
                      type: string
                      maxLength: 5000
                      minLength: 1
                      description: 描述目标场景和运动。输入 1–5,000 个字符。
                    image_urls:
                      type: array
                      items:
                        type: string
                        format: uri
                        description: 可公开访问的参考图 URL。
                      maxItems: 1
                      minItems: 1
                      description: 提供恰好一个可公开访问的 HTTP(S) 图片 URL。
                    mode:
                      type: string
                      enum:
                        - fun
                        - normal
                        - spicy
                      description: 生成风格。可选 fun、normal 或 spicy。
                    duration:
                      type: integer
                      enum:
                        - 6
                        - 10
                      description: 视频时长（秒）。可选 6 或 10，默认 6。
                      default: 6
                  additionalProperties: false
                callback_url:
                  type: string
                  nullable: true
                  description: 可选，接收任务完成通知的公开 HTTP(S) 地址，建议使用 HTTPS。省略、传 null 或传空字符串即不启用回调。
              description: model 和 callback_url 放在请求根级，生成参数放在 input 中。
            examples:
              basic:
                summary: 基础工作流
                value:
                  model: xai/grok-imagine-video/image-to-video
                  input:
                    duration: 6
                    image_urls:
                      - https://example.com/image.png
                    prompt: >-
                      A quiet forest under soft morning light, with natural
                      detail.
              callback:
                summary: 接收完成回调
                value:
                  model: xai/grok-imagine-video/image-to-video
                  input:
                    duration: 6
                    image_urls:
                      - https://example.com/image.png
                    prompt: >-
                      A quiet forest under soft morning light, with natural
                      detail.
                  callback_url: https://your-domain.com/callback
      responses:
        '200':
          description: 任务已提交
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - data
                properties:
                  code:
                    type: integer
                    enum:
                      - 200
                  data:
                    type: object
                    required:
                      - task_id
                      - status
                      - created_time
                    properties:
                      task_id:
                        type: string
                      status:
                        type: string
                        enum:
                          - not_started
                          - running
                          - finished
                          - failed
                      created_time:
                        type: string
                        format: date-time
              example:
                code: 200
                data:
                  task_id: task-unified-example
                  status: running
                  created_time: '2026-09-10T08:00:00'
        '400':
          description: 请检查输入值、媒体可访问性和账户余额。
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '401':
          description: 凭证无效
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '403':
          description: 拒绝访问
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '404':
          description: 模型未知或已停用
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '408':
          description: 请求超时
          content:
            text/plain:
              schema:
                type: string
              example: Request timeout
        '422':
          description: JSON 无效或请求体不是对象
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '429':
          description: 超出速率限制或 API Key 积分限额
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '500':
          description: 内部错误
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '502':
          description: 任务创建失败。请提交新请求重试。
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '503':
          description: 服务暂时不可用，请在服务恢复后重试。
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 使用 VIDGO_API_KEY。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.