feat(ai-openrouter): update model catalog from OpenRouter API#400
Conversation
Regenerate model-meta.ts from the current OpenRouter /api/v1/models endpoint (346 models total, +57 new, -59 deprecated). Notable additions: - openai/gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.4-pro - anthropic/claude-sonnet-4.6, claude-opus-4.6 - z-ai/glm-5-turbo, glm-5, glm-4.7-flash - xiaomi/mimo-v2-pro, mimo-v2-omni - minimax/minimax-m2.7, minimax-m2.5 - google/gemini-3.1-flash-lite-preview, gemini-3.1-pro-preview - mistralai/mistral-small-2603 - moonshotai/kimi-k2.5 - qwen/qwen3.5-* series Fixes in conversion script: - Map snake_case supported_parameters from the API to camelCase keys matching OpenRouterBaseOptions (frequency_penalty → frequencyPenalty, etc.) - Skip duplicate openrouter/auto entries when the model is already in the API catalog Other changes: - Add parallelToolCalls to OpenRouterBaseOptions - Update image-adapter test to use non-deprecated model ID
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Comment |
- Add minor changeset for @tanstack/ai-openrouter - Apply prettier formatting to model-meta.ts and scripts
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/typescript/ai-openrouter/src/text/text-provider-options.ts (1)
308-311: Duplicate property definition with inconsistent JSDoc.
parallelToolCallsis already defined inOpenRouterCommonOptions(lines 197-200) with@default truein its JSDoc. This duplicate inOpenRouterBaseOptionslacks the default value annotation.If both definitions are intentional (to enable per-model
Pick<>typing), consider aligning the JSDoc or adding a comment explaining why it's defined in both interfaces.♻️ Suggested JSDoc alignment
/** * Whether to allow the model to make multiple tool calls in parallel. + * `@default` true */ parallelToolCalls?: boolean🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/typescript/ai-openrouter/src/text/text-provider-options.ts` around lines 308 - 311, The property parallelToolCalls is duplicated between OpenRouterCommonOptions and OpenRouterBaseOptions with inconsistent JSDoc; either remove the duplicate from OpenRouterBaseOptions if redundant, or align the documentation by adding the same JSDoc (e.g., `@default` true) to the OpenRouterBaseOptions declaration and include a short comment explaining the duplication is intentional to support per-model Pick<> typing (referencing OpenRouterCommonOptions, OpenRouterBaseOptions, and parallelToolCalls to locate the declarations).scripts/convert-openrouter-models.ts (1)
168-172: Consider adding a TODO for future type coverage.Excluding
tools,reasoning_effort, andstructured_outputsis pragmatic since they're either handled elsewhere (toolsinInternalTextProviderOptions) or have no correspondingOpenRouterBaseOptionsfields. However, this means models supporting these features won't have type-checked access via per-model types.📝 Optional: Add TODO comment for future enhancement
const excludedParams = new Set([ 'tools', 'reasoning_effort', 'structured_outputs', ]) + // TODO: Consider adding reasoning_effort and structured_outputs to OpenRouterBaseOptions + // to enable per-model type safety for these capabilities🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/convert-openrouter-models.ts` around lines 168 - 172, Add a TODO comment above the excludedParams Set declaration (the excludedParams variable that contains 'tools', 'reasoning_effort', and 'structured_outputs') noting that these keys are intentionally excluded for now and that future work should extend per-model types to cover tools, reasoning_effort, and structured_outputs (or map them from InternalTextProviderOptions/OpenRouterBaseOptions) so models supporting these features get proper type-checked access. Keep the TODO concise and reference the three excluded keys and the excludedParams identifier so it's easy to find later.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/convert-openrouter-models.ts`:
- Around line 186-188: The runtime "supports" array construction currently uses
model.supported_parameters directly and maps with paramNameMap, which causes
excludedParams (tools, reasoning_effort, structured_outputs) to appear at
runtime even though they're filtered from the generated TypeScript types; update
the supports push to filter model.supported_parameters through the same
excludedParams set before mapping (e.g., model.supported_parameters?.filter(p =>
!excludedParams.has(p)).map(p => paramNameMap[p] ?? p)...) and preserve the
existing join/empty-string behavior so runtime metadata matches the Pick<> type
filtering.
---
Nitpick comments:
In `@packages/typescript/ai-openrouter/src/text/text-provider-options.ts`:
- Around line 308-311: The property parallelToolCalls is duplicated between
OpenRouterCommonOptions and OpenRouterBaseOptions with inconsistent JSDoc;
either remove the duplicate from OpenRouterBaseOptions if redundant, or align
the documentation by adding the same JSDoc (e.g., `@default` true) to the
OpenRouterBaseOptions declaration and include a short comment explaining the
duplication is intentional to support per-model Pick<> typing (referencing
OpenRouterCommonOptions, OpenRouterBaseOptions, and parallelToolCalls to locate
the declarations).
In `@scripts/convert-openrouter-models.ts`:
- Around line 168-172: Add a TODO comment above the excludedParams Set
declaration (the excludedParams variable that contains 'tools',
'reasoning_effort', and 'structured_outputs') noting that these keys are
intentionally excluded for now and that future work should extend per-model
types to cover tools, reasoning_effort, and structured_outputs (or map them from
InternalTextProviderOptions/OpenRouterBaseOptions) so models supporting these
features get proper type-checked access. Keep the TODO concise and reference the
three excluded keys and the excludedParams identifier so it's easy to find
later.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 441907d0-726c-4955-b967-915e4e8075cf
📒 Files selected for processing (5)
packages/typescript/ai-openrouter/src/model-meta.tspackages/typescript/ai-openrouter/src/text/text-provider-options.tspackages/typescript/ai-openrouter/tests/image-adapter.test.tsscripts/convert-openrouter-models.tsscripts/openrouter.models.ts
|
Went through the review comments:
|
The supports array in generated model metadata included tools, reasoning_effort, and structured_outputs which were already filtered from the TypeScript Pick<> types, creating a runtime/type mismatch.
Add missing @default true annotation to OpenRouterBaseOptions to match OpenRouterCommonOptions.
|
related to #312, but fresher? maybe we can join/consolidate changes? |
|
View your CI Pipeline Execution ↗ for commit 3b8e074
☁️ Nx Cloud last updated this comment at |
+1 new model (kwaipilot/kat-coder-pro-v2), -2 removed free variants (mistralai/mistral-small-3.1-24b-instruct:free, qwen/qwen3-4b:free), plus pricing/parameter updates across existing models.
@tanstack/ai
@tanstack/ai-anthropic
@tanstack/ai-client
@tanstack/ai-devtools-core
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-groq
@tanstack/ai-ollama
@tanstack/ai-openai
@tanstack/ai-openrouter
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-react-ui
@tanstack/ai-solid
@tanstack/ai-solid-ui
@tanstack/ai-svelte
@tanstack/ai-vue
@tanstack/ai-vue-ui
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
commit: |
🎯 Changes
Regenerates
model-meta.tsfrom the current OpenRouter/api/v1/modelsendpoint, bringing the type system up to date with all models available on the platform.parallelToolCallstoOpenRouterBaseOptionsNotable new models
gpt-5.4,gpt-5.4-mini,gpt-5.4-nano,gpt-5.4-pro,gpt-5.3-chat,gpt-5.3-codex,gpt-5.2-codexclaude-sonnet-4.6,claude-opus-4.6glm-5-turbo,glm-5,glm-4.7-flashmimo-v2-pro,mimo-v2-omniminimax-m2.7,minimax-m2.5gemini-3.1-flash-lite-preview,gemini-3.1-pro-preview,gemini-3.1-flash-image-previewmistral-small-2603qwen3.5-*series (9b, 27b, 35b, 122b, 397b, plus, flash)kimi-k2.5,mercury-2,solar-pro-3,palmyra-x5,grok-4.20-*Conversion script fixes
The OpenRouter API now returns
supported_parametersin snake_case (e.g.frequency_penalty) whereas the previous data used camelCase. The conversion script only mappedmax_tokens→max_completion_tokensbut missed all other params, causingPick<OpenRouterBaseOptions, 'frequency_penalty'>type errors on build.Fix: Added a complete
paramNameMapthat converts all snake_case API params to their camelCaseOpenRouterBaseOptionsequivalents (frequency_penalty→frequencyPenalty,presence_penalty→presencePenalty,logit_bias→logitBias, etc.).Also fixed duplicate
openrouter/autoentries — the model is now returned by the API directly, so the hardcoded manual additions are skipped when already present.Other changes
parallelToolCalls?: booleantoOpenRouterBaseOptions(2 models use it)image-adapter.test.tsto usegoogle/gemini-2.5-flash-image(the-previewvariant was removed from the catalog)✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
New Features
Tests
Chores