圖片生成 API
利用來自 OpenAI、Google 和 ByteDance 的 14 種模型,將文字提示詞轉換為圖片。所有模型共用一組 API 金鑰與統一的請求格式,依圖片張數以點數計費。
模型
下方所有模型皆可在 POST /v1/images/generations 接收文字提示詞。價格為預設路由產生單張圖片的預估費用。
| 模型與 API 模型 ID | 選項 | official-cheap 價格(預設) |
|---|---|---|
GPT Image 2openai/gpt-image-2 | 尺寸:1K, 2K, 4K | 每張 1K 圖片 $0.032official:$0.053 |
GPT Image 2.5 Flareopenai/gpt-image-2.5-flare | 尺寸:1K, 2K | 每張 1K 圖片 $0.008official:$0.013 |
GPT Image 2.5 Sunburstopenai/gpt-image-2.5-sunburst | 尺寸:1K, 2K | 每張 1K 圖片 $0.008official:$0.013 |
Nano Bananagoogle/nano-banana | 單一標準尺寸 | 每張圖片 $0.019official:$0.039 |
Nano Banana 2google/nano-banana-2 | 尺寸:1K, 2K, 4K | 每張 1K 圖片 $0.034official:$0.067 |
Nano Banana 2 Litegoogle/nano-banana-2-lite | 單一標準尺寸 | 每張圖片 $0.017official:$0.034 |
Nano Banana 2.1google/nano-banana-2.1 | 尺寸:1K, 2K, 4K | 每張 1K 圖片 $0.017official:$0.034 |
Nano Banana Progoogle/nano-banana-pro | 尺寸:1K, 2K, 4K | 每張 1K 圖片 $0.067official:$0.134 |
Seedream 4.0bytedance/seedream-4.0 | 尺寸:1K, 2K, 4K | 每張圖片 $0.027official:$0.03 |
Seedream 4.5bytedance/seedream-4.5 | 尺寸:2K, 4K | 每張圖片 $0.036official:$0.04 |
Seedream 5.0bytedance/seedream-5.0 | 尺寸:2K, 4K | 每張圖片 $0.032official:$0.035 |
Seedream 5 Probytedance/seedream-5.0-pro | 尺寸:2K, 4K | 每張圖片 $0.081official:$0.09 |
Qwen Image 2.1 Proqwen/qwen-image-2.1-pro | 尺寸:1K, 2K | 每張圖片 $0.035official:$0.038 |
Qwen Image 2.1 Turboqwen/qwen-image-2.1-turbo | 尺寸:1K, 2K | 每張圖片 $0.014official:$0.015 |
快速入門
- 建立 API 金鑰
在主控台中建立金鑰,並將其儲存為 MLMUX_API_KEY 環境變數。
建立 API 金鑰 - 發送請求
範例會將 Nano Banana 2 (google/nano-banana-2) 發送至 https://api.mlmux.com/v1/images/generations。您可以將模型 ID 變更為上方表格中的任一模型。
- 讀取結果
回應會在 data 中列出圖片 URL。新增 "async": true 則可改為取得輪詢任務。
圖片 API 參考文件
curl https://api.mlmux.com/v1/images/generations \
-H "Authorization: Bearer $MLMUX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana-2",
"route_mode": "official-cheap",
"prompt": "A red fox in fresh snow at sunrise, cinematic light",
"resolution": "1K",
"aspect_ratio": "1:1",
"output_format": "jpg",
"n": 1
}'常見問題
圖片生成應該選擇哪款模型?
建議從 Nano Banana 2 開始進行通用圖片生成。GPT Image 和 Qwen Image 擅長處理圖片中的文字,Nano Banana Pro 適合精細的專業工作,而 Seedream 則以每張固定價格提供高解析度生成。GPT Image 2.5 Flare 是成本最低的選擇。
圖片生成 API 的費用是多少?
在預設的 official-cheap 路由下,價格約從每張圖片 $0.008 起(GPT Image 2.5 Flare)。GPT Image 和 Nano Banana 依圖片消耗的 token 計費,因此尺寸愈大費用愈高;Seedream 與 Qwen Image 則為每張圖片固定價格。
我會在同一個請求中收到圖片嗎?
是的。回應中會列出圖片的 URL。若為耗時較長或批次任務,可加上 "async": true 來取得任務並進行輪詢,或在完成時接收 webhook 通知。
失敗的請求會被計費嗎?是否有上限限制?
失敗的請求不會計費,預扣的點數將退回您的餘額。每個帳號最多可同時執行 60 個任務;如需提高上限,請寄信至 support@mlmux.com。