素材库
上传素材
POST /v1/assets — 把图片、视频或音频链接上传为素材
POST
/
v1
/
assets
curl -X POST https://api.qingbo.ai/v1/assets \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"type": "video",
"url": "https://cdn.example.com/refs/hero-walk.mp4",
"name": "hero-walk-ref"
}'
import requests
response = requests.post(
"https://api.qingbo.ai/v1/assets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "seedance-2.5",
"type": "video",
"url": "https://cdn.example.com/refs/hero-walk.mp4",
"name": "hero-walk-ref"
}
)
asset_id = response.json()["id"]
{
"id": "ast_3f9c2a7d1e8b4c6a5f0e9d21",
"object": "asset",
"model": "seedance-2.5",
"type": "video",
"name": "hero-walk-ref",
"status": "processing",
"duration_seconds": 5.062,
"created_at": 1790220525,
"updated_at": 1790220525
}
{
"error": {
"message": "无法读取该文件的时长,请使用可直接下载的 MP4 / MOV / WebM 视频或 WAV / MP3 音频",
"type": "invalid_request_error",
"param": "url",
"code": "asset_duration_unknown"
}
}
{
"error": {
"message": "Model 'seedance-9' not found or not enabled",
"type": "invalid_request_error",
"param": "model",
"code": "model_not_found"
}
}
把一个可公开下载的图片、视频或音频链接上传为素材。提交后
status 为 processing,用查询素材获取审核结果。
素材存放在模型供应商的共享素材库中,该供应商的其他客户可能看到并下载。请勿上传私密或敏感内容。
curl -X POST https://api.qingbo.ai/v1/assets \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"type": "video",
"url": "https://cdn.example.com/refs/hero-walk.mp4",
"name": "hero-walk-ref"
}'
import requests
response = requests.post(
"https://api.qingbo.ai/v1/assets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "seedance-2.5",
"type": "video",
"url": "https://cdn.example.com/refs/hero-walk.mp4",
"name": "hero-walk-ref"
}
)
asset_id = response.json()["id"]
{
"id": "ast_3f9c2a7d1e8b4c6a5f0e9d21",
"object": "asset",
"model": "seedance-2.5",
"type": "video",
"name": "hero-walk-ref",
"status": "processing",
"duration_seconds": 5.062,
"created_at": 1790220525,
"updated_at": 1790220525
}
{
"error": {
"message": "无法读取该文件的时长,请使用可直接下载的 MP4 / MOV / WebM 视频或 WAV / MP3 音频",
"type": "invalid_request_error",
"param": "url",
"code": "asset_duration_unknown"
}
}
{
"error": {
"message": "Model 'seedance-9' not found or not enabled",
"type": "invalid_request_error",
"param": "model",
"code": "model_not_found"
}
}
鉴权
请求参数
以上之外的字段返回400(invalid_request)。
响应
错误码
| HTTP | code | 说明 |
|---|---|---|
| 400 | invalid_request | 请求体不是合法 JSON,或含不支持的字段 |
| 400 | missing_model | 缺少 model |
| 400 | invalid_asset_type | type 不是 image / video / audio |
| 400 | invalid_name | name 超过 128 字 |
| 400 | invalid_url | url 不是可公开下载的 http(s) 链接 |
| 400 | asset_type_unsupported | 该模型不支持此类型素材 |
| 400 | asset_limit_exceeded | 已达每个账号 500 个素材的上限 |
| 400 | asset_duration_unknown | 无法读取视频或音频的时长 |
| 400 | asset_rejected | 素材不符合模型要求(格式、大小、时长或内容) |
| 401 | — | API Key 缺失或无效 |
| 404 | model_not_found | 模型不存在或未启用 |
| 429 | — | 上传过于频繁 |
| 500 | asset_store_error | 素材记录保存失败,可重试 |
| 502 | asset_upstream_error | 素材服务暂不可用,可重试 |
相关文档
⌘I
curl -X POST https://api.qingbo.ai/v1/assets \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"type": "video",
"url": "https://cdn.example.com/refs/hero-walk.mp4",
"name": "hero-walk-ref"
}'
import requests
response = requests.post(
"https://api.qingbo.ai/v1/assets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "seedance-2.5",
"type": "video",
"url": "https://cdn.example.com/refs/hero-walk.mp4",
"name": "hero-walk-ref"
}
)
asset_id = response.json()["id"]
{
"id": "ast_3f9c2a7d1e8b4c6a5f0e9d21",
"object": "asset",
"model": "seedance-2.5",
"type": "video",
"name": "hero-walk-ref",
"status": "processing",
"duration_seconds": 5.062,
"created_at": 1790220525,
"updated_at": 1790220525
}
{
"error": {
"message": "无法读取该文件的时长,请使用可直接下载的 MP4 / MOV / WebM 视频或 WAV / MP3 音频",
"type": "invalid_request_error",
"param": "url",
"code": "asset_duration_unknown"
}
}
{
"error": {
"message": "Model 'seedance-9' not found or not enabled",
"type": "invalid_request_error",
"param": "model",
"code": "model_not_found"
}
}