Skip to content

feat(ai-gemini): add Gemini 4 Carbon, Hydrogen and Neon, and 3.1 Pro custom tools - #2336

Open
jperasmus wants to merge 1 commit into
TanStack:mainfrom
jperasmus:feat/gemini-4-models
Open

jperasmus wants to merge 1 commit into
TanStack:mainfrom
jperasmus:feat/gemini-4-models

Conversation

@jperasmus

@jperasmus jperasmus commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

You can now use Gemini 4 Carbon (gemini-4-carbon), Gemini 4 Hydrogen (gemini-4-hydrogen), Gemini 4 Neon (gemini-4-neon) and the Gemini 3.1 Pro custom tools endpoint (gemini-3.1-pro-preview-customtools) with geminiText. chat({ reasoning }) now works on gemini-4-argon too.

Closes #2292. Closes #2119.

Why these models exist

The reply on #2292 found no Carbon, Hydrogen or Neon in the gateway catalogs under scripts/. Those catalogs don't list them yet, but Google does:

  • Google Cloud. Each model has its own page, and the model versions page gives its release date:
  • models.dev (api.json) lists all four Gemini 4 models and the custom tools endpoint under both google and google-vertex, with prices, limits and a 2026-03 knowledge cutoff.

🎯 Changes

  • Three new Gemini 4 models. Each copies the shape of gemini-4-argon: the same inputs, capabilities and built-in tools. Prices and limits come from models.dev's google entries:

    Model Input / cached / output ($ per 1M tokens) Max output
    gemini-4-carbon 4 / 0.20 / 20 32,768
    gemini-4-hydrogen 1.50 / 0.075 / 7.50 65,536
    gemini-4-neon 3 / 0.15 / 15 65,536
  • gemini-3.1-pro-preview-customtools. A copy of gemini-3.1-pro-preview under the custom tools id.

  • gemini-4-argon (ai-gemini: gemini-4-argon has no reasoning metadata #2119).

    • It gets reasoning: EFFORT_LOW_TO_HIGH, so chat({ reasoning }) sends thinkingConfig.thinkingLevel.
    • It joins GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS.
    • Its price moves to $4 / $0.20 / $20, as on models.dev and Google's pricing page.
  • Reasoning on the new models. Every Gemini 4 model gets low, medium, high. Google also lists XHIGH for Hydrogen and Neon, but @google/genai's ThinkingLevel has no XHIGH value yet, so I left it out. It can be added once the SDK has it.

  • Combined tools and schema. All new models join GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS.

  • Tests. model-meta.test.ts checks that each new model is registered, takes combined tools and schema, has the expected options and input types, and reasons at low, medium, high. reasoning-request.test.ts checks that each Gemini 4 model sends thinkingLevel.

  • Docs. docs/adapters/gemini.md lists the new ids in the reasoning table and the models table.

  • Changeset. One patch changeset for @tanstack/ai-gemini.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.
  • Docs: I updated docs/ for this change, or this change is not user-facing.
  • Changeset: I added a changeset (pnpm changeset), or this PR does not change a published package.

🚀 Release Impact

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

Testing

Commands run

  • nx run @tanstack/ai-gemini:build: passed.
  • In packages/ai-gemini: vitest run (552 tests) and tsc passed. oxlint showed only warnings that were already there.
  • vitest run scripts/model-sync, pnpm run test:docs (link check) and oxfmt --check on the changed files: passed.
  • pnpm run test:pr: passed (525 Nx tasks, then test:dts: no dangling .d.ts).

Manual test

  1. Run pnpm --filter @tanstack/ai-gemini exec vitest run tests/model-meta.test.ts tests/reasoning-request.test.ts.
  2. In a TypeScript file, write geminiText('gemini-4-neon'). It type-checks now; on main it does not.

Risk / rollback

Low. The PR adds ids and model entries, so code that type-checks today still type-checks. Argon's chat({ reasoning }) now sends thinkingConfig, where before it sent nothing. To undo it, revert the PR.

Public API change

Before

geminiText('gemini-4-carbon') // type error
chat({ adapter: geminiText('gemini-4-argon'), reasoning: 'high', ... }) // no thinkingConfig sent

After

geminiText('gemini-4-carbon') // accepted
chat({ adapter: geminiText('gemini-4-argon'), reasoning: 'high', ... }) // thinkingConfig.thinkingLevel: 'HIGH'

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for Gemini 4 Argon, Carbon, Hydrogen, and Neon, plus Gemini 3.1 Pro Preview with custom tools.
    • The new Gemini 4 models support tool use, structured responses, multimodal input, and low, medium, and high reasoning levels.
  • Updates
    • Updated Gemini 4 Neon pricing.

…custom tools

Add gemini-4-carbon, gemini-4-hydrogen, gemini-4-neon and
gemini-3.1-pro-preview-customtools to GEMINI_MODELS and every per-model
map. Give gemini-4-argon its reasoning levels and combined tools + schema
support (TanStack#2119), and update its price to $4 / $20.

Sources: Google's Gemini 4 model pages on Vertex AI and models.dev.

Closes TanStack#2292
Closes TanStack#2119

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2211519

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@tanstack/ai-gemini Patch
@tanstack/ai-optimize-evals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Gemini adapter adds metadata and registrations for Gemini 4 Carbon, Hydrogen, and Neon and Gemini 3.1 Pro custom-tools. It updates Argon reasoning and pricing, changes Neon pricing, and adds tests and documentation for the model changes.

Changes: Gemini model support

Layer / File(s) Summary
Model metadata definitions
packages/ai-gemini/src/model-meta.ts
Adds Gemini 3.1 Pro custom-tools metadata and Gemini 4 Carbon, Hydrogen, and Neon metadata. Updates Argon reasoning and pricing and Neon pricing.
Model registry and type maps
packages/ai-gemini/src/model-meta.ts
Adds the models to the model registries and provider-option, tool-capability, modality, and reasoning maps.
Tests and model documentation
packages/ai-gemini/tests/model-meta.test.ts, packages/ai-gemini/tests/reasoning-request.test.ts, docs/adapters/gemini.md, .changeset/gemini-4-models.md
Tests cover model metadata and high-reasoning request shapes. Documentation and the changeset list the Gemini 4 models and describe Argon reasoning, capabilities, and pricing.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Low

Possibly related issues

Suggested reviewers: alemtuzlak

Merge Risk: Minimal · up to 22115

This change adds Gemini 4 model metadata and Argon reasoning support. It is additive, and no actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes the main change: adding Gemini 4 Carbon, Hydrogen and Neon models and the Gemini 3.1 Pro custom tools endpoint to the ai-gemini package. It matches the raw summary, the objectives,…
Linked Issues check Passed [#2292] Requires native support for Gemini 4 Carbon, Hydrogen, and Neon. The PR summary for packages/ai-gemini/src/model-meta.ts reports new metadata entries for all three, added to the model and comb…
Out of Scope Changes check Passed All reported changes relate to the two linked issues or their supporting tests and docs. The changes are: three Gemini 4 model entries, gemini-3.1-pro-preview-customtools (a copy of gemini-3.1-pro-pre…
Description check Passed The description covers the required template sections: Changes, Checklist, and Release Impact. It explains what changed and why, lists the new models with prices and limits, and links the related issu…
Full details: Title check

Explanation

The title describes the main change: adding Gemini 4 Carbon, Hydrogen and Neon models and the Gemini 3.1 Pro custom tools endpoint to the ai-gemini package. It matches the raw summary, the objectives, and the description. It is one concise sentence and follows the conventional commit format.

Full details: Linked Issues check

Explanation

[#2292] Requires native support for Gemini 4 Carbon, Hydrogen, and Neon. The PR summary for packages/ai-gemini/src/model-meta.ts reports new metadata entries for all three, added to the model and combined-tools/schema lists, with provider-options, input-modality, and reasoning maps updated. tests/model-meta.test.ts asserts registry membership, combined tools and schema support, options, input types, and low/medium/high reasoning for each. [#2119] Requires gemini-4-argon to have reasoning metadata (EFFORT_LOW_TO_HIGH) and to be included in GEMINI_REASONING. The PR adds Argon to the reasoning map, and tests/reasoning-request.test.ts asserts that gemini-4-argon sends thinkingLevel 'HIGH' for a high reasoning request. Both issues' coding requirements are covered by the supplied evidence. Limitation: the base and head file diffs were unavailable in this review, so the verdict relies on the PR summary and the test summaries, not on the source hunks.

Full details: Out of Scope Changes check

Explanation

All reported changes relate to the two linked issues or their supporting tests and docs. The changes are: three Gemini 4 model entries, gemini-3.1-pro-preview-customtools (a copy of gemini-3.1-pro-preview), the Argon reasoning and combined-tools metadata and price update (#2119), the combined-tools list update, unit tests for these models, docs/adapters/gemini.md model and reasoning table rows, and a patch changeset for @tanstack/ai-gemini. The PR description states the Neon price change (to 3 / 0.15 / 15) and the Argon price change (to 4 / 0.20 / 20), so both are intentional. The raw summary describes Neon's prices as changed from earlier values, which does not match the claim that the Neon id is new. This may reflect a pre-existing entry elsewhere. The base file could not be read, so this point remains unverified. It does not show an unrelated change.

Full details: Description check

Explanation

The description covers the required template sections: Changes, Checklist, and Release Impact. It explains what changed and why, lists the new models with prices and limits, and links the related issues (#2292, #2119). It also documents testing, risk, and the public API change. The checklist items are marked, and the changeset and docs updates match the raw summary. The description goes beyond the template with extra sections, which is acceptable. Minor gap: the 'Changes' section is long and the template comment asks for the reason for skipping docs or changesets, which is not needed here because both were added.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: TanStack/ai
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: a7501eb
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 332f4193-2369-4060-921f-deb2d4430748
Commits

Reviewing files that changed from the base of the PR and between a7501eb and 2211519.

Files selected for processing: 5

  • .changeset/gemini-4-models.md
  • docs/adapters/gemini.md
  • packages/ai-gemini/src/model-meta.ts
  • packages/ai-gemini/tests/model-meta.test.ts
  • packages/ai-gemini/tests/reasoning-request.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@github-actions
github-actions Bot requested a review from jherr December 4, 2026 22:32
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR, @jperasmus! 🙌 @jherr will take a look.

Automated pre-review checks

  • ✅ CI passing
  • ✅ No merge conflicts
  • ✅ Changeset present
  • ⚠️ No E2E test changes detected — behavior changes need coverage under testing/e2e/ (see CONTRIBUTING)

Automated triage — a human review follows.

@github-actions github-actions Bot added the waiting-on: maintainer The ball is in the maintainers’ court label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-on: maintainer The ball is in the maintainers’ court

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support latest Gemini 4 models ai-gemini: gemini-4-argon has no reasoning metadata

2 participants