素材库
上传素材
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"
}
}
鉴权
string
必填
Bearer YOUR_API_KEY请求参数
string
必填
引用该素材的模型:
seedance-2.0、seedance-2.0-fast、seedance-2.0-mini、seedance-2.5。string
必填
素材类型:
image、video、audio。string
必填
可公开下载的
http(s) 链接,不超过 4096 字符。视频、音频上传时读取时长,读不到时返回 400;视频用 MP4 / MOV / WebM,音频用 WAV / MP3。string
备注名,不超过 128 字。
400(invalid_request)。
响应
string
素材 ID,
ast_ 开头。查询、删除时使用。string
固定为
asset。string
上传时的
model。string
image、video 或 audio。string
备注名,未传时为空字符串。
string
上传成功时固定为
processing。number
视频、音频的时长(秒),上传时读取。图片无此字段。
integer
创建时间(Unix 秒)。
integer
更新时间(Unix 秒)。
错误码
| 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"
}
}