Submit a Video
Generate a video through the input prompt. This API returns the user’s current request ID. The user needs to poll the status interface to get the specific video link. The generated result is valid for 10 minutes, so please retrieve the video link promptly.
端点:POST /v1/video/submit
Request Body
model (string, required)
对应模型名称。可选值:Wan-AI/Wan2.2-I2V-A14B | Wan-AI/Wan2.2-T2V-A14B。
示例:"Wan-AI/Wan2.2-I2V-A14B"
prompt (string, required)
用于生成视频的文本提示词。
negative_prompt (string)
负向提示词,描述您不希望视频中出现的内容。
image_size (string, required)
生成图像的长宽比。可选值:1280x720 | 720x1280 | 960x960。
- 16:9 → 1280×720
- 9:16 → 720×1280
- 1:1 → 960×960
image (string, optional)
上传图片(图生视频场景)。可选值:data:image/png;base64,XXX | img_url。
当选择 Wan-AI/Wan2.2-I2V-14B-720P 模型时,image 参数是必填字段。
示例:"https://example.com/source-image.jpg"
seed (integer)
随机数生成器种子,设置固定值可复现结果。
代码示例
cURL
curl --request POST \
--url https://khb.net.cn/v1/video/submit \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "Wan-AI/Wan2.2-I2V-A14B",
"prompt": "a cat walking on the beach, sunset, cinematic",
"image_size": "1280x720",
"image": "https://example.com/cat.jpg",
"seed": 12345
}'
Python
import requests
url = "https://khb.net.cn/v1/video/submit"
payload = {
"model": "Wan-AI/Wan2.2-I2V-A14B",
"prompt": "a cat walking on the beach, sunset, cinematic",
"image_size": "1280x720",
"image": "https://example.com/cat.jpg",
"seed": 12345
}
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
result = response.json()
print(f"Request ID: {result['requestId']}")
Response Body
{
"requestId": "video-1741685396-abc123"
}
下一步:查询视频生成状态
提交请求后,使用返回的 requestId 调用 POST /v1/video/status 查询状态并获取视频链接。视频生成通常需要数分钟,链接有效期为 10 分钟,请及时下载。
错误码
| 状态码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 参数错误(模型不支持该尺寸、image 缺失等) |
| 401 | API Key 无效 |
| 403 | 权限不足 |
| 404 | 资源不存在 |
| 429 | 触发 Rate Limits |
| 500/503/504 | 服务端错误 |
