feat: Update openrouter package, models, and scripts to generate openrouter models#312
feat: Update openrouter package, models, and scripts to generate openrouter models#312tombeckenham wants to merge 18 commits intoTanStack:mainfrom
Conversation
|
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:
📝 WalkthroughWalkthroughBumps OpenRouter SDK to 0.8.0; wraps text and image adapter request payloads inside Changes
Sequence Diagram(s)sequenceDiagram
participant Fetcher as scripts/fetch-openrouter-models.ts
participant Remote as openrouter.ai API
participant FS as Local filesystem (scripts/openrouter.models.ts)
Fetcher->>Remote: GET /api/v1/models
Remote-->>Fetcher: 200 JSON models
Note right of Fetcher: validate & serialize to TypeScript literals
Fetcher->>FS: write updated scripts/openrouter.models.ts
FS-->>Fetcher: write success
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
|
View your CI Pipeline Execution ↗ for commit ed027a1
☁️ Nx Cloud last updated this comment at |
@tanstack/ai
@tanstack/ai-anthropic
@tanstack/ai-client
@tanstack/ai-devtools-core
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@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: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/fetch-openrouter-models.ts (1)
69-73: Content after the original models array will be silently dropped.Line 73 reconstructs the file as
preamble + ARRAY_START + entries + "]", discarding anything that existed after the array's closing bracket in the original file. Ifopenrouter.models.tsever gains trailing exports or content, they'll be lost. This is fine if the file is known to end with the array, but worth a note.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/fetch-openrouter-models.ts` around lines 69 - 73, The current reconstruction builds output as `${preamble}${ARRAY_START}\n${modelEntries.join('\n')}\n]\n` which discards any content after the original array; modify the logic that writes `output` (referencing preamble, ARRAY_START, modelEntries, serializeValue and models) to preserve the original file's trailing content by locating the end of the original array in the source (e.g., find the closing `]` for ARRAY_START or use a regex) and capturing the suffix (originalSuffix) and then produce output as `preamble + ARRAY_START + entries + closingBracket + originalSuffix` so any trailing exports or other content remain intact. Ensure you handle cases with trailing whitespace or comments when computing the array end index.
🤖 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/fetch-openrouter-models.ts`:
- Around line 36-44: The serializer emits object keys raw which breaks
TypeScript when keys contain hyphens or start with digits; update the
serializeValue logic (the branch handling typeof value === 'object' that builds
entries and lines) to detect whether each key is a valid JS identifier (e.g.
match /^[A-Za-z_$][A-Za-z0-9_$]*$/) and if not, quote and escape the key (use a
safe stringifier like JSON.stringify(key)) before producing `${childPad}${k}:
...`; keep existing comma/formatting but replace unquoted k with the quoted form
so keys like "some-key" or "123a" produce valid TS output.
---
Nitpick comments:
In `@scripts/fetch-openrouter-models.ts`:
- Around line 69-73: The current reconstruction builds output as
`${preamble}${ARRAY_START}\n${modelEntries.join('\n')}\n]\n` which discards any
content after the original array; modify the logic that writes `output`
(referencing preamble, ARRAY_START, modelEntries, serializeValue and models) to
preserve the original file's trailing content by locating the end of the
original array in the source (e.g., find the closing `]` for ARRAY_START or use
a regex) and capturing the suffix (originalSuffix) and then produce output as
`preamble + ARRAY_START + entries + closingBracket + originalSuffix` so any
trailing exports or other content remain intact. Ensure you handle cases with
trailing whitespace or comments when computing the array end index.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
.changeset/giant-garlics-crash.mdpackage.jsonpackages/typescript/ai-openrouter/package.jsonpackages/typescript/ai-openrouter/src/adapters/image.tspackages/typescript/ai-openrouter/src/adapters/text.tspackages/typescript/ai-openrouter/src/model-meta.tspackages/typescript/ai-openrouter/tests/image-adapter.test.tspackages/typescript/ai-openrouter/tests/openrouter-adapter.test.tsscripts/convert-openrouter-models.tsscripts/fetch-openrouter-models.tsscripts/openrouter.models.ts
tombeckenham
left a comment
There was a problem hiding this comment.
I created a script to compare the model list. Wondering if it should be sorted in the future
Added models (28)
allenai/molmo-2-8banthropic/claude-opus-4.6anthropic/claude-sonnet-4.6arcee-ai/trinity-large-preview:freegoogle/gemini-3.1-pro-previewliquid/lfm-2.5-1.2b-instruct:freeliquid/lfm-2.5-1.2b-thinking:freeminimax/minimax-m2-herminimax/minimax-m2.5moonshotai/kimi-k2.5openai/gpt-5.2-codexopenai/gpt-audioopenai/gpt-audio-miniopenrouter/autoopenrouter/bodybuilderopenrouter/freeqwen/qwen3-coder-nextqwen/qwen3-max-thinkingqwen/qwen3-next-80b-a3b-instruct:freeqwen/qwen3.5-397b-a17bqwen/qwen3.5-plus-02-15stepfun/step-3.5-flashstepfun/step-3.5-flash:freeupstage/solar-pro-3:freewriter/palmyra-x5xiaomi/mimo-v2-flashz-ai/glm-4.7-flashz-ai/glm-5
Removed models (39)
ai21/jamba-mini-1.7allenai/molmo-2-8b:freeanthropic/claude-3.5-haiku-20241022deepcogito/cogito-v2-preview-llama-109b-moedeepcogito/cogito-v2-preview-llama-405bdeepcogito/cogito-v2-preview-llama-70bdeepseek/deepseek-prover-v2deepseek/deepseek-r1-0528-qwen3-8bdeepseek/deepseek-r1-distill-qwen-14bgoogle/gemini-2.0-flash-exp:freegoogle/gemini-2.5-flash-image-previewgoogle/gemini-2.5-flash-preview-09-2025meta-llama/llama-3.1-405b-instruct:freemeta-llama/llama-3.2-90b-vision-instructmicrosoft/phi-4-multimodal-instructmicrosoft/phi-4-reasoning-plusminimax/minimax-m1-80kmistral/ministral-8bmistralai/devstral-2512:freemistralai/devstral-small-2505mistralai/ministral-3bmistralai/ministral-8bmistralai/mistral-7b-instruct:freemistralai/mistral-tinymistralai/pixtral-12bmoonshotai/kimi-dev-72bmoonshotai/kimi-k2:freenousresearch/deephermes-3-mistral-24b-previewopenai/chatgpt-4o-latestopenai/codex-miniqwen/qwen-2.5-vl-7b-instruct:freeqwen/qwen3-vl-4b-instructstepfun-ai/step3tngtech/deepseek-r1t-chimeratngtech/deepseek-r1t-chimera:freetngtech/deepseek-r1t2-chimera:freetngtech/tng-r1t-chimeratngtech/tng-r1t-chimera:freexiaomi/mimo-v2-flash:free
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
scripts/compare-openrouter-models.ts (2)
97-105:stderrfrom git leaks to the console before the friendly error message
execSyncinherits the parent'sstdioby default, so whengit show main:…fails (e.g., wrong branch name), git's own error is printed before yourconsole.errormessage. Suppress it explicitly:♻️ Proposed fix
mainSource = execSync(`git show main:${modelsPath}`, { encoding: 'utf-8', + stdio: ['pipe', 'pipe', 'pipe'], })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/compare-openrouter-models.ts` around lines 97 - 105, The call to execSync when populating mainSource (execSync(`git show main:${modelsPath}`)) inherits the parent's stdio so git's stderr leaks to the console before your friendly message; change the execSync options to explicitly capture stdio (e.g., add stdio: 'pipe' alongside encoding) and when catching the error log the captured error.message (or error.stderr) in your console.error so the raw git output is suppressed and you still surface useful error details before calling process.exit(1).
12-19: snake_case identifiers violate the camelCase guideline
context_length,pricing_prompt, andpricing_completionappear as both interface properties (Lines 15–17) and local variable names (Lines 36–40). Even if the interface mirrors the OpenRouter API payload, the local variables are pure in-script identifiers and should use camelCase.♻️ Proposed rename
interface ModelSnapshot { id: string name: string - context_length: string - pricing_prompt: string - pricing_completion: string + contextLength: string + pricingPrompt: string + pricingCompletion: string modality: string }- const context_length = - block.match(/^\s*context_length:\s*(.+),?\s*$/m)?.[1] ?? '' - const pricing_prompt = block.match(/prompt:\s*'([^']+)'/)?.[1] ?? '' - const pricing_completion = block.match(/completion:\s*'([^']+)'/)?.[1] ?? '' + const contextLength = + block.match(/^\s*context_length:\s*(.+),?\s*$/m)?.[1] ?? '' + const pricingPrompt = block.match(/prompt:\s*'([^']+)'/)?.[1] ?? '' + const pricingCompletion = block.match(/completion:\s*'([^']+)'/)?.[1] ?? ''Update
models.set(...)anddescribeChangesaccordingly.As per coding guidelines: "Use camelCase for function and variable names throughout the codebase."
Also applies to: 35-40
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/compare-openrouter-models.ts` around lines 12 - 19, Rename the snake_case identifiers to camelCase: change ModelSnapshot properties context_length, pricing_prompt, pricing_completion to contextLength, pricingPrompt, pricingCompletion and update any local variables/destructuring that use those names; then update the call sites referenced (models.set(...) and describeChanges) to use the new camelCase names. If the interface must mirror the external API payload, add a mapping step when parsing the API response to convert context_length -> contextLength, pricing_prompt -> pricingPrompt, pricing_completion -> pricingCompletion before storing in ModelSnapshot and before calling models.set or describeChanges.
🤖 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/compare-openrouter-models.ts`:
- Around line 36-37: The regex assigned to context_length (the block.match call)
is greedy and can capture a trailing comma; update the pattern to avoid greedy
capture — e.g., replace the `(.+),?\s*$` part with a non-greedy or
comma-excluding capture like `(.+?)\s*,?\s*$` or `([^,]+)\s*,?\s*$`, then trim
the resulting match before using it so context_length stores the clean value;
locate the block.match(...) expression and update its regex and/or apply .trim()
to the captured group.
- Around line 91-94: The code uses import.meta.dirname when building the path
for readFileSync (currentSource) but import.meta.dirname is only defined on Node
>=20.11.0; add a Node-compatibility fallback: detect if import.meta.dirname is
undefined and compute a dirname from import.meta.url using fileURLToPath +
dirname (or use an existing __dirname helper) and then use that resolvedDir in
the resolve(...) call that builds the path for modelsPath before calling
readFileSync; update references to import.meta.dirname in this file (e.g., the
expression passed to resolve for currentSource) to use the fallback variable so
the script works on Node 18.x and earlier 20.x releases.
---
Nitpick comments:
In `@scripts/compare-openrouter-models.ts`:
- Around line 97-105: The call to execSync when populating mainSource
(execSync(`git show main:${modelsPath}`)) inherits the parent's stdio so git's
stderr leaks to the console before your friendly message; change the execSync
options to explicitly capture stdio (e.g., add stdio: 'pipe' alongside encoding)
and when catching the error log the captured error.message (or error.stderr) in
your console.error so the raw git output is suppressed and you still surface
useful error details before calling process.exit(1).
- Around line 12-19: Rename the snake_case identifiers to camelCase: change
ModelSnapshot properties context_length, pricing_prompt, pricing_completion to
contextLength, pricingPrompt, pricingCompletion and update any local
variables/destructuring that use those names; then update the call sites
referenced (models.set(...) and describeChanges) to use the new camelCase names.
If the interface must mirror the external API payload, add a mapping step when
parsing the API response to convert context_length -> contextLength,
pricing_prompt -> pricingPrompt, pricing_completion -> pricingCompletion before
storing in ModelSnapshot and before calling models.set or describeChanges.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
scripts/compare-openrouter-models.tsscripts/fetch-openrouter-models.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- scripts/fetch-openrouter-models.ts
There was a problem hiding this comment.
🧹 Nitpick comments (2)
scripts/compare-openrouter-models.ts (2)
18-25: Renamesnake_casefields tocamelCaseper coding guidelines
context_length,pricing_prompt, andpricing_completionappear as both interface properties and local variables — all in snake_case. These are purely internal identifiers with no external schema dependency, so they should follow the project's camelCase convention.♻️ Proposed rename
interface ModelSnapshot { id: string name: string - context_length: string - pricing_prompt: string - pricing_completion: string + contextLength: string + pricingPrompt: string + pricingCompletion: string modality: string }- const context_length = ( + const contextLength = ( block.match(/^\s*context_length:\s*([^,]+)\s*,?\s*$/m)?.[1] ?? '' ).trim() - const pricing_prompt = block.match(/prompt:\s*'([^']+)'/)?.[1] ?? '' - const pricing_completion = block.match(/completion:\s*'([^']+)'/)?.[1] ?? '' + const pricingPrompt = block.match(/prompt:\s*'([^']+)'/)?.[1] ?? '' + const pricingCompletion = block.match(/completion:\s*'([^']+)'/)?.[1] ?? '' models.set(id, { id, name, - context_length, - pricing_prompt, - pricing_completion, + contextLength, + pricingPrompt, + pricingCompletion, modality, })And update
describeChangesproperty accesses accordingly:- if (oldModel.context_length !== newModel.context_length) { - changes.push(`context_length: ${oldModel.context_length} → ${newModel.context_length}`) + if (oldModel.contextLength !== newModel.contextLength) { + changes.push(`context_length: ${oldModel.contextLength} → ${newModel.contextLength}`) } - if (oldModel.pricing_prompt !== newModel.pricing_prompt) { - changes.push(`prompt price: ${oldModel.pricing_prompt} → ${newModel.pricing_prompt}`) + if (oldModel.pricingPrompt !== newModel.pricingPrompt) { + changes.push(`prompt price: ${oldModel.pricingPrompt} → ${newModel.pricingPrompt}`) } - if (oldModel.pricing_completion !== newModel.pricing_completion) { - changes.push(`completion price: ${oldModel.pricing_completion} → ${newModel.pricing_completion}`) + if (oldModel.pricingCompletion !== newModel.pricingCompletion) { + changes.push(`completion price: ${oldModel.pricingCompletion} → ${newModel.pricingCompletion}`) }As per coding guidelines: "Use camelCase for function and variable names throughout the codebase" (
**/*.{ts,tsx,js,jsx}).Also applies to: 41-47
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/compare-openrouter-models.ts` around lines 18 - 25, The interface ModelSnapshot and its related local variables use snake_case for internal fields (context_length, pricing_prompt, pricing_completion); rename these to camelCase (contextLength, pricingPrompt, pricingCompletion) in the ModelSnapshot interface and everywhere they're referenced (including any local vars and in describeChanges property accesses) to follow project conventions; update all property reads/writes and any destructuring or assignments that reference context_length, pricing_prompt, pricing_completion (including the other occurrences noted around the compare/describe logic) so the code compiles with the new names.
117-123:currentSet/mainSetare redundant —Map.has()already gives O(1) lookup
currentModelsandmainModelsare already Maps, so creating intermediate Sets adds allocations without benefit.♻️ Proposed simplification
const currentIds = [...currentModels.keys()] const mainIds = [...mainModels.keys()] -const currentSet = new Set(currentIds) -const mainSet = new Set(mainIds) -const added = currentIds.filter((id) => !mainSet.has(id)).sort() -const removed = mainIds.filter((id) => !currentSet.has(id)).sort() +const added = currentIds.filter((id) => !mainModels.has(id)).sort() +const removed = mainIds.filter((id) => !currentModels.has(id)).sort()And update the
showUpdatedblock:- if (!mainSet.has(id)) continue + if (!mainModels.has(id)) continue🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/compare-openrouter-models.ts` around lines 117 - 123, The current code creates unnecessary Sets (currentSet/mainSet) from currentModels and mainModels maps; remove those allocations and use Map.has() directly: compute currentIds and mainIds as before, then compute added by filtering currentIds with !mainModels.has(id) and removed by filtering mainIds with !currentModels.has(id), and update any related logic in the showUpdated block to call currentModels.has(...) / mainModels.has(...) instead of checking the removed/added Sets so all lookups use the existing Map.has O(1) method.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@scripts/compare-openrouter-models.ts`:
- Around line 18-25: The interface ModelSnapshot and its related local variables
use snake_case for internal fields (context_length, pricing_prompt,
pricing_completion); rename these to camelCase (contextLength, pricingPrompt,
pricingCompletion) in the ModelSnapshot interface and everywhere they're
referenced (including any local vars and in describeChanges property accesses)
to follow project conventions; update all property reads/writes and any
destructuring or assignments that reference context_length, pricing_prompt,
pricing_completion (including the other occurrences noted around the
compare/describe logic) so the code compiles with the new names.
- Around line 117-123: The current code creates unnecessary Sets
(currentSet/mainSet) from currentModels and mainModels maps; remove those
allocations and use Map.has() directly: compute currentIds and mainIds as
before, then compute added by filtering currentIds with !mainModels.has(id) and
removed by filtering mainIds with !currentModels.has(id), and update any related
logic in the showUpdated block to call currentModels.has(...) /
mainModels.has(...) instead of checking the removed/added Sets so all lookups
use the existing Map.has O(1) method.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/typescript/ai-openrouter/src/adapters/text.ts`:
- Around line 239-242: The code currently does JSON.parse(rawText) even when
result.choices is empty or message.content is null/empty; update the parsing
block in the adapter (the code around
result.choices[0]?.message.content/rawText) to first check that result.choices
exists and that content is a non-empty string, and only then call JSON.parse; if
content is missing or empty return a clear failure value (e.g., { data: null,
rawText: '' } or throw a specific error) so the caller can distinguish "no
content" from "invalid JSON" — reference the variables result, choices,
message.content, rawText and perform the guard before JSON.parse.
- Around line 116-119: The call to this.client.chat.send currently wraps the
ChatGenerationParams in a { chatGenerationParams: ... } object which produces a
malformed payload; change both the streaming call (where you pass {
chatGenerationParams: { ...requestParams, stream: true } }) and the
non-streaming call to pass the flat ChatGenerationParams directly as the first
argument (i.e., pass { ...requestParams, stream: true } for streaming and {
...requestParams } for non-streaming). Locate usages where mapTextOptionsToSDK()
(which already returns ChatGenerationParams) is used and update chat.send(...)
invocations accordingly (also fix the same pattern in other adapters such as
image.ts).
In `@packages/typescript/ai-openrouter/src/text/text-provider-options.ts`:
- Around line 281-291: The response_format type in OpenRouterBaseOptions uses
snake_case (json_schema) which doesn't match the SDK's ChatGenerationParams
expecting camelCase (jsonSchema); update the response_format union to rename the
json_schema property to jsonSchema so the shape matches what structuredOutput
and mapTextOptionsToSDK expect, ensuring modelOptions spread into
mapTextOptionsToSDK preserves the schema.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.changeset/giant-garlics-crash.mdpackages/typescript/ai-openrouter/src/adapters/text.tspackages/typescript/ai-openrouter/src/text/text-provider-options.tspackages/typescript/ai-openrouter/tests/openrouter-adapter.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/typescript/ai-openrouter/tests/openrouter-adapter.test.ts
- .changeset/giant-garlics-crash.md
packages/typescript/ai-openrouter/src/text/text-provider-options.ts
Outdated
Show resolved
Hide resolved
…leanup - Add explicit guard for empty content in structuredOutput before JSON.parse - Remove redundant Sets in compare script (Map.has() is already O(1)) - Suppress stderr leaks from execSync in compare script - Update example to use valid model name Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
let's update the PR! |
tombeckenham
left a comment
There was a problem hiding this comment.
I'll take a look tomorrow at the conflicts. Did you change much on main?
…refactor parameter handling - Introduced new models: AI21 Jamba Large 1.7, AionLabs Aion-1.0, AionLabs Aion-1.0 Mini, AionLabs Aion-2.0, AionLabs Aion-RP Llama 3.1 8B, AlfredPros CodeLLaMa 7B Instruct Solidity, and Tongyi DeepResearch 30B A3B. - Updated existing model parameters, including context windows and max output tokens. - Refactored parameter handling in scripts to improve consistency and readability, including the introduction of a mapping function for API parameters. - Adjusted pricing structures for several models to reflect updated costs. - Ensured all model entries are sorted for better organization.
tombeckenham
left a comment
There was a problem hiding this comment.
This is updated now. Great that everything is now camelCase. I've also added sorting to the model meta generation to make it easier to compare changes in the future.
tombeckenham
left a comment
There was a problem hiding this comment.
Wait... just realised openrouter updated the sdk again since we started this PR
Spread modelOptions first in request construction so provider-specific options pass through correctly, only override with explicit options when defined. Remove unused InternalTextProviderOptions import. Bump @fal-ai/client to ^1.9.4. Fixes TanStack#310 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ionParams Replace hand-written interfaces with type aliases derived from @openrouter/sdk's ChatGenerationParams, eliminating type drift and keeping provider options aligned with the SDK automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tombeckenham
left a comment
There was a problem hiding this comment.
I've updated this now. The types we needed are now exported from the openrouter sdk, so I've removed our duplicate definiations. There's a few parameters that are no longer supported through the sdk. By doing this, I could remove the cast in the text adapter to preserve type safety all the way through.
OpenRouter appears to be moving further down the track of "taking anything" then using the backend to accept or reject. There's quite a few instances where the supported_paramaters don't cleanly map to what the model supports.
Parameters that map cleanly (snake_case in Parameter → camelCase in ChatGenerationParams):
supportedParameters value |
ChatGenerationParams field |
|---|---|
temperature |
temperature |
top_p |
topP |
frequency_penalty |
frequencyPenalty |
presence_penalty |
presencePenalty |
max_tokens |
maxTokens / maxCompletionTokens |
logit_bias |
logitBias |
logprobs |
logprobs |
top_logprobs |
topLogprobs |
seed |
seed |
response_format |
responseFormat |
stop |
stop |
tools |
tools |
tool_choice |
toolChoice |
parallel_tool_calls |
parallelToolCalls |
reasoning |
reasoning |
Parameters in the enum with NO corresponding ChatGenerationParams field:
top_kmin_ptop_arepetition_penaltyinclude_reasoning(separate fromreasoning)reasoning_effort(separate fromreasoning)web_search_optionsverbosity
The image generation needs a bit of work as there's no type safety at all in image generation, and it's clear the open router team hasn't done much to support image generation yet in the sdk either.
ready to go through
Fixes #310
🎯 Changes
@openrouter/sdkfrom 0.8.0 to 0.9.11text-provider-optionsto derive types from SDK'sChatGenerationParams✅ Checklist
pnpm run test:pr.🚀 Release Impact