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

# 视频Extend

> 使用 `POST /v1/videos/{video_id}/extend` 基于已有 Grok 视频任务做片段延展。

# 视频Extend

OpenAI 格式入口。统一视频请使用 [视频Extend（统一视频）](./unified-extend)（`POST /v1/video/extend`，Body 传 `task_id`）。

在已有 Grok 视频任务基础上，通过 `POST /v1/videos/{video_id}/extend` 从指定时间点延展视频内容。

* 路径参数 `video_id` 为原始任务 ID。
* 请求体为 JSON，必填 `model` 与 `prompt`。
* 可通过 `start_time` 指定从原视频的哪一秒开始延展，通过 `images` 补充参考图。

## 方法与路径

```http theme={null}
POST /v1/videos/{video_id}/extend
```

## 请求示例

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://octopusx.ai/v1/videos/grok:48a67431-0708-46d1-9ab9-83cb84700153/extend \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
      "model": "grok-video-3",
      "prompt": "play with another white cat",
      "aspect_ratio": "3:2",
      "start_time": 4,
      "size": "1080P",
      "upscale": true
    }'
  ```

  ```python theme={null}
  import requests

  video_id = "grok:48a67431-0708-46d1-9ab9-83cb84700153"

  resp = requests.post(
      f"https://octopusx.ai/v1/videos/{video_id}/extend",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
          "Accept": "application/json",
      },
      json={
          "model": "grok-video-3",
          "prompt": "play with another white cat",
          "aspect_ratio": "3:2",
          "start_time": 4,
          "size": "1080P",
          "upscale": True,
      },
      timeout=60,
  )
  print(resp.json())
  ```

  ```javascript theme={null}
  const videoId = "grok:48a67431-0708-46d1-9ab9-83cb84700153";

  const response = await fetch(
    `https://octopusx.ai/v1/videos/${encodeURIComponent(videoId)}/extend`,
    {
      method: "POST",
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
        Accept: "application/json",
      },
      body: JSON.stringify({
        model: "grok-video-3",
        prompt: "play with another white cat",
        aspect_ratio: "3:2",
        start_time: 4,
        size: "1080P",
        upscale: true,
      }),
    }
  );

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

## 响应示例

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "grok:48a67431-0708-46d1-9ab9-83cb84700153",
    "status": "processing",
    "status_update_time": 1762685256
  }
  ```
</ResponseExample>

## 认证

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

## Path Parameters

<ParamField path="video_id" type="string" required>
  原始视频任务 ID。
</ParamField>

## Body

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

<ParamField body="prompt" type="string" required>
  延展片段的提示词。
</ParamField>

<ParamField body="images" type="array<string>">
  参考图链接列表，按需补充视觉约束。
</ParamField>

<ParamField body="size" type="string">
  分辨率规格，传 `720P` 或 `1080P`。Apifox 示例中也出现 `1080p` 写法，建议统一为大写 `1080P`。
</ParamField>

<ParamField body="aspect_ratio" type="string">
  视频比例，Apifox 示例使用 `3:2` 等取值。
</ParamField>

<ParamField body="start_time" type="integer">
  从原视频的哪一秒开始延展。
</ParamField>

<ParamField body="upscale" type="boolean">
  是否对输出做高清增强。
</ParamField>

## Response

<ResponseField name="id" type="string">
  新 extend 任务 ID。
</ResponseField>

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

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

## 相关接口

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