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

# Sora 2

> OpenAI Sora 2 视频生成模型。从文本提示和参考图像生成视频。

Sora 2 是 OpenAI 的视频生成模型，可通过 Starrise AI API 使用。支持文生视频、图生视频（首帧参考）和视频混音。

## 核心能力

* **文生视频** — 从自然语言描述生成视频
* **图生视频** — 使用参考图像作为第一帧
* **视频混音** — 重复使用先前视频的结构、动作和取景
* **灵活时长** — 4、8 或 12 秒
* **多种分辨率** — 竖屏（720x1280）、横屏（1280x720）等

## 工作流程

Sora 2 API 是异步的。请按以下步骤操作：

1. **创建任务** — `POST /v1/videos`
2. **查询状态** — `GET /v1/videos/{id}`（轮询直到 `status` 为 `completed`）
3. **下载视频** — `GET /v1/videos/{id}/content`

## 快速示例

### 步骤 1：创建任务

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "model=sora-2" \
  -F "prompt=一只猫在金色日落时分穿过向日葵田" \
  -F "seconds=12" \
  -F "size=1280x720"
```

```python Python theme={null}
import requests

response = requests.post(
    "https://dayu.cdn-fly.com/v1/videos",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    data={
        "model": "sora-2",
        "prompt": "一只猫在金色日落时分穿过向日葵田",
        "seconds": "12",
        "size": "1280x720"
    }
)

task = response.json()
print(f"任务 ID: {task['id']}")
```

### 步骤 2：查询状态

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/v1/videos/video_69b131ea03548190925a6a06febf993b \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```python Python theme={null}
status = requests.get(
    f"https://dayu.cdn-fly.com/v1/videos/{task['id']}",
    headers={"Authorization": "Bearer YOUR_API_KEY"}
).json()

print(f"状态: {status['status']}, 进度: {status['progress']}")
```

### 步骤 3：下载视频

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/v1/videos/video_69b131ea03548190925a6a06febf993b/content \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```python Python theme={null}
result = requests.get(
    f"https://dayu.cdn-fly.com/v1/videos/{task['id']}/content",
    headers={"Authorization": "Bearer YOUR_API_KEY"}
).json()

print(f"视频 URL: {result['video_url']}")
```

## 参数说明

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | 是 | 必须为 `sora-2` |
| `prompt` | string | 是 | 视频的自然语言描述。包括镜头类型、主题、动作、场景、光照。保持单一用途以获得最佳效果。 |
| `seconds` | string | 否 | `4`、`8`、`12`。默认值：`4` |
| `size` | string | 否 | `720x1280`、`1280x720`、`1024x1792`、`1792x1024`。默认值：`720x1280` |
| `input_reference` | file | 否 | 首帧的参考图像。接受 image/jpeg、image/png、image/webp。 |
| `remix_video_id` | string | 否 | 已完成视频的 ID，用于重复使用其结构、动作和取景。 |

> **[API 参考](/zh/api-reference/model-api/openai/sora-2)**
>
> 查看 Sora 2 的交互式 API Playground。


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