Skip to content
Source
Sign inSign up
TanStack/ai

feat: opus 4.6 model & additional config for provider clients #278

MergedAlemTuzlakmerged 2 commits intomain fromrefs/pull/278/headmerged by AlemTuzlak View on GitHub

AlemTuzlakcommented

🎯 Changes

✅ 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 Claude Opus 4.6 with greatly expanded context and output capabilities
    • Exported additional model type definitions for safer model selection
  • Updates

    • Refreshed Claude lineup (Opus/Sonnet/Haiku) with updated specs and pricing
    • Enhanced configuration options and client initialization for Anthropic, Gemini, and Grok providers
    • Bumped Anthropic SDK dependency version
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      📝 Walkthrough

      Walkthrough

      Adds Claude Opus 4.6 and reorganizes Anthropic model metadata; extends client config interfaces to inherit underlying SDK options and forwards full config to SDK constructors across Anthropic, Gemini, and Grok; refactors Gemini summarize adapter to accept unified config; consolidates Grok type exports.

      Changes

      Cohort / File(s)Summary
      Changeset & Package Manifest
      \.changeset/slimy-ways-wave.md, packages/typescript/ai-anthropic/package.json
      Adds changeset documenting patch bumps for Anthropic/Gemini/Grok; bumps @anthropic-ai/sdk to ^0.71.2.
      Anthropic models & exports
      packages/typescript/ai-anthropic/src/model-meta.ts, packages/typescript/ai-anthropic/src/index.ts
      Adds CLAUDE_OPUS_4_6 (200k context, large output limits), reorders/renames several Claude model constants, expands ANTHROPIC_MODELS, and exports AnthropicChatModel and ANTHROPIC_MODELS.
      Anthropic client factory
      packages/typescript/ai-anthropic/src/utils/client.ts
      AnthropicClientConfig now extends SDK ClientOptions; createAnthropicClient forwards full config into SDK constructor.
      Gemini summarize adapter & client
      packages/typescript/ai-gemini/src/adapters/summarize.ts, packages/typescript/ai-gemini/src/utils/client.ts
      GeminiClientConfig extends GoogleGenAIOptions; createGeminiClient spreads config into SDK; GeminiSummarizeAdapter constructor changed to accept a GeminiSummarizeConfig config object and uses createGeminiClient(config); factory helpers updated to merge env/apiKey into config.
      Grok types & client
      packages/typescript/ai-grok/src/model-meta.ts, packages/typescript/ai-grok/src/adapters/image.ts, packages/typescript/ai-grok/src/index.ts, packages/typescript/ai-grok/src/utils/client.ts
      Adds GrokChatModel and GrokImageModel type aliases in model-meta; adapters import those types instead of declaring local unions; GrokClientConfig extends ClientOptions, client factory spreads full config and applies default baseURL.

      Estimated code review effort

      🎯 3 (Moderate) | ⏱️ ~25 minutes

      • TanStack/ai#245: Same pattern — extend provider client configs to inherit SDK ClientOptions and spread full config into SDK constructors.
      • TanStack/ai#183: Related Grok changes (model-meta, adapters, client utilities, type exports) that overlap this PR’s Grok edits.
      • TanStack/ai#263: Related changes to ai-anthropic exports and client config handling; overlaps Anthropic modifications.

      Poem

      🐰 A hop for Opus four-point-six, configs spread like clever tricks, types gathered, tidy and bright, clients forward all just right. ✨

      🚥 Pre-merge checks | ✅ 2 | ❌ 1
      ❌ Failed checks (1 warning)
      Check nameStatusExplanationResolution
      Description check⚠️ WarningThe PR description uses only the template placeholders with no actual content filled in; the 'Changes' section is empty and checklist items remain unchecked.Fill in the 'Changes' section with details about what was modified and why, and indicate which checklist items apply to this PR.
      ✅ Passed checks (2 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title accurately summarizes the main changes: adding the Opus 4.6 model and extending client config options across provider packages.
      Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
      ✏️ Tip: You can configure your own custom pre-merge checks in the settings.
      ✨ Finishing touches
      • 📝 Generate docstrings
        🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `chore/add-new-opus-model-and-exports`

      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.
    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 0f58b36dc039368d6aaf61138d26575a15a3d4bf

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded1m 17sView ↗
      nx run-many --targets=build --exclude=examples/**✅ Succeeded39sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-02-09 09:54:58 UTC

    3. pkg-pr-new[bot](GitHub profile, opens in a new tab)commented

      Open in StackBlitz

      @tanstack/ai

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

      @tanstack/ai-anthropic

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

      @tanstack/ai-client

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

      @tanstack/ai-devtools-core

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

      @tanstack/ai-gemini

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

      @tanstack/ai-grok

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

      @tanstack/ai-ollama

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

      @tanstack/ai-openai

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

      @tanstack/ai-openrouter

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

      @tanstack/ai-preact

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

      @tanstack/ai-react

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

      @tanstack/ai-react-ui

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

      @tanstack/ai-solid

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

      @tanstack/ai-solid-ui

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

      @tanstack/ai-svelte

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

      @tanstack/ai-vue

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

      @tanstack/ai-vue-ui

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

      @tanstack/preact-ai-devtools

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

      @tanstack/react-ai-devtools

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

      @tanstack/solid-ai-devtools

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

      commit: 0f58b36

    4. Actionable comments posted: 1

      🤖 Fix all issues with AI agents
      In `@packages/typescript/ai-gemini/src/adapters/summarize.ts`:
      - Around line 229-231: The factory is passing the SDK/client config (options:
      Omit<GeminiSummarizeConfig,'apiKey'>) as the adapter-options third parameter to
      GeminiSummarizeAdapter, which currently masks a type mismatch and will break
      when GeminiSummarizeAdapterOptions gains fields; update the call sites (the
      factory that returns new GeminiSummarizeAdapter and the geminiSummarize helper)
      to pass adapter options separately (e.g., pass {} or a dedicated adapterOptions
      argument) so the third parameter is a GeminiSummarizeAdapterOptions while the
      client config remains the second-parameter config (GeminiSummarizeConfig);
      ensure signatures reflect separate clientConfig vs adapterOptions to avoid
      silent shape mispasses.
      🧹 Nitpick comments (6)
      packages/typescript/ai-gemini/src/adapters/summarize.ts (1)

      16-19: Empty interface extension — consider using a type alias or adding a doc note.

      GeminiSummarizeConfig is currently identical to GeminiClientConfig. This is fine as a future extension point, but a brief comment clarifying the intent (e.g., "extend with summarize-specific options as needed") would help.

      packages/typescript/ai-grok/src/utils/client.ts (1)

      11-17: Minor: || vs ?? for baseURL default.

      Line 15 uses ||, which means an explicitly provided empty string '' would also fall through to the default. This is likely fine in practice, but ?? would be more precise if the intent is to only default on undefined/null.

      Proposed fix
      -    baseURL: config.baseURL || 'https://api.x.ai/v1',
      +    baseURL: config.baseURL ?? 'https://api.x.ai/v1',
      packages/typescript/ai-anthropic/src/index.ts (1)

      22-22: Nit: ANTHROPIC_MODELS value export is placed between adapter exports and the "Type Exports" section.

      Consider moving this runtime value export below the type exports section header or into its own labeled block, to keep the adapter/type organizational structure consistent.

      Suggested reorganization
      -export { ANTHROPIC_MODELS } from './model-meta'
       // ============================================================================
       // Type Exports
       // ============================================================================
       
      +export { ANTHROPIC_MODELS } from './model-meta'
       export type {
         AnthropicChatModelProviderOptionsByName,
         AnthropicModelInputModalitiesByName,
         AnthropicChatModel,
       } from './model-meta'
      packages/typescript/ai-anthropic/src/model-meta.ts (1)

      349-392: Stale commented-out code — missing CLAUDE_OPUS_4_6 entry.

      The commented-out ANTHROPIC_MODEL_META block (lines 349–359) and the type helpers below it don't include CLAUDE_OPUS_4_6. If this code is planned for future use, it should be updated. If it's abandoned, consider removing it to reduce noise.

      packages/typescript/ai-anthropic/src/utils/client.ts (2)

      14-17: Nit: apiKey: config.apiKey is redundant after spreading config.

      Since config already contains apiKey, the explicit override on line 16 has no effect. It's not harmful, but if the intent is clarity, a comment would be more informative than a no-op override.

      ♻️ Suggested simplification
         return new Anthropic_SDK({
           ...config,
      -    apiKey: config.apiKey,
         })

      45-47: substring(7) yields only ~4 random characters; consider substring(2) for more entropy.

      Math.random().toString(36) produces something like "0.k5b8c0m3xo". Using substring(7) skips most of the random portion, leaving ~4 characters. The more common idiom is substring(2) (or .slice(2)) to capture the full random segment after "0.".

      ♻️ Suggested fix
      -  return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(7)}`
      +  return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2)}`
    5. Caution

      Some comments are outside the diff and can’t be posted inline due to platform limitations.

      ⚠️ Outside diff range comments (1)
      packages/typescript/ai-gemini/src/adapters/summarize.ts (1)

      131-132: ⚠️ Potential issue | 🟡 Minor

      Inconsistent unit: "words" here vs "tokens" in summarize (Line 84).

      summarize instructs "Keep the summary under ${options.maxLength} tokens" while summarizeStream says "words". These should use the same unit for consistent behavior.

      Proposed fix
           const lengthInstructions = options.maxLength
      -      ? ` Keep the summary under ${options.maxLength} words.`
      +      ? ` Keep the summary under ${options.maxLength} tokens.`
             : ''
      🧹 Nitpick comments (1)
      packages/typescript/ai-gemini/src/adapters/summarize.ts (1)

      51-53: GeminiSummarizeAdapterOptions is now unused.

      The constructor was updated to (config: GeminiSummarizeConfig, model: TModel) and no longer accepts adapter options. This interface is dead code. Consider removing it, or if it's intended for future use, add a TODO to clarify intent.

    6. harry-whorlow(GitHub profile, opens in a new tab) approved these changes

    7. AlemTuzlak merged this6bd3a8b

    8. AlemTuzlak closed this

Sign in to join this conversation.