基础信息
所有接口均使用 HTTPS 调用。
https://api.kuocai.net
支持模型
| model_id | 模型 | 售价 | 默认时长 | 支持时长 | 分辨率 | 说明 |
|---|---|---|---|---|---|---|
52 |
Seedance | ¥1.00/秒 | 4 秒 | 4-15 秒 | 480P、720P |
支持参考图、首尾帧、参考音频、参考视频 |
51 |
Seedance Fast | ¥1.00/秒 | 4 秒 | 4-15 秒 | 480P、720P |
支持参考图、参考音频、参考视频 |
53 |
Seedance 标准线路一 | ¥1.00/秒 | 4 秒 | 4-15 秒 | 480P、720P |
固定使用标准线路一;折扣用户最低 ¥0.90/秒,720P 结果由本服务后处理生成 |
39 |
Happy Horse | ¥0.40/秒 | 5 秒 | 5、10、15 秒 |
720P |
支持参考图、首尾帧 |
45 |
fengling image2 | ¥0.30/张 | - | - | 2K、4K、1080P |
图片生成,支持参考图 |
视频接口 model_id 可不传,不传时默认使用 Seedance。选择 Seedance Fast 时请传 model_id: 51,选择 Seedance 标准线路一时请传 model_id: 53,选择 Happy Horse 时请传 model_id: 39。图片接口选择 fengling image2 时请传 model_id: 45。
鉴权方式
所有业务接口都需要在请求头中携带客户 API Key。请妥善保管 API Key,建议由服务端调用本 API。
Authorization: Bearer kc_xxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
1. 提交视频生成任务
/api/v1/video/generations
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt | string | 是 | 视频描述文本 |
model_id | number | 否 | 52 为 Seedance,51 为 Seedance Fast,53 为 Seedance 标准线路一,39 为 Happy Horse;默认 52 |
size | string | 否 | Seedance 系列: 9:16、16:9、1:1、3:2、2:3、21:9;Happy Horse: 16:9、9:16、4:3、3:4、1:1 |
seconds | number | 否 | Seedance 系列: 4-15,默认 4;Happy Horse: 5/10/15,默认 5 |
resolution | string | 否 | Seedance 系列: 480P、720P;Happy Horse: 720P |
count | number | 否 | 1、2、3、4,默认 1 |
reference_image | string | 否 | 单张参考图公网 HTTPS URL |
reference_images | string[] | 否 | 多张参考图公网 HTTPS URL,最多 9 个 |
frame_start | string | 否 | Seedance、Happy Horse 支持,首帧图片公网 HTTPS URL |
frame_end | string | 否 | Seedance、Happy Horse 支持,尾帧图片公网 HTTPS URL |
reference_audio | string | 否 | Seedance 系列支持,单个参考音频公网 HTTPS URL |
reference_audios | string[] | 否 | Seedance 系列支持,多个参考音频公网 HTTPS URL,最多 3 个 |
reference_video | string | 否 | Seedance 系列支持,单个参考视频公网 HTTPS URL |
reference_videos | string[] | 否 | Seedance 系列支持,多个参考视频公网 HTTPS URL,最多 3 个 |
参考素材 URL 只能使用公网 HTTPS 地址。系统会拒绝 HTTP、localhost、内网/本地 IP、带账号密码的 URL,以及 DNS 解析到内网/本地地址的域名。
计费规则
消费金额 = seconds × count × 模型单价
| 模型 | seconds | count | 消费金额 |
|---|---|---|---|
| Seedance | 4 | 1 | ¥4.00 |
| Seedance | 15 | 4 | ¥60.00 |
| Seedance Fast | 8 | 2 | ¥16.00 |
| Seedance 标准线路一 | 8 | 2 | ¥16.00;折扣用户最低 ¥14.40 |
| Happy Horse | 5 | 2 | ¥4.00 |
| Happy Horse | 15 | 4 | ¥24.00 |
余额不足时返回 402 Insufficient balance。上游失败、超时、业务错误码非 200 或生成接口没有返回 data.task_id 时,本次预扣金额会自动退回。
Seedance 请求示例
curl -X POST https://api.kuocai.net/api/v1/video/generations \
-H "Authorization: Bearer kc_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model_id": 52,
"prompt": "海边日落延时摄影,金色阳光洒在波浪上",
"size": "9:16",
"seconds": 4,
"resolution": "480P",
"count": 1,
"reference_video": "https://your-cdn.example/reference.mp4"
}'
Happy Horse 请求示例
curl -X POST https://api.kuocai.net/api/v1/video/generations \
-H "Authorization: Bearer kc_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model_id": 39,
"prompt": "草原上奔跑的马,电影感镜头",
"size": "16:9",
"seconds": 5,
"resolution": "720P",
"count": 2,
"reference_images": [
"https://your-cdn.example/horse-1.jpg",
"https://your-cdn.example/horse-2.jpg"
]
}'
Seedance Fast 请求示例
curl -X POST https://api.kuocai.net/api/v1/video/generations \
-H "Authorization: Bearer kc_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model_id": 51,
"prompt": "海边日落延时摄影,金色阳光洒在波浪上",
"size": "9:16",
"seconds": 8,
"resolution": "480P",
"count": 1,
"reference_image": "https://your-cdn.example/reference.jpg",
"reference_audio": "https://your-cdn.example/reference.mp3"
}'
Seedance 标准线路一请求示例
curl -X POST https://api.kuocai.net/api/v1/video/generations \
-H "Authorization: Bearer kc_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model_id": 53,
"prompt": "城市夜景航拍,霓虹灯反射在雨后街道上",
"size": "16:9",
"seconds": 8,
"resolution": "720P",
"count": 1,
"reference_image": "https://your-cdn.example/reference.jpg"
}'
2. 提交图片生成任务
/api/v1/images/generations
fengling image2 售价为 ¥0.30/张,成本为 ¥0.10/张。计费公式为 count × ¥0.30。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt | string | 是 | 图片描述文本 |
model_id | number | 否 | 45 为 fengling image2 |
size | string | 否 | 1:1、2:3、3:2、3:4、4:3、16:9、9:16 |
resolution | string | 否 | 2K、4K、1080P |
count | number | 否 | 1、2、3、4,默认 1 |
reference_image | string | 否 | 单张参考图公网 HTTPS URL |
reference_images | string[] | 否 | 多张参考图公网 HTTPS URL,最多 9 个 |
curl -X POST https://api.kuocai.net/api/v1/images/generations \
-H "Authorization: Bearer kc_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model_id": 45,
"prompt": "窗边晒太阳的橘猫,柔和自然光",
"size": "1:1",
"resolution": "2K",
"count": 3,
"reference_images": [
"https://your-cdn.example/cat-1.jpg",
"https://your-cdn.example/cat-2.jpg"
]
}'
3. 查询任务状态
/api/v1/tasks/{task_id}
task_id 为提交生成任务后返回的任务 ID。后续只能使用同一个 API Key 查询该任务结果。
curl -X GET https://api.kuocai.net/api/v1/tasks/T202604271430001234C001 \
-H "Authorization: Bearer kc_your_api_key"
建议客户服务端轮询查询任务状态。轮询间隔建议不少于 3-5 秒。
4. 查询账户用量和余额
/api/v1/usage
该接口用于查询当前 API Key 的余额、消费金额、计费秒数/张数、任务历史和最近请求记录。
curl -X GET https://api.kuocai.net/api/v1/usage \
-H "Authorization: Bearer kc_your_api_key"
5. 健康检查
/health
该接口不需要客户 API Key,会返回当前可用模型列表。
curl https://api.kuocai.net/health
6. 客户页面
客户可打开自助页面查询余额,也可在测试台用自己的 kc_... API Key 直接测试 Seedance、Seedance Fast、Seedance 标准线路一、Happy Horse 和 fengling image2。
https://api.kuocai.net/client
https://api.kuocai.net/test
错误码
| HTTP 状态码 | message | 说明 |
|---|---|---|
400 | Request body must be valid JSON | 请求体不是合法 JSON |
400 | prompt must be a non-empty string | 缺少 prompt 或为空 |
400 | model_id must be one of: 52, 51, 53, 39 或 model_id must be one of: 45 | 模型 ID 不支持 |
400 | {field} has an unsupported value | 参数值不在所选模型支持范围内 |
400 | {field} must be a public HTTPS URL | 参考素材 URL 不是公网 HTTPS 地址 |
401 | Invalid or missing API key | API Key 缺失或无效 |
403 | API key is disabled | API Key 已停用 |
402 | Insufficient balance | 余额不足 |
404 | Task not found | 任务不存在或不属于当前 API Key |
502 | Upstream request failed | 上游服务请求失败或返回业务错误 |
504 | Upstream request timed out | 上游服务请求超时 |