跳到主要内容

模型指南

Nano Banana 2

gemini-3.1-flash-image

均衡

一条适合日常生图和图片编辑的均衡路线,当前工作台开放多种输出尺寸与画面比例。

0.5K 至 4K图片编辑高吞吐
路线凭条
模型 ID
gemini-3.1-flash-image
配置估价
$0.055/ 次
输出尺寸
512 · 1K · 2K · 4K
API 类型
Gemini native

提示词预设

这些控制项直接读取 YingTu 模型注册表。

商品摄影

浅色石材桌面上的哑光陶瓷咖啡杯商品图,柔和窗光,自然阴影,极简陈列,保留真实材质细节。

旅行编辑图

日出时分的高山湖泊旅行编辑摄影,层次分明的空气透视,自然色彩,精细细节。

参考图编辑

保留主体与构图,把背景替换为安静的现代摄影棚,使用柔和的定向日光。

实际路线配置

本页数值与图片工作台读取同一份模型配置。

适合

  • 日常图片生成
  • 参考图编辑
  • 测试多种输出尺寸

使用前检查

  • 页面所列速度是估计值,不是交付承诺。
  • 编辑效果取决于参考图与指令质量。
  • 使用前应检查文字、标志、手部和小细节。
图片编辑: 支持

API 快速开始

示例由现有工作台使用的同一代码生成器产生。

查看 API 页面
gemini-3.1-flash-image
import requests
import base64

# Configuration
API_KEY = "sk-YOUR_API_KEY"  # Replace with your API Key
API_URL = "https://api2.laozhang.ai/v1beta/models/gemini-3.1-flash-image:generateContent"

# Request headers
headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Build request payload
payload = {
    "contents": [{
        "parts": [{"text": "浅色石材桌面上的哑光陶瓷咖啡杯商品图,柔和窗光,自然阴影,极简陈列,保留真实材质细节。"}]
    }],
    "generationConfig": {
        "responseModalities": ["IMAGE"],
        "imageConfig": {
            "imageSize": "2K"
        }
    }
}

# Send request
print("Generating image...")
response = requests.post(API_URL, headers=headers, json=payload, timeout=180)

if response.status_code != 200:
    print(f"Error: {response.status_code} - {response.text}")
    exit(1)

# Extract and save image
result = response.json()

image_part = None
for candidate in result.get("candidates", []):
    for part in candidate.get("content", {}).get("parts", []):
        inline_data = part.get("inlineData") or part.get("inline_data")
        if inline_data and inline_data.get("data"):
            image_part = inline_data
            break
    if image_part:
        break

if not image_part:
    print("No image data in response")
    print(result)
    exit(1)

mime_type = image_part.get("mimeType") or image_part.get("mime_type") or "image/png"
extension = "jpg" if mime_type == "image/jpeg" else "webp" if mime_type == "image/webp" else "png"
output_path = f"output.{extension}"

with open(output_path, "wb") as f:
    image_data = image_part["data"]
    f.write(base64.b64decode(image_data))

print(f"✅ Image saved: {output_path}")

既有工作台图库

这些旧图库图片没有模型或提示词来源记录,只作视觉示例,不能证明本页路线的效果。

未归属模型的工作台示例
未归属模型的工作台示例
未归属模型的工作台示例