# Seedream 5.0 Pro API ByteDance Seedream 5.0 Pro 模型的完整 API 參考。 ## 模型變體 此 API 支援兩種模型變體: | 模型 | ID | 說明 | |-------|-----|-------------| | **Seedream 5.0 Pro** | `seedream-v5.0-pro` | 高品質文字轉圖像生成 | | **Seedream 5.0 Pro Edit** | `seedream-v5.0-pro-edit` | 使用參考圖像進行圖片編輯 | ## 快速比較 | 功能 | Seedream 5.0 Pro | Seedream 5.0 Pro Edit | |---------|------------------|-----------------------| | 輸入 | 文字提示詞 | 圖像 + 文字提示詞 | | 長寬比 | 8 個選項 | 8 個選項 | | 解析度 | 1K, 2K | 1K, 2K | | 圖像輸入 | 否 | 必填(1–10 張圖像) | ### 支援的長寬比 `16:9`、`4:3`、`3:2`、`1:1`、`2:3`、`3:4`、`9:16`、`21:9` ## Seedream 5.0 Pro(文字轉圖像) ### 端點 ``` POST /api/v1/image/task ``` ### 請求參數 #### 必填參數 | 參數 | 類型 | 說明 | |-----------|------|-------------| | `model_name` | string | 必須為 `"seedream-v5.0-pro"` | | `prompt` | string | 圖像生成提示詞 | | `resolution` | string | 輸出解析度:`"1k"` 或 `"2k"` | | `width` | number | 寬度比例值(例如,16:9 中的 16) | | `height` | number | 高度比例值(例如,16:9 中的 9) | **注意:** 長寬比必須為以下值之一:`16:9`、`4:3`、`3:2`、`1:1`、`2:3`、`3:4`、`9:16`、`21:9` ### 請求範例 ```javascript 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-v5.0-pro', prompt: 'Editorial fashion portrait, soft window light, muted palette', resolution: '1k', width: 16, height: 9 }) }); const { data } = await response.json(); const taskId = data.task_id; // Poll for results 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 5.0 Pro Edit(圖片編輯) ### 端點 ``` POST /api/v1/image/task ``` ### 請求參數 #### 必填參數 | 參數 | 類型 | 說明 | |-----------|------|-------------| | `model_name` | string | 必須為 `"seedream-v5.0-pro-edit"` | | `prompt` | string | 所需編輯的說明 | | `image_url_list` | string[] | 要編輯的圖像 URL 陣列(1–10 張圖像) | | `resolution` | string | 輸出解析度:`"1k"` 或 `"2k"` | | `width` | number | 寬度比例值(例如,16:9 中的 16) | | `height` | number | 高度比例值(例如,16:9 中的 9) | **注意:** 長寬比必須為以下值之一:`16:9`、`4:3`、`3:2`、`1:1`、`2:3`、`3:4`、`9:16`、`21:9` **計費說明:** 從第二張參考圖像開始,每增加一張圖像都會依設定的固定單圖費率計費。 ### 請求範例 ```javascript 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-v5.0-pro-edit', prompt: 'Change the hairstyle', image_url_list: [ 'https://img.bestimage.ai/test/2026/7/1/ad8e011a-3e9b-49f0-9397-282bf51e2e45_162640331.jpeg' ], resolution: '1k', width: 16, height: 9 }) }); const { data } = await response.json(); const taskId = data.task_id; // Poll for results 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); ``` ### 單圖編輯範例 ```javascript { model_name: 'seedream-v5.0-pro-edit', image_url_list: ['https://img.bestimage.ai/test/2026/7/1/ad8e011a-3e9b-49f0-9397-282bf51e2e45_162640331.jpeg'], prompt: 'Change the hairstyle', resolution: '1k', width: 16, height: 9 } ``` ### 多圖編輯範例 ```javascript { model_name: 'seedream-v5.0-pro-edit', image_url_list: [ 'https://example.com/image1.jpg', 'https://example.com/image2.jpg' ], prompt: 'Blend these images into a cohesive composition', resolution: '1k', width: 16, height: 9 } ``` ## 回應格式 ### 初始回應 ```json { "code": 0, "message": "success", "data": { "task_id": "0ca5f379-327b-4d49-ba19-e38782ceb2f0", "response_url": "https://api.flaq.ai/api/v1/image/0ca5f379-327b-4d49-ba19-e38782ceb2f0", "task_status": "submitted" } } ``` ### 輪詢回應 輪詢 `GET /api/v1/image/{task_id}` 以檢查狀態: ```json { "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.09, "images": [ { "url": "https://example.com/generated-image.jpeg" } ] } }, "message": "success" } ``` ### 錯誤回應 ```json { "code": 1201, "message": "[width, height] Invalid parameter (e.g. wrong key or value)", "data": null } ``` ### 狀態值 - `submitted`:任務已接受 - `processing`:圖像生成進行中 - `succeed`:圖像生成已完成 - `failed`:圖像生成失敗 ## 處理時間 典型處理時間:15–60 秒,具體取決於複雜程度。 ## 最佳實務 1. **詳細提示詞**:說明越詳細,生成結果越好 2. **長寬比**:生成前,請依目標使用情境選擇符合的比例 3. **圖片編輯品質**:進行編輯時,請使用高解析度、光線充足的來源圖像