Runbase

Command Palette

Search for a command to run...

Gemini

Nano Banana 2.1

ID:google/nano-banana-2.1

Google 推出的 Nano Banana 2.1 圖像生成 API —— Gemini Flash 圖像模型的升級版,視覺設計、編輯與主體一致性全面提升,最高 4K,支援 14 張參考圖。

Nano Banana 2.1Gemini ImageGoogle圖像編輯4K

概覽

Google 推出的 Nano Banana 2.1 圖像生成 API —— Gemini Flash 圖像模型的升級版,視覺設計、編輯與主體一致性全面提升,最高 4K,支援 14 張參考圖。

驗證

所有 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-2.1",
    "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-2.1",
    "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:11:41:82:33:23:44:14:34:55:48:19:1616:921:9auto
resolutionstring選填Resolution選項: 1K2K4K
image_urlsstring[]選填Reference images

輸出結構

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

錯誤

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

狀態碼說明
400잘못된 요청 - 매개변수가 누락되었거나 형식이 올바르지 않습니다
401인증 실패 - API 키가 누락되었거나 유효하지 않습니다
402크레딧 부족
403접근 거부 - IP가 허용되지 않았거나, 계정이 차단되었거나, API 키 지출 한도 초과
404실행을 찾을 수 없습니다
429요청 속도 제한 초과
500내부 서버 오류