个人中心
我的 API
管理 API Key,并通过开放接口异步调用平台能力。
调用地址
生成接口
https://hmtm.cn/api/open/v1/generations查询接口
https://hmtm.cn/api/open/v1/tasks/{taskId}API Key
加载中...
Seedance 2.0 API 文档
鉴权
在请求头中传入 API Key,支持两种方式:
Authorization: Bearer YOUR_API_KEY或使用 X-API-Key: YOUR_API_KEY
1. 提交生成任务
POSThttps://hmtm.cn/api/open/v1/generations
请求参数 (JSON Body)
除 abilityId 外,所有参数均为 Seedance 2.0 原生字段。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| abilityId | string | 是 | 能力标识,固定为 cme_doubao_seedance_2_0 |
| content | object[] | 是 | 输入内容数组,每个元素为以下类型之一:
|
| duration | number | 否 | 生成视频时长(秒)。 |
| ratio | string | 否 | 画面比例:16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive |
| resolution | string | 否 | 分辨率:480p / 720p。1080p 即将开放。 |
| generate_audio | boolean | 否 | 是否生成音频。 |
| return_last_frame | boolean | 否 | 是否返回尾帧图像。 |
| watermark | boolean | 否 | 是否添加水印。 |
| seed | number | 否 | 随机种子,用于结果复现。传入 -1 使用随机种子。 |
提交响应
| 字段 | 类型 | 说明 |
|---|---|---|
| taskId | string | 任务唯一标识,用于后续查询。 |
| status | string | queued |
| createdAt | string | 任务创建时间。 |
2. 查询任务状态
GEThttps://hmtm.cn/api/open/v1/tasks/{taskId}
通过任务 ID 查询进度和结果。建议间隔 3-5 秒轮询。
查询响应
| 字段 | 类型 | 说明 |
|---|---|---|
| taskId | string | 任务唯一标识。 |
| status | string | queued(排队)/running(生成中)/succeeded(完成)/failed(失败) |
| progress | number | 进度百分比,0-100。 |
| output | object | null | 成功后返回。包含 videoUrl(视频地址)。 |
| billing | object | null | 成功后返回。deductedCredits 为实际扣除积分。 |
| error | string | null | 失败时的错误信息。 |
| createdAt | string | 任务创建时间。 |
| completedAt | string | null | 任务完成时间。 |
curl 示例
文生视频
curl -X POST "https://hmtm.cn/api/open/v1/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"abilityId": "cme_doubao_seedance_2_0",
"content": [
{"type": "text", "text": "一只猫在草地上奔跑,阳光明媚,电影质感"}
],
"duration": 5,
"ratio": "16:9"
}'图生视频(参考图片 + 提示词)
curl -X POST "https://hmtm.cn/api/open/v1/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"abilityId": "cme_doubao_seedance_2_0",
"content": [
{"type": "text", "text": "人物转头微笑,自然光线"},
{"type": "image_url", "image_url": {"url": "https://example.com/ref-image.jpg"}}
],
"duration": 5,
"ratio": "adaptive"
}'视频参考(参考视频 + 提示词)
curl -X POST "https://hmtm.cn/api/open/v1/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"abilityId": "cme_doubao_seedance_2_0",
"content": [
{"type": "text", "text": "延续参考视频的风格和动作"},
{"type": "video_url", "video_url": {"url": "https://example.com/ref-video.mp4"}}
],
"duration": 5
}'查询任务
curl -X GET "https://hmtm.cn/api/open/v1/tasks/YOUR_TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"扣费说明
任务完成后自动按 API 计费规则扣费(与站内分开配置),享受会员等级折扣。 扣费记录可在「扣费记录」查看。
