Skip to content

feat(ai-gemini): support Nano Banana 2 Lite (gemini-3.1-flash-lite-image)#874

Merged
AlemTuzlak merged 1 commit into
mainfrom
870-support-google-omni-and-nb-lite
Jul 1, 2026
Merged

feat(ai-gemini): support Nano Banana 2 Lite (gemini-3.1-flash-lite-image)#874
AlemTuzlak merged 1 commit into
mainfrom
870-support-google-omni-and-nb-lite

Conversation

@tombeckenham

@tombeckenham tombeckenham commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

Adds proper support for Nano Banana 2 Lite (gemini-3.1-flash-lite-image) to the Gemini adapter, and fixes the model-sync bug that mis-landed it.

Background: the automated OpenRouter sync (#772) had already added gemini-3.1-flash-lite-image to main — but mis-classified as a text-only chat model (output: ['text'], listed in GEMINI_MODELS + the chat type maps). Verified against the live Gemini API, it's a native image model (generateContent → inline image, ~1120 tokens/1K image).

This PR:

  • Corrects the model entry and wires it into the image surface — output: ['text', 'image'], in the image-model region + GEMINI_IMAGE_MODELS, added to the GeminiNativeImageModels union (template-literal sizes like "1:1_2K", image-conditioned prompts) — matching the other native image models. Removed from the chat arrays/type maps.
  • Fixes the sync generator (scripts/sync-provider-models.ts): the guard isImageOnlyModel (image output and not text) → outputsImage (any image output), so native text+image image models are skipped for manual curation instead of being inserted as chat models. Verified against scripts/openrouter.models.json: all six gemini-*-image models flip from "added to chat" → "skipped".
  • Unit test asserting native generateContent routing + size parsing for the new model.
  • Docs (docs/adapters/gemini.md, docs/media/image-generation.md + updatedAt), and the media-generation skill model list.

Scope note: this issue was split — Gemini Omni Flash (gemini-omni-flash-preview) needs a separate Interactions-API path and is tracked in #871.

Closes #870.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features

    • Added support for a new Gemini native image model, “Nano Banana 2 Lite,” for faster, lower-cost image generation.
    • Improved image generation handling for mixed text-and-image output models, including better size and prompt support.
  • Bug Fixes

    • Correctly routes the new model through the native image generation flow instead of treating it as a chat model.
    • Prevents image-capable models from being incorrectly included in manual model lists.
  • Documentation

    • Updated image model availability and Gemini adapter docs to include the new model.

…age)

Add proper support for the Nano Banana 2 Lite native image model. The
automated OpenRouter model sync had landed this model mis-classified as a
text-only chat model (output: ['text'], in GEMINI_MODELS + chat type maps).
Correct it and wire it into the image surface: routed through the
generateContent API with output: ['text','image'], template-literal sizes
(aspectRatio_resolution), and image-conditioned prompts — matching the other
native image models.

Also fix scripts/sync-provider-models.ts so native image models that output
both text and image are skipped for manual curation (via outputsImage)
instead of being inserted as chat models with a bogus output: ['text'].

Closes #870.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tombeckenham tombeckenham requested a review from a team as a code owner July 1, 2026 02:46
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 97521935-1e4f-4c0f-b825-e136955adf62

📥 Commits

Reviewing files that changed from the base of the PR and between 00505fe and a7b672d.

📒 Files selected for processing (9)
  • .changeset/gemini-nano-banana-2-lite.md
  • docs/adapters/gemini.md
  • docs/config.json
  • docs/media/image-generation.md
  • packages/ai-gemini/src/image/image-provider-options.ts
  • packages/ai-gemini/src/model-meta.ts
  • packages/ai-gemini/tests/image-adapter.test.ts
  • packages/ai/skills/ai-core/media-generation/SKILL.md
  • scripts/sync-provider-models.ts

📝 Walkthrough

Walkthrough

Reclassifies gemini-3.1-flash-lite-image (Nano Banana 2 Lite) from a Gemini chat model to a native Gemini image model. Updates metadata, type maps, and image-provider option unions, adds a routing test, updates the OpenRouter sync script's image-model exclusion logic, and refreshes related docs.

Changes

Nano Banana 2 Lite image model registration

Layer / File(s) Summary
Model metadata and classification
packages/ai-gemini/src/model-meta.ts
GEMINI_3_1_FLASH_LITE_IMAGE metadata updated (token limits, modalities); moved from GEMINI_MODELS to GEMINI_IMAGE_MODELS; removed from GeminiChatModelProviderOptionsByName and GeminiModelInputModalitiesByName.
Native image model type wiring
packages/ai-gemini/src/image/image-provider-options.ts
Added 'gemini-3.1-flash-lite-image' to the GeminiNativeImageModels union.
Image adapter test coverage
packages/ai-gemini/tests/image-adapter.test.ts
New test asserting generateImage routes through generateContent with correct imageConfig and response parsing.
OpenRouter sync exclusion update
scripts/sync-provider-models.ts
Replaced isImageOnlyModel with outputsImage, excluding any model that outputs image (including text+image) from chat model curation.
Docs, skill list, and changeset
docs/adapters/gemini.md, docs/media/image-generation.md, packages/ai/skills/ai-core/media-generation/SKILL.md, docs/config.json, .changeset/gemini-nano-banana-2-lite.md
Added the new model entry to documentation tables and skill list, bumped updatedAt timestamps, and added a changeset describing the changes.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

Not applicable — changes are model registration/metadata and documentation updates without new multi-component control flow.

Suggested reviewers: AlemTuzlak

Poem

A tiny rabbit hops with glee,
Nano Banana 2 Lite, fast and free!
From chat to image, it found its lane,
generateContent — no more disdain 🎨
Docs and tests all lined in a row,
Hop hop hop, watch this model glow! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for Nano Banana 2 Lite in the Gemini adapter.
Description check ✅ Passed The description follows the required template and covers changes, checklist, and release impact.
Linked Issues check ✅ Passed The PR implements the Nano Banana 2 Lite support requested in #870, including model registration, native routing, size parsing, tests, and docs.
Out of Scope Changes check ✅ Passed The additional docs, tests, changeset, and sync-script updates support the stated Gemini image-model change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 870-support-google-omni-and-nb-lite

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

3 package(s) bumped directly, 0 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/ai-gemini 0.18.4 → 0.19.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/ai-anthropic 0.15.12 → 0.15.13 Changeset
@tanstack/ai-react 0.16.1 → 0.16.2 Changeset

@nx-cloud

nx-cloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a7b672d

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 9s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-01 02:47:39 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jul 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@874

@tanstack/ai-acp

npm i https://pkg.pr.new/@tanstack/ai-acp@874

@tanstack/ai-angular

npm i https://pkg.pr.new/@tanstack/ai-angular@874

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@874

@tanstack/ai-bedrock

npm i https://pkg.pr.new/@tanstack/ai-bedrock@874

@tanstack/ai-claude-code

npm i https://pkg.pr.new/@tanstack/ai-claude-code@874

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@874

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@874

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@874

@tanstack/ai-codex

npm i https://pkg.pr.new/@tanstack/ai-codex@874

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@874

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@874

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@874

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@874

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@874

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@874

@tanstack/ai-grok-build

npm i https://pkg.pr.new/@tanstack/ai-grok-build@874

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@874

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@874

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@874

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@874

@tanstack/ai-mcp

npm i https://pkg.pr.new/@tanstack/ai-mcp@874

@tanstack/ai-mistral

npm i https://pkg.pr.new/@tanstack/ai-mistral@874

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@874

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@874

@tanstack/ai-opencode

npm i https://pkg.pr.new/@tanstack/ai-opencode@874

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@874

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@874

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@874

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@874

@tanstack/ai-sandbox

npm i https://pkg.pr.new/@tanstack/ai-sandbox@874

@tanstack/ai-sandbox-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-sandbox-cloudflare@874

@tanstack/ai-sandbox-daytona

npm i https://pkg.pr.new/@tanstack/ai-sandbox-daytona@874

@tanstack/ai-sandbox-docker

npm i https://pkg.pr.new/@tanstack/ai-sandbox-docker@874

@tanstack/ai-sandbox-local-process

npm i https://pkg.pr.new/@tanstack/ai-sandbox-local-process@874

@tanstack/ai-sandbox-vercel

npm i https://pkg.pr.new/@tanstack/ai-sandbox-vercel@874

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@874

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@874

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@874

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@874

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@874

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@874

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@874

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@874

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@874

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@874

commit: a7b672d

@AlemTuzlak AlemTuzlak merged commit 84d1225 into main Jul 1, 2026
10 checks passed
@AlemTuzlak AlemTuzlak deleted the 870-support-google-omni-and-nb-lite branch July 1, 2026 09:05
@github-actions github-actions Bot mentioned this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Google Nano Banana 2 Lite image model (gemini-3.1-flash-lite-image)

2 participants