SuperAPI AI 工具集

nano-banana-2

设计与创作

查看项目

更新于 10-15 10:19

技能介绍

用途

nano-banana-2 是一个图像生成与编辑技能,名称对应 Google Gemini 3.1 Flash Image Preview(Nano Banana 2)模型,通过 inference.sh CLI(belt)在命令行中调用。它面向需要以脚本或命令行方式批量生成、编辑图片的用户,可用于文生图、图像编辑和多图输入等场景。

主要能力

  • 文生图:根据 prompt 生成图片。
  • 批量生成:通过 num_images 指定生成数量,例如一次生成 4 张。
  • 自定义画面比例:aspect_ratio 支持 "1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"auto"。
  • 图像编辑:通过 images 传入输入图片进行修改,最多 14 张,支持 JPEG、PNG、WebP 格式。
  • 高分辨率:resolution 可选 "1K"、"2K"、"4K",默认 1K。
  • Google 搜索接地:enable_google_search 为布尔值,可启用实时信息(天气、新闻等)作为生成依据。
  • 输出:images(生成或编辑后的图片数组)、description(模型的文字描述或回应)、output_meta(用于计价的输入输出元数据)。

使用方式

  1. 安装 belt CLI 技能:npx skills add belt-sh/cli
  2. 登录:belt login
  3. 运行应用:belt app run google/gemini-3-1-flash-image-preview --input '{"prompt": "a banana in space, photorealistic"}'

基础文生图示例:

belt app run google/gemini-3-1-flash-image-preview --input '{
  "prompt": "A futuristic cityscape at sunset with flying cars"
}'

多图生成示例:

belt app run google/gemini-3-1-flash-image-preview --input '{
  "prompt": "Minimalist logo design for a coffee shop",
  "num_images": 4
}'

自定义比例示例:

belt app run google/gemini-3-1-flash-image-preview --input '{
  "prompt": "Panoramic mountain landscape with northern lights",
  "aspect_ratio": "16:9"
}'

图像编辑示例:

belt app run google/gemini-3-1-flash-image-preview --input '{
  "prompt": "Add a rainbow in the sky",
  "images": ["https://example.com/landscape.jpg"]
}'

4K 生成示例:

belt app run google/gemini-3-1-flash-image-preview --input '{
  "prompt": "Detailed illustration of a medieval castle",
  "resolution": "4K"
}'

启用 Google 搜索接地示例:

belt app run google/gemini-3-1-flash-image-preview --input '{
  "prompt": "Current weather in Tokyo visualized as an artistic scene",
  "enable_google_search": true
}'

示例工作流:

# 1. Generate sample input to see all options
belt app sample google/gemini-3-1-flash-image-preview --save input.json

# 2. Edit the prompt
# 3. Run
belt app run google/gemini-3-1-flash-image-preview --input input.json

Python SDK 调用:

from inferencesh import inference

client = inference()

# Basic generation
result = client.run({
    "app": "google/gemini-3-1-flash-image-preview@0c7ma1ex",
    "input": {
        "prompt": "A banana in space, photorealistic"
    }
})
print(result["output"])

# Stream live updates
for update in client.run({
    "app": "google/gemini-3-1-flash-image-preview@0c7ma1ex",
    "input": {
        "prompt": "A futuristic cityscape at sunset"
    }
}, stream=True):
    if update.get("progress"):
        print(f"progress: {update['progress']}%")
    if update.get("output"):
        print(f"output: {update['output']}")

输入参数

参数 类型 说明
prompt string 必填。要生成或修改的内容
images array 用于编辑的输入图片(最多 14 张)。支持:JPEG、PNG、WebP
num_images integer 生成图片的数量
aspect_ratio string 输出比例:"1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"auto"
resolution string "1K"、"2K"、"4K"(默认:1K)
output_format string 图片的输出格式
enable_google_search boolean 启用实时信息接地(天气、新闻等)

适用场景

  • 快速产出多种视觉方案(如一次生成 4 个 Logo 草图)。
  • 需要特定画面比例(横幅、竖版、方形)的配图。
  • 对已有图片做局部或元素级修改。
  • 需要高分辨率(4K)成图的插画、场景图。
  • 结合实时信息(天气、新闻)的主题创作。
  • 在脚本或 Python 流程中集成图片生成与流式进度反馈。

提示词建议

  • 风格:photorealistic、illustration、watercolor、oil painting、digital art、anime、3D render。
  • 构图:close-up、wide shot、aerial view、macro、portrait、landscape。
  • 光照:natural light、studio lighting、golden hour、dramatic shadows、neon。
  • 细节:补充纹理、颜色、氛围与情绪等具体描述。

相关技能

# Original Nano Banana (Gemini 3 Pro Image, Gemini 2.5 Flash Image)
npx skills add inference-sh/skills@nano-banana

# Full platform skill (all apps)
npx skills add inference-sh/skills@infsh-cli

# All image generation models
npx skills add inference-sh/skills@ai-image-generation

浏览全部图像应用:belt app list --category image

限制与暂未提供

资料未说明该技能的计费方式、价格、免费额度、并发或速率限制、生成耗时、可用地区及账号要求等,相关细节暂未提供。输入图片最多 14 张、支持 JPEG/PNG/WebP,分辨率与比例选项以输入参数表为准。