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

# Sora 2

> Sora 2：支持同步音频的视频生成模型。包含 MixRoute 调用示例与参数。

Sora 2 是 OpenAI 推出的支持同步音频的视频生成模型。

可使用下方端点通过 MixRoute 调用 `sora-2`。

## 核心能力

* 文生视频 - 根据文本提示词生成视频
* 图生视频 - 使用图片作为首帧或参考
* 异步流程 - 提交任务后轮询获取结果
* 视频重混 - 根据源视频 URL 创建变体

## 输出规格

| 属性   | 取值                |
| ---- | ----------------- |
| 分辨率  | 480p, 720p, 1080p |
| 宽高比  | 16:9, 9:16, 1:1   |
| 时长   | 5, 10, 15, 20 s   |
| 同步音频 | 支持                |
| 调用方式 | 异步任务              |

## 调用流程

```text theme={null}
1. POST /v1/video/generations -> task_id
2. GET /v1/video/generations/{task_id} -> status
3. When the task succeeds -> read the video URL
```

## 调用示例

### 文生视频

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/video/generations" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "sora-2",
      "prompt": "A red square gently pulses on a clean white background",
      "duration": 5,
      "resolution": "720p",
      "aspect_ratio": "16:9"
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        "https://api.mixroute.ai/v1/video/generations",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={'model': 'sora-2',
              'prompt': 'A red square gently pulses on a clean white background',
              'duration': 5,
              'resolution': '720p',
              'aspect_ratio': '16:9'},
    )

    print(response.json())
    ```
  </Tab>
</Tabs>

### 图生视频

```bash theme={null}
curl "https://api.mixroute.ai/v1/video/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "sora-2",
  "prompt": "Animate the reference image with a slow camera push-in",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9",
  "image_url": "https://example.com/reference.png"
}'
```

### 视频重混

```bash theme={null}
curl "https://api.mixroute.ai/v1/video/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "sora-2",
  "prompt": "Keep the composition while changing the lighting to a warm sunset",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9",
  "remix_url": "https://example.com/source.mp4"
}'
```

## 参数

| 参数             | 类型      | 必填 | 说明                   |
| -------------- | ------- | -- | -------------------- |
| `model`        | string  | 是  | 固定为 `sora-2`。        |
| `prompt`       | string  | 是  | 视频生成或重混指令。           |
| `duration`     | integer | 否  | 视频时长：5、10、15 或 20 秒。 |
| `resolution`   | string  | 否  | 480p、720p 或 1080p。   |
| `aspect_ratio` | string  | 否  | 16:9、9:16 或 1:1。     |
| `image_url`    | string  | 否  | 图生视频使用的参考图片 URL。     |
| `remix_url`    | string  | 否  | 重混模式使用的源视频 URL。      |

### 输入模式

| 模式   | 输入                  |
| ---- | ------------------- |
| 文生视频 | prompt              |
| 图生视频 | prompt + image\_url |
| 视频重混 | prompt + remix\_url |
