Nano Banana 2 - Gemini 3.1 Flash Image Preview
Generate images with Google Gemini 3.1 Flash Image Preview via inference.sh CLI.
Quick Start
CODEBLOCK0
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.
Examples
Basic Text-to-Image
CODEBLOCK1
Multiple Images
CODEBLOCK2
Custom Aspect Ratio
CODEBLOCK3
Image Editing (with input images)
CODEBLOCK4
High Resolution (4K)
CODEBLOCK5
With Google Search Grounding
CODEBLOCK6
Input Options
| Parameter | Type | Description |
|---|
| INLINECODE1 | string | Required. What to generate or change |
| INLINECODE2 |
array | Input images for editing (up to 14). Supported: JPEG, PNG, WebP |
|
num_images | integer | Number of images to generate |
|
aspect_ratio | string | Output ratio: "1:1", "16:9", "9:16", "4:3", "3:4", "auto" |
|
resolution | string | "1K", "2K", "4K" (default: 1K) |
|
output_format | string | Output format for images |
|
enable_google_search | boolean | Enable real-time info grounding (weather, news, etc.) |
Output
| Field | Type | Description |
|---|
| INLINECODE8 | array | The generated or edited images |
| INLINECODE9 |
string | Text description or response from the model |
|
output_meta | object | Metadata about inputs/outputs for pricing |
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
Sample Workflow
CODEBLOCK7
Python SDK
CODEBLOCK8
Related Skills
CODEBLOCK9
Browse all image apps: INLINECODE11
Documentation
技能名称: nano-banana-2
详细描述:
Nano Banana 2 - Gemini 3.1 Flash 图像预览
通过 inference.sh CLI 使用 Google Gemini 3.1 Flash 图像预览生成图像。
快速开始
bash
curl -fsSL https://cli.inference.sh | sh && infsh login
infsh app run google/gemini-3-1-flash-image-preview --input {prompt: 太空中的香蕉,照片级真实感}
安装说明: 安装脚本 仅检测您的操作系统/架构,从 dist.inference.sh 下载匹配的二进制文件,并验证其 SHA-256 校验和。无需提升权限或后台进程。提供手动安装与验证。
示例
基础文生图
bash
infsh app run google/gemini-3-1-flash-image-preview --input {
prompt: 日落时分拥有飞行汽车的未来城市景观
}
多图生成
bash
infsh app run google/gemini-3-1-flash-image-preview --input {
prompt: 咖啡店的极简标志设计,
num_images: 4
}
自定义宽高比
bash
infsh app run google/gemini-3-1-flash-image-preview --input {
prompt: 带有北极光的全景山脉景观,
aspect_ratio: 16:9
}
图像编辑(带输入图像)
bash
infsh app run google/gemini-3-1-flash-image-preview --input {
prompt: 在天空中增加一道彩虹,
images: [https://example.com/landscape.jpg]
}
高分辨率(4K)
bash
infsh app run google/gemini-3-1-flash-image-preview --input {
prompt: 中世纪城堡的精细插图,
resolution: 4K
}
使用 Google 搜索接地
bash
infsh app run google/gemini-3-1-flash-image-preview --input {
prompt: 将东京当前天气可视化为艺术场景,
enablegooglesearch: true
}
输入选项
| 参数 | 类型 | 描述 |
|---|
| prompt | 字符串 | 必填。 要生成或更改的内容 |
| images |
数组 | 用于编辑的输入图像(最多 14 张)。支持:JPEG、PNG、WebP |
| num_images | 整数 | 要生成的图像数量 |
| aspect_ratio | 字符串 | 输出比例:1:1、16:9、9:16、4:3、3:4、auto |
| resolution | 字符串 | 1K、2K、4K(默认:1K) |
| output_format | 字符串 | 图像的输出格式 |
| enable
googlesearch | 布尔值 | 启用实时信息接地(天气、新闻等) |
输出
| 字段 | 类型 | 描述 |
|---|
| images | 数组 | 生成或编辑的图像 |
| description |
字符串 | 模型的文本描述或响应 |
| output_meta | 对象 | 关于输入/输出的元数据,用于定价 |
提示技巧
风格:照片级真实感、插图、水彩、油画、数字艺术、动漫、3D 渲染
构图:特写、广角、鸟瞰、微距、人像、风景
光照:自然光、影棚光、黄金时刻、戏剧性阴影、霓虹灯
细节:添加关于纹理、颜色、情绪、氛围的具体细节
示例工作流
bash
1. 生成示例输入以查看所有选项
infsh app sample google/gemini-3-1-flash-image-preview --save input.json
2. 编辑提示词
3. 运行
infsh app run google/gemini-3-1-flash-image-preview --input input.json
Python SDK
python
from inferencesh import inference
client = inference()
基础生成
result = client.run({
app: google/gemini-3-1-flash-image-preview@0c7ma1ex,
input: {
prompt: 太空中的香蕉,照片级真实感
}
})
print(result[output])
流式实时更新
for update in client.run({
app: google/gemini-3-1-flash-image-preview@0c7ma1ex,
input: {
prompt: 日落时分的未来城市景观
}
}, stream=True):
if update.get(progress):
print(f进度:{update[progress]}%)
if update.get(output):
print(f输出:{update[output]})
相关技能
bash
原始 Nano Banana(Gemini 3 Pro 图像,Gemini 2.5 Flash 图像)
npx skills add inference-sh/skills@nano-banana
完整平台技能(所有 150+ 应用)
npx skills add inference-sh/skills@inference-sh
所有图像生成模型
npx skills add inference-sh/skills@ai-image-generation
浏览所有图像应用:infsh app list --category image
文档