Commit 9c68bcc
feat(ai-openrouter): upgrade openrouter SDK to 0.12.14, add builtin structured output support, and refresh models (#312)
* Update openrouter package, models, and scripts to generate openrouter models
Fixes #310
* ci: apply automated fixes
* Added compare script and fixed key name issue in fetch models
Fixes #310
* resolved coderabbit issues
* ci: apply automated fixes
* Added support for openrouter structured output
* Address PR #312 review feedback: improve error handling and cleanup
- 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>
* Update model metadata and pricing in OpenRouter, add new models, and 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.
* ci: apply automated fixes
* Update openrouter package models and added prettier to fetch script
Fixes #310
* Updated models and script
Fixes #310
* ci: apply automated fixes
* Update openrouter package to 0.9.11
Fixes #310
* Refactor OpenRouter options passthrough and bump fal client
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 #310
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor text-provider-options to derive types from SDK's ChatGenerationParams
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>
* ci: apply automated fixes
* Changeset updated
Fixes #310
* ci: apply automated fixes
* chore(ai-openrouter): upgrade @openrouter/sdk to 0.12.13
The SDK renamed every chat-related exported type (ChatGenerationParams →
ChatRequest, ChatResponse → ChatResult, etc.) and renamed the request
wrapper key on chat.send from chatGenerationParams to chatRequest.
Migrate adapters and tests to the new names.
The SDK also narrowed ChatRequest to OpenAI-compatible fields, so Zod
strips topK/topA/minP/repetitionPenalty/includeReasoning/verbosity/
webSearchOptions from outbound requests. Drop these keys from
OpenRouterBaseOptions and the model catalog so callers get a TS error
instead of silent no-op behavior, and add them to excludedParams in the
catalog generator so future syncs stay honest.
Also restore the SDK-derived shape of text-provider-options that was
lost to an upstream merge, re-keyed off ChatRequest.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* ci: apply automated fixes
* chore(ai-openrouter): expand changeset, wire format into generate:models
Rewrite the ai-openrouter changeset to reflect the full scope of the PR:
the 0.12.13 SDK bump (not 0.9.11), the ChatGenerationParams -> ChatRequest
rename, and the deliberate removal of topK/topA/minP/repetitionPenalty/
includeReasoning/verbosity/webSearchOptions from OpenRouterBaseOptions
so callers get a TS error instead of silent stripping.
Append pnpm format to generate:models so regenerated model-meta and
provider files land formatted in a single command. Remove the now-unused
compare-openrouter-models.ts script — the models file is sorted
alphabetically so a plain git diff is sufficient.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Corrected openrouter params in example
Fixes #310
* chore(ai-openrouter): bump @openrouter/sdk to 0.12.14
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(ai-openrouter): clarify changeset, tidy image error check, document common options
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ai-openrouter): explain modelOptions-first spread ordering in text adapter
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ai-openrouter): apply OpenAI-strict transformation to structuredOutput schemas
OpenRouter forwards `json_schema` requests with `strict: true` to upstream
providers (notably OpenAI), which reject schemas that don't mark every property
required and set `additionalProperties: false`. Run the schema through
`convertSchemaToJsonSchema(..., { forStructuredOutput: true })` before sending
so Zod / ArkType / Valibot schemas work out of the box.
Adds adapter-level regression tests covering the transformation (nested
objects, arrays, optional-to-nullable widening) and a structured-output
example page in `ts-react-chat` to exercise the path end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent cb07e01 commit 9c68bcc
File tree
22 files changed
+17138
-9534
lines changed- .changeset
- examples/ts-react-chat/src
- components
- routes
- packages/typescript
- ai-anthropic/src
- ai-openrouter
- src
- adapters
- text
- tests
- scripts
22 files changed
+17138
-9534
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
141 | 155 | | |
142 | 156 | | |
143 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
| |||
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
86 | 99 | | |
87 | 100 | | |
88 | 101 | | |
| |||
119 | 132 | | |
120 | 133 | | |
121 | 134 | | |
| 135 | + | |
122 | 136 | | |
123 | 137 | | |
124 | 138 | | |
125 | 139 | | |
126 | 140 | | |
| 141 | + | |
127 | 142 | | |
128 | 143 | | |
129 | 144 | | |
| |||
138 | 153 | | |
139 | 154 | | |
140 | 155 | | |
| 156 | + | |
141 | 157 | | |
142 | 158 | | |
143 | 159 | | |
144 | 160 | | |
145 | 161 | | |
| 162 | + | |
146 | 163 | | |
147 | 164 | | |
148 | 165 | | |
| |||
158 | 175 | | |
159 | 176 | | |
160 | 177 | | |
| 178 | + | |
161 | 179 | | |
162 | 180 | | |
163 | 181 | | |
164 | 182 | | |
165 | 183 | | |
| 184 | + | |
166 | 185 | | |
167 | 186 | | |
168 | 187 | | |
| |||
179 | 198 | | |
180 | 199 | | |
181 | 200 | | |
| 201 | + | |
182 | 202 | | |
183 | 203 | | |
184 | 204 | | |
185 | 205 | | |
186 | 206 | | |
| 207 | + | |
187 | 208 | | |
188 | 209 | | |
189 | 210 | | |
| |||
198 | 219 | | |
199 | 220 | | |
200 | 221 | | |
| 222 | + | |
201 | 223 | | |
202 | 224 | | |
203 | 225 | | |
204 | 226 | | |
205 | 227 | | |
| 228 | + | |
206 | 229 | | |
207 | 230 | | |
208 | 231 | | |
| |||
217 | 240 | | |
218 | 241 | | |
219 | 242 | | |
| 243 | + | |
220 | 244 | | |
221 | 245 | | |
222 | 246 | | |
223 | 247 | | |
224 | 248 | | |
| 249 | + | |
225 | 250 | | |
226 | 251 | | |
227 | 252 | | |
| |||
237 | 262 | | |
238 | 263 | | |
239 | 264 | | |
| 265 | + | |
240 | 266 | | |
241 | 267 | | |
242 | 268 | | |
243 | 269 | | |
244 | 270 | | |
| 271 | + | |
245 | 272 | | |
246 | 273 | | |
247 | 274 | | |
| |||
296 | 323 | | |
297 | 324 | | |
298 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
299 | 333 | | |
300 | 334 | | |
301 | 335 | | |
| |||
331 | 365 | | |
332 | 366 | | |
333 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
334 | 375 | | |
335 | 376 | | |
336 | 377 | | |
| |||
381 | 422 | | |
382 | 423 | | |
383 | 424 | | |
| 425 | + | |
384 | 426 | | |
385 | 427 | | |
386 | 428 | | |
387 | 429 | | |
388 | 430 | | |
| 431 | + | |
389 | 432 | | |
390 | 433 | | |
391 | 434 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | 149 | | |
152 | 150 | | |
153 | 151 | | |
| |||
0 commit comments