Skip to content
Source
Sign inSign up
TanStack/ai

Support latest Gemini 4 models #2293 (GitHub #2292)

OpenXhale1(GitHub profile, opens in a new tab) opened this issue 2 comments

TanStack AI version

@tanstack/ai 1.10.1, @tanstack/ai-gemini 1.3.1

Framework/Library version

Node 26.14

Describe the bug and the steps to reproduce it

Reporting as a bug instead of a feature request as I think model syncing is supposed to be handled automatically. Possibly related to https://github.com/TanStack/ai/issues/2279 however that issue was raised 3 days ago while the gemini models appear to have been out of date for ~a month.

These Gemini models don't appear to be supported natively by Tanstack AI

  1. Gemini 4 Carbon (October 28)
  2. Gemini 4 Hydrogen (November 12)
  3. Gemini 4 Neon (November 18)

I also ran into a possibly related issues: https://github.com/TanStack/ai/issues/2119

N/A

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
  1. tanstack-sourcecommented

    Result: the models named in the issue do not exist

    I checked the Gemini 4 ids in the repository's own gateway catalogs against what @tanstack/ai-gemini registers on main (0ac51d8).

    1. gemini-4-carbon, gemini-4-hydrogen and gemini-4-neon appear in no catalog. The five catalogs under scripts/ (openrouter, vercel-gateway, llmgateway, lovell-gateway, neon) list no such ids. Google publishes no such ids either.
    2. The only Gemini 4 chat model in every one of those catalogs is gemini-4-argon, from 2026-10-13. It is registered in GEMINI_MODELS on main.
    3. gemini-4-argon is not in packages/ai-gemini/CHANGELOG.md, so it is unreleased. The reporter on @tanstack/ai-gemini 1.3.1 does not have it yet. The gap they hit is a release gap, not a missing model.

    So the claim "Gemini 4 models are not supported natively" does not reproduce for the Gemini 4 model that exists. The three ids in the report cannot be checked against anything.

    Two real gaps in gemini-4-argon

    The repro surfaced defects in the registered Gemini 4 model, not the ones the issue describes.

    1. GEMINI_MODEL_REASONING has no entry for gemini-4-argon. The catalog marks reasoning mandatory with low, medium, high. So chat({ reasoning: 'high' }) resolves to nothing and the adapter sends no thinkingConfig (packages/ai-gemini/src/adapters/text.ts:1755).
    2. GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS in packages/ai-gemini/src/model-meta.ts omits gemini-4-argon, so supportsCombinedToolsAndSchema() returns false for a model that supports structured output and function calling.
    3. The docs tables in docs/adapters/gemini.md and docs/adapters/gemini-advanced.md do not list gemini-4-argon.

    The reasoning gap is expected from the comment at packages/ai-gemini/src/model-meta.ts:1292: the sync scripts do not write reasoning fields. scripts/sync-provider-models.ts reads model.reasoning.mandatory only to pick supports flags.

    Suspected files

    • packages/ai-gemini/src/model-meta.ts: missing reasoning entry and combined-tools set entry for gemini-4-argon.
    • scripts/sync-provider-models.ts: the sync does not write reasoning fields for new models.
    • docs/adapters/gemini.md, docs/adapters/gemini-advanced.md: model tables omit gemini-4-argon.

    Repro

    Path: repro/issue-2293.mjs Command: node repro/issue-2293.mjs

    // Issue #2293: "Support latest Gemini 4 models".
    //
    // The issue names three Gemini 4 models (carbon, hydrogen, neon) and says
    // @tanstack/ai-gemini does not support them natively.
    //
    // This script checks:
    //   1. Which Gemini 4 ids the repo's own gateway catalogs list, and whether
    //      @tanstack/ai-gemini registers each one.
    //   2. Whether the three ids the issue names appear in any of those catalogs.
    //   3. As a side finding: whether the registered Gemini 4 model has reasoning
    //      data, which `chat({ reasoning })` needs.
    //
    // `packages/ai-gemini/src/model-meta.ts` and `packages/ai/src/reasoning.ts`
    // have type-only imports, so Node loads them directly with type stripping.
    import assert from 'node:assert/strict'
    import { readFileSync } from 'node:fs'
    import {
      GEMINI_MODELS,
      GEMINI_MODEL_INPUT_MODALITIES,
      GEMINI_MODEL_REASONING,
    } from '../packages/ai-gemini/src/model-meta.ts'
    import { resolveReasoning } from '../packages/ai/src/reasoning.ts'
    
    const CATALOGS = [
      'scripts/openrouter.models.json',
      'scripts/vercel-gateway.models.json',
      'scripts/llmgateway.models.json',
      'scripts/lovell-gateway.models.json',
      'scripts/neon.models.json',
    ]
    
    // Gateway id to native Gemini id. `:batch` is a routing variant, not a model.
    function nativeId(id) {
      return id.replace(/^google\//, '').replace(/:batch$/, '')
    }
    
    const catalogGemini4 = new Map() // native id -> catalogs that list it
    for (const file of CATALOGS) {
      let json
      try {
        json = JSON.parse(readFileSync(file, 'utf8'))
      } catch {
        continue // catalog not present in this checkout
      }
      const models = Array.isArray(json) ? json : (json.data ?? json.models ?? [])
      for (const model of models) {
        const id = nativeId(model.id ?? '')
        if (!id.startsWith('gemini-4')) continue
        catalogGemini4.set(id, (catalogGemini4.get(id) ?? 0) + 1)
      }
    }
    
    console.log('1. Gemini 4 ids the repo gateway catalogs list:')
    for (const [id, count] of catalogGemini4) {
      const registered = GEMINI_MODELS.includes(id)
      const reasoning = GEMINI_MODEL_REASONING[id]
      console.log(
        `   ${id}: catalogs=${count} registered=${registered} ` +
          `inputModalities=${JSON.stringify(GEMINI_MODEL_INPUT_MODALITIES[id])} ` +
          `reasoning=${reasoning ? Object.keys(reasoning.levels).join('/') : 'none'}`,
      )
    }
    
    const issueIds = ['gemini-4-carbon', 'gemini-4-hydrogen', 'gemini-4-neon']
    console.log('2. Gemini 4 ids the issue names:')
    for (const id of issueIds) {
      console.log(
        `   ${id}: inCatalogs=${catalogGemini4.has(id)} registered=${GEMINI_MODELS.includes(id)}`,
      )
    }
    
    // Every Gemini 4 chat model the repo catalogs list is registered.
    assert.ok(catalogGemini4.size > 0, 'no Gemini 4 model in any catalog')
    for (const id of catalogGemini4.keys()) {
      assert.ok(
        GEMINI_MODELS.includes(id),
        `${id} is in a repo catalog but missing from GEMINI_MODELS`,
      )
      assert.ok(
        GEMINI_MODEL_INPUT_MODALITIES[id] !== undefined,
        `${id} has no input-modality entry`,
      )
    }
    
    // The ids the issue names are in no catalog, so nothing is missing for them.
    for (const id of issueIds) {
      assert.equal(
        catalogGemini4.has(id),
        false,
        `${id} is in a catalog after all, so the issue names a real model`,
      )
    }
    console.log('   -> the three ids the issue names appear in no catalog')
    console.log('   -> every Gemini 4 model in the catalogs is registered')
    
    // Side finding: `gemini-4-argon` is registered but has no reasoning data.
    console.log('3. Reasoning for the registered Gemini 4 model:')
    for (const id of catalogGemini4.keys()) {
      const resolved = resolveReasoning({ level: 'high', summary: false }, GEMINI_MODEL_REASONING[id])
      console.log(
        `   ${id}: chat({ reasoning: 'high' }) resolves to ` +
          (resolved ? `thinkingConfig level ${resolved.value}` : 'nothing'),
      )
    }

    Output (end):

    1. Gemini 4 ids the repo gateway catalogs list:
       gemini-4-argon: catalogs=5 registered=true inputModalities=["audio","document","image","text","video"] reasoning=none
    2. Gemini 4 ids the issue names:
       gemini-4-carbon: inCatalogs=false registered=false
       gemini-4-hydrogen: inCatalogs=false registered=false
       gemini-4-neon: inCatalogs=false registered=false
       -> the three ids the issue names appear in no catalog
       -> every Gemini 4 model in the catalogs is registered
    3. Reasoning for the registered Gemini 4 model:
       gemini-4-argon: chat({ reasoning: 'high' }) resolves to nothing
    EXIT=0

    TanStack Source bot, investigate agent

  2. I think the investigation agent is either mistaken, or perhaps it's not reading the latest catalogs?

    Open router, for example, has listed Neon, Carbon, and Hydrogen for a few days as far as I can tell.

  3. github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: maintainer

Sign in to join this conversation.