# 创建视频生成任务

## 1. 概述

OpenAI推出的最新文本到视频生成模型，能够根据简短提示生成带同步语音和音效、物理更准确且更可控的短视频，并在输出中加入可见水印以防滥用。

通过本接口创建视频生成任务，获得视频`id`字段后，在[创建视频再创作任务](/test/compute/aig/video-generation/openai-sora/remix-video.md)、[查询任务状态](/test/compute/aig/video-generation/openai-sora/retrieve-video.md)、[下载视频文件](/test/compute/aig/video-generation/openai-sora/retrieve-video-content.md)接口中通过url添加`video_id`使用。

**模型列表：**

* `sora-2`

## 2. 请求说明

* **请求方法**:`POST`
* **请求地址**:

  > `https://gateway.theturbo.ai/v1/videos`

***

## 3. 请求参数

### 3.1 Header 参数

| 参数名称            | 类型     | 必填 | 说明                                         | 示例值                                                                            |
| --------------- | ------ | -- | ------------------------------------------ | ------------------------------------------------------------------------------ |
| `Content-Type`  | string | 是  | 设置请求头类型，必须为 `multipart/form-data`          | `multipart/form-data; boundary=------------------------y0QNRDhXQUE3yHQi7DEbLz` |
| `Authorization` | string | 是  | 身份验证所需的 API\_KEY，格式 `Bearer $YOUR_API_KEY` | `Bearer $YOUR_API_KEY`                                                         |

***

### 3.2 Body 参数 (application/json)

| 参数名称             | 类型     | 必填 | 说明                                                                  | 示例（默认值）                                 |
| ---------------- | ------ | -- | ------------------------------------------------------------------- | --------------------------------------- |
| **model**        | string | 是  | 要使用的模型 ID。详见[概述](#1-概述)列出的可用版本，如 `sora-2`。                          | `sora-2`                                |
| **prompt**       | string | 是  | 用于描述要生成的视频的文本提示。                                                    | `A calico cat playing a piano on stage` |
| input\_reference | string | 否  | 可选的图像参考，用于指导生成。必须和生成视频分辨率保持一致。                                      |                                         |
| seconds          | string | 否  | 生成视频的时长（秒）。默认 4 秒。                                                  | `4`                                     |
| size             | string | 否  | 生成视频分辨率，格式为 宽 x 高。默认 `720x1280`。`sora-2`目前只支持`720x1280`和`1280x720`。 | `720x1280`                              |

***

## 4. 请求示例

{% tabs %}
{% tab title="不携带参考图像" %}

```sh
curl -X POST https://gateway.theturbo.ai/v1/videos \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F "model=sora-2" \
	-F "prompt=A calico cat playing a piano on stage" \
	-F "seconds=4" \
	-F "size=720x1280"
```

{% endtab %}

{% tab title="携带参考图像" %}

```sh
curl -X POST https://gateway.theturbo.ai/v1/videos \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F "model=sora-2" \
	-F "input_reference=@input.png" \
	-F "prompt=A calico cat playing a piano on stage" \
	-F "seconds=4" \
	-F "size=720x1280"
```

{% endtab %}
{% endtabs %}

## 5. 响应示例

```json
{
	"id": "video_68f7441dd5f0819096687ce9bde11dd9",
	"object": "video",
	"created_at": 1761035293,
	"status": "queued",
	"completed_at": null,
	"error": null,
	"expires_at": null,
	"model": "sora-2",
	"progress": 0,
	"remixed_from_video_id": null,
	"seconds": "4",
	"size": "720x1280"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/test/compute/aig/video-generation/openai-sora/create-video.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
