nano-banana-2

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nano Banana 2 - Gemini 3.1 Flash Image Preview

Nano Banana 2 - Gemini 3.1 Flash Image Preview

Generate images with Google Gemini 3.1 Flash Image Preview via inference.sh CLI.
通过inference.sh CLI使用Google Gemini 3.1 Flash Image Preview生成图片。

Quick Start

快速开始

bash
curl -fsSL https://cli.inference.sh | sh && infsh login

infsh app run google/gemini-3-1-flash-image-preview --input '{"prompt": "a banana in space, photorealistic"}'
Install note: The install script only detects your OS/architecture, downloads the matching binary from
dist.inference.sh
, and verifies its SHA-256 checksum. No elevated permissions or background processes. Manual install & verification available.
bash
curl -fsSL https://cli.inference.sh | sh && infsh login

infsh app run google/gemini-3-1-flash-image-preview --input '{"prompt": "a banana in space, photorealistic"}'
安装说明: 安装脚本仅会检测您的操作系统/架构,从
dist.inference.sh
下载匹配的二进制文件,并验证其SHA-256校验和。无需提升权限或后台进程。提供手动安装与验证选项。

Examples

示例

Basic Text-to-Image

基础文本转图片

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

Multiple Images

生成多张图片

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

Custom Aspect Ratio

自定义宽高比

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

Image Editing (with input images)

图片编辑(含输入图片)

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

High Resolution (4K)

高分辨率(4K)

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

With Google Search Grounding

结合Google搜索 Grounding

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

Input Options

输入选项

ParameterTypeDescription
prompt
stringRequired. What to generate or change
images
arrayInput images for editing (up to 14). Supported: JPEG, PNG, WebP
num_images
integerNumber of images to generate
aspect_ratio
stringOutput ratio: "1:1", "16:9", "9:16", "4:3", "3:4", "auto"
resolution
string"1K", "2K", "4K" (default: 1K)
output_format
stringOutput format for images
enable_google_search
booleanEnable real-time info grounding (weather, news, etc.)
参数类型说明
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启用实时信息 grounding(如天气、新闻等)

Output

输出

FieldTypeDescription
images
arrayThe generated or edited images
description
stringText description or response from the model
output_meta
objectMetadata about inputs/outputs for pricing
字段类型说明
images
array生成或编辑后的图片
description
string模型返回的文本描述或响应
output_meta
object用于计费的输入/输出元数据

Prompt Tips

提示词技巧

Styles: photorealistic, illustration, watercolor, oil painting, digital art, anime, 3D render
Composition: close-up, wide shot, aerial view, macro, portrait, landscape
Lighting: natural light, studio lighting, golden hour, dramatic shadows, neon
Details: add specific details about textures, colors, mood, atmosphere
风格:写实风、插画、水彩画、油画、数字艺术、动漫、3D渲染
构图:特写、广角镜头、航拍、微距、人像、风景
光线:自然光、影棚灯光、黄金时刻、戏剧性阴影、霓虹光
细节:添加关于纹理、颜色、情绪、氛围的具体细节

Sample Workflow

示例工作流

bash
undefined
bash
undefined

1. Generate sample input to see all options

1. 生成示例输入以查看所有选项

infsh app sample google/gemini-3-1-flash-image-preview --save input.json
infsh app sample google/gemini-3-1-flash-image-preview --save input.json

2. Edit the prompt

2. 编辑提示词

3. Run

3. 运行

infsh app run google/gemini-3-1-flash-image-preview --input input.json
undefined
infsh app run google/gemini-3-1-flash-image-preview --input input.json
undefined

Python SDK

Python SDK

python
from inferencesh import inference

client = inference()
python
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"])
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']}")
undefined
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']}")
undefined

Related Skills

相关技能

bash
undefined
bash
undefined

Original Nano Banana (Gemini 3 Pro Image, Gemini 2.5 Flash Image)

原版Nano Banana(Gemini 3 Pro Image、Gemini 2.5 Flash Image)

npx skills add inference-sh/skills@nano-banana
npx skills add inference-sh/skills@nano-banana

Full platform skill (all 150+ apps)

全平台技能(包含150+应用)

npx skills add inference-sh/skills@inference-sh
npx skills add inference-sh/skills@inference-sh

All image generation models

所有图片生成模型

npx skills add inference-sh/skills@ai-image-generation

Browse all image apps: `infsh app list --category image`
npx skills add inference-sh/skills@ai-image-generation

浏览所有图片类应用:`infsh app list --category image`

Documentation

文档