Skip to content

chore(ai-gemini): sync model meta with Google's current model list#714

Open
season179 wants to merge 1 commit into
TanStack:mainfrom
season179:gemini-model-meta-refresh
Open

chore(ai-gemini): sync model meta with Google's current model list#714
season179 wants to merge 1 commit into
TanStack:mainfrom
season179:gemini-model-meta-refresh

Conversation

@season179
Copy link
Copy Markdown
Contributor

@season179 season179 commented Jun 6, 2026

Summary

Closes #620, closes #621.

Syncs @tanstack/ai-gemini model metadata with Google's current published model list, migrates every workspace consumer off the retired ids, and fixes the structured-output demo dropdown.

All removals/additions were verified against the live API (GET /v1beta/models + real generateContent calls on a paid Tier 1 key) on 2026-06-06, not just the docs page.

Added

  • gemini-3.1-flash-lite (stable GA) to model-meta, all type maps, and GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS — it round-trips the native combined tools+schema path. The existing preview const was renamed GEMINI_3_1_FLASH_LITEGEMINI_3_1_FLASH_LITE_PREVIEW to follow the stable/_PREVIEW naming convention used by the 2.5 line.

Removed (verified retired)

id live API status successor
gemini-3-pro-preview 404 ("no longer available") gemini-3.1-pro-preview
gemini-2.5-flash-preview-09-2025 gone from /v1beta/models gemini-2.5-flash
gemini-2.5-flash-lite-preview-09-2025 gone from /v1beta/models gemini-2.5-flash-lite
gemini-2.0-flash docs-retired gemini-2.5-flash
gemini-2.0-flash-lite docs-retired gemini-2.5-flash-lite
gemini-2.0-flash-preview-image-generation gone from /v1beta/models gemini-2.5-flash-image

Note: gemini-2.0-flash / -lite still respond at the API level (deprecation grace), but they're gone from the published docs per the #620 acceptance criteria, so they're removed here.

Drive-by fixes (beyond the strict issue text, all small and disclosed here)

  • gemini-3.5-flash was missing from GeminiChatModelToolCapabilitiesByName, so its provider-tool typing was broken. One-line fix in a map this PR rewrites anyway.
  • gemini-3.5-flash was grouped under "no document" in GeminiModelInputModalitiesByName despite supports.input including document.
  • Display labels next to migrated model values: the svelte/vue/panel model-selection lists ended up with a duplicate gemini-2.5-flash entry (the old 2.0-flash row pointed at the same id) — duplicates removed, stale "Gemini - 2.0 Flash" labels updated. Same label sync in the panel's structured/summarize provider chips and its OpenRouter row.
  • Removed two stale commented-out blocks in model-meta.ts: the GEMINI_2_FLASH_LIVE draft (a retired 2.0-line id) and a GEMINI_MODEL_META draft that referenced consts deleted by this PR. Happy to restore if you prefer the tighter diff.

Consumer migration (#620 cascade)

  • testing/e2e (providers, summarize route, media-providers), testing/panel (model-selection, chat/structured/summarize/image routes, vendor-config), ai-code-mode-skills test CLI, and the react/svelte/vue chat examples.
  • Panel's OpenRouter entry google/gemini-2.0-flash-001google/gemini-2.5-flash (validated against the OpenRouter catalog).
  • Docs: stale ids corrected in adapters/gemini.md, adapters/openrouter.md (google/gemini-3-pro-preview isn't in OpenRouter's catalog either), advanced/multimodal-content.md, media/image-generation.md, and the ai-core skill reference. Factual fixes only — no addedAt/updatedAt bumps.
  • Deliberately untouched: ai-openrouter/model-meta.ts and scripts/openrouter.models.json (nightly-synced from OpenRouter), community-adapters/cencori.md (third-party service's own table).

Tests

The retired 2.0 line was the last chat model without thinking support, so the "models WITHOUT thinking" type-test category is gone. Those negative tests were replaced with retired-id rejection tests — geminiText('gemini-2.0-flash') / geminiText('gemini-3-pro-preview') are now compile errors, guarded by @ts-expect-error. The mixed accept/reject tool-gating coverage moved from gemini-2.0-flash-lite (rejected everything) to gemini-2.5-flash-lite (partial tool set, still exercises both directions). Full positive coverage added for the new stable gemini-3.1-flash-lite.

Demo (#621)

  • Dropdown: removed gemini-3-pro-preview (404s), added gemini-3.1-flash-lite.
  • Server fallback default: gemini-3-pro-previewgemini-3.5-flash — picked because it's the newest stable (non-preview) 3.x id and matches the dropdown's first entry; gemini-3.1-pro-preview is still a preview id. Happy to switch if you'd rather default to the pro line.

Open questions for maintainers

  1. imagen-3.0-generate-002 is also gone from the live API (verified), but chore(ai-gemini): remove retired model ids + cascade workspace consumer migration #620 scoped imagen variants as out-of-scope-but-check. It's kept in this PR. Want me to remove it here too, or file a follow-up issue?
  2. Fallback defaultgemini-3.5-flash (stable) vs gemini-3.1-pro-preview (newer flagship, but preview). Currently stable wins; say the word and I'll flip it.

Verification

  • pnpm test:pr — green (sherif/knip/docs/eslint/lib/types/build, 32 projects)
  • E2E suite — 253 passed, 0 failed (10 flaky-passed on non-Gemini providers, pre-existing)
  • Live round-trip of every dropdown entry through /api/structured-output on a paid key — all five stream and deliver structured-output.complete:
  • gemini-3.5-flash
  • gemini-3-flash-preview
  • gemini-3.1-pro-preview
  • gemini-3.1-flash-lite
  • gemini-3.1-flash-lite-preview

Summary by CodeRabbit

  • Documentation

    • Updated Gemini adapter documentation to reflect the latest available models and their capabilities, including multimodal and image generation options.
  • Chores

    • Synchronized Gemini model support with Google's current offerings, including new model additions and retirement of older versions across all adapters and examples.

Remove retired Gemini ids (gemini-3-pro-preview, the 09-2025 2.5
previews, and the 2.0 line), add the stable gemini-3.1-flash-lite, and
migrate every workspace consumer off the removed ids. Also fixes the
structured-output demo dropdown, which still offered the retired
gemini-3-pro-preview as its default.

All removals were verified against the live API, not just the docs
page. Includes a couple of small fixes found along the way: missing
gemini-3.5-flash entries in the tool-capability and modality maps, and
stale display labels left next to migrated model values.

Closes TanStack#620, closes TanStack#621
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 6, 2026

Wondering what really moved? Review this PR in Change Stack to inspect semantic changes, definitions, and references.

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: 626b3e9f-6ac3-4526-ad68-a27702a7f21f

📥 Commits

Reviewing files that changed from the base of the PR and between afb2960 and 8ed0409.

📒 Files selected for processing (33)
  • .changeset/gemini-model-meta-refresh.md
  • docs/adapters/gemini.md
  • docs/adapters/openrouter.md
  • docs/advanced/multimodal-content.md
  • docs/media/image-generation.md
  • examples/ts-react-chat/src/lib/model-selection.ts
  • examples/ts-react-chat/src/routes/api.structured-output.ts
  • examples/ts-react-chat/src/routes/generations.structured-output.tsx
  • examples/ts-svelte-chat/src/lib/model-selection.ts
  • examples/ts-svelte-chat/src/routes/api/chat/+server.ts
  • examples/ts-vue-chat/src/lib/model-selection.ts
  • examples/ts-vue-chat/vite.config.ts
  • packages/ai-code-mode-skills/test-cli/adapters.ts
  • packages/ai-code-mode-skills/test-cli/cli.ts
  • packages/ai-gemini/src/adapters/summarize.ts
  • packages/ai-gemini/src/image/image-provider-options.ts
  • packages/ai-gemini/src/model-meta.ts
  • packages/ai-gemini/tests/chat-per-model-type-safety.test.ts
  • packages/ai-gemini/tests/gemini-adapter.test.ts
  • packages/ai-gemini/tests/model-meta.test.ts
  • packages/ai-gemini/tests/tools-per-model-type-safety.test.ts
  • packages/ai/skills/ai-core/adapter-configuration/references/gemini-adapter.md
  • testing/e2e/src/lib/media-providers.ts
  • testing/e2e/src/lib/providers.ts
  • testing/e2e/src/routes/api.summarize.ts
  • testing/panel/src/lib/model-selection.ts
  • testing/panel/src/routes/api.chat.ts
  • testing/panel/src/routes/api.image.ts
  • testing/panel/src/routes/api.structured.ts
  • testing/panel/src/routes/api.summarize.ts
  • testing/panel/src/routes/structured.tsx
  • testing/panel/src/routes/summarize.tsx
  • testing/panel/tests/vendor-config.ts
💤 Files with no reviewable changes (6)
  • packages/ai/skills/ai-core/adapter-configuration/references/gemini-adapter.md
  • packages/ai-gemini/src/image/image-provider-options.ts
  • examples/ts-vue-chat/src/lib/model-selection.ts
  • examples/ts-svelte-chat/src/lib/model-selection.ts
  • docs/adapters/gemini.md
  • docs/media/image-generation.md

📝 Walkthrough

Walkthrough

This PR syncs Gemini model metadata with Google's current published list by removing six retired model IDs, adding stable gemini-3.1-flash-lite, and updating exported type maps and registries. All 30+ workspace consumers (example apps, E2E tests, testing panels, and documentation) are migrated to current models.

Changes

Gemini Model Metadata Refresh and Consumer Migration

Layer / File(s) Summary
Core model metadata, types, and registries
packages/ai-gemini/src/model-meta.ts, packages/ai-gemini/src/image/image-provider-options.ts
Model constants updated: GEMINI_3_PRO removed and replaced with GEMINI_3_FLASH, stable GEMINI_3_1_FLASH_LITE and preview variant added, older 2.x preview variants removed. Exported type maps (GeminiChatModelProviderOptionsByName, GeminiChatModelToolCapabilitiesByName, GeminiModelInputModalitiesByName) and registries (GEMINI_MODELS, GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS, GEMINI_IMAGE_MODELS) updated to reflect the new model set. GeminiNativeImageModels union type updated to remove gemini-2.0-flash-preview-image-generation.
Type safety and model validation tests
packages/ai-gemini/tests/chat-per-model-type-safety.test.ts, packages/ai-gemini/tests/tools-per-model-type-safety.test.ts, packages/ai-gemini/tests/model-meta.test.ts
Compile-time type-safety coverage extended for stable gemini-3.1-flash-lite including thinking support validation. Retired model IDs (gemini-3-pro-preview, gemini-2.0-flash, gemini-2.0-flash-lite) removed from assertions with @ts-expect-error markers added for deprecated models. Tool capability gating tests updated for gemini-2.5-flash-lite and gemini-3.1-flash-lite. Model metadata assertions reorganized for current model roster.
Adapter test default model updates
packages/ai-gemini/tests/gemini-adapter.test.ts
Test suite updated to use current model IDs: createGeminiSummarize now targets gemini-2.5-flash instead of gemini-2.0-flash, native combined-mode test expects gemini-3.1-pro-preview instead of gemini-3-pro-preview.
Example application model defaults and selections
examples/ts-react-chat/src/lib/model-selection.ts, examples/ts-react-chat/src/routes/api.structured-output.ts, examples/ts-react-chat/src/routes/generations.structured-output.tsx, examples/ts-svelte-chat/src/lib/model-selection.ts, examples/ts-svelte-chat/src/routes/api/chat/+server.ts, examples/ts-vue-chat/src/lib/model-selection.ts, examples/ts-vue-chat/vite.config.ts
Default chat models migrated from gemini-2.0-flash to gemini-2.5-flash. Structured-output dropdown options updated to remove gemini-3-pro-preview and add stable gemini-3.1-flash-lite. API route defaults updated across all three example frameworks.
E2E and testing panel model defaults
testing/e2e/src/lib/providers.ts, testing/e2e/src/lib/media-providers.ts, testing/e2e/src/routes/api.summarize.ts, testing/panel/src/lib/model-selection.ts, testing/panel/src/routes/api.chat.ts, testing/panel/src/routes/api.image.ts, testing/panel/src/routes/api.structured.ts, testing/panel/src/routes/api.summarize.ts, testing/panel/src/routes/structured.tsx, testing/panel/src/routes/summarize.tsx, testing/panel/tests/vendor-config.ts
Testing infrastructure and panel defaults updated: testing/e2e providers and routes now use gemini-2.5-flash for text and gemini-2.5-flash-image for images. Testing panel model selection UI updated with gemini-2.0-flash removal and OpenRouter Gemini entry updated to google/gemini-2.5-flash. API route defaults for chat, structured, summarize, and image endpoints migrated across both E2E and panel test suites.
Documentation and reference updates
docs/adapters/gemini.md, docs/adapters/openrouter.md, docs/advanced/multimodal-content.md, docs/media/image-generation.md, packages/ai/skills/ai-core/adapter-configuration/references/gemini-adapter.md, packages/ai-gemini/src/adapters/summarize.ts, packages/ai-code-mode-skills/test-cli/adapters.ts, packages/ai-code-mode-skills/test-cli/cli.ts, .changeset/gemini-model-meta-refresh.md
Documentation tables updated: retired gemini-2.0-flash-preview-image-generation replaced with current image model variants in adapter and media docs. Multimodal content example updated to reference gemini-2.5-flash. Adapter reference doc updated to list gemini-3.1-pro-preview as flagship. JSDoc examples and CLI tool defaults updated to use gemini-2.5-flash. Release notes added documenting the model refresh, removed IDs, and consumer migration guidance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • tombeckenham
  • jherr
  • AlemTuzlak

Poem

🐰 The models were old, so we said goodbye,
Three-one-flash-lite now reaches the sky,
Two-point-five bounces across every test,
Retired IDs rest while new ones do best! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main change: syncing Gemini model metadata with Google's current model list, which is the primary objective of the PR.
Description check ✅ Passed Description covers the changeset comprehensively, including summary, added/removed models, consumer migrations, tests, demo fixes, verification, and open questions for maintainers.
Linked Issues check ✅ Passed All objectives from #620 (remove retired model IDs, add stable gemini-3.1-flash-lite, migrate consumers, update type maps, update GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS, ensure tests pass) and #621 (fix dropdown entries, ensure types clean, demo round-trips) are comprehensively addressed in the changeset.
Out of Scope Changes check ✅ Passed All changes directly support the linked issue objectives: model-meta updates, consumer migrations across workspace, documentation updates, and type-map fixes. Drive-by fixes (gemini-3.5-flash mappings, label cleanups, commented-block removals) are appropriately scoped and disclosed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

examples/ts-svelte-chat/src/routes/api/chat/+server.ts

Parsing error: Unable to parse the specified 'tsconfig' file. Ensure it's correct and has valid syntax.

error TS5012: Cannot read file '/examples/ts-svelte-chat/.svelte-kit/tsconfig.json': ENOENT: no such file or directory, open '/examples/ts-svelte-chat/.svelte-kit/tsconfig.json'.

examples/ts-vue-chat/vite.config.ts

Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): examples/ts-vue-chat/vite.config.ts

packages/ai-code-mode-skills/test-cli/adapters.ts

Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): packages/ai-code-mode-skills/test-cli/adapters.ts

  • 1 others

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 and usage tips.

@season179 season179 marked this pull request as ready for review June 6, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant