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

# 创建视频

> 使用 `POST /v1/video/create` 通过统一视频格式提交 Grok 异步生成任务。

# 创建视频

Grok 统一视频入口使用 `POST /v1/video/create`，请求体为 JSON。与 [OpenAI 格式的 Grok 视频生成](./generation) 不同，本接口使用 `images`、`aspect_ratio`、`size` 等字段，并支持在 `prompt` 中通过 `@img1`、`@img2` 引用多图。

* 路由入口是 `POST /v1/video/create`。
* 参考图通过 `images` 数组传入 URL 或 base64；文生视频可传 `[]`。
* 常见模型为 `grok-video-3`，以当前渠道实际可用模型为准。
* 提交成功后返回 `id` 或 `task_id` 与 `status`，后续用 [查询任务](./unified-query) 轮询结果。

## 方法与路径

```http theme={null}
POST /v1/video/create
```

## 请求示例

<CodeGroup>
  ```bash theme={null}
  # 文生视频 / 首尾帧（images 为空或按场景传图）
  curl -X POST https://octopusx.ai/v1/video/create \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
      "model": "grok-video-3",
      "prompt": "cat fish --mode=custom",
      "images": [],
      "aspect_ratio": "3:2",
      "size": "1080P",
      "duration": 10
    }'
  ```

  ```bash theme={null}
  # 多图参考（prompt 中用 @img1、@img2 引用 images 顺序）
  curl -X POST https://octopusx.ai/v1/video/create \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "grok-video-3",
      "prompt": "@img1 一只猫拿着刀追 @img2",
      "images": [
        "data:image/png;base64,BASE64_IMAGE_1",
        "data:image/png;base64,BASE64_IMAGE_2"
      ],
      "aspect_ratio": "3:2",
      "size": "1080P",
      "duration": 6
    }'
  ```

  ```python theme={null}
  import requests

  resp = requests.post(
      "https://octopusx.ai/v1/video/create",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
          "Accept": "application/json",
      },
      json={
          "model": "grok-video-3",
          "prompt": "cat fish --mode=custom",
          "images": [],
          "aspect_ratio": "3:2",
          "size": "1080P",
          "duration": 10,
      },
      timeout=60,
  )
  print(resp.json())
  ```

  ```javascript theme={null}
  const response = await fetch("https://octopusx.ai/v1/video/create", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
      Accept: "application/json",
    },
    body: JSON.stringify({
      model: "grok-video-3",
      prompt: "cat fish --mode=custom",
      images: [],
      aspect_ratio: "3:2",
      size: "1080P",
      duration: 10,
    }),
  });

  console.log(await response.json());
  ```
</CodeGroup>

## 响应示例

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "grok:48a67431-0708-46d1-9ab9-83cb84700153",
    "status": "processing",
    "status_update_time": 1762780400,
    "task_id": "48038932-0ff5-4251-8b4b-7a76c09fd114",
    "created_at": "2025-11-08T23:07:57.510141923+08:00"
  }
  ```
</ResponseExample>

实际响应字段可能因渠道略有差异，请以返回中的 `id` 或 `task_id` 作为后续查询凭据。

## 认证

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Body

<ParamField body="model" type="string" required>
  模型名称，例如 `grok-video-3`。
</ParamField>

<ParamField body="prompt" type="string" required>
  提示词。多图参考时可在文案中使用 `@img1`、`@img2` 等占位符，对应 `images` 数组下标顺序。
</ParamField>

<ParamField body="images" type="array<string>" required>
  参考图列表，元素为 URL 或 base64 data URI。文生视频可传 `[]`；首尾帧一般按顺序传 2 张；多图参考最多支持 6 张。
</ParamField>

<ParamField body="aspect_ratio" type="string" required>
  视频比例。可选 `16:9`、`9:16`、`2:3`、`3:2`、`1:1`。
</ParamField>

<ParamField body="size" type="string" required>
  分辨率规格，传 `720P` 或 `1080P`。
</ParamField>

<ParamField body="duration" type="integer">
  视频时长（秒）。默认 `10`，支持 `6`、`10`、`15`。
</ParamField>

## Response

<ResponseField name="id" type="string">
  任务 ID，查询时作为 `id` 参数；部分响应可能仅返回 `task_id`。
</ResponseField>

<ResponseField name="task_id" type="string">
  上游任务 ID，与 `id` 可能并存，以实际响应为准。
</ResponseField>

<ResponseField name="status" type="string">
  任务状态，常见值包括 `processing`、`completed`、`failed`。
</ResponseField>

<ResponseField name="status_update_time" type="integer">
  状态最近更新时间（Unix 时间戳）。
</ResponseField>

<ResponseField name="created_at" type="string">
  创建时间，部分响应为 RFC3339 字符串。
</ResponseField>

## 相关接口

* [Grok 视频概览](./overview)
* [视频Remix](./unified-remix)
* [视频Extend](./unified-extend)
* [视频Extensions](./unified-extensions)
* [查询任务](./unified-query)
* [Grok 视频生成（OpenAI 格式）](./generation)
