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