一、模型与端点
视频模型是异步任务:先提交,再轮询,完成后下载。三个端点都在 https://caapi.top 下,鉴权与其它接口相同(Authorization: Bearer sk-xxxxxx)。
| 动作 | 端点 | 说明 |
|---|---|---|
| 提交任务 | POST /v1/videos | JSON 或 multipart/form-data,返回任务 id |
| 查询状态 | GET /v1/videos/{id} | 轮询直到 completed / failed |
| 下载成片 | GET /v1/videos/{id}/content | 返回 video/mp4 |
当前在售的视频模型(调用名):
| 调用名 | 模型 | 备注 |
|---|---|---|
seedance-2.5 | Seedance 2.5 | 文生视频 / 图生视频 |
seedance-2.0 | Seedance 2.0 | 文生视频 / 图生视频 |
seedance-2.0-fast | Seedance 2.0 Fast | 出片更快 |
seedance-2.0-mini | Seedance 2.0 Mini | 轻量版 |
minimax-video-h3 | MiniMax H3 | 接入中,暂不可提交 |
每秒单价按分辨率档(480P / 720P / 1080P / 4K)列在 模型广场 的视频模型卡片上。
二、提交任务
bash
curl https://caapi.top/v1/videos \
-H "Authorization: Bearer sk-xxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "一只橘猫在窗台上晒太阳,镜头缓慢推进,柔和的午后光线",
"seconds": 5,
"size": "1280x720"
}'返回:
json
{
"id": "task_WjPfIKct7267UdmhjBOn1thJ8u9Bdmap",
"object": "video",
"model": "seedance-2.5",
"status": "queued",
"progress": 0,
"created_at": 1789524105
}参数:
| 参数 | 说明 |
|---|---|
model | 视频模型的调用名,见上表。 |
prompt | 视频描述。必填。 |
seconds | 时长(秒),默认 5。各模型支持的时长范围以上游为准,超出会在提交时被拒。 |
size | 输出尺寸 宽x高,如 854x480、1280x720、1920x1080、3840x2160;竖版写 720x1280 即可。不传按 1080P。上游只接受常见长宽比(16:9、9:16、1:1 等),不支持的比例会返回 Aspect ratio is not supported。 |
input_reference | 图生视频:首帧图片的 URL。用 multipart/form-data 时可直接上传文件,字段名同样是 input_reference。 |
提交成功即按「分辨率档 × 秒」预扣费用;任务失败(上游拒绝、生成失败)会自动全额退回,可在控制台的用量日志里看到一笔退款记录。
三、查询状态
bash
curl https://caapi.top/v1/videos/task_WjPfIKct7267UdmhjBOn1thJ8u9Bdmap \
-H "Authorization: Bearer sk-xxxxxx"status 依次为 queued → in_progress → completed(或 failed),progress 为 0–100。建议每 10–15 秒轮询一次;Seedance 2.5 生成 5 秒 720P 实测约 10–12 分钟,排队高峰会更久。完成后的返回里带成片地址:
json
{
"id": "task_WjPfIKct7267UdmhjBOn1thJ8u9Bdmap",
"object": "video",
"model": "seedance-2.5",
"status": "completed",
"progress": 100,
"created_at": 1789524105,
"completed_at": 1789524839,
"data": [{ "url": "https://…/video_82be2231.mp4", "width": 1280, "height": 720, "media_type": "video/mp4" }],
"video_url": "https://…/video_82be2231.mp4"
}四、下载成片
bash
curl -L https://caapi.top/v1/videos/task_WjPfIKct7267UdmhjBOn1thJ8u9Bdmap/content \
-H "Authorization: Bearer sk-xxxxxx" \
-o output.mp4也可以直接下载状态返回里的 video_url。上游的成片地址有时效,任务完成后请尽快保存到自己的存储。
五、Python 示例
python
import time, requests
BASE = "https://caapi.top"
H = {"Authorization": "Bearer sk-xxxxxx"}
task = requests.post(f"{BASE}/v1/videos", headers=H, json={
"model": "seedance-2.5",
"prompt": "一只橘猫在窗台上晒太阳,镜头缓慢推进",
"seconds": 5,
"size": "1280x720",
}).json()
task_id = task["id"]
while True:
s = requests.get(f"{BASE}/v1/videos/{task_id}", headers=H).json()
print(s["status"], s.get("progress"))
if s["status"] in ("completed", "failed"):
break
time.sleep(15)
if s["status"] == "completed":
mp4 = requests.get(f"{BASE}/v1/videos/{task_id}/content", headers=H)
open("output.mp4", "wb").write(mp4.content)六、常见错误
| 返回 | 原因 |
|---|---|
Aspect ratio is not supported | size 的长宽比上游不支持,换成 16:9 / 9:16 / 1:1 等常见比例。 |
No available channel for model … | 调用名写错(区分大小写),对照 模型广场 的调用名。 |
status 为 failed | 上游生成失败,费用已自动退回;可换提示词或尺寸重试。 |