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

# 创建视频生成任务

> 提交视频生成任务，支持文生视频和图生视频。返回任务 ID，可通过 GET 接口查询任务状态。

## 请求头

**Authorization** `string` *required*

使用 Bearer Token 认证。格式：`Authorization: Bearer sk-xxxxxx`

## 请求体

格式：`application/json`

**model** `string`

模型/风格 ID

**prompt** `string`

文本描述提示词

**image** `string`

图片输入（URL 或 Base64）

**duration** `number`

视频时长（秒）

**width** `integer`

视频宽度

**height** `integer`

视频高度

**fps** `integer`

视频帧率

**seed** `integer`

随机种子

**n** `integer`

生成视频数量

**response\_format** `string`

响应格式

**user** `string`

用户标识

**metadata** `object`

扩展参数（如 negative\_prompt、style、quality\_level 等）

**属性**

**\[key: string]** `any`

任意键值对，键为字符串，值为任意类型。

## 响应

### 200 成功创建视频生成任务

格式：`application/json`

**task\_id** `string`

任务 ID

**status** `string`

任务状态

### 400 请求参数错误

格式：`application/json`

**error** `object`

错误信息

**属性**

**message** `string`

错误信息

**type** `string`

错误类型

**param** `string | null`

相关参数

**code** `string | null`

错误代码

```bash cURL theme={"dark"}
curl -X POST "https://t.ato2.nodesms.com/v1/video/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora",
    "prompt": "A cute cat playing in the garden",
    "duration": 5,
    "width": 1280,
    "height": 720
  }'
```

```python Python theme={"dark"}
import requests

response = requests.post(
    "https://t.ato2.nodesms.com/v1/video/generations",
    headers={"Authorization": "Bearer sk-xxxxx"},
    json={
        "model": "sora",
        "prompt": "A cute cat playing in the garden",
        "duration": 5,
        "width": 1280,
        "height": 720,
    },
)
print(response.json())
```

```json 200 theme={"dark"}
{
  "task_id": "string",
  "status": "string"
}
```

```json 400 theme={"dark"}
{
  "error": {
    "message": "string",
    "type": "string",
    "param": null,
    "code": null
  }
}
```


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