跳到主要内容Skip to content
文档

素材资产

创建可复用的素材资产组和素材资产,并在视频生成任务中引用。

概览

素材资产会把公网图片或视频 URL 登记到上游素材服务。素材状态变为 Active 后,可以在视频任务的 resources[].asset_id 中直接引用,避免每次重复传同一个 URL。

这里使用普通 0-0 Bearer Key 鉴权。不要向 0-0 API 传上游的 X-Access-Key X-Secret-Key

端点

http
1POST /v1/asset-groups2GET /v1/asset-groups/{group_id}?platform=JIMENG3POST /v1/assets4GET /v1/assets/{asset_id}?platform=JIMENG5Content-Type: application/json6Authorization: Bearer $API_KEY

素材资产组

创建素材前先创建资产组。资产组是一批同类素材的容器,例如一组角色参考图。当前上游素材服务需要传 platform,通常为 JIMENG

bash
1curl -X POST "https://api.0-0.pro/v1/asset-groups" \2  -H "Authorization: Bearer $API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "platform": "JIMENG",6    "name": "角色素材组",7    "description": "角色参考素材",8    "project_name": "default"9  }'
json
1{2  "code": 200,3  "msg": "OK",4  "data": {5    "group_id": "group-abcdef1234567890",6    "name": "角色素材组",7    "description": "角色参考素材",8    "project_name": "default",9    "status": "Active",10    "created_at": 171444480011  }12}
bash
1curl "https://api.0-0.pro/v1/asset-groups/group-abcdef1234567890?platform=JIMENG" \2  -H "Authorization: Bearer $API_KEY"

素材资产

创建素材时传一个上游素材服务可访问的公网 URL。新素材通常先处于 Processing 状态;请轮询到 Active 后再用于生成任务。

bash
1curl -X POST "https://api.0-0.pro/v1/assets" \2  -H "Authorization: Bearer $API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "platform": "JIMENG",6    "group_id": "group-abcdef1234567890",7    "url": "https://example.com/front.png",8    "asset_type": "Image",9    "name": "角色正面图"10  }'
json
1{2  "code": 200,3  "msg": "OK",4  "data": {5    "asset_id": "Asset-abcdef1234567890",6    "name": "角色正面图",7    "group_id": "group-abcdef1234567890",8    "asset_type": "Image",9    "status": "Processing",10    "url": "https://example.com/front.png",11    "created_at": 171444480012  }13}
bash
1curl "https://api.0-0.pro/v1/assets/Asset-abcdef1234567890?platform=JIMENG" \2  -H "Authorization: Bearer $API_KEY"

素材状态

  • Processing:处理中,暂时不要用于生成任务。
  • Active:处理完成,可以在视频生成任务中引用。
  • Failed:处理失败,需要换一个可访问 URL 重新创建。

在视频生成中引用素材

把返回的 asset_id 放进视频任务的 resources 列表。常见 role 包括 first_frame last_frame reference

bash
1curl -X POST "https://api.0-0.pro/v1/video/tasks" \2  -H "Authorization: Bearer $API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "model": "seedance-2-0",6    "prompt": "使用参考角色,镜头缓慢推进,电影感,细节清晰",7    "duration": 5,8    "resolution": "720p",9    "ratio": "16:9",10    "resources": [11      {"type": "image", "role": "first_frame", "asset_id": "Asset-abcdef1234567890"}12    ]13  }'