Nano Banana 图片模型

本页说明 Nano Banana 系列每个模型 ID 的调用方式和计费。通用协议见 图片生成 API。

模型 ID 接口 每次最多张数 单价(按分辨率)
nano-banana-2.0 POST /v1/images/generations 1 1080p $0.0707 / 2K $0.1188 / 4K $0.1654 每张
nano-banana-pro POST /v1/images/generations 1 1080p $0.1414 / 2K $0.1414 / 4K $0.2586 每张

单价以控制台模型详情页为准。

调用方式

  • 请求是同步的:网关等待图片生成完成后一次性返回,单次最长等待 10 分钟,超时返回 504 upstream_timeout。
  • 返回的图片只有 b64_json(PNG 的 Base64),不返回 url;response_format 不传或传 b64_json,其它值返回 400。
  • 输出尺寸由比例 + 分辨率档位决定。可以直接传 aspect_ratio 与 resolution,也可以传 OpenAI 风格的 size(宽x高),网关按短边换算档位:短边 1080 → 1080p,1440 → 2K,2160 → 4K,其它短边返回 400;size 的宽高比必须是模型支持的比例。两种写法同时传时必须一致。
  • 参考图通过 image(单个 URL 或数组)或 images(数组)传入,只接受公网可访问的 HTTP(S) 图片 URL,不接受 Base64。
  • 每次只生成 1 张(n 只能是 1)。不支持 quality、stream,不提供 /v1/images/edits。

请求参数

每个模型 ID 一张完整参数表。在页面顶部「选择模型 ID」,就只显示该模型的参数。

nano-banana-2.0

参数 类型 必填 默认值 取值范围 说明
model string 是 — nano-banana-2.0 模型 ID
prompt string 是 — 1~2000 字符 图片描述,不能为空
n integer 否 1 只能 1 每次只生成 1 张
aspect_ratio string 否 1:1 1:1 / 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 输出画面比例,不影响价格
resolution string 否 1080p 1080p / 2k / 4k(也接受 1440p / 2160p) 分辨率档位,决定单价
size string 否 — 宽x高,短边 1080 / 1440 / 2160 代替 aspect_ratio + resolution 的写法,如 1920x1080 = 16:9 + 1080p。不能是 auto
image / images string / string[] 否 — 最多 14 个 HTTP(S) 图片 URL 参考图,省略时为文生图。不影响价格
response_format string 否 b64_json 只能 b64_json 返回 Base64 图片
stream boolean 否 false 只能 false 不支持流式,传 true 返回 400

nano-banana-pro

参数 类型 必填 默认值 取值范围 说明
model string 是 — nano-banana-pro 模型 ID
prompt string 是 — 1~2000 字符 图片描述,不能为空
n integer 否 1 只能 1 每次只生成 1 张
aspect_ratio string 否 1:1 1:1 / 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 输出画面比例,不影响价格
resolution string 否 1080p 1080p / 2k / 4k(也接受 1440p / 2160p) 分辨率档位,决定单价(1080p 与 2K 同价)
size string 否 — 宽x高,短边 1080 / 1440 / 2160 代替 aspect_ratio + resolution 的写法,如 1920x1080 = 16:9 + 1080p。不能是 auto
image / images string / string[] 否 — 最多 14 个 HTTP(S) 图片 URL 参考图,省略时为文生图。不影响价格
response_format string 否 b64_json 只能 b64_json 返回 Base64 图片
stream boolean 否 false 只能 false 不支持流式,传 true 返回 400

计费

  • 按张计费,单价只看 resolution 档位(传 size 时按短边换算的档位),与比例、参考图张数无关。
  • 提交时冻结该档位的每张单价,完成后按实际返回的张数结算(这两个模型每次 1 张)。
  • 生成失败或超时不计费。

例:nano-banana-2.0 用 "aspect_ratio": "16:9", "resolution": "4k" 生成 1 张,收 $0.1654。

示例

curl https://api.admesh.ai/v1/images/generations \
  -H "Authorization: Bearer $ADMESH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-pro",
    "prompt": "A watercolor lighthouse on a cliff at dawn",
    "aspect_ratio": "16:9",
    "resolution": "2k",
    "images": ["https://example.com/reference.jpg"]
  }'

返回:

{
  "created": 1762650000,
  "data": [
    { "b64_json": "iVBORw0KGgo…" }
  ]
}