主题
Seedance(火山兼容)
星算 视频网关挂载于 /api/v3,与火山引擎方舟 API 1:1 兼容。鉴权用 Authorization: Bearer xsk_...。
MVP 范围
当前仅支持「创建任务」与「查询任务」两个接口;任务取消 / 列表等火山官方接口暂未实现。
创建任务
POST /api/v3/contents/generations/tasks
请求体原样透传到上游(火山格式),仅 model 字段在服务端被改写为上游真实标识。
bash
API_BASE=https://xingsuan.cloud
curl "$API_BASE/api/v3/contents/generations/tasks" \
-H "Authorization: Bearer $XSK_KEY" \
-H "content-type: application/json" \
-d '{
"model": "seedance-1-0",
"content": [{"type": "text", "value": "一只在月球上弹吉他的猫"}]
}'python
import requests
API_BASE = "https://xingsuan.cloud"
resp = requests.post(
f"{API_BASE}/api/v3/contents/generations/tasks",
headers={"Authorization": f"Bearer {XSK_KEY}"},
json={
"model": "seedance-1-0",
"content": [{"type": "text", "value": "一只在月球上弹吉他的猫"}],
},
)
task = resp.json()
print(task["id"]) # 任务 ID,用于查询响应返回任务 id,用于后续查询。
查询任务
GET /api/v3/contents/generations/tasks/{task_id}
bash
curl "$API_BASE/api/v3/contents/generations/tasks/$TASK_ID" \
-H "Authorization: Bearer $XSK_KEY"响应包含任务状态与生成结果(视频 URL),格式与火山官方一致。建议用轮询方式查询直到任务完成。
错误
错误信封为火山风格({"error":{"code":"<string>","message":...}}),code 是字符串。上游超时 → 504;连接错误 → 502;若上游已返回火山错误体则原样透传。详见 错误码。