ai-world-sdk 1.5.11 → 1.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/config-cmd.js +1 -1
- package/dist/cli/config.js +3 -2
- package/dist/config.d.ts +3 -3
- package/dist/config.js +11 -5
- package/dist/llm.js +3 -3
- package/dist/vite-plugin.js +3 -1
- package/package.json +3 -2
- package/skills/ai-world-sdk/SKILL.md +1 -0
- package/skills/ai-world-sdk/docs/cli-usage.md +7 -4
- package/pacakges/ai-sdk-provider/.changeset/README.md +0 -34
- package/pacakges/ai-sdk-provider/.changeset/config.json +0 -13
- package/pacakges/ai-sdk-provider/.github/PULL_REQUEST_TEMPLATE.md +0 -16
- package/pacakges/ai-sdk-provider/.github/workflows/ci.yaml +0 -24
- package/pacakges/ai-sdk-provider/.github/workflows/publish-manual.yaml +0 -36
- package/pacakges/ai-sdk-provider/.github/workflows/publish.yaml +0 -107
- package/pacakges/ai-sdk-provider/.vscode/settings.json +0 -32
- package/pacakges/ai-sdk-provider/CHANGELOG.md +0 -631
- package/pacakges/ai-sdk-provider/CLAUDE.md +0 -79
- package/pacakges/ai-sdk-provider/CONTRIBUTING.md +0 -241
- package/pacakges/ai-sdk-provider/LICENSE +0 -201
- package/pacakges/ai-sdk-provider/README.md +0 -426
- package/pacakges/ai-sdk-provider/biome.json +0 -122
- package/pacakges/ai-sdk-provider/e2e/cache-control.test.ts +0 -74
- package/pacakges/ai-sdk-provider/e2e/embeddings/index.test.ts +0 -128
- package/pacakges/ai-sdk-provider/e2e/fixtures/pdfs/generate-pdfs.sh +0 -181
- package/pacakges/ai-sdk-provider/e2e/fixtures/pdfs/large.json +0 -7
- package/pacakges/ai-sdk-provider/e2e/fixtures/pdfs/large.pdf +41 -12894
- package/pacakges/ai-sdk-provider/e2e/gemini/reasoning-multiturn.test.ts +0 -221
- package/pacakges/ai-sdk-provider/e2e/issues/issue-160-toolcallid-uniqueness.test.ts +0 -88
- package/pacakges/ai-sdk-provider/e2e/issues/issue-166-finish-reason-null.test.ts +0 -129
- package/pacakges/ai-sdk-provider/e2e/issues/issue-171-cache-tool-key-ordering.test.ts +0 -70
- package/pacakges/ai-sdk-provider/e2e/issues/issue-181-tool-response-image.test.ts +0 -199
- package/pacakges/ai-sdk-provider/e2e/issues/issue-190-streamobject-flush-error.test.ts +0 -114
- package/pacakges/ai-sdk-provider/e2e/issues/issue-194-grok-invalid-json.test.ts +0 -93
- package/pacakges/ai-sdk-provider/e2e/issues/issue-196-anthropic-1h-cache-ttl.test.ts +0 -85
- package/pacakges/ai-sdk-provider/e2e/issues/issue-199-openai-pdf-processing.test.ts +0 -102
- package/pacakges/ai-sdk-provider/e2e/issues/issue-212-anthropic-web-search-online.test.ts +0 -128
- package/pacakges/ai-sdk-provider/e2e/issues/issue-234-prompt-caching.test.ts +0 -201
- package/pacakges/ai-sdk-provider/e2e/issues/issue-237-reasoning-linebreaks.test.ts +0 -103
- package/pacakges/ai-sdk-provider/e2e/issues/issue-248-gemini-web-search-empty-response.test.ts +0 -210
- package/pacakges/ai-sdk-provider/e2e/issues/issue-269-image-size-parameter.test.ts +0 -208
- package/pacakges/ai-sdk-provider/e2e/issues/issue-287-tool-calls-missing-arguments.test.ts +0 -87
- package/pacakges/ai-sdk-provider/e2e/issues/issue-341-cache-control-last-text-part.test.ts +0 -138
- package/pacakges/ai-sdk-provider/e2e/issues/issue-383-video-url-support.test.ts +0 -120
- package/pacakges/ai-sdk-provider/e2e/issues/issue-386-image-files-parameter.test.ts +0 -109
- package/pacakges/ai-sdk-provider/e2e/issues/issue-387-temperature-settings.test.ts +0 -113
- package/pacakges/ai-sdk-provider/e2e/issues/issue-389-system-cache-control.test.ts +0 -107
- package/pacakges/ai-sdk-provider/e2e/issues/issue-391-reasoning-effort-values.test.ts +0 -121
- package/pacakges/ai-sdk-provider/e2e/issues/issue-392-auto-router-plugin.test.ts +0 -84
- package/pacakges/ai-sdk-provider/e2e/issues/issue-394-reasoning-end-signature.test.ts +0 -157
- package/pacakges/ai-sdk-provider/e2e/issues/issue-407-token-usage-details.test.ts +0 -141
- package/pacakges/ai-sdk-provider/e2e/issues/issue-411-output-object-tools-conflict.test.ts +0 -75
- package/pacakges/ai-sdk-provider/e2e/issues/issue-412-mid-stream-termination.test.ts +0 -217
- package/pacakges/ai-sdk-provider/e2e/issues/issue-413-reasoning-metadata-bloat.test.ts +0 -292
- package/pacakges/ai-sdk-provider/e2e/issues/issue-413-tool-input-end-streaming.test.ts +0 -167
- package/pacakges/ai-sdk-provider/e2e/issues/issue-418-gemini-thought-signature.test.ts +0 -171
- package/pacakges/ai-sdk-provider/e2e/issues/issue-419-420-finish-reason-usage-fallback.test.ts +0 -87
- package/pacakges/ai-sdk-provider/e2e/issues/issue-419-usage-fallback.test.ts +0 -106
- package/pacakges/ai-sdk-provider/e2e/issues/issue-422-incomplete-error-information.test.ts +0 -46
- package/pacakges/ai-sdk-provider/e2e/issues/issue-423-signature-stripped.test.ts +0 -165
- package/pacakges/ai-sdk-provider/e2e/issues/issue-423-streaming-signature-loss.test.ts +0 -161
- package/pacakges/ai-sdk-provider/e2e/issues/issue-423-uimessage-roundtrip.test.ts +0 -111
- package/pacakges/ai-sdk-provider/e2e/issues/issue-424-anthropic-auto-cache.test.ts +0 -66
- package/pacakges/ai-sdk-provider/e2e/issues/issue-432-raw-response-body.test.ts +0 -52
- package/pacakges/ai-sdk-provider/e2e/issues/issue-438-gemini-reasoning-redacted.test.ts +0 -120
- package/pacakges/ai-sdk-provider/e2e/issues/issue-439-exact-payload.test.ts +0 -108
- package/pacakges/ai-sdk-provider/e2e/issues/issue-443-eager-input-streaming.test.ts +0 -204
- package/pacakges/ai-sdk-provider/e2e/issues/issue-453-signature-reopen.test.ts +0 -203
- package/pacakges/ai-sdk-provider/e2e/issues/issue-474-web-search-server-tool.test.ts +0 -102
- package/pacakges/ai-sdk-provider/e2e/issues/issue-483-response-format-strict-option.test.ts +0 -199
- package/pacakges/ai-sdk-provider/e2e/issues/issue-484-image-url-query-params.test.ts +0 -165
- package/pacakges/ai-sdk-provider/e2e/issues/issue-63-web-search-annotations.test.ts +0 -159
- package/pacakges/ai-sdk-provider/e2e/parallel-tool-calls.test.ts +0 -425
- package/pacakges/ai-sdk-provider/e2e/pdf-blob/index.test.ts +0 -139
- package/pacakges/ai-sdk-provider/e2e/pdf-url/index.test.ts +0 -60
- package/pacakges/ai-sdk-provider/e2e/reasoning-effort.test.ts +0 -139
- package/pacakges/ai-sdk-provider/e2e/reasoning-multiturn/index.test.ts +0 -69
- package/pacakges/ai-sdk-provider/e2e/tools-with-reasoning.test.ts +0 -76
- package/pacakges/ai-sdk-provider/e2e/tools.ts +0 -61
- package/pacakges/ai-sdk-provider/e2e/usage-accounting.test.ts +0 -55
- package/pacakges/ai-sdk-provider/e2e/utils.ts +0 -15
- package/pacakges/ai-sdk-provider/e2e/video-generation.test.ts +0 -43
- package/pacakges/ai-sdk-provider/e2e/web-search/index.test.ts +0 -50
- package/pacakges/ai-sdk-provider/example.env.e2e +0 -3
- package/pacakges/ai-sdk-provider/pnpm-lock.yaml +0 -3075
- package/pacakges/ai-sdk-provider/pnpm-workspace.yaml +0 -6
- package/pacakges/ai-sdk-provider/src/chat/convert-to-openrouter-chat-messages.test.ts +0 -3079
- package/pacakges/ai-sdk-provider/src/chat/convert-to-openrouter-chat-messages.ts +0 -618
- package/pacakges/ai-sdk-provider/src/chat/errors.test.ts +0 -97
- package/pacakges/ai-sdk-provider/src/chat/file-parser-schema.test.ts +0 -112
- package/pacakges/ai-sdk-provider/src/chat/file-url-utils.ts +0 -167
- package/pacakges/ai-sdk-provider/src/chat/get-tool-choice.ts +0 -42
- package/pacakges/ai-sdk-provider/src/chat/index.test.ts +0 -6093
- package/pacakges/ai-sdk-provider/src/chat/index.ts +0 -1300
- package/pacakges/ai-sdk-provider/src/chat/is-url.ts +0 -15
- package/pacakges/ai-sdk-provider/src/chat/large-pdf-response.test.ts +0 -108
- package/pacakges/ai-sdk-provider/src/chat/payload-comparison.test.ts +0 -154
- package/pacakges/ai-sdk-provider/src/chat/schemas.ts +0 -288
- package/pacakges/ai-sdk-provider/src/chat/signature-roundtrip.test.ts +0 -777
- package/pacakges/ai-sdk-provider/src/completion/convert-to-openrouter-completion-prompt.ts +0 -150
- package/pacakges/ai-sdk-provider/src/completion/index.test.ts +0 -958
- package/pacakges/ai-sdk-provider/src/completion/index.ts +0 -441
- package/pacakges/ai-sdk-provider/src/completion/schemas.ts +0 -67
- package/pacakges/ai-sdk-provider/src/embedding/index.test.ts +0 -262
- package/pacakges/ai-sdk-provider/src/embedding/index.ts +0 -113
- package/pacakges/ai-sdk-provider/src/embedding/schemas.ts +0 -26
- package/pacakges/ai-sdk-provider/src/facade.ts +0 -131
- package/pacakges/ai-sdk-provider/src/image/index.test.ts +0 -769
- package/pacakges/ai-sdk-provider/src/image/index.ts +0 -206
- package/pacakges/ai-sdk-provider/src/image/schemas.ts +0 -48
- package/pacakges/ai-sdk-provider/src/index.ts +0 -3
- package/pacakges/ai-sdk-provider/src/internal/index.ts +0 -10
- package/pacakges/ai-sdk-provider/src/provider.ts +0 -327
- package/pacakges/ai-sdk-provider/src/schemas/error-response.test.ts +0 -171
- package/pacakges/ai-sdk-provider/src/schemas/error-response.ts +0 -105
- package/pacakges/ai-sdk-provider/src/schemas/format.ts +0 -12
- package/pacakges/ai-sdk-provider/src/schemas/image.ts +0 -23
- package/pacakges/ai-sdk-provider/src/schemas/provider-metadata.ts +0 -91
- package/pacakges/ai-sdk-provider/src/schemas/reasoning-details.ts +0 -92
- package/pacakges/ai-sdk-provider/src/tests/provider-options.test.ts +0 -234
- package/pacakges/ai-sdk-provider/src/tests/stream-usage-accounting.test.ts +0 -409
- package/pacakges/ai-sdk-provider/src/tests/usage-accounting.test.ts +0 -555
- package/pacakges/ai-sdk-provider/src/tests/web-search-tool.test.ts +0 -319
- package/pacakges/ai-sdk-provider/src/tool/web-search.ts +0 -52
- package/pacakges/ai-sdk-provider/src/types/index.ts +0 -114
- package/pacakges/ai-sdk-provider/src/types/openrouter-api-types.ts +0 -83
- package/pacakges/ai-sdk-provider/src/types/openrouter-chat-completions-input.ts +0 -116
- package/pacakges/ai-sdk-provider/src/types/openrouter-chat-settings.ts +0 -233
- package/pacakges/ai-sdk-provider/src/types/openrouter-completion-settings.ts +0 -39
- package/pacakges/ai-sdk-provider/src/types/openrouter-embedding-settings.ts +0 -56
- package/pacakges/ai-sdk-provider/src/types/openrouter-image-settings.ts +0 -49
- package/pacakges/ai-sdk-provider/src/types/openrouter-video-settings.ts +0 -26
- package/pacakges/ai-sdk-provider/src/utils/compute-token-usage.test.ts +0 -186
- package/pacakges/ai-sdk-provider/src/utils/compute-token-usage.ts +0 -55
- package/pacakges/ai-sdk-provider/src/utils/deterministic-stringify.test.ts +0 -87
- package/pacakges/ai-sdk-provider/src/utils/deterministic-stringify.ts +0 -35
- package/pacakges/ai-sdk-provider/src/utils/map-finish-reason.ts +0 -43
- package/pacakges/ai-sdk-provider/src/utils/reasoning-details-duplicate-tracker.test.ts +0 -324
- package/pacakges/ai-sdk-provider/src/utils/reasoning-details-duplicate-tracker.ts +0 -70
- package/pacakges/ai-sdk-provider/src/utils/remove-undefined.ts +0 -12
- package/pacakges/ai-sdk-provider/src/utils/type-guards.ts +0 -6
- package/pacakges/ai-sdk-provider/src/utils/with-stream-error-handling.test.ts +0 -119
- package/pacakges/ai-sdk-provider/src/utils/with-stream-error-handling.ts +0 -25
- package/pacakges/ai-sdk-provider/src/utils/with-user-agent-suffix.test.ts +0 -133
- package/pacakges/ai-sdk-provider/src/utils/with-user-agent-suffix.ts +0 -78
- package/pacakges/ai-sdk-provider/src/version.ts +0 -4
- package/pacakges/ai-sdk-provider/src/video/index.test.ts +0 -515
- package/pacakges/ai-sdk-provider/src/video/index.ts +0 -275
- package/pacakges/ai-sdk-provider/src/video/schemas.ts +0 -36
- package/pacakges/ai-sdk-provider/tsconfig.json +0 -42
- package/pacakges/ai-sdk-provider/tsup.config.ts +0 -28
- package/pacakges/ai-sdk-provider/turbo.json +0 -8
- package/pacakges/ai-sdk-provider/vitest.e2e.config.ts +0 -21
- package/pacakges/ai-sdk-provider/vitest.edge.config.ts +0 -16
- package/pacakges/ai-sdk-provider/vitest.issues.config.ts +0 -28
- package/pacakges/ai-sdk-provider/vitest.node.config.ts +0 -16
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
# @openrouter/ai-sdk-provider
|
|
2
|
-
|
|
3
|
-
## 2.9.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- [#486](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/486) [`82e8014`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/82e8014d2f82325db64e5eb6bf99a0cf781dafef) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add `structuredOutputs.strict` setting to opt out of `response_format.json_schema.strict` (issue #483).
|
|
8
|
-
|
|
9
|
-
Previously the SDK hardcoded `strict: true` whenever a JSON schema response format was used, which made it impossible to route requests to providers that don't advertise support for strict json_schema. Models like `moonshotai/kimi-k2.6` (routed through Parasail/Venice/Io Net) returned HTTP 404 "No endpoints available matching your guardrail restrictions and data policy" because the strict flag eliminated every eligible endpoint.
|
|
10
|
-
|
|
11
|
-
Users can now opt out per-model:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
const model = openrouter.chat("moonshotai/kimi-k2.6", {
|
|
15
|
-
structuredOutputs: { strict: false },
|
|
16
|
-
});
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The default remains `strict: true` for backward compatibility.
|
|
20
|
-
|
|
21
|
-
### Patch Changes
|
|
22
|
-
|
|
23
|
-
- [#485](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/485) [`bf664b1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/bf664b188e773cbe78c12a3f674062e2f6d86082) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix `supportedUrls['image/*']` regex to accept image URLs with query strings or fragments (e.g. `https://cdn.example.com/photo.png?height=200`, `.../photo.webp#frag`). Previously the `$` anchor on the extension caused such URLs to be treated as unsupported, forcing the AI SDK runtime to download and base64-inline them, which bloated conversation history and inflated token usage.
|
|
24
|
-
|
|
25
|
-
- [#489](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/489) [`bb2d4cb`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/bb2d4cb254c1d69dbafd615aba96ff28b2b4261f) Thanks [@0age](https://github.com/0age)! - fix: stop emitting duplicate `tool-call` events when a trailing-whitespace argument delta arrives after a complete tool call
|
|
26
|
-
|
|
27
|
-
In the streaming chat handler, the merge-into-existing-tool-call path enqueues a `tool-call` stream event whenever the accumulated `function.arguments` is parsable JSON. Because `JSON.parse` accepts trailing whitespace, any subsequent argument delta for the same tool-call `index` (e.g. a stray space, newline, or closing-token chunk) leaves the arguments parsable and would re-trigger the emit, producing a second `tool-call` event with the same `toolCallId`. Downstream tool runners (e.g. Vercel AI SDK `streamText`) then execute the tool twice. Observed in production with `moonshotai/kimi-k2.6` via OpenRouter, where the user-visible effect was every outbound message being delivered twice.
|
|
28
|
-
|
|
29
|
-
**`src/chat/index.ts`:**
|
|
30
|
-
|
|
31
|
-
- Merge-path `tool-call` emit is now gated on `!toolCall.sent`, mirroring the new-path behavior. The `sent` flag was already being set after the first emit but was never read on this path.
|
|
32
|
-
|
|
33
|
-
**`src/chat/index.test.ts`:**
|
|
34
|
-
|
|
35
|
-
- Adds a regression test that streams a complete tool call followed by a trailing-whitespace-only argument delta for the same `index` and asserts exactly one `tool-call` event is emitted.
|
|
36
|
-
|
|
37
|
-
## 2.8.1
|
|
38
|
-
|
|
39
|
-
### Patch Changes
|
|
40
|
-
|
|
41
|
-
- [#487](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/487) [`4588197`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/4588197ee1ccd249fdba0d4ad232482203b2a105) Thanks [@louisgv](https://github.com/louisgv)! - fix: preserve empty reasoning_details arrays in multi-turn conversations
|
|
42
|
-
|
|
43
|
-
Some providers (notably DeepSeek V4 in thinking mode) return `reasoning_details: []`
|
|
44
|
-
on turns where they produced no visible reasoning tokens. They require this empty array
|
|
45
|
-
to be sent back in subsequent requests to maintain conversation state; omitting it
|
|
46
|
-
causes 4xx errors on follow-up turns.
|
|
47
|
-
|
|
48
|
-
**`src/chat/index.ts`:**
|
|
49
|
-
|
|
50
|
-
- Stream finish event now always sets `openrouterMetadata.reasoning_details`, even when
|
|
51
|
-
the accumulated array is empty (previously guarded by `length > 0`).
|
|
52
|
-
- Both `reasoning-end` emit sites now always include `providerMetadata.openrouter.reasoning_details`,
|
|
53
|
-
removing the `length > 0` ternary that would drop the field entirely.
|
|
54
|
-
|
|
55
|
-
**`src/chat/convert-to-openrouter-chat-messages.ts`:**
|
|
56
|
-
|
|
57
|
-
- `candidateReasoningDetails` selection now uses `Array.isArray(messageReasoningDetails)`
|
|
58
|
-
instead of `messageReasoningDetails.length > 0` — an explicit `[]` is now treated as
|
|
59
|
-
"metadata was provided" rather than "metadata was absent", and no longer falls through
|
|
60
|
-
to `findFirstReasoningDetails`.
|
|
61
|
-
- The top-level `if (candidateReasoningDetails)` guard no longer requires `length > 0`;
|
|
62
|
-
an empty candidate array still triggers the dedup/signature-filter block.
|
|
63
|
-
- `finalReasoningDetails` is now always set to `uniqueDetails` (the deduplicated array),
|
|
64
|
-
never collapsed to `undefined`. When all entries were duplicate or signature-stripped,
|
|
65
|
-
the empty array is preserved as a meaningful signal.
|
|
66
|
-
- `effectiveReasoning` still requires `finalReasoningDetails.length > 0` — reasoning
|
|
67
|
-
text is never sent alongside an empty details array.
|
|
68
|
-
|
|
69
|
-
## 2.8.0
|
|
70
|
-
|
|
71
|
-
### Minor Changes
|
|
72
|
-
|
|
73
|
-
- [#479](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/479) [`e381895`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/e381895d7f6189d14f5ef34df36f6ac190fb8410) Thanks [@abhinav-pola](https://github.com/abhinav-pola)! - Add video generation support via `provider.videoModel()` implementing the `Experimental_VideoModelV3` interface. Supports text-to-video and image-to-video generation with configurable aspect ratio, resolution, duration, seed, audio generation, and provider options passthrough.
|
|
74
|
-
|
|
75
|
-
## 2.7.0
|
|
76
|
-
|
|
77
|
-
### Minor Changes
|
|
78
|
-
|
|
79
|
-
- [#465](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/465) [`d32823e`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/d32823ee71a6387b0e3022d5c7c9b59e77aa8510) Thanks [@robert-j-y](https://github.com/robert-j-y)! - feat: support Anthropic eager_input_streaming parameter via tool providerOptions
|
|
80
|
-
|
|
81
|
-
Tools can now pass `eager_input_streaming: true` through `providerOptions.openrouter.eager_input_streaming` to enable Anthropic's fine-grained tool streaming, reducing latency for large tool outputs.
|
|
82
|
-
|
|
83
|
-
### Patch Changes
|
|
84
|
-
|
|
85
|
-
- [#477](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/477) [`918d564`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/918d564a999b5bab52bc414cb967cd989ebd8323) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: stop attaching accumulated reasoning_details to reasoning-delta events (#413)
|
|
86
|
-
|
|
87
|
-
Previously, each reasoning-delta chunk carried a full snapshot of all
|
|
88
|
-
accumulatedReasoningDetails in its providerMetadata. For N reasoning
|
|
89
|
-
chunks, this caused O(N²) total payload size.
|
|
90
|
-
|
|
91
|
-
reasoning-start and reasoning-delta events no longer carry providerMetadata.
|
|
92
|
-
The full accumulated reasoning_details are still available on reasoning-end,
|
|
93
|
-
tool-call, and finish events (unchanged).
|
|
94
|
-
|
|
95
|
-
- [#473](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/473) [`839f9b0`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/839f9b0d6dd774adb0e196eb78f4d5707f02b2ba) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: add defensive usage fallback in streaming flush handler (#419)
|
|
96
|
-
|
|
97
|
-
When the standard usage object has undefined totals but openrouterUsage
|
|
98
|
-
has valid token data, the flush handler now copies values from
|
|
99
|
-
openrouterUsage as a fallback. This ensures usage.inputTokens.total and
|
|
100
|
-
usage.outputTokens.total are populated even when providers deliver usage
|
|
101
|
-
data in non-standard chunk formats.
|
|
102
|
-
|
|
103
|
-
- [#388](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/388) [`916c4c1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/916c4c1710318f5c09c3f8d3ad6ae9aad920c552) Thanks [@robert-j-y](https://github.com/robert-j-y)! - feat: add temperature and other common settings to model-level configuration
|
|
104
|
-
|
|
105
|
-
## 2.6.0
|
|
106
|
-
|
|
107
|
-
### Minor Changes
|
|
108
|
-
|
|
109
|
-
- [#475](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/475) [`5b8fa40`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/5b8fa406715a0607ac23f93472a382e32ae24c58) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add `openrouter.tools.webSearch()` provider-defined tool for server-side web search
|
|
110
|
-
|
|
111
|
-
- New `src/tool/web-search.ts` — web search tool factory using `createProviderToolFactory`
|
|
112
|
-
- Updated `OpenRouterProvider` interface with `tools.webSearch` property
|
|
113
|
-
- Updated `getArgs()` to map `LanguageModelV3ProviderTool` to OpenRouter API server tool format (`openrouter:web_search`)
|
|
114
|
-
- Supports optional args: `maxResults`, `searchPrompt`, `engine` ('auto' | 'native' | 'exa')
|
|
115
|
-
|
|
116
|
-
Usage:
|
|
117
|
-
|
|
118
|
-
```ts
|
|
119
|
-
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
120
|
-
import { generateText } from "ai";
|
|
121
|
-
|
|
122
|
-
const openrouter = createOpenRouter();
|
|
123
|
-
const result = await generateText({
|
|
124
|
-
model: openrouter("openai/gpt-4o"),
|
|
125
|
-
tools: {
|
|
126
|
-
web_search: openrouter.tools.webSearch({ maxResults: 5 }),
|
|
127
|
-
},
|
|
128
|
-
prompt: "What are the latest news?",
|
|
129
|
-
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Patch Changes
|
|
133
|
-
|
|
134
|
-
- [#472](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/472) [`44ba7ec`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/44ba7ecc288b4bf3045a5ecd96cbc871507ae0f3) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix non-deterministic JSON serialization of tool call arguments that broke prompt caching
|
|
135
|
-
|
|
136
|
-
When the AI SDK deserializes and re-serializes tool call arguments across turns, the key insertion order may change. `JSON.stringify()` follows insertion order, so semantically identical objects could produce different strings, causing cache misses. This adds a recursive key-sorting utility (`deterministicStringify`) to ensure consistent serialization regardless of key order.
|
|
137
|
-
|
|
138
|
-
## 2.5.1
|
|
139
|
-
|
|
140
|
-
### Patch Changes
|
|
141
|
-
|
|
142
|
-
- [#468](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/468) [`aa7b8c6`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/aa7b8c60124db6ed763d4350400a08172b72381d) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix Gemini "Corrupted thought signature" error in multi-turn conversations (issue #418)
|
|
143
|
-
|
|
144
|
-
Extend signature validation to also cover google-gemini-v1 format. Previously, only Anthropic-format reasoning entries were validated for signatures. Gemini extended thinking also uses signed thought tokens, and corrupted/missing signatures now get stripped before being sent back to the API.
|
|
145
|
-
|
|
146
|
-
## 2.5.0
|
|
147
|
-
|
|
148
|
-
### Minor Changes
|
|
149
|
-
|
|
150
|
-
- [#463](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/463) [`6ad5a9b`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/6ad5a9bee62c3e494edc89aaf6f43c64874e919d) Thanks [@robert-j-y](https://github.com/robert-j-y)! - feat: include raw response body in doGenerate and add video URL support
|
|
151
|
-
|
|
152
|
-
**Issue #432**: `doGenerate()` now includes the raw API response body in `response.body`, matching the behavior of other AI SDK providers (OpenAI, Anthropic). This gives access to OpenRouter-specific fields like `provider`, `cost_details`, `is_byok`, and `native_finish_reason`.
|
|
153
|
-
|
|
154
|
-
**Issue #383**: Video files (`video/mp4`, `video/mpeg`, `video/mov`, `video/webm`) are now correctly converted to `video_url` content parts instead of being treated as generic files. This fixes "File is not a PDF" errors when sending videos to Gemini and other video-capable models.
|
|
155
|
-
|
|
156
|
-
## 2.4.3
|
|
157
|
-
|
|
158
|
-
### Patch Changes
|
|
159
|
-
|
|
160
|
-
- [#460](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/460) [`7fe7005`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/7fe7005a5fd63fc39cf9acc5a3cf220cd5ea74fb) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: emit tool-input-end events in streaming tool call lifecycle
|
|
161
|
-
|
|
162
|
-
Fixes three gaps in the tool call streaming event lifecycle:
|
|
163
|
-
|
|
164
|
-
1. **Multi-chunk merge path**: When tool call arguments arrive across multiple SSE chunks, the `tool-input-end` event was missing before the `tool-call` event. Now emits the complete lifecycle: `tool-input-start → tool-input-delta(s) → tool-input-end → tool-call`.
|
|
165
|
-
|
|
166
|
-
2. **Flush path**: When unsent tool calls are forwarded at stream end, the full `tool-input-start → tool-input-delta → tool-input-end` sequence was missing. Now checks `inputStarted` to emit either the full lifecycle (never streamed) or just `tool-input-end` (partially streamed).
|
|
167
|
-
|
|
168
|
-
3. **Initial chunk arguments**: When the first chunk of a multi-chunk tool call includes partial arguments (e.g. `{"q`), those arguments were silently dropped instead of being emitted as a `tool-input-delta`. Now emits the initial arguments as a delta immediately after `tool-input-start`.
|
|
169
|
-
|
|
170
|
-
## 2.4.2
|
|
171
|
-
|
|
172
|
-
### Patch Changes
|
|
173
|
-
|
|
174
|
-
- [#456](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/456) [`cb7f6c1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/cb7f6c1a2f632917b56c133ce479716d02e93fc6) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix console.warn for signature stripping to respect `AI_SDK_LOG_WARNINGS=false`, preventing warnings from bleeding through TUI and worker threads. Also generate unique IDs for reasoning and text stream events to avoid downstream ID collisions.
|
|
175
|
-
|
|
176
|
-
- [#458](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/458) [`cea746a`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/cea746a71ec1e5d41b3289a7eac75e47a436a468) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fixed duplicate reasoning blocks when signature-only reasoning_details arrive after text content has started. Late-arriving signatures are still accumulated for multi-turn roundtrip via the finish event's providerMetadata, but no longer start a new reasoning block.
|
|
177
|
-
|
|
178
|
-
## 2.4.1
|
|
179
|
-
|
|
180
|
-
### Patch Changes
|
|
181
|
-
|
|
182
|
-
- [#454](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/454) [`b4c3c8f`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/b4c3c8f1794ec5f70b1118a952ed7451d412f53d) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Stop emitting `[REDACTED]` as visible reasoning text for encrypted reasoning details. Encrypted reasoning blobs are opaque data used for multi-turn conversation roundtripping and are already preserved in `providerMetadata.openrouter.reasoning_details`. Previously, the SDK created confusing `[REDACTED]` reasoning content parts for these details; they are now silently skipped while remaining fully available in provider metadata.
|
|
183
|
-
|
|
184
|
-
## 2.4.0
|
|
185
|
-
|
|
186
|
-
### Minor Changes
|
|
187
|
-
|
|
188
|
-
- [#425](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/425) [`495d4cb`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/495d4cb0b76d660de3f8f90440310608e9c8233e) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add `appName` and `appUrl` options to `createOpenRouter()` for setting app identification headers (`X-OpenRouter-Title` and `HTTP-Referer`) on every request. This provides a clean, developer-friendly alternative to manually setting headers.
|
|
189
|
-
|
|
190
|
-
### Patch Changes
|
|
191
|
-
|
|
192
|
-
- [#430](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/430) [`3b31872`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/3b31872b84431c82a8992d0df7c1bb499585ba15) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: infer tool-calls finishReason when tool calls present but finish_reason is unknown (#420)
|
|
193
|
-
|
|
194
|
-
- When finishReason is 'other' (unknown/missing) but tool calls are present, infer 'tool-calls' so agentic loops continue correctly
|
|
195
|
-
- Fixes both streaming (doStream) and non-streaming (doGenerate) paths
|
|
196
|
-
|
|
197
|
-
- [#416](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/416) [`fece5d0`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/fece5d0397a5fec1b0159735ea4c9149bb237ad0) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix mid-stream socket termination (TypeError: terminated) to emit structured error and finish events instead of throwing a raw TypeError
|
|
198
|
-
|
|
199
|
-
## 2.3.3
|
|
200
|
-
|
|
201
|
-
### Patch Changes
|
|
202
|
-
|
|
203
|
-
- [#445](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/445) [`16db454`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/16db454f904bb231dedcbe3b821d88443f03d7df) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: strip reasoning.text entries without valid signatures (#423/#439)
|
|
204
|
-
|
|
205
|
-
When reasoning_details exist but reasoning.text entries lack a signature (lost during custom pruning, DB serialization, or model switching), Anthropic rejects with "Invalid signature in thinking block". This adds validation to filter out signatureless reasoning.text entries before sending to the API.
|
|
206
|
-
|
|
207
|
-
## 2.3.2
|
|
208
|
-
|
|
209
|
-
### Patch Changes
|
|
210
|
-
|
|
211
|
-
- [#446](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/446) [`b1ccc53`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/b1ccc53512b797a5a9b3d638f9a1ce07cd6e30bf) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix multimodal tool results being flattened to strings
|
|
212
|
-
|
|
213
|
-
When a tool returns `output.type = "content"` with structured multimodal parts (text + images), those parts were being JSON.stringified instead of preserved as structured content parts. This prevented models from using vision on images in tool results.
|
|
214
|
-
|
|
215
|
-
Changes:
|
|
216
|
-
|
|
217
|
-
- `getToolResultContent()` now maps each content part to the appropriate OpenRouter format (text, image_url, file) instead of stringifying
|
|
218
|
-
- `ChatCompletionToolMessageParam.content` type updated to accept `string | Array<ChatCompletionContentPart>`
|
|
219
|
-
|
|
220
|
-
Fixes #181
|
|
221
|
-
|
|
222
|
-
## 2.3.1
|
|
223
|
-
|
|
224
|
-
### Patch Changes
|
|
225
|
-
|
|
226
|
-
- [#442](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/442) [`a921eb7`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/a921eb78ecc99f5d7ee9dc0ddebd5cbf0a1f5149) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: strip reasoning text when reasoning_details are missing to prevent "Invalid signature in thinking block" errors (#423)
|
|
227
|
-
|
|
228
|
-
## 2.3.0
|
|
229
|
-
|
|
230
|
-
### Minor Changes
|
|
231
|
-
|
|
232
|
-
- [#431](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/431) [`f488f97`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f488f9756859b85c89970f069c03531f4ecda174) Thanks [@robert-j-y](https://github.com/robert-j-y)! - feat: add explicit cache_control support for Anthropic automatic prompt caching (#424)
|
|
233
|
-
|
|
234
|
-
- Added `cache_control` field to `OpenRouterChatSettings` for typed, discoverable configuration
|
|
235
|
-
- Supports both `cache_control` (snake_case) and `cacheControl` (camelCase) in `providerOptions.openrouter`
|
|
236
|
-
- Enables Anthropic automatic caching via top-level request body directive
|
|
237
|
-
|
|
238
|
-
## 2.2.5
|
|
239
|
-
|
|
240
|
-
### Patch Changes
|
|
241
|
-
|
|
242
|
-
- [#428](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/428) [`6e2ff61`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/6e2ff61c4d2441ff9bfe1a96350417dfe4f225a0) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Surface detailed error information from provider metadata in error messages
|
|
243
|
-
|
|
244
|
-
When OpenRouter returns an error, the top-level `error.message` is often generic (e.g. "Provider returned error"). The actual error details from the upstream provider are in `error.metadata.raw` but were not being surfaced to users.
|
|
245
|
-
|
|
246
|
-
Now `extractErrorMessage` recursively extracts meaningful error messages from `metadata.raw` (which can be a string, JSON string, or nested object) and includes the provider name when available. For example, instead of just "Provider returned error", users will now see "[Anthropic] Your credit balance is too low".
|
|
247
|
-
|
|
248
|
-
## 2.2.4
|
|
249
|
-
|
|
250
|
-
### Patch Changes
|
|
251
|
-
|
|
252
|
-
- [#427](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/427) [`34b1c27`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/34b1c275b9c474659deb2ad8d3e3c8800b0524c3) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: preserve thinking block signature in streaming reasoning deltas
|
|
253
|
-
|
|
254
|
-
Fixed two bugs causing Anthropic thinking block signatures to be lost during streaming:
|
|
255
|
-
|
|
256
|
-
1. Signature-only deltas (containing a signature but no text) were silently dropped by the `if (detail.text)` guard in the reasoning delta handler. These deltas are now emitted with an empty string text, ensuring the signature propagates to downstream consumers.
|
|
257
|
-
|
|
258
|
-
2. Per-delta `providerMetadata.reasoning_details` only contained the current chunk's details instead of an accumulated snapshot. This meant the signature (which arrives in a later delta) was never visible in earlier deltas' metadata. Now each reasoning delta carries a snapshot of all accumulated reasoning details.
|
|
259
|
-
|
|
260
|
-
These fixes prevent "Invalid signature in thinking block" errors in multi-turn conversations with Anthropic models.
|
|
261
|
-
|
|
262
|
-
## 2.2.3
|
|
263
|
-
|
|
264
|
-
### Patch Changes
|
|
265
|
-
|
|
266
|
-
- [#409](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/409) [`7b21d68`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/7b21d684c11847a7e5dd3fb89bff3374169cc4c6) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Compute missing token usage detail fields from available API data
|
|
267
|
-
|
|
268
|
-
Previously, `inputTokens.noCache`, `outputTokens.text`, and `inputTokens.cacheWrite` were always `undefined`, even when the data to compute them was available in the API response. This caused downstream dashboards and analytics to receive misleading values.
|
|
269
|
-
|
|
270
|
-
Now the provider computes these fields:
|
|
271
|
-
|
|
272
|
-
- `inputTokens.noCache` = `total - cacheRead` (non-cached input tokens)
|
|
273
|
-
- `outputTokens.text` = `total - reasoning` (text output tokens)
|
|
274
|
-
- `inputTokens.cacheWrite` = passthrough from `cache_write_tokens` when available
|
|
275
|
-
|
|
276
|
-
This applies to all code paths: chat `doGenerate`, chat `doStream`, completion `doGenerate`, and completion `doStream`.
|
|
277
|
-
|
|
278
|
-
## 2.2.2
|
|
279
|
-
|
|
280
|
-
### Patch Changes
|
|
281
|
-
|
|
282
|
-
- [#405](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/405) [`f7139f1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f7139f180803e24858a12559b3389cd16c64c40e) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Support `files` parameter in image generation for image editing and image-to-image use cases
|
|
283
|
-
|
|
284
|
-
## 2.2.1
|
|
285
|
-
|
|
286
|
-
### Patch Changes
|
|
287
|
-
|
|
288
|
-
- [#403](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/403) [`e3908c6`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/e3908c65484a110e6ff6be7fe5669ec68269c1e3) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add support for `auto-router` plugin to configure allowed models when using `openrouter/auto`
|
|
289
|
-
|
|
290
|
-
## 2.2.0
|
|
291
|
-
|
|
292
|
-
### Minor Changes
|
|
293
|
-
|
|
294
|
-
- [#399](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/399) [`ad0c2e1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/ad0c2e11ab31fe91e2d1e9ff2f218572f57706be) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix system message cache control to use block-level format
|
|
295
|
-
|
|
296
|
-
When cache control is specified on a system message via `providerOptions`, the content is now converted to array format with `cache_control` on the text block, matching the existing behavior for user messages. This ensures consistent Anthropic prompt caching behavior across all message types.
|
|
297
|
-
|
|
298
|
-
Before (message-level cache_control):
|
|
299
|
-
|
|
300
|
-
```json
|
|
301
|
-
{
|
|
302
|
-
"role": "system",
|
|
303
|
-
"content": "...",
|
|
304
|
-
"cache_control": { "type": "ephemeral" }
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
After (block-level cache_control):
|
|
309
|
-
|
|
310
|
-
```json
|
|
311
|
-
{
|
|
312
|
-
"role": "system",
|
|
313
|
-
"content": [
|
|
314
|
-
{
|
|
315
|
-
"type": "text",
|
|
316
|
-
"text": "...",
|
|
317
|
-
"cache_control": { "type": "ephemeral" }
|
|
318
|
-
}
|
|
319
|
-
]
|
|
320
|
-
}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
Fixes #389
|
|
324
|
-
|
|
325
|
-
## 2.1.3
|
|
326
|
-
|
|
327
|
-
### Patch Changes
|
|
328
|
-
|
|
329
|
-
- [#398](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/398) [`50c932c`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/50c932c48d0c4b238a9454e2ba95618495b61810) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add support for reasoning effort values 'xhigh', 'minimal', and 'none' in the reasoning configuration type. Previously only 'high', 'medium', and 'low' were accepted.
|
|
330
|
-
|
|
331
|
-
## 2.1.2
|
|
332
|
-
|
|
333
|
-
### Patch Changes
|
|
334
|
-
|
|
335
|
-
- [#395](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/395) [`23f02f1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/23f02f1b7d87cbe9a1fa99d34dcc261ae989c154) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: include accumulated reasoning_details with signature in reasoning-end stream event
|
|
336
|
-
|
|
337
|
-
When streaming a text-only response (no tool calls) with reasoning enabled, the reasoning-end event now includes the accumulated reasoning_details (with signature) in providerMetadata. This fixes multi-turn conversation failures with Anthropic models where the signature was lost, causing "Invalid signature in thinking block" errors on subsequent turns.
|
|
338
|
-
|
|
339
|
-
## 2.1.1
|
|
340
|
-
|
|
341
|
-
### Patch Changes
|
|
342
|
-
|
|
343
|
-
- [#365](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/365) [`363e232`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/363e232615e3a6430c547a90f45f12b567331911) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: deduplicate reasoning_details across multi-turn conversations to prevent duplicate ID errors
|
|
344
|
-
|
|
345
|
-
## 2.1.0
|
|
346
|
-
|
|
347
|
-
### Minor Changes
|
|
348
|
-
|
|
349
|
-
- [#366](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/366) [`f2b78f5`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f2b78f54f395cd1bce5be9ff3690a8752b991b49) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add imageModel() method to OpenRouter provider for image generation support
|
|
350
|
-
|
|
351
|
-
This adds the `imageModel()` method to the OpenRouter provider, enabling image generation through the AI SDK's `generateImage()` function. The implementation uses OpenRouter's chat completions endpoint with `modalities: ['image', 'text']` to generate images.
|
|
352
|
-
|
|
353
|
-
Features:
|
|
354
|
-
|
|
355
|
-
- Implements `ImageModelV3` interface from AI SDK
|
|
356
|
-
- Supports `aspectRatio` parameter via `image_config`
|
|
357
|
-
- Supports `seed` parameter for reproducible generation
|
|
358
|
-
- Supports provider routing settings (order, allow_fallbacks, etc.)
|
|
359
|
-
- Returns appropriate warnings for unsupported features (n > 1, size)
|
|
360
|
-
- Throws `UnsupportedFunctionalityError` for image editing (files/mask parameters)
|
|
361
|
-
|
|
362
|
-
Usage:
|
|
363
|
-
|
|
364
|
-
```typescript
|
|
365
|
-
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
366
|
-
import { generateImage } from "ai";
|
|
367
|
-
|
|
368
|
-
const openrouter = createOpenRouter();
|
|
369
|
-
const { image } = await generateImage({
|
|
370
|
-
model: openrouter.imageModel("google/gemini-2.5-flash-image"),
|
|
371
|
-
prompt: "A cat wearing a hat",
|
|
372
|
-
aspectRatio: "16:9",
|
|
373
|
-
});
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
- [#361](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/361) [`da10f19`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/da10f190cca86fb8c0942033e1af32d1520760db) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add support for the Response Healing plugin
|
|
377
|
-
|
|
378
|
-
The Response Healing plugin automatically validates and repairs malformed JSON responses from AI models. Enable it by adding `{ id: 'response-healing' }` to the plugins array when using structured outputs with `generateObject`.
|
|
379
|
-
|
|
380
|
-
```typescript
|
|
381
|
-
const model = openrouter("openai/gpt-4o", {
|
|
382
|
-
plugins: [{ id: "response-healing" }],
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
const { object } = await generateObject({
|
|
386
|
-
model,
|
|
387
|
-
schema: z.object({ name: z.string(), age: z.number() }),
|
|
388
|
-
prompt: "Generate a person.",
|
|
389
|
-
});
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
Note: Response Healing only works with non-streaming requests.
|
|
393
|
-
|
|
394
|
-
- [#360](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/360) [`b129d36`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/b129d36987e4a635f86f28bead4259f79dc265d3) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Add includeRawChunks support for streaming
|
|
395
|
-
|
|
396
|
-
When `includeRawChunks: true` is passed to streaming calls, the provider now emits `{ type: 'raw', rawValue: <parsed chunk> }` stream parts for each SSE event, giving consumers access to the raw provider chunks alongside the processed AI SDK stream parts.
|
|
397
|
-
|
|
398
|
-
This feature is available for both chat and completion models.
|
|
399
|
-
|
|
400
|
-
- [#357](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/357) [`f24fac7`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f24fac78fb99341698a5f7a5d44484c61644321c) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Remove dependency on @openrouter/sdk
|
|
401
|
-
|
|
402
|
-
This change removes the external dependency on `@openrouter/sdk` by inlining the necessary type definitions locally. The types are now defined in `src/types/openrouter-api-types.ts`.
|
|
403
|
-
|
|
404
|
-
This reduces the package's dependency footprint and eliminates potential version conflicts with the SDK.
|
|
405
|
-
|
|
406
|
-
### Patch Changes
|
|
407
|
-
|
|
408
|
-
- [#359](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/359) [`85d6633`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/85d6633058f8853d66b6a658c33604af1e9c0233) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix undefined cost field in providerMetadata causing AI SDK validation failures
|
|
409
|
-
|
|
410
|
-
- [#362](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/362) [`bd8794a`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/bd8794a86707ae16eb97c16a01b169e00b524b3c) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: respect user-specified User-Agent headers without modification
|
|
411
|
-
|
|
412
|
-
Previously, when users provided a custom `User-Agent` header via `createOpenRouter({ headers: { 'User-Agent': 'my-app/1.0' } })`, the SDK would append its identifier to the header, resulting in `my-app/1.0, ai-sdk/openrouter/x.x.x`. This was unexpected behavior.
|
|
413
|
-
|
|
414
|
-
Now, user-specified `User-Agent` headers are used verbatim without modification. The SDK identifier is only added as the default when no `User-Agent` header is provided.
|
|
415
|
-
|
|
416
|
-
This also fixes a case-sensitivity bug where `User-Agent` (capitalized) was not recognized as the same header as `user-agent` (lowercase), causing duplicate headers to be sent.
|
|
417
|
-
|
|
418
|
-
Fixes #300
|
|
419
|
-
|
|
420
|
-
- [#363](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/363) [`f2d5034`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f2d5034ef85cc5ef5b16283de5ee45fe8bfeaf64) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Populate usage.raw with OpenRouter raw usage accounting object in finish step
|
|
421
|
-
|
|
422
|
-
- [#364](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/364) [`c6ae94d`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/c6ae94db7b2832fe1bcc6b1722ca7dca9855bc21) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix missing web search citations by making url_citation schema fields optional
|
|
423
|
-
|
|
424
|
-
## 2.0.4
|
|
425
|
-
|
|
426
|
-
### Patch Changes
|
|
427
|
-
|
|
428
|
-
- [#352](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/352) [`d76d566`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/d76d566da54c4ac3133c5abc045297fd4da2f11d) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: handle tool calls with missing arguments field (#287)
|
|
429
|
-
|
|
430
|
-
Made the arguments field optional in the tool_calls schema and default to '{}' (empty JSON object) when missing. This handles cases where upstream providers may omit the arguments field for tools with no parameters.
|
|
431
|
-
|
|
432
|
-
## 2.0.3
|
|
433
|
-
|
|
434
|
-
### Patch Changes
|
|
435
|
-
|
|
436
|
-
- [#351](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/351) [`ac75d1f`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/ac75d1ff825379b918d37ca09a107446fd52cf4c) Thanks [@robert-j-y](https://github.com/robert-j-y)! - fix: only apply message-level cache_control to last text part (#341)
|
|
437
|
-
|
|
438
|
-
When message-level cache_control is set on a user message with multiple parts, it now only applies to the last text part. Non-text parts (images, audio, files) no longer inherit message-level cache_control. Part-specific cache_control still takes precedence and works on all part types.
|
|
439
|
-
|
|
440
|
-
## 2.0.2
|
|
441
|
-
|
|
442
|
-
### Patch Changes
|
|
443
|
-
|
|
444
|
-
- [#344](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/344) [`8228294`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/822829423def7a801b8e4e630370ada4386dc89f) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix parallel tool calls with Claude models when thinking/reasoning is enabled. Previously, reasoning_details were duplicated across all parallel tool calls, causing Anthropic to reject continuation requests.
|
|
445
|
-
|
|
446
|
-
## 2.0.1
|
|
447
|
-
|
|
448
|
-
### Patch Changes
|
|
449
|
-
|
|
450
|
-
- [#337](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/337) [`09f85dc`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/09f85dccd2db2d81de8dd0f9b0b944a5b01a6d8d) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Fix ai peer dependency from exact version 6.0.3 to ^6.0.0
|
|
451
|
-
|
|
452
|
-
## 2.0.0
|
|
453
|
-
|
|
454
|
-
### Major Changes
|
|
455
|
-
|
|
456
|
-
- [#307](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/307) [`6fd68db`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/6fd68dba222d12a555c08c644e27e18949331dbb) Thanks [@pablof7z](https://github.com/pablof7z)! - Add AI SDK v6 support with LanguageModelV3 and EmbeddingModelV3 interfaces
|
|
457
|
-
|
|
458
|
-
### Minor Changes
|
|
459
|
-
|
|
460
|
-
- [#324](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/324) [`d055b96`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/d055b963a16e95beabecb5f880b4b0ec7b0b83c1) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Update zod peerDependency from "^3.24.1 || ^v4" to "^3.25.0 || ^4.0.0". This fixes TypeScript errors ("Cannot find module 'zod/v3'") that occur when users have Zod < 3.25.0 installed, as the subpath exports (zod/v3, zod/v4) were only added in Zod 3.25.0.
|
|
461
|
-
|
|
462
|
-
### Patch Changes
|
|
463
|
-
|
|
464
|
-
- [#326](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/326) [`9f7a125`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/9f7a1259e2fd69e670ebb2a14bdcff5d064ad3d5) Thanks [@robert-j-y](https://github.com/robert-j-y)! - Make file content part fields optional and add file_id support. The `filename` and `file_data` fields in `ChatCompletionContentPartFile` are now optional, and a new `file_id` field has been added for OpenAI file uploads support.
|
|
465
|
-
|
|
466
|
-
## 1.5.4
|
|
467
|
-
|
|
468
|
-
### Patch Changes
|
|
469
|
-
|
|
470
|
-
- [#301](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/301) [`3c0ba4c`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/3c0ba4cfdd70aa3a449604e58f1241c88205974f) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Remove TOON encoding/decoding helper functions
|
|
471
|
-
|
|
472
|
-
BREAKING CHANGE: Removes @toon-format/toon dependency and related exports (encodeToon, decodeToon, ToonEncodeOptions, ToonDecodeOptions, JsonValue). Users who were using these helpers should import directly from @toon-format/toon instead.
|
|
473
|
-
|
|
474
|
-
## 1.5.3
|
|
475
|
-
|
|
476
|
-
### Patch Changes
|
|
477
|
-
|
|
478
|
-
- [#294](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/294) [`83c6b41`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/83c6b41a0bd9d965ad66117527f2dbf44c3130ec) Thanks [@subtleGradient](https://github.com/subtleGradient)! - File annotations from FileParserPlugin are now available in streaming responses.
|
|
479
|
-
If you use `streamText()` with PDFs or other files, you can now access parsed file content via `providerMetadata.openrouter.annotations` in the finish event.
|
|
480
|
-
This was already available for non-streaming responses.
|
|
481
|
-
|
|
482
|
-
## 1.5.2
|
|
483
|
-
|
|
484
|
-
### Patch Changes
|
|
485
|
-
|
|
486
|
-
- [#288](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/288) [`0caf9f1`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/0caf9f174a280598aadce27835605e0b6108e2d3) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Fix Gemini 3 tool-call conversations stopping prematurely when thoughtSignature (encrypted reasoning) is present. Override finishReason from 'stop' to 'tool-calls' when tool calls and encrypted reasoning are detected.
|
|
487
|
-
|
|
488
|
-
## 1.5.1
|
|
489
|
-
|
|
490
|
-
### Patch Changes
|
|
491
|
-
|
|
492
|
-
- [#295](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/295) [`2fbe4e5`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/2fbe4e58e3798790fda99dbde67bc9b3f5e222d0) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Patch transitive security vulnerabilities in glob and js-yaml dev dependencies
|
|
493
|
-
|
|
494
|
-
## 1.5.0
|
|
495
|
-
|
|
496
|
-
### Minor Changes
|
|
497
|
-
|
|
498
|
-
- [#276](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/276) [`eb7d3a2`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/eb7d3a237dadbb09b279fe65cc3c25030d441bc8) Thanks [@jamespsterling](https://github.com/jamespsterling)! - Add TOON encoding/decoding helper functions for token-efficient data serialization
|
|
499
|
-
|
|
500
|
-
### Patch Changes
|
|
501
|
-
|
|
502
|
-
- [#291](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/291) [`5f4a9b9`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/5f4a9b993b8d17cb8c23e890269c785cf5396e29) Thanks [@mstykow](https://github.com/mstykow)! - expand supported audio formats
|
|
503
|
-
|
|
504
|
-
## 1.4.1
|
|
505
|
-
|
|
506
|
-
### Patch Changes
|
|
507
|
-
|
|
508
|
-
- [#279](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/279) [`922dc10`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/922dc1082c13b7c810f5adb2c7606868fa0cab84) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Add first-class embedding model support via OpenRouterEmbeddingModel -- Thanks @Loule95450 !
|
|
509
|
-
|
|
510
|
-
- [#281](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/281) [`4294d67`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/4294d670486d6cf907de6a0cd79ed5866a189b37) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Add `engine` option to `web_search_options` for specifying search engine
|
|
511
|
-
|
|
512
|
-
Users can now specify which search engine to use for web search via `web_search_options.engine`:
|
|
513
|
-
|
|
514
|
-
- `"native"`: Use provider's built-in web search
|
|
515
|
-
- `"exa"`: Use Exa's search API
|
|
516
|
-
- `undefined`: Native if supported, otherwise Exa
|
|
517
|
-
|
|
518
|
-
Thanks to @xdagiz for identifying this missing option in #182.
|
|
519
|
-
|
|
520
|
-
- [#280](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/280) [`f0d3bc9`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f0d3bc9b856889ae34fe0bfc54459d029004ebda) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Fix responseFormat and tools working together
|
|
521
|
-
|
|
522
|
-
Previously, when both `responseFormat` (with a JSON schema) and `tools` were provided to `doGenerate` or `doStream`, the tools would be silently ignored due to an early return in the `getArgs` method. Now both options work correctly together.
|
|
523
|
-
|
|
524
|
-
Thanks to @soksx for identifying and proposing the fix in #175.
|
|
525
|
-
|
|
526
|
-
- [#170](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/170) [`261d44a`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/261d44acca299f502f96ee616d654208c53f54a3) Thanks [@louisgv](https://github.com/louisgv)! - Add api_keys parameter for provider-specific API key injection via X-OpenRouter-API-Keys header
|
|
527
|
-
|
|
528
|
-
## 1.4.0
|
|
529
|
-
|
|
530
|
-
### Minor Changes
|
|
531
|
-
|
|
532
|
-
- [#272](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/272) [`4c7176e`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/4c7176e92bd864657aef40a6d666a62ba9ccb603) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Add support for FileParser annotations to enable "Skip Parsing Costs" feature
|
|
533
|
-
|
|
534
|
-
- Annotations from file parsing are now exposed via `providerMetadata.openrouter.annotations`
|
|
535
|
-
- Pass annotations back via `providerOptions.openrouter.annotations` to skip re-parsing costs
|
|
536
|
-
- See https://openrouter.ai/docs/guides/overview/multimodal/pdfs#skip-parsing-costs
|
|
537
|
-
|
|
538
|
-
### Patch Changes
|
|
539
|
-
|
|
540
|
-
- [#274](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/274) [`4b7814b`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/4b7814b33edec022c3fe202ceef5315c0b160246) Thanks [@yogasanas](https://github.com/yogasanas)! - Add supportsImageUrls property to indicate image URL support for all models
|
|
541
|
-
|
|
542
|
-
## 1.3.0
|
|
543
|
-
|
|
544
|
-
### Minor Changes
|
|
545
|
-
|
|
546
|
-
- [#263](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/263) [`ed2bec5`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/ed2bec549c117375ec2d25f3df370cf23b082df8) Thanks [@talos](https://github.com/talos)! - Add support for debug flag to echo upstream request body
|
|
547
|
-
|
|
548
|
-
- Added `debug` option to `OpenRouterChatSettings` with `echo_upstream_body` boolean
|
|
549
|
-
- The debug flag is passed through to the OpenRouter API in both streaming and non-streaming requests
|
|
550
|
-
- Debug mode only works with streaming requests and returns the upstream request body (with sensitive data redacted) as the first chunk
|
|
551
|
-
- Updated README with usage documentation
|
|
552
|
-
|
|
553
|
-
### Patch Changes
|
|
554
|
-
|
|
555
|
-
- [#266](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/266) [`c3f6381`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/c3f63818b6a432a8fd86cafcf21669d8be18ef71) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Fix token details in providerMetadata to only be included when present in API response. Previously, `promptTokensDetails` and `completionTokensDetails` were always included with default values of 0, which could be misleading. Now they are only included when the API actually returns these details, matching the behavior of `costDetails`.
|
|
556
|
-
|
|
557
|
-
- [#268](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/268) [`6ac3814`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/6ac38143fba8ae64895c4136662ab751bf54bcea) Thanks [@jamespsterling](https://github.com/jamespsterling)! - Add reasoning_details accumulation and providerMetadata support for multi-turn conversations
|
|
558
|
-
|
|
559
|
-
- Accumulate reasoning_details from reasoning parts when converting messages
|
|
560
|
-
- Include reasoning_details in providerMetadata for reasoning delta chunks during streaming
|
|
561
|
-
- Enables users to accumulate reasoning_details across multi-turn conversations
|
|
562
|
-
|
|
563
|
-
- [#246](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/246) [`78d20ef`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/78d20ef3f87df20cf5ce7807d7a29aff40ebcc80) Thanks [@abromberg](https://github.com/abromberg)! - build was failing due to mismatch with @openrouter/sdk types. simply renamed models.Sort to models.ProviderSort and it now builds
|
|
564
|
-
|
|
565
|
-
- [#260](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/260) [`c38eade`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/c38eade5fa31435731df20a49ec1b28866102e25) Thanks [@AviVahl](https://github.com/AviVahl)! - adjust sort type to latest @openrouter/sdk
|
|
566
|
-
|
|
567
|
-
- [#267](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/267) [`89ae694`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/89ae6946ecf8180ec9fdac6c965439ab4519375d) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Adds support for OpenRouter's BYOK usage accounting. If you have a provider's own API key in your OpenRouter account, cost details are now accessible via usage.costDetails.upstreamInferenceCost -- Thanks @abromberg!
|
|
568
|
-
|
|
569
|
-
## 1.2.8
|
|
570
|
-
|
|
571
|
-
### Patch Changes
|
|
572
|
-
|
|
573
|
-
- [#258](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/258) [`a4ac615`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/a4ac615206276b5c71f1d115dd296fa5408bb149) Thanks [@louisgv](https://github.com/louisgv)! - Fix reasoning details passing backup to include signature for Text part
|
|
574
|
-
|
|
575
|
-
## 1.2.7
|
|
576
|
-
|
|
577
|
-
### Patch Changes
|
|
578
|
-
|
|
579
|
-
- [#255](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/255) [`f48fa96`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f48fa963428f20c82f6cceb805a084242b7cbe70) Thanks [@subtleGradient](https://github.com/subtleGradient)! - support for audio input with input_audio format (#241) Thanks @Karavil!
|
|
580
|
-
|
|
581
|
-
## 1.2.6
|
|
582
|
-
|
|
583
|
-
### Patch Changes
|
|
584
|
-
|
|
585
|
-
- [#251](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/251) [`c8c639d`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/c8c639d523e38bb20300d127f23cfa2419692e37) Thanks [@subtleGradient](https://github.com/subtleGradient)! - fix: make text field optional in file annotation content schema
|
|
586
|
-
|
|
587
|
-
When processing PDFs with the file-parser plugin using Mistral OCR, image elements in the response were failing validation. The schema required a `text` field on all content elements, but image elements (`type: "image_url"`) only have `image_url` data—no text. This made it impossible to process PDFs containing images.
|
|
588
|
-
|
|
589
|
-
Thanks @smorimoto for the fix! (#235)
|
|
590
|
-
|
|
591
|
-
## 1.2.4
|
|
592
|
-
|
|
593
|
-
### Patch Changes
|
|
594
|
-
|
|
595
|
-
- [#242](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/242) [`55ac920`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/55ac920ffa386418cdbe9731e5879b2c31259787) Thanks [@subtleGradient](https://github.com/subtleGradient)! - reasoning_details preservation for Gemini 3 multi-turn conversations. Thanks @mattapperson!
|
|
596
|
-
|
|
597
|
-
## 1.2.3
|
|
598
|
-
|
|
599
|
-
### Patch Changes
|
|
600
|
-
|
|
601
|
-
- [#232](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/232) [`2b49df4`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/2b49df448550e393312f129bcfbf260d429e17c7) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Relax zod schemas with passthrough to allow unexpected API fields
|
|
602
|
-
|
|
603
|
-
Add `.passthrough()` to all zod object schemas to prevent validation failures when the API returns extra fields not in our schema definitions. This ensures forward compatibility with API changes and prevents breaking when new fields are added to responses.
|
|
604
|
-
|
|
605
|
-
## 1.2.2
|
|
606
|
-
|
|
607
|
-
### Patch Changes
|
|
608
|
-
|
|
609
|
-
- [#219](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/219) [`8cb1d2d`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/8cb1d2d61ed9b01aa0a1cad630483a3d2792e907) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Replace generic `Error` instances with proper AI SDK error types for improved error handling consistency and debugging.
|
|
610
|
-
|
|
611
|
-
**Error Type Changes:**
|
|
612
|
-
|
|
613
|
-
- Use `APICallError` for HTTP 200 responses with error payloads (includes url, requestBody, statusCode, headers, and error data)
|
|
614
|
-
- Use `NoContentGeneratedError` when API returns no choices (with custom context messages)
|
|
615
|
-
- Use `InvalidResponseDataError` for malformed streaming responses and missing tool calls (with structured data)
|
|
616
|
-
- Use `InvalidArgumentError` for invalid function arguments (with argument name and serialized value)
|
|
617
|
-
|
|
618
|
-
**Benefits:**
|
|
619
|
-
|
|
620
|
-
- Aligns with AI SDK ecosystem error handling patterns
|
|
621
|
-
- Provides structured error data instead of just string messages
|
|
622
|
-
- Enables better error handling and debugging for consumers
|
|
623
|
-
- Preserves all original error context while adding additional debugging information
|
|
624
|
-
|
|
625
|
-
- [#223](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/223) [`9935792`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/9935792f4377a1e461a8b99c71934c3049a47f31) Thanks [@HashimMufti](https://github.com/HashimMufti)! - fix: support file annotation type for file uploads
|
|
626
|
-
|
|
627
|
-
## 1.2.1
|
|
628
|
-
|
|
629
|
-
### Patch Changes
|
|
630
|
-
|
|
631
|
-
- [#214](https://github.com/OpenRouterTeam/ai-sdk-provider/pull/214) [`f29f61f`](https://github.com/OpenRouterTeam/ai-sdk-provider/commit/f29f61f298294e7b44fdbc160870e13e6b411117) Thanks [@subtleGradient](https://github.com/subtleGradient)! - Add changeset support for automated release management. This replaces the manual version bump and GitHub Release process with an automated workflow that creates version PRs and publishes to npm when merged.
|