curl --request POST \
--url https://api.tokenlab.sh/v1/videos/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_url": "https://example.com/reference.png",
"asset_name": "Front view",
"asset_type": "Image",
"library_type": "aigc_avatar",
"group_id": "group-20260720123456-vrt01"
}
'{
"id": "asset-20260720123456-qn7wr",
"object": "seedance.material_asset",
"group_id": "group-20260720123456-vrt01",
"library_type": "aigc_avatar",
"asset_name": "Front view",
"asset_type": "Image",
"status": "PROCESSING",
"ready": false,
"error_message": null,
"metadata": null,
"created_at": 1782998400000
}{
"error": {
"message": "model: Model is required",
"type": "invalid_request_error",
"param": "model"
},
"validation_errors": [
{
"field": "model",
"message": "Model is required"
}
]
}{
"error": {
"message": "Invalid API key provided",
"type": "invalid_api_key"
}
}{
"error": {
"message": "<string>",
"type": "unauthorized",
"code": "<string>",
"param": "<string>",
"model": "<string>",
"did_you_mean": "<string>",
"suggestions": [
{
"id": "<string>"
}
],
"alternatives": [
{
"id": "<string>",
"status": "<string>",
"tags": [
"<string>"
]
}
],
"hint": "<string>",
"retry_after": 123,
"retryable": true,
"balance_usd": 123,
"estimated_cost_usd": 123,
"supported_operations": [
"<string>"
],
"supported_parameters": [
"<string>"
],
"required_selectors": [
"<string>"
],
"optional_selectors": [
"<string>"
],
"allowed_resolutions": [
"<string>"
],
"allowed_durations": [
"<string>"
],
"allowed_aspect_ratios": [
"<string>"
],
"prompt_max_characters": 123,
"recommended_request": {},
"request_endpoint": "<string>",
"request_shape_mode": "<string>",
"status_mode": "<string>",
"request_id": "<string>"
}
}{
"error": {
"message": "An internal error occurred",
"type": "server_error"
}
}{
"error": {
"message": "Seedance material library request failed",
"type": "server_error",
"code": "seedance_material_library_request_failed"
}
}视频与素材
创建素材
把图片、视频或音频保存为可复用的 Seedance 素材。
POST
/
v1
/
videos
/
assets
curl --request POST \
--url https://api.tokenlab.sh/v1/videos/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_url": "https://example.com/reference.png",
"asset_name": "Front view",
"asset_type": "Image",
"library_type": "aigc_avatar",
"group_id": "group-20260720123456-vrt01"
}
'{
"id": "asset-20260720123456-qn7wr",
"object": "seedance.material_asset",
"group_id": "group-20260720123456-vrt01",
"library_type": "aigc_avatar",
"asset_name": "Front view",
"asset_type": "Image",
"status": "PROCESSING",
"ready": false,
"error_message": null,
"metadata": null,
"created_at": 1782998400000
}{
"error": {
"message": "model: Model is required",
"type": "invalid_request_error",
"param": "model"
},
"validation_errors": [
{
"field": "model",
"message": "Model is required"
}
]
}{
"error": {
"message": "Invalid API key provided",
"type": "invalid_api_key"
}
}{
"error": {
"message": "<string>",
"type": "unauthorized",
"code": "<string>",
"param": "<string>",
"model": "<string>",
"did_you_mean": "<string>",
"suggestions": [
{
"id": "<string>"
}
],
"alternatives": [
{
"id": "<string>",
"status": "<string>",
"tags": [
"<string>"
]
}
],
"hint": "<string>",
"retry_after": 123,
"retryable": true,
"balance_usd": 123,
"estimated_cost_usd": 123,
"supported_operations": [
"<string>"
],
"supported_parameters": [
"<string>"
],
"required_selectors": [
"<string>"
],
"optional_selectors": [
"<string>"
],
"allowed_resolutions": [
"<string>"
],
"allowed_durations": [
"<string>"
],
"allowed_aspect_ratios": [
"<string>"
],
"prompt_max_characters": 123,
"recommended_request": {},
"request_endpoint": "<string>",
"request_shape_mode": "<string>",
"status_mode": "<string>",
"request_id": "<string>"
}
}{
"error": {
"message": "An internal error occurred",
"type": "server_error"
}
}{
"error": {
"message": "Seedance material library request failed",
"type": "server_error",
"code": "seedance_material_library_request_failed"
}
}提交一个可公开访问的文件 URL,TokenLab 会将它保存到 Seedance 素材组。后续生成使用返回的素材
TokenLab 会检查来源 URL、媒体类型、文件大小和可读取的图像尺寸。导入受理不代表素材已就绪:请等待
id。
library_type: "aigc_avatar" 可以省略 group_id,素材会进入工作区的默认素材组。library_type: "liveness_face" 必须传入 视觉验证结果 返回的素材组 ID。
| 类型 | 支持的输入 |
|---|---|
| 图像 | jpeg, jpg, png, webp, bmp, tiff, gif, heic, heif; ≤30 MiB; 宽度和高度 [300, 6000] px; 宽高比 [0.4, 2.5]. |
| 视频 | mp4, mov; ≤200 MiB. |
| 音频 | aac, wav, mp3; ≤15 MiB. |
ACTIVE,处理失败时查看 error_message。其他媒体及人脸要求在处理期间校验。
素材需要一些时间处理。通过 获取素材 查询状态;status 变为 ACTIVE 后即可使用。真人素材组只对应一位已验证人员,图片中出现多张人脸或人员不一致时会处理失败。
project_name 用于同一组织内的资源隔离,默认为 default。相关素材组和素材须使用相同且区分大小写的值;POST/PUT 在 JSON 请求体中传入,GET/DELETE 在查询参数中传入。
请求示例
curl https://api.tokenlab.sh/v1/videos/assets \
-H "Authorization: Bearer $TOKENLAB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"library_type":"aigc_avatar","group_id":"group-20260720123456-vrt01","asset_url":"https://example.com/reference.png","asset_type":"Image","asset_name":"Front view","project_name":"default"}'
响应示例
{
"id": "asset-20260720123456-qn7wr",
"object": "seedance.material_asset",
"project_name": "default",
"group_id": "group-20260720123456-vrt01",
"library_type": "aigc_avatar",
"asset_name": "Front view",
"asset_type": "Image",
"status": "PROCESSING",
"ready": false,
"error_message": null,
"metadata": null,
"created_at": 1782998400000
}
授权
API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。
请求体
application/json
可公开访问的导入源 URL。TokenLab 会存储该素材以供后续使用;请勿将此 URL 视为长期的素材地址。
随素材资源存储的可选显示名称。
Required string length:
1 - 128可用选项:
Image, Video, Audio 素材库类别。aigc_avatar 用于虚拟化身素材。liveness_face 用于已验证的真人素材。
可用选项:
aigc_avatar, liveness_face TokenLab 素材组 ID。liveness_face 素材必需;aigc_avatar 可选。
素材资源的项目范围。资产和组在已认证的组织内按项目隔离。
Required string length:
1 - 128随素材资源存储的可选客户端元数据。
响应
素材资产已创建
TokenLab 素材资源 ID。在资产变为 ACTIVE 后,请将其用作 material_asset_id。
可用选项:
seedance.material_asset 可用选项:
aigc_avatar, liveness_face 可用选项:
Image, Video, Audio 可用选项:
PROCESSING, ACTIVE, FAILED, DELETED 当资产处于活跃状态且未被删除时为 true。
拥有此素材资源的 TokenLab 素材组 ID。
此素材资源的项目范围。
可公开显示的终端处理错误。永久性源验证失败包括被拒绝的尺寸约束。
素材资源记录创建时的 Unix 时间戳。
素材资源记录最后更新时的 Unix 时间戳。