Skip to content

Commit a050da0

Browse files
committed
fix(ai-openrouter): generate OPENROUTER_COMBINED_TOOLS_AND_SCHEMA_MODELS from the catalog
The model sync (#1158) dropped the hand-maintained set. Instead of restoring it by hand, derive it in convert-openrouter-models.ts from each chat model's supported_parameters (structured_outputs + tools + tool_choice), so every sync regenerates it and nothing is curated. Closes #1163
1 parent 6ac4343 commit a050da0

7 files changed

Lines changed: 337 additions & 150 deletions

File tree

.changeset/openrouter-combined-models-restore.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@tanstack/ai-openrouter': patch
33
---
44

5-
Restore `OPENROUTER_COMBINED_TOOLS_AND_SCHEMA_MODELS`, which the model-metadata sync dropped from the generated `model-meta.ts`. The list now lives in its own hand-maintained module and the generator re-exports it, so future syncs can't remove it.
5+
Restore `OPENROUTER_COMBINED_TOOLS_AND_SCHEMA_MODELS`, which the model-metadata sync dropped from the generated `model-meta.ts`. The set is now generated from OpenRouter's catalog (chat models whose `supported_parameters` include `structured_outputs`, `tools` and `tool_choice`) instead of being hand-maintained, so combined tools + `outputSchema` mode now covers every model OpenRouter flags as supporting it.

docs/adapters/openrouter.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,12 @@ upstream models OpenRouter can return the typed object in that same streaming
119119
request, so the engine does not make a second finalization call.
120120

121121
That happens only when **every** model that can receive the request is in
122-
`OPENROUTER_COMBINED_TOOLS_AND_SCHEMA_MODELS`. The set is the upstream models
123-
that already support this combined mode:
124-
125-
- Anthropic Claude 4.5 and later
126-
- Gemini 3.x text models
127-
- Grok 4.x (not the multi-agent variant)
128-
- OpenAI models from the `gpt-4o-2024-08-06` strict JSON Schema era onward
129-
(the unpinned `openai/gpt-4o-mini` alias is included; the dated pin
130-
`openai/gpt-4o-mini-2024-07-18` is not)
122+
`OPENROUTER_COMBINED_TOOLS_AND_SCHEMA_MODELS`. The set is generated from
123+
OpenRouter's catalog on every model sync: every chat model whose
124+
`supported_parameters` include `structured_outputs`, `tools` and `tool_choice`
125+
(Claude 4.5+, Gemini 2.5+, GPT-4o+, Grok 4, DeepSeek V3+, Llama 3.1+, and so
126+
on). Models OpenRouter does not flag, such as `anthropic/claude-opus-4.1`, stay
127+
on the legacy two-call path.
131128

132129
If any fallback in `modelOptions.models` is outside that set, OpenRouter keeps
133130
the two-call path. Routing suffixes such as `:nitro` do not change the gate.

docs/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@
884884
"label": "OpenRouter Adapter",
885885
"to": "adapters/openrouter",
886886
"addedAt": "2026-04-15",
887-
"updatedAt": "2026-08-19"
887+
"updatedAt": "2026-08-20"
888888
},
889889
{
890890
"label": "Perplexity Search",

packages/ai-openrouter/src/combined-tools-and-schema-models.ts

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)