You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
- Upgrade `@openrouter/sdk` to 0.12.14 (from 0.3.15)
6
+
- Migrate adapters and tests to the SDK's renamed chat types (`ChatGenerationParams` → `ChatRequest`, `ChatResponse` → `ChatResult`) and the renamed `chatRequest` key on `chat.send`
7
+
- Derive `text-provider-options` types from the SDK's `ChatRequest` so provider options stay in lockstep with the SDK surface
8
+
- Drop `topK` / `topA` / `minP` / `repetitionPenalty` / `includeReasoning` / `verbosity` / `webSearchOptions` from `OpenRouterBaseOptions` now that the SDK narrows `ChatRequest` to OpenAI-compatible fields — callers passing these previously saw them silently stripped at runtime, and now get a TypeScript error instead
9
+
- Add those same keys to `excludedParams` in the model-catalog generator so future syncs don't reintroduce them
10
+
- Switch `structuredOutput` to the SDK's native `responseFormat: { type: 'json_schema' }` instead of coercing the model via a forced `structured_output` tool call — the schema now flows straight to the provider, yielding cleaner responses and dropping the dummy-tool round-trip
11
+
- Apply the OpenAI-strict schema transformation (`additionalProperties: false`, all properties required, optional fields widened to include `null`) inside `structuredOutput` before forwarding — without this, upstream OpenAI rejected the request with "Provider returned error" for schemas generated by Zod / ArkType / Valibot
12
+
- Refactor options passthrough to use camelCase naming convention
13
+
- Refresh the model catalog with the latest OpenRouter models (Opus 4.6, Sonnet 4.6, Gemini 3.1 Pro, etc.) and remove the deprecated `openrouter/auto` model
14
+
- Unify the outbound request payload envelope
15
+
- Improve error handling and add tests for nested payloads, structured output parsing, and error cases
0 commit comments