curl --request POST \
--url https://api.tokengongfang.com/v1/seedance2/private-avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}'
curl --request POST \
--url https://api.tokengongfang.com/v1/seedance2/private-avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"group_id": "group_xxx",
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
}
]
}'
import requests
url = "https://api.tokengongfang.com/v1/seedance2/private-avatar"
payload = {
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.tokengongfang.com/v1/seedance2/private-avatar";
const payload = {
group: {
name: "virtual-avatar-group",
description: "demo group"
},
project_name: "default",
asset_type: "Image",
assets: [
{
url: "https://example.com/avatar-a.png",
name: "avatar-a"
},
{
url: "https://example.com/avatar-b.png",
name: "avatar-b"
}
]
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": {
"id": "task_01K...",
"object": "seedance.avatar.asset.task",
"status": "processing",
"progress": 10,
"model": "doubao-seedance-2.0"
}
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
doubao-seedance-2-0
虚拟人像素材
- 私域虚拟人像素材提交接口
- 支持批量提交,单次最多 20 个素材
- 自动创建或复用素材组,返回任务 ID 用于状态查询
- 审核通过的素材可直接用于 Seedance 2.0 视频生成
POST
/
v1
/
seedance2
/
private-avatar
curl --request POST \
--url https://api.tokengongfang.com/v1/seedance2/private-avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}'
curl --request POST \
--url https://api.tokengongfang.com/v1/seedance2/private-avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"group_id": "group_xxx",
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
}
]
}'
import requests
url = "https://api.tokengongfang.com/v1/seedance2/private-avatar"
payload = {
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.tokengongfang.com/v1/seedance2/private-avatar";
const payload = {
group: {
name: "virtual-avatar-group",
description: "demo group"
},
project_name: "default",
asset_type: "Image",
assets: [
{
url: "https://example.com/avatar-a.png",
name: "avatar-a"
},
{
url: "https://example.com/avatar-b.png",
name: "avatar-b"
}
]
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": {
"id": "task_01K...",
"object": "seedance.avatar.asset.task",
"status": "processing",
"progress": 10,
"model": "doubao-seedance-2.0"
}
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
curl --request POST \
--url https://api.tokengongfang.com/v1/seedance2/private-avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}'
curl --request POST \
--url https://api.tokengongfang.com/v1/seedance2/private-avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"group_id": "group_xxx",
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
}
]
}'
import requests
url = "https://api.tokengongfang.com/v1/seedance2/private-avatar"
payload = {
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.tokengongfang.com/v1/seedance2/private-avatar";
const payload = {
group: {
name: "virtual-avatar-group",
description: "demo group"
},
project_name: "default",
asset_type: "Image",
assets: [
{
url: "https://example.com/avatar-a.png",
name: "avatar-a"
},
{
url: "https://example.com/avatar-b.png",
name: "avatar-b"
}
]
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": {
"id": "task_01K...",
"object": "seedance.avatar.asset.task",
"status": "processing",
"progress": 10,
"model": "doubao-seedance-2.0"
}
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
认证
所有接口均需要使用 Bearer Token 进行认证获取 API Key:访问 API Key 管理页面 获取您的 API Key使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求参数
已有素材组 ID传入时跳过素材组创建,直接向该素材组提交素材
与
group 二选一使用,不可同时传入项目名称默认值:
default素材类型可选值:
Image- 图片素材(默认)Video- 视频素材Audio- 音频素材
Image单素材兼容写法:素材 URL
与
assets 数组二选一使用,适用于只提交一个素材的场景单素材兼容写法:素材名称
与
assets 数组二选一使用,适用于只提交一个素材的场景响应
响应状态码,成功时为 200
使用场景
场景 1:批量提交素材(自动创建素材组)
不传group_id,服务端自动创建 AIGC 类型素材组后提交素材。
{
"group": {
"name": "virtual-avatar-group",
"description": "demo group"
},
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
},
{
"url": "https://example.com/avatar-b.png",
"name": "avatar-b"
}
]
}
场景 2:向已有素材组追加素材
传入group_id,跳过素材组创建直接提交。
{
"group_id": "group_xxx",
"project_name": "default",
"asset_type": "Image",
"assets": [
{
"url": "https://example.com/avatar-a.png",
"name": "avatar-a"
}
]
}
场景 3:单素材兼容写法
只提交一个素材时,可直接使用顶层url 和 name 字段。
{
"group_id": "group_xxx",
"url": "https://example.com/avatar.png",
"asset_type": "Image",
"name": "avatar-1"
}
查询审核结果
素材提交后为异步审核任务,使用 获取任务状态 接口查询:GET /v1/tasks/{id}
全部通过
{
"code": 200,
"data": {
"id": "task_01K...",
"status": "completed",
"progress": 100,
"result": {
"assets": [
{
"asset_id": "asset_a",
"asset_url": "asset://asset_a",
"status": "Active"
},
{
"asset_id": "asset_b",
"asset_url": "asset://asset_b",
"status": "Active"
}
],
"usable_assets": [
{
"asset_id": "asset_a",
"asset_url": "asset://asset_a",
"status": "Active"
},
{
"asset_id": "asset_b",
"asset_url": "asset://asset_b",
"status": "Active"
}
],
"failed_assets": []
}
}
}
部分失败
批量提交时,只要有一个素材审核失败,任务状态为failed。已通过的素材仍可用,出现在 result.usable_assets。
{
"code": 200,
"data": {
"id": "task_01K...",
"status": "failed",
"progress": 100,
"result": {
"assets": [
{
"asset_id": "asset_a",
"asset_url": "asset://asset_a",
"status": "Active"
},
{
"asset_id": "asset_b",
"asset_url": "asset://asset_b",
"status": "Failed"
}
],
"usable_assets": [
{
"asset_id": "asset_a",
"asset_url": "asset://asset_a",
"status": "Active"
}
],
"failed_assets": [
{
"asset_id": "asset_b",
"asset_url": "asset://asset_b",
"status": "Failed"
}
]
},
"error": {
"code": "task_failed",
"message": "部分素材审核失败"
}
}
}
result.usable_assets[].asset_url可直接用于 Seedance 2.0 视频生成result.failed_assets中的素材需更换源文件或重新提交- 单素材任务也会兼容返回
result.asset_url
审核后使用素材
审核通过后,将asset://... URL 直接传入 Seedance 2.0 视频生成 接口:
{
"model": "doubao-seedance-2.0",
"prompt": "让人物在城市街道自然行走",
"image_urls": ["asset://asset_a"],
"duration": 5,
"resolution": "720p"
}
服务端识别到
asset:// 前缀后,会直接提交官方生成任务,不会再次触发素材审核。⌘I