创建视频任务
curl --request POST \
--url https://api.omnirelay.ai/api/v3/contents/generations/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "A paper boat drifting on a calm pond at sunrise, slow camera pan"
}
]
}
'import requests
url = "https://api.omnirelay.ai/api/v3/contents/generations/tasks"
payload = {
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "A paper boat drifting on a calm pond at sunrise, slow camera pan"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'doubao-seedance-2-0-260128',
content: [
{
type: 'text',
text: 'A paper boat drifting on a calm pond at sunrise, slow camera pan'
}
]
})
};
fetch('https://api.omnirelay.ai/api/v3/contents/generations/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3f0c9a2e-6b1d-4c35-9a7e-2d8c5b1e4f60"
}{
"error": {
"code": "invalid_parameter"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "unauthorized"
}
}{
"error": {
"code": "inference_budget_or_access_denied"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "model_not_allowed"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "model_unavailable"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "payload_too_large"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "rate_limited"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "video_submit_held"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "live_provider_unavailable"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "video_submit_held"
},
"request_id": "2f6c1d0e9a"
}视频
创建视频任务
提交文生视频任务并立即返回任务 ID,之后查询任务直到完成。按实际生成的输出 tokens 计费(标价每百万 USD 25):宽 x 高 x (24 x 秒数 + 1) / 1024。提交时按所选分辨率下最大画面和时长再加 10% 预留;任务成功后按实际生成的 tokens 结算,失败、过期或取消的任务不收费。只接受文档列出的字段。
POST
/
api
/
v3
/
contents
/
generations
/
tasks
创建视频任务
curl --request POST \
--url https://api.omnirelay.ai/api/v3/contents/generations/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "A paper boat drifting on a calm pond at sunrise, slow camera pan"
}
]
}
'import requests
url = "https://api.omnirelay.ai/api/v3/contents/generations/tasks"
payload = {
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "A paper boat drifting on a calm pond at sunrise, slow camera pan"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'doubao-seedance-2-0-260128',
content: [
{
type: 'text',
text: 'A paper boat drifting on a calm pond at sunrise, slow camera pan'
}
]
})
};
fetch('https://api.omnirelay.ai/api/v3/contents/generations/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3f0c9a2e-6b1d-4c35-9a7e-2d8c5b1e4f60"
}{
"error": {
"code": "invalid_parameter"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "unauthorized"
}
}{
"error": {
"code": "inference_budget_or_access_denied"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "model_not_allowed"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "model_unavailable"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "payload_too_large"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "rate_limited"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "video_submit_held"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "live_provider_unavailable"
},
"request_id": "2f6c1d0e9a"
}{
"error": {
"code": "video_submit_held"
},
"request_id": "2f6c1d0e9a"
}授权
在 OmniRelay 控制台创建的 API Key。所有者确认身份后可在控制台再次查看。
请求头
本次调用的标签,以逗号分隔的 key=value,例如 client=acme,env=prod。与 API Key 的默认标签合并;同名 key 以请求体 tags 字段为准。X-OmniRelay-Tags 是同一个请求头的旧名,继续接受。
请求体
application/json
GET /v1/models 中的视频模型 ID(type 为 video)。
示例:
"doubao-seedance-2-0-260128"
恰好一项文本,1 到 4000 个字符。
Required array length:
1 elementShow child attributes
Show child attributes
可用选项:
480p, 720p 可用选项:
16:9, 4:3, 1:1, 3:4, 9:16, 21:9, adaptive 时长,整数秒。
必填范围:
4 <= x <= 10必填范围:
-1 <= x <= 4294967295除非设为 false,视频带音轨。
响应
任务已受理,预留已生效。
任务 ID。用 GET /api/v3/contents/generations/tasks/{id} 查询。