Seedream 4.5 API
Tài liệu API đầy đủ cho các mô hình Seedream 4.5 của ByteDance.
Các Biến Thể Mô Hình
API này hỗ trợ hai biến thể mô hình:
So Sánh Nhanh
Tỷ Lệ Khung Hình Được Hỗ Trợ
Cả hai mô hình đều hỗ trợ 9 tỷ lệ khung hình:
21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21
Seedream 4.5 (Văn Bản Sang Ảnh)
Endpoint
POST /api/v1/image/task
Tham Số Yêu Cầu
Bắt Buộc
Lưu ý: Tỷ lệ width:height phải là một trong các giá trị: "21:9", "9:21", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1:1"
Ví Dụ Yêu Cầu
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 (Chỉnh Sửa Ảnh)
Endpoint
POST /api/v1/image/task
Tham Số Yêu Cầu
Bắt Buộc
Tùy Chọn
Ví Dụ Chỉnh Sửa Một Ảnh
{
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'
}
Ví Dụ Kết Hợp Nhiều Ảnh
{
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'
}
Định Dạng Phản Hồi
Phản Hồi Ban Đầu
Cả hai mô hình đều trả về task_id để theo dõi:
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "submitted",
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}"
},
"message": "success"
}
Phản Hồi Khi Theo Dõi
Gọi /api/v1/image/{taskId} để kiểm tra trạng thái:
{
"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"
}
Các Giá Trị Trạng Thái
submitted: Tác vụ đã được chấp nhận
processing: Đang tạo ảnh
succeed: Tạo ảnh thành công
failed: Tạo ảnh thất bại
Thời Gian Xử Lý
Seedream 4.5 được tối ưu hóa cho tốc độ:
- Văn Bản Sang Ảnh: ~10-30 giây
- Chỉnh Sửa Ảnh: ~15-40 giây
Các Phương Pháp Tốt Nhất
- Tập Trung Vào Anime & Minh Họa: Seedream xuất sắc trong anime, manga và nghệ thuật có phong cách
- Lặp Lại Nhanh: Thời gian tạo ngắn cho phép thử nghiệm nhanh chóng
- Chỉnh Sửa Nhiều Ảnh: Có thể kết hợp tới 10 ảnh cho các cấu trúc phức tạp
- Chọn Độ Phân Giải: 2K đủ cho hầu hết các trường hợp, 4K cho chất lượng cao nhất
- Phong Cách Prompt: Thêm từ khóa phong cách nghệ thuật (anime, manga, illustration) để có kết quả tốt nhất
Ví Dụ Trường Hợp Sử Dụng
Tạo Nhân Vật Anime
{
model_name: 'seedream-v4.5',
prompt: 'Anime girl with blue hair, magical powers, detailed eyes, studio lighting',
width: 9,
height: 16,
resolution: '2k'
}
Chuyển Đổi Phong Cách
{
model_name: 'seedream-v4.5-edit',
image_url_list: ['photo.jpg'],
prompt: 'Transform into vibrant anime art style with bold colors',
resolution: '2k'
}
Ghép Nhiều Ảnh
{
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'
}