feat: opus 4.6 model & additional config for provider clients #278
main fromrefs/pull/278/head·merged by AlemTuzlak View on GitHub🎯 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
View your CI Pipeline Execution ↗ for commit 0f58b36dc039368d6aaf61138d26575a15a3d4bf
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 1m 17s View ↗ nx run-many --targets=build --exclude=examples/**✅ Succeeded 39s View ↗
☁️ Nx Cloud last updated this comment at
2026-02-09 09:54:58UTC@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@278commit:
0f58b36Actionable 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.GeminiSummarizeConfigis currently identical toGeminiClientConfig. 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??forbaseURLdefault.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 onundefined/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_MODELSvalue 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 — missingCLAUDE_OPUS_4_6entry.The commented-out
ANTHROPIC_MODEL_METAblock (lines 349–359) and the type helpers below it don't includeCLAUDE_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.apiKeyis redundant after spreadingconfig.Since
configalready containsapiKey, 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; considersubstring(2)for more entropy.Math.random().toString(36)produces something like"0.k5b8c0m3xo". Usingsubstring(7)skips most of the random portion, leaving ~4 characters. The more common idiom issubstring(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)}`packages/typescript/ai-gemini/src/adapters/summarize.ts lines 229 to 231OutdatedResolvedby AlemTuzlak@@ -224,6 +226,6 @@224226 export function createGeminiSummarize<TModel extends GeminiSummarizeModel>(225227 apiKey: string,226228 model: TModel,227- options?: GeminiSummarizeAdapterOptions,229+ options?: Omit<GeminiSummarizeConfig, 'apiKey'>,228230 ): GeminiSummarizeAdapter<TModel> {229- return new GeminiSummarizeAdapter(apiKey, model, options)231+ return new GeminiSummarizeAdapter({ ...options, apiKey }, model, options)⚠️ Potential issue | 🟡 Minor
Third argument passes client config where adapter options are expected.
optionshere isOmit<GeminiSummarizeConfig, 'apiKey'>(i.e., SDK/client config), but the constructor's third parameter expectsGeminiSummarizeAdapterOptions. This works today only becauseGeminiSummarizeAdapterOptionsis an empty interface — once adapter-specific options are added, this will silently pass the wrong shape. The same issue applies togeminiSummarizeon Line 242.Suggested fix
Either pass
{}(or a dedicated adapter-options argument) as the third parameter, or restructure the factory signatures to separate client config from adapter options:export function createGeminiSummarize<TModel extends GeminiSummarizeModel>( apiKey: string, model: TModel, options?: Omit<GeminiSummarizeConfig, 'apiKey'>, ): GeminiSummarizeAdapter<TModel> { - return new GeminiSummarizeAdapter({ ...options, apiKey }, model, options) + return new GeminiSummarizeAdapter({ ...options, apiKey }, model) }export function geminiSummarize<TModel extends GeminiSummarizeModel>( model: TModel, options?: Omit<GeminiSummarizeConfig, 'apiKey'>, ): GeminiSummarizeAdapter<TModel> { const apiKey = getGeminiApiKeyFromEnv() - return new GeminiSummarizeAdapter({ ...options, apiKey }, model, options) + return new GeminiSummarizeAdapter({ ...options, apiKey }, model) }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change229- options?: Omit<GeminiSummarizeConfig, 'apiKey'>,230-): GeminiSummarizeAdapter<TModel> {231- return new GeminiSummarizeAdapter({ ...options, apiKey }, model, options)229+ options?: Omit<GeminiSummarizeConfig, 'apiKey'>,230+): GeminiSummarizeAdapter<TModel> {231+ return new GeminiSummarizeAdapter({ ...options, apiKey }, model)🤖 Prompt for AI Agents
In `@packages/typescript/ai-gemini/src/adapters/summarize.ts` around lines 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.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 | 🟡 MinorInconsistent unit: "words" here vs "tokens" in
summarize(Line 84).summarizeinstructs"Keep the summary under ${options.maxLength} tokens"whilesummarizeStreamsays"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:GeminiSummarizeAdapterOptionsis 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 aTODOto clarify intent.harry-whorlow(GitHub profile, opens in a new tab) approved these changes
AlemTuzlak merged this6bd3a8b
AlemTuzlak closed this
Sign in to join this conversation.
📝 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#
\.changeset/slimy-ways-wave.md,packages/typescript/ai-anthropic/package.json@anthropic-ai/sdkto ^0.71.2.packages/typescript/ai-anthropic/src/model-meta.ts,packages/typescript/ai-anthropic/src/index.tsCLAUDE_OPUS_4_6(200k context, large output limits), reorders/renames several Claude model constants, expandsANTHROPIC_MODELS, and exportsAnthropicChatModelandANTHROPIC_MODELS.packages/typescript/ai-anthropic/src/utils/client.tsAnthropicClientConfignow extends SDKClientOptions;createAnthropicClientforwards full config into SDK constructor.packages/typescript/ai-gemini/src/adapters/summarize.ts,packages/typescript/ai-gemini/src/utils/client.tsGeminiClientConfigextendsGoogleGenAIOptions;createGeminiClientspreads config into SDK;GeminiSummarizeAdapterconstructor changed to accept aGeminiSummarizeConfigconfig object and usescreateGeminiClient(config); factory helpers updated to merge env/apiKey into config.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.tsGrokChatModelandGrokImageModeltype aliases inmodel-meta; adapters import those types instead of declaring local unions;GrokClientConfigextendsClientOptions, client factory spreads full config and applies defaultbaseURL.Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs#
Poem#
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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