Nano Banana 2.1 Ext

Google圖片生成按請求檔位定價較官方價省 12%

Nano Banana 2.1 Ext asynchronous image generation and editing: one image per request at a fixed price per resolution (1K/2K/4K), same output quality as Nano Banana 2.1, up to 14 reference images. 1:4, 4:1, 1:8 and 8:1 are available only at 1K.

價格

$0.022/ 次

端點

/images/tasks

交付模式

非同步任務生命週期

可用狀態

目前可用

API 文件

設定並複製請求

選擇這個模型支援的選項,下面的程式碼會即時更新。

在文件裡一步步看
POSThttps://www.aisplice.store/v1/images/tasksBearer API key非同步任務

選項這裡只顯示目前模型已公開支援的選項。

# Requires curl and jq
API_KEY="${API_KEY:-YOUR_API_KEY}"

# 1. Submit once
SUBMITTED=$(curl --fail-with-body -sS https://www.aisplice.store/v1/images/tasks \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: model-docs-$(date +%s)-$$" \\
  -d '{
  "model": "Nano Banana 2.1 Ext",
  "prompt": "A cinematic scene with careful composition",
  "size": "auto",
  "resolution": "1K",
  "n": 1
}')
TASK_ID=$(printf '%s' "$SUBMITTED" | jq -r '.task_id // .id // empty')
if [ -z "$TASK_ID" ]; then
  printf '%s\n' "$SUBMITTED" >&2
  exit 1
fi
echo "task_id=$TASK_ID"

# 2. Poll until terminal
while true; do
  STATUS_JSON=$(curl --fail-with-body -sS \
    "https://www.aisplice.store/v1/images/tasks/$TASK_ID" \
    -H "Authorization: Bearer $API_KEY")
  STATUS=$(printf '%s' "$STATUS_JSON" | jq -r '.status // empty' | tr '[:upper:]' '[:lower:]')
  echo "status=$STATUS"
  case "$STATUS" in
    completed|succeeded|success) break ;;
    failed|failure|cancelled|canceled)
      printf '%s\n' "$STATUS_JSON" | jq .
      exit 1
      ;;
  esac
  sleep 3
done

# 3. Fetch the final result
curl --fail-with-body -sS \
  "https://www.aisplice.store/v1/images/tasks/$TASK_ID/content" \
  -H "Authorization: Bearer $API_KEY" | jq .
  1. 1提交任務
  2. 2輪詢狀態
  3. 3取得結果內容

正式環境建議使用公開媒體網址。 先上傳本機檔案,再把 public_url 放入模型請求;避免傳送大體積 Base64 請求主體。

檢視上傳指南

參數說明

model
string必填

本次請求使用的精確模型識別碼。

gemini-nano-banana-2.1-ext
prompt
string必填

描述期望結果的指令。

size
string選填

Output aspect ratio. 1:4, 4:1, 1:8 and 8:1 require 1K. auto follows the reference image when one is given.

auto1:12:33:23:44:34:55:49:1616:921:91:44:11:88:1
resolution
string選填

請求的輸出解析度。

1K2K4K
n
integer選填
1
images
string[]選填

Optional reference images (URLs or data URIs), up to 14, 20 MB each and 50 MB in total.

回應流程

檢視任務狀態、終態和結果回應範例。

提交
{
  "id": "task_xxx",
  "task_id": "task_xxx",
  "object": "image.task",
  "model": "Nano Banana 2.1 Ext",
  "status": "queued"
}
結果內容
{
  "created": 1720000000,
  "data": [
    {
      "url": "https://media.example/result.png"
    }
  ]
}

等待中

queued · submitted · in_progress · processing

成功

completed · succeeded · success

失敗

failed · failure · cancelled · canceled

錯誤與正式環境設定

檢視重試規則、冪等要求和最基本的正式環境檢查清單。

400 / 422

修正請求欄位或不支援的選項,不要原樣重試。

401

檢查 API 金鑰是否存在、有效,並已以 Bearer Token 傳送。

402

帳戶餘額不足。

409

Idempotency-Key 正在處理中,或已被其他請求主體使用。

429

按照 Retry-After 退避後再重試。

5xx

使用指數退避重試,並保留原始 Idempotency-Key。

  • 面向公眾的行動裝置和瀏覽器應用程式應把 API 金鑰存放在伺服器端。
  • 為每個會計費的非同步操作設定唯一 Idempotency-Key。
  • 持久儲存 task_id,以便重啟後恢復輪詢。
  • 為每個 HTTP 請求設定逾時,並在客服工單中提供請求 ID。
  • 讀取即時模型後設資料,不要把價格和支援選項寫死在程式碼裡。

價格與檔位

較官方價省 12%

按請求計價

$0.022/ 次

$0.025

檔位定價

基準價 $0.022

檔位定價——最終價格取決於請求的參數選項,未列出的檔位按基準價計費。

尺寸價格
  • 16:9×1$0.022
  • 1:1×1$0.022
  • 1:4×1$0.022
  • 1:8×1$0.022
  • 21:9×1$0.022
  • 2:3×1$0.022
  • 3:2×1$0.022
  • 3:4×1$0.022
  • 4:1×1$0.022
  • 4:3×1$0.022
  • 4:5×1$0.022
  • 5:4×1$0.022
  • 8:1×1$0.022
  • 9:16×1$0.022
  • auto×1$0.022
解析度價格
  • 1k×1$0.022
  • 2k×1.25$0.0275
  • 4k×1.5$0.033

頁面顯示的價格即實際計費價格,呼叫失敗會自動退款。

相關模型