Seedream 4.5 API
ByteDance Seedream 4.5 模型的完整 API 參考文件。
模型變體
此 API 支援兩個模型變體:
快速對比
支援的長寬比
兩個模型都支援 9 種長寬比:
21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21
Seedream 4.5(文字生成圖像)
端點
POST /api/v1/image/task
請求參數
必填參數
注意: width:height 比例必須是以下之一:"21:9", "9:21", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1:1"
請求示例
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'seedream-v4.5',
prompt: 'A magical girl in a fantasy forest, anime style',
width: 16,
height: 9,
resolution: '2k'
})
});
const { data } = await response.json();
const taskId = data.task_id;
const pollResponse = await fetch(
`https://api.flaq.ai/api/v1/image/${taskId}`,
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
}
);
const result = await pollResponse.json();
console.log(result.data.task_result.images[0].url);
Seedream 4.5 Edit(圖像編輯)
端點
POST /api/v1/image/task
請求參數
必填參數
可選參數
单圖像編輯示例
{
model_name: 'seedream-v4.5-edit',
image_url_list: ['https://example.com/photo.jpg'],
prompt: 'Convert to anime art style with vibrant colors',
width: 16,
height: 9,
resolution: '2k'
}
多圖像合成示例
{
model_name: 'seedream-v4.5-edit',
image_url_list: [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg'
],
prompt: 'Blend these images into a cohesive anime-style illustration',
width: 16,
height: 9,
resolution: '2k'
}
回應格式
初始回應
兩個模型都回傳用於輪詢的 task_id:
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "submitted",
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}"
},
"message": "success"
}
輪詢回應
輪詢 /api/v1/image/{taskId} 以檢查狀態:
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}",
"task_result": {
"credit": 0.0997,
"images": [
{
"url": "https://example.com/generated-image.jpeg"
}
]
}
},
"message": "success"
}
狀態值
submitted:任務已接受
processing:生成进行中
succeed:生成成功完成
failed:生成失敗
處理時間
Seedream 4.5 針對速度进行了最佳化:
- 文字生成圖像:约 10-30 秒
- 圖像編輯:约 15-40 秒
最佳實踐
- 动漫與插画专注:Seedream 擅長动漫、漫画和風格化艺术
- 快速迭代:较短的生成時間允许快速实验
- 多圖像編輯:可以组合最多 10 張圖像进行复杂合成
- 解析度選擇:2K 足以满足大多數用例,4K 用於最高品質
- 提示詞風格:包含艺术風格关键词(动漫、漫画、插画)以獲得最佳效果
使用案例示例
动漫角色生成
{
model_name: 'seedream-v4.5',
prompt: 'Anime girl with blue hair, magical powers, detailed eyes, studio lighting',
width: 9,
height: 16,
resolution: '2k'
}
風格迁移
{
model_name: 'seedream-v4.5-edit',
image_url_list: ['photo.jpg'],
prompt: 'Transform into vibrant anime art style with bold colors',
resolution: '2k'
}
多圖像拼贴
{
model_name: 'seedream-v4.5-edit',
image_url_list: ['img1.jpg', 'img2.jpg', 'img3.jpg'],
prompt: 'Create a manga-style panel layout with these images',
width: 16,
height: 9,
resolution: '2k'
}