Runbase

Command Palette

Search for a command to run...

Gemini

Nano Banana

ID:google/nano-banana

Google 的 Nano Banana 圖片產生 API — 基於 Gemini 2.5 Flash 的平價模型,11 種比例,最多 10 張參考圖片。

文字轉圖片圖片編輯參考圖片

概覽

Google 的 Nano Banana 圖片產生 API — 基於 Gemini 2.5 Flash 的平價模型,11 種比例,最多 10 張參考圖片。

驗證

所有 API 請求都需要透過 Authorization 標頭以 Bearer 方式傳遞有效的 API 金鑰。

快速開始

憑證

設定 RUNBASE_API_KEY 環境變數。

Shell
export RUNBASE_API_KEY=your-api-key

建立執行

Shell
curl -s https://runbase.net/api/v1/runs \
  -H "Authorization: Bearer $RUNBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/nano-banana",
    "input": {
      "prompt": "A cinematic product photo of a ceramic lamp"
    }
  }'

執行紀錄

執行為非同步處理。提交請求後,輪詢取得結果。

建立執行

Shell
curl -s https://runbase.net/api/v1/runs \
  -H "Authorization: Bearer $RUNBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/nano-banana",
    "input": { "prompt": "A cinematic product photo of a ceramic lamp" }
  }'

取得執行狀態

Shell
curl -s https://runbase.net/api/v1/runs/RUN_ID \
  -H "Authorization: Bearer $RUNBASE_API_KEY"

取得結果

輪詢狀態端點,直到 status 為 "succeeded",然後從回應中讀取 output.urls。

輸入結構

參數類型必填說明
promptstring必填Prompt
aspect_ratiostring選填Aspect ratio選項: 1:12:33:23:44:34:55:49:1616:921:9auto
image_urlsstring[]選填Reference images

輸出結構

欄位類型說明
urlsstring[]產生的輸出 URL

錯誤

API 使用標準 HTTP 狀態碼表示成功或失敗。

狀態碼說明
400Request không hợp lệ - thiếu hoặc sai định dạng tham số
401Xác thực thất bại - thiếu hoặc sai khóa API
402Không đủ tín dụng
403Bị từ chối - IP không được phép hoặc khóa API vượt giới hạn chi tiêu
404Không tìm thấy lượt chạy
429Vượt giới hạn tốc độ
500Lỗi máy chủ nội bộ