Nano Banana
nano-banana-1 與 nano-banana-2 使用 PopGo 圖片相容端點,支援文字生成與參考圖編輯。兩個模型的實際尺寸、比例、品質與數量仍以模型頁為準。
Endpoint 與欄位
POST https://api.popgo.site/v1/images/generations
POST https://api.popgo.site/v1/images/edits
Authorization: Bearer YOUR_API_KEY
| 欄位 | 類型 | 說明 |
|---|---|---|
model | string | 必填,nano-banana-1 或 nano-banana-2 |
prompt | string | 必填,生成或修改指令 |
size | string | 選填,使用模型支援的 WIDTHxHEIGHT 或 auto |
quality | string | 選填,模型頁未列出時不要傳 |
n | integer | 選填,回傳數量,預設 1 |
response_format | string | 選填,url 或 b64_json |
image / image[] | file | /edits 的參考圖片檔案 |
文生圖
curl https://api.popgo.site/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL","prompt":"A clean product catalog photo on a white background","size":"1024x1024","n":1}'
參考圖編輯
curl https://api.popgo.site/v1/images/edits \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=YOUR_MODEL" \
-F "image=@reference.png" \
-F "prompt=Keep the pose and clothing, and change the background to a bright studio"
多張檔案請重複 image[],並在提示詞中說明順序。只有 URL 時,先由客戶端下載成檔案再提交 multipart。
回應與排查
data[].url 是結果 URL;data[].b64_json 是不含 Data URL 前綴的 Base64 圖片內容。HTTP 400 時先檢查模型 ID、提示詞、multipart 欄位、檔案格式、數量與即時規格。不要直接複製其他模型的專用欄位。計費依模型與價格頁配置。