Nano Banana 2.1 跑在 Gemini 3.6 Flash 上:先读模型卡,再谈兴奋

·阅读约9分钟·Evergreen Tools Team

Nano Banana 2.1 在十月初出现在 Google 的模型文档里,几乎没有任何发布会式的排场,其模型卡于 2026 年 10 月 6 日发布。它是 Gemini 3 系列成员,基于 Gemini 3.6 Flash 构建。它接受文本与图片作为输入,token 上下文窗口最高 100 万;输出为图片(4K token 预算)以及最高 64K token 的文本。图片与文本输出在同一次响应中生成。这份清单值得读两遍,因为很多产品决策就藏在里面。

抽象 AI 视觉

模型卡是规格说明,不是营销文案

模型卡到底说了什么

Nano Banana 2.1 被描述为一个原生多模态推理模型:能理解来自文本与图片的输入,并在响应中生成图片与文本输出。它基于 Gemini 3.6 Flash——这是整份文档里最有用的一行,因为它直接告诉你这个模型在家族里处于什么位置,而不是让你从一个产品名去猜。输入为文本字符串与图片,上下文窗口最高 100 万 token。输出为一张图片(4K token 输出预算)以及文本(64K token 预算)。模型卡可能随时间更新以纳入新的评测,所以发布日期应当被视为规格的一部分。

# The model card is a spec. Encode it, then assert against it in CI
# so nobody discovers a limit in production.
import json

SPEC = {
    'model_family':   'Gemini 3 series',
    'based_on':       'Gemini 3.6 Flash',
    'inputs':         ['text', 'image'],
    'input_context_tokens': 1_000_000,   # up to 1M
    'image_output_tokens':  4_000,
    'text_output_tokens':   64_000,
    'published':      '2026-10-06',
}

def preflight(prompt_tokens, images, want_text):
    assert prompt_tokens <= SPEC['input_context_tokens'], 'prompt exceeds 1M context'
    assert images, 'this is a text-and-image model; send an image'
    assert want_text <= SPEC['text_output_tokens'], 'text output cap is 64K'
    return True

模型卡为什么比发布文章更值得读

发布文章告诉你模型在 demo 里能做什么;模型卡告诉你它「打算用于什么」、局限在哪里、如何被评测、有哪些内容安全缓解措施。后面那几节才是决定它是否适合你产品的内容,也恰恰是没人读的部分。一个实用的习惯是:把模型卡变成代码里的断言。如果卡片写着输入最高 100 万 token、图片输出 4K token,那么一个拒绝超大请求的预检,就是把卡片变成可执行的东西。当卡片被修订时,挂掉的断言会告诉你:你的哪一个假设变了。

# Benchmark image models on YOUR prompts. A generic leaderboard tells
# you nothing about whether your product looks right.
import hashlib, json, pathlib

def build_eval(prompt_dir, out='eval_set.jsonl'):
    rows = []
    for p in sorted(pathlib.Path(prompt_dir).glob('*.txt')):
        text = p.read_text(encoding='utf-8').strip()
        rows.append({'id': hashlib.sha1(text.encode()).hexdigest()[:12],
                     'prompt': text,
                     'source': p.name,
                     'must_hold': _constraints(text)})
    pathlib.Path(out).write_text(
        '\n'.join(json.dumps(r, ensure_ascii=False) for r in rows), encoding='utf-8')
    return rows

def _constraints(text):
    # what a human would check, written down so a machine can check it too
    return {'aspect_ratio': '16:9', 'no_extra_limbs': True, 'brand_text_exact': True}
数据可视化屏幕

先建评测集,再建流水线

基于 Gemini 3.6 Flash 意味着什么

图片模型很少是独立系统。它们通常是一个生成组件,挂在一个负责理解提示词、规划构图、判断结果够不够好的语言模型上。当卡片写明 Nano Banana 2.1 基于 Gemini 3.6 Flash,它其实是在告诉你像素底下坐的是什么类型的推理。这会影响到提示词写法、对延迟的预期,以及你应该假设它有多强的指令遵循能力、又需要验证多少。这也意味着你的评测应该把推理行为一起测,而不只是看那张图。

# Generation cost is dominated by repeats. Cache by a hash of the
# full request so a retry does not buy the same picture twice.
import hashlib, pathlib, json

CACHE = pathlib.Path('gen-cache'); CACHE.mkdir(exist_ok=True)

def cache_key(prompt, image_sha, params):
    blob = json.dumps({'p': prompt, 'i': image_sha, 'params': params},
                      sort_keys=True, ensure_ascii=False)
    return hashlib.sha256(blob.encode()).hexdigest()[:32]

def get_or_generate(key, generate):
    hit = CACHE / f'{key}.json'
    if hit.exists():
        return json.loads(hit.read_text(encoding='utf-8'))['asset'], True
    asset = generate()
    hit.write_text(json.dumps({'asset': asset}), encoding='utf-8')
    return asset, False

定价不在模型卡里

模型卡覆盖的是能力与安全,不是计费,值得对这个区分保持纪律。媒体报道了这一代模型有显著降价,但「被报道的数字」不是合同。把数字写进预算之前,请在 Google 的定价文档上确认当前费率;把模型标识与参数名写进代码之前,请在开发文档里确认它们。真正重要的成本是「每个完成资产的成本」而不是每个 token:会重试的生成流水线,就是图片预算悄悄翻倍的地方。

# Log what a generation actually cost, per asset, from day one.
# You cannot optimise a line item you never recorded.
import json, time, pathlib

LOG = pathlib.Path('gen-usage.jsonl')

def record(asset_id, input_tokens, image_tokens, text_tokens,
           price_in, price_img, price_text, latency_ms, attempt):
    row = {
        'ts': time.strftime('%Y-%m-%dT%H:%M:%S%z'),
        'asset': asset_id, 'attempt': attempt,
        'input_tokens': input_tokens,
        'cost_usd': round((input_tokens * price_in
                           + image_tokens * price_img
                           + text_tokens * price_text) / 1e6, 6),
        'latency_ms': latency_ms,
    }
    with LOG.open('a', encoding='utf-8') as fh:
        fh.write(json.dumps(row, ensure_ascii=False) + '\n')
    return row

# Log attempts, not just successes. Retry rate is where image budgets go.
笔记本屏幕上的代码

缓存与去重:生成成本主要来自重复

上线前该评测什么

评测集要用你自己的提示词来建,而不是用通用榜单——榜单量的是别人的分布。把人类会检查的约束写下来:宽高比、文字渲染准确度、解剖结构合理性、品牌色保真度,并尽可能用机械方式检查;因为图片类回归在聚合指标里看不出来,用户却一眼就看得见。从第一天起,就为每个资产记录输入 token、图片 token、文本 token、延迟与尝试次数。然后对着完整请求的哈希做激进缓存,让重试永远不会为同一张图付第二次钱。

# Wrapping the provider means you can swap it without a refactor.
# It also means you can see exactly which fields you actually depend on.
from dataclasses import dataclass

@dataclass
class GenResult:
    image_b64: str
    text: str | None
    model_id: str
    latency_ms: int

def generate_image(prompt: str, image_b64: str | None, *, model_id: str,
                   aspect_ratio: str = '16:9', want_text: bool = False) -> GenResult:
    # Confirm the current model id and parameter names in Google's
    # developer documentation before wiring this into production.
    raise NotImplementedError('wire to the provider SDK you use')

# The point is the seam. A provider wrapper is what lets you change
# your mind about the model without changing your product.

在产品与供应商之间留一道缝

把供应商包在你自己的接口后面,哪怕只是一个很薄的数据类加一个函数。这不是架构上的花活,而是「一个下午改主意」与「改四十个文件」之间的差别。它还在一处集中记录了:你到底依赖返回里的哪些字段——这正是模型被修订时你需要的。生成类模型变得很快,模型卡会更新,价格会动。能扛住这些的团队,其产品调用的是自己拥有的函数,而不是撒得到处都是的厂商 SDK。

📌 常见问题 FAQ

Nano Banana 2.1 是什么?

它是 Google DeepMind Gemini 3 系列的成员,于 2026 年 10 月 6 日发布模型卡。它是一个原生多模态推理模型,接受文本与图片输入,并在响应中生成图片与文本输出。

它基于哪个模型?

模型卡写明 Nano Banana 2.1 基于 Gemini 3.6 Flash。这告诉你图片生成底下是哪一层推理,对提示词写法和延迟预期都有影响。

上下文与输出上限是多少?

输入为文本与图片,token 上下文窗口最高 100 万;输出为一张图片(4K token 输出预算)以及最高 64K token 的文本。硬编码之前请对照当前模型卡确认。

定价在哪里写?

模型卡覆盖能力、局限与安全,不含计费。当前费率请看 Google 的定价文档,确切模型标识与参数名请看开发文档,而不要依赖媒体对价格变动的报道。

该怎么评测一个图片模型?

用你自己的提示词建评测集,并检查明确的、人类会检查的约束——宽高比、文字渲染、解剖结构、品牌色。为每个资产记录 token、延迟与重试次数,并对着完整请求的哈希做缓存,避免重试重复购买同一次生成。