外观
视频生成
提供视频生成任务提交与内容下载两个接口。
POST /v1/videos
提交一个视频生成任务,返回任务信息。
- 方法:
POST /v1/videos - 鉴权:必须使用 API Key(
agent = "api") - 来源:
manager/router.go→VideosRelayAPI(manager/videos.go)
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | ❌ | 视频模型标识,缺省为 sora-2。-official 后缀会被剥离 |
prompt | string | ✅ | 视频描述,去空格后不能为空 |
seconds | string | ❌ | 视频时长(秒) |
size | string | ❌ | 分辨率,如 1024x1024 |
input_reference | string | ❌ | 输入参考(如图片转视频的参考图) |
请求示例
bash
curl https://app.1in2.top/api/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key-here" \
-d '{
"model": "sora-2",
"prompt": "一只小猫在草地上奔跑",
"seconds": "5",
"size": "1024x1024"
}'响应体
json
{
"id": "video-abc123",
"object": "video",
"model": "sora-2",
"created_at": 1700000000,
"completed_at": null,
"expires_at": null,
"error": null,
"progress": 0,
"prompt": "一只小猫在草地上奔跑",
"seconds": "5",
"size": "1024x1024",
"remixed_from_video_id": null,
"status": "queued"
}响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,用于下载内容 |
object | string | 对象类型,如 "video" |
model | string | 视频模型 |
created_at | int64 | 创建时间戳 |
completed_at | int64 | 完成时间戳(未完成时为空) |
expires_at | int64 | 过期时间戳 |
error | object | 错误信息(code + message),无错误时为空 |
progress | int | 进度 |
prompt | string | 生成提示词 |
seconds | string | 时长 |
size | string | 分辨率 |
remixed_from_video_id | string | 来源视频 ID(重混时) |
status | string | 状态,如 queued / processing / completed / failed |
轮询建议
提交任务后可根据 id 与 status 轮询;status = "completed" 后即可下载内容。
错误
| 错误类型 | 触发场景 |
|---|---|
invalid_request_error | prompt 为空、id 为空、找不到任务或渠道 |
authentication_error | 未携带 Key 或身份不合法 |
quota_exceeded_error | 额度不足 |
