# 创建视频

**方法**: `POST`
**路径**: `/sora/v1/videos`

尺寸参数:
"480x480": "1:1",
"720x720": "1:1",
"480x854": "9:16",
"854x480": "16:9",
"1280x720": "16:9",
"720x1280": "9:16"

分辨率参数：
"480x480": "480p",
"720x720": "720p",
"480x854": "480p",
"854x480": "480p",
"1280x720": "720p",
"720x1280": "720p"

视频时长：
"150": "5s",
"300": "10s"

## 请求参数

### Header 参数

```text
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
Schema for video generation request parameters
actions
array
[object]
可选
视频动作列表，定义视频中需要执行的一系列动作和时间点
time
number
必需
动作执行的时间点(秒)
description
string
动作描述
必需
inpaint_items
array
[object]
可选
图像修复项列表，定义需要进行修复或替换的视频帧区域
type
enum<string>
项目类型
可选
值:
image
url
string
图像URL
可选
frame_index
number
目标帧索引
可选
preset_id
null
预设ID
可选
generation_id
null
生成ID
可选
upload_media_id
string
上传媒体ID
可选
source_start_frame
number
源视频起始帧
可选
source_end_frame
number
源视频结束帧
可选
type
enum<string>
生成类型
可选
值:
video_gen
style
enum<string>
视频风格
可选
值:
natural
prompt
string
可选
用于指导AI生成视频的文本描述
width
number
可选
视频宽度(像素) 480、854、720、1280
>= 1
height
number
可选
视频高度(像素) 480、854、720、1280
>= 1
n_frames
number
可选
视频帧数 150、300
>= 1
n_variants
number
生成变体数量
可选
>= 1
sdedit
object
可选
SDE(随机扩散编辑)相关配置
amount
number
编辑强度
必需
>= 1
<= 8
source_generation_id
string
源生成ID
必需
source_upload_media_id
string
|
null
源上传媒体ID
必需
operation
enum<string>
操作类型
可选
枚举值:
simple_compose
storyboard
remix
blend
model
enum<string>
使用的模型
可选
值:
turbo
示例
{
"actions"
:
[
{
"time"
:
0
,
"description"
:
"string"
}
]
,
"inpaint_items"
:
[
{
"type"
:
"image"
,
"url"
:
"string"
,
"frame_index"
:
0
,
"preset_id"
:
null
,
"generation_id"
:
null
,
"upload_media_id"
:
"string"
,
"source_start_frame"
:
0
,
"source_end_frame"
:
0
}
]
,
"type"
:
"video_gen"
,
"style"
:
"natural"
,
"prompt"
:
"string"
,
"width"
:
1
,
"height"
:
1
,
"n_frames"
:
1
,
"n_variants"
:
1
,
"sdedit"
:
{
"amount"
:
1
,
"source_generation_id"
:
"string"
,
"source_upload_media_id"
:
"string"
}
,
"operation"
:
"simple_compose"
,
"model"
:
"turbo"
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/sora/v1/videos' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "actions": [
        {
            "time": 0,
            "description": "string"
        }
    ],
    "inpaint_items": [
        {
            "type": "image",
            "url": "string",
            "frame_index": 0,
            "preset_id": null,
            "generation_id": null,
            "upload_media_id": "string",
            "source_start_frame": 0,
            "source_end_frame": 0
        }
    ],
    "type": "video_gen",
    "style": "natural",
    "prompt": "string",
    "width": 1,
    "height": 1,
    "n_frames": 1,
    "n_variants": 1,
    "sdedit": {
        "amount": 1,
        "source_generation_id": "string",
        "source_upload_media_id": "string"
    },
    "operation": "simple_compose",
    "model": "turbo"
}'
```

## 返回响应

### 🟢 200 成功

**内容类型**: `application/json`

#### 响应结构

```text
object
```

#### 示例

```json
{
    "code": "success",
    "message": "",
    "data": "task_01jhjnz502ejqsm6r37km2q637"
}
```
