跳转到主要内容
Nano Banana 是由 Google DeepMind 开发的 Google 最先进图片生成模型,支持图片生成与图片编辑。

模型参数

  • 模型ID:gemini-nano-banana
  • 模型价格:你可以在模型广场查看最新价格信息(Nano Banana 的价格不区分图片尺寸和质量,统一按每张图片计费)
  • 模型参数:参考画图 API 手册
  • API认证:获取 API KEY
不支持画图公共 API 中的以下参数:
  • negative_prompt
  • seed
  • strength
  • quality
  • size
  • style_preset
  • mask
  • watermark
  • background
Nano Banana 支持的 aspect_ratio 尺寸如下:
  • 1:1
  • 2:3
  • 3:2
  • 4:3
  • 3:4
  • 4:5
  • 5:4
  • 16:9
  • 9:16
  • 21:9

图片生成

通过文字描述来生成对应图像:
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"gemini-nano-banana",
    "prompt":"画一只可爱的小猫在草丛中玩耍",
    "aspect_ratio": "1:1"
}'

图片编辑

和 GPT-Image-1 一样,Nano Banana 也支持图片编辑接口,因此我们通过此接口可以实现图生图功能。 单图 通过传入图片+文本提示对指定图片进行编辑:
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "gemini-nano-banana",
    "prompt": "修复这张破损的照片",
    "image": "https://static.geekai.co/storage/2025/04/02/broken-picture.jpg"
}'
多图 多张图片可以通过字符串数组传递:
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "gemini-nano-banana",
    "prompt": "将图1中的面料应用至图2的服装上,图片比例按照图2来",
    "image": [
        "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/针织.jpg",
        "https://style3d-render.oss-cn-hangzhou.aliyuncs.com/test/款式图.jpg"
    ]
}'
I