backport v6 - #5
Open
callycodes wants to merge 3552 commits into
Open
Conversation
…ations (#18402) ## Background Spliced Anthropic streams silently merged separate generations, corrupting signed thinking history and causing subsequent tool-loop requests to fail. ## Root Cause The Anthropic stream transform did not track whether a message was open or its ID; reproduction showed a second message_start overwrote metadata while existing content state remained, merging both generations. ## Summary Added message lifecycle tracking that ignores same-ID duplicate starts, emits InvalidResponseDataError for a different message while one is open, and suppresses remaining invalid stream events. ## Testing Added Node and Edge regression coverage for spliced generations and benign duplicate message_start events, while preserving sequential programmatic tool-calling streams. ## End-to-end Validation - `pnpm -C packages/anthropic build` followed by the reproduction script: emitted one InvalidResponseDataError, no second-message metadata or finish event, and only one metadata event for the same-ID duplicate. ## Related Issues Fixes #18331 Closes #18397 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: Lars Grammel <205036+lgrammel@users.noreply.github.com> Co-authored-by: ro-hansolo <87645076+ro-hansolo@users.noreply.github.com>
…18403) ## Background Completed time-sliced HarnessAgent workflows returned session and finish data but omitted available aggregate token usage from finalResult. ## Root Cause workflow-harness normalized only nested provider-style inputTokens.total and outputTokens.total fields, while HarnessStreamTextResult.totalUsage supplies flat numeric token counts; the reproduction confirmed this mismatch produced undefined usage. ## Summary Updated usage normalization to accept flat AI SDK token counts while retaining nested-shape compatibility, added a patch changeset, and removed reproduction-only artifacts. ## Testing Added regression coverage verifying that a continued time-sliced run preserves flat aggregate input and output token counts. ## End-to-end Validation - `pnpm -C packages/workflow-harness build` followed by replaying the original reproduction with `pnpm -C examples/ai-functions exec tsx -e`: the two-slice workflow completed with `{ inputTokens: 120, outputTokens: 30 }`. ## Related Issues Fixes #18335 Closes #18398 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: Lars Grammel <205036+lgrammel@users.noreply.github.com> Co-authored-by: eirikhaugstulen <12842868+eirikhaugstulen@users.noreply.github.com>
…Gateway requests (#18497) ## Background Follow-up fix for #16879: The Claude Code harness unconditionally set its custom client-app environment variable, causing direct Anthropic requests to receive AI Gateway-specific attribution headers. ## Summary - Set `CLAUDE_AGENT_SDK_CLIENT_APP` only when auth resolves to AI Gateway. - Add regression coverage for both AI Gateway and direct Anthropic auth. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
Adds `@ai-sdk/fish-audio` with speech (TTS) and transcription (STT)
models.
Groundwork for adding Fish Audio to AI Gateway (AIG-411), which needs a
published provider package. Gateway wiring follows in a separate PR once
this releases.
## Models
| Fish Audio endpoint | Spec | Notes |
| --- | --- | --- |
| `POST /v1/tts` | `SpeechModelV4` | JSON request, binary audio response
|
| `POST /v1/asr` | `TranscriptionModelV4` | multipart request,
word-level segments |
**Speech.** The model is selected via the `model` HTTP header rather
than a body field. `voice` maps to `reference_id`, `outputFormat` to
`format` (`wav`/`pcm`/`mp3`/`opus`), and `speed` to `prosody.speed`.
`language` and `instructions` have no Fish Audio equivalent and produce
`unsupported` warnings. Multi-speaker dialogue is available through
`providerOptions.fishAudio.referenceId` as an array, since the generic
`voice` option is a single string.
**Transcription.** `/v1/asr` currently serves a single model and exposes
no model selector, so the model ID defaults to `transcribe-1` — the
routing label Fish Audio recommends. It is not sent to the API. Fish
Audio expects to add ASR models and select them with the `model` header,
matching `/v1/tts`.
## Behavior confirmed with the Fish Audio team
Several behaviors were reverse-engineered from the live API because the
published docs were wrong or silent. The Fish Audio team has since
confirmed all of them and is updating their docs. Each is commented at
the relevant call site.
1. **`/v1/asr` takes `multipart/form-data`.** The docs contradict
themselves — prose says form-data/msgpack, the OpenAPI `requestBody`
says json/msgpack. Form-data is correct; there is no base64-over-JSON
path and none is planned.
2. **Responses include undocumented `language` and `language_code`.**
The documented 200 schema is `{text, duration, segments[]}`, but real
responses also carry `language` (`"English"`) and `language_code`
(`"en"`). `language_code` is the reliable one: always two-letter
ISO-639-1, never a locale like `en-US`, and absent when no language is
detected. It is reported as `result.language`; the display name is
exposed as provider metadata and documented as presentation-only.
3. **The `language` request parameter does not affect detection.** It is
passed to the model, but auto-detection is authoritative and overrides
it. Tested both directions before the team confirmed it:
| Audio | Requested `language` | `language_code` returned |
| --- | --- | --- |
| English | *(none)* | `en` |
| English | `ja` | `en` |
| Japanese | *(none)* | `ja` |
| Japanese | `ja` | `ja` |
| Japanese | `en` | `ja` |
Detection is accurate — a Japanese round-trip transcribes back verbatim.
Echoing the requested value, which an earlier revision did, would have
misreported audio in both directions.
4. **`ignore_timestamps: true` returns `segments: []`** by design, with
`duration` still populated.
5. **`prosody.normalize_loudness` covers the S2 family** (`s2-pro` and
`s2.1-pro`), not just `s2-pro` as documented. On `s1` it is accepted but
silently ignored, so the provider drops it there and emits a warning
rather than letting it no-op.
6. **All four models work on the TTS-live WebSocket.** The doc listing
only `s1` and `s2-pro` is stale. Not used here, but it removes a
restriction an earlier revision had encoded.
## Deliberate choices
- **`ignoreTimestamps` defaults to `false`**, inverting the API default
of `true`, because Fish Audio returns an empty `segments` array when
timestamps are skipped and `TranscriptionModelV4Result.segments` is
required. The documented latency cost applies only to audio under 30
seconds. The option mirrors the API's negative name rather than an
inverted `enableTimestamps`, so it cross-references cleanly against Fish
Audio's docs. Precedent: `google-vertex` defaults
`enableWordTimeOffsets` to `true` for the same reason.
- **`s2.1-pro` is treated as the recommended default.** `s2.1-pro-free`
is a free developer tier with no time-to-first-audio or data-processing
guarantees. The provider always sends the `model` header explicitly and
never relies on the API default.
- **`voice` is optional.** Fish Audio defaults `reference_id` to null
and uses a default voice, so `basic.ts` runs with only an API key.
- **`speechModel` / `transcriptionModel` are narrowed to required** on
`FishAudioProvider`. They are optional on `ProviderV4`; Fish Audio
always provides both, so consumers don't need `?.`.
- **Inline `references` (zero-shot cloning) are unsupported.** They
require a MessagePack request body, and no provider in this repo handles
msgpack — supporting it would mean a new dependency. Fish Audio
confirmed a JSON path is not planned and that pre-uploading is
preferable regardless, since pre-uploaded voices are encoded once and
reused while inline references re-encode per request. Tracked as
AIG-450.
- **Streaming TTS is out of scope.** `SpeechModelV4` is generate-only
(no `doStream`), so neither the TTS-live WebSocket nor the timestamped
streaming endpoint has a home in the current specification.
`RealtimeModelV4` is a bidirectional conversational spec — client
secrets, session config, tool definitions — and is not a fit for a
one-directional text-in/audio-out endpoint. Tracked as AIG-451, routed
to the `RealtimeSpeechEngine` design in KDA-126.
## Versioning
The package is at `2.0.0` with a `major` changeset, so it releases as
`3.0.0`, in line with the current provider line (`@ai-sdk/cartesia`
3.0.12, `@ai-sdk/minimax` 3.0.2).
## Verification
- 46 unit tests across node and edge runtimes
- All 7 examples run against the live API: mp3 (128 kbps / 44.1 kHz
mono) and Ogg Opus (48 kHz mono) verified with `file`; transcription
returns a correct transcript with 82 word-level segments; multi-speaker
output transcribes back to the intended dialogue with no literal
`<|speaker:N|>` tokens; the `s1` loudness warning fires while `s2-pro`
and `s2.1-pro` pass the flag through
- `pnpm check`, `pnpm konsistent`, package type-check and build all
clean
- `pnpm type-check:full` clean for this branch
Examples use public voice IDs from the Fish Audio library, verified
working. `list-voices.ts` browses others — voice listing is not part of
the speech model specification, so it calls the Fish Audio REST API
directly.
The lockfile diff is deliberately hand-maintained and purely additive
(30 lines, no removals). A plain `pnpm install` on macOS re-resolves
unrelated peers — `@opentelemetry/api`, `picomatch`, `@babel/core`,
`@workflow/*` — and an earlier revision of this PR failed CI for exactly
that reason.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @ai-sdk/fish-audio@3.0.0 ### Major Changes - e1f9b02: feat(fish-audio): add Fish Audio provider with speech and transcription models ## ai@7.0.54 ### Patch Changes - a6b17a2: Allow `ToolLoopAgent` `prepareCall` callbacks to read and override the top-level `reasoning` option. - 5615eb7: Add `defaultInstructionsMiddleware` for applying default language model instructions while preserving call-level overrides. - 36a3ff6: Preserve preceding assistant messages when regenerating a response. ## @ai-sdk/amazon-bedrock@5.0.45 ### Patch Changes - Updated dependencies [8b96941] - @ai-sdk/anthropic@4.0.32 ## @ai-sdk/angular@3.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/anthropic@4.0.32 ### Patch Changes - 8b96941: Reject spliced Anthropic generations while allowing duplicate message start events for the active message. ## @ai-sdk/anthropic-aws@2.0.24 ### Patch Changes - Updated dependencies [8b96941] - @ai-sdk/anthropic@4.0.32 ## @ai-sdk/code-mode@1.0.11 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/google-vertex@5.0.43 ### Patch Changes - Updated dependencies [8b96941] - @ai-sdk/anthropic@4.0.32 ## @ai-sdk/harness@1.0.60 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/harness-claude-code@1.0.61 ### Patch Changes - 64a0ff2: fix(harness-claude-code): avoid sending custom user-agent for non-AI Gateway requests - @ai-sdk/harness@1.0.60 ## @ai-sdk/harness-codex@1.0.62 ### Patch Changes - @ai-sdk/harness@1.0.60 ## @ai-sdk/harness-deepagents@1.0.59 ### Patch Changes - @ai-sdk/harness@1.0.60 ## @ai-sdk/harness-opencode@1.0.61 ### Patch Changes - @ai-sdk/harness@1.0.60 ## @ai-sdk/harness-pi@1.0.60 ### Patch Changes - @ai-sdk/harness@1.0.60 ## @ai-sdk/langchain@3.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/llamaindex@3.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/minimax@3.0.8 ### Patch Changes - Updated dependencies [8b96941] - @ai-sdk/anthropic@4.0.32 ## @ai-sdk/otel@1.0.54 ### Patch Changes - 12cfe40: Record separately supplied system instructions on OpenTelemetry chat spans and preserve system messages in chat history order. - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/policy-opa@1.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/react@4.0.57 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/rsc@3.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/sandbox-just-bash@1.0.60 ### Patch Changes - @ai-sdk/harness@1.0.60 ## @ai-sdk/sandbox-vercel@1.0.60 ### Patch Changes - @ai-sdk/harness@1.0.60 ## @ai-sdk/svelte@5.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/tui@1.0.55 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/vue@4.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/workflow@1.0.54 ### Patch Changes - Updated dependencies [a6b17a2] - Updated dependencies [5615eb7] - Updated dependencies [36a3ff6] - ai@7.0.54 ## @ai-sdk/workflow-harness@1.0.60 ### Patch Changes - 9ee38cd: fix(workflow-harness): preserve flat token usage from completed harness agent runs - @ai-sdk/harness@1.0.60 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background
OpenAI, Anthropic, and Google all have Batch APIs to run many requests
asynchronously in a large batch, and get results later. AI SDK did not
support this.
## Summary
Added experimental batch APIs.
- `startTextBatch` accepts a model and an array of `requests` and
returns a reference to that batch.
- `getBatchStatus` accepts the batch reference and returns the current
status.
- `getBatchResults` accepts the batch reference and returns a stream of
results if the batch is complete.
The user flow is:
- Create a batch with `startTextBatch`
- Persist the batch reference - either in DB or using something like
Vercel Workflow
- Poll `getBatchStatus` with that reference
- When complete, accept the results with `getBatchResults`
Batches can take many hours to complete, so the batch reference needs to
persist across process restarts. Because of this, AI SDK does not
control the polling itself - users are expected to persist the batch and
poll themselves using the batch APIs.
```ts
const model = openai('gpt-5.6');
const batch = await startTextBatch({
model,
requests: [
{
id: 'capital-france',
prompt: 'What is the capital of France?',
},
{
id: 'capital-germany',
prompt: 'What is the capital of Germany?',
},
],
});
while (true) {
const status = await getBatchStatus({ model, batch });
if (status.status !== 'pending') {
break;
}
await new Promise(resolve => setTimeout(resolve, 60_000));
}
for await (const result of getBatchResults({ model, batch })) {
console.log(result);
}
```
Supported models implement `BatchLanguageModelV4`, which is an extension
of `LanguageModelV4` with added methods:
- `doCreateBatch`
- `doGetBatchStatus`
- `doGetBatchResults`
## End-to-End Verification
Have not e2e verified yet because I haven't added provider
implementations - will do that in a separate PR later.
## Checklist
- [X] All commits are signed (PRs with unsigned commits cannot be
merged)
- [X] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [X] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [X] I have reviewed this pull request (self-review)
## Future Work
* Add provider support (OpenAI, Anthropic, Google, and AI Gateway)
* Add APIs for other request types (image, video, etc)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.55 ### Patch Changes - 3469d0c: feat: add batch APIs - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/gateway@4.0.43 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/alibaba@2.0.27 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/amazon-bedrock@5.0.46 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/anthropic@4.0.33 - @ai-sdk/openai@4.0.32 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/angular@3.0.55 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/anthropic@4.0.33 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/anthropic-aws@2.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/anthropic@4.0.33 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/assemblyai@3.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/azure@4.0.33 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/deepseek@3.0.24 - @ai-sdk/openai@4.0.32 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/baseten@2.1.3 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/black-forest-labs@2.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/bytedance@2.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/cartesia@3.0.18 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/cerebras@3.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/code-mode@1.0.12 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 ## @ai-sdk/cohere@4.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/deepgram@3.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/deepinfra@3.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/deepseek@3.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/devtools@1.0.11 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 ## @ai-sdk/elevenlabs@3.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/fal@3.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/fireworks@3.0.27 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/fish-audio@3.0.1 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/gateway@4.0.43 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/gladia@3.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/google@4.0.36 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/google-vertex@5.0.44 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/anthropic@4.0.33 - @ai-sdk/google@4.0.36 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/groq@4.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/harness@1.0.61 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/harness-claude-code@1.0.62 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/harness-codex@1.0.63 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/harness-deepagents@1.0.60 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/harness-opencode@1.0.62 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/harness-pi@1.0.61 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/huggingface@2.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/hume@3.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/klingai@4.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/langchain@3.0.55 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 ## @ai-sdk/llamaindex@3.0.55 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 ## @ai-sdk/lmnt@3.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/luma@3.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/mcp@2.0.27 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/minimax@3.0.9 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/anthropic@4.0.33 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/mistral@4.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/moonshotai@3.0.28 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/open-responses@2.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/openai@4.0.32 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/openai-compatible@3.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/otel@1.0.55 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - ai@7.0.55 ## @ai-sdk/perplexity@4.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/policy-opa@1.0.55 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/prodia@2.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/provider@4.0.6 ### Patch Changes - 3469d0c: feat: add batch APIs ## @ai-sdk/provider-utils@5.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 ## @ai-sdk/quiverai@2.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/react@4.0.58 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - ai@7.0.55 - @ai-sdk/mcp@2.0.27 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/replicate@3.0.24 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/revai@3.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/rsc@3.0.55 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/sandbox-just-bash@1.0.61 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/sandbox-vercel@1.0.61 ### Patch Changes - @ai-sdk/harness@1.0.61 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/svelte@5.0.55 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/togetherai@3.0.26 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/tui@1.0.56 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 ## @ai-sdk/valibot@3.0.23 ### Patch Changes - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/vercel@3.0.25 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/voyage@2.0.23 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/vue@4.0.55 ### Patch Changes - Updated dependencies [3469d0c] - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/workflow@1.0.55 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - ai@7.0.55 - @ai-sdk/provider-utils@5.0.23 ## @ai-sdk/workflow-harness@1.0.61 ### Patch Changes - @ai-sdk/harness@1.0.61 ## @ai-sdk/xai@4.0.30 ### Patch Changes - Updated dependencies [3469d0c] - @ai-sdk/provider@4.0.6 - @ai-sdk/openai-compatible@3.0.25 - @ai-sdk/provider-utils@5.0.23 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background OpenAI has [Batch API](https://developers.openai.com/api/docs/guides/batch) for process many requests asynchronously. #18346 adds batch APIs to AI SDK. ## Summary Added Batch API support for the OpenAI provider. The provider uses the OpenAI Files endpoint to create a temporary (48h expiration) file with the requests, then creates a batch with that file. ## End-to-End Verification OpenAI batch example works ## Checklist - [X] All commits are signed (PRs with unsigned commits cannot be merged) - [X] Tests have been added / updated (for bug fixes / features) - [X] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [X] I have reviewed this pull request (self-review) --------- Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @ai-sdk/amazon-bedrock@5.0.47 ### Patch Changes - Updated dependencies [e6a93c4] - @ai-sdk/openai@4.0.33 ## @ai-sdk/azure@4.0.34 ### Patch Changes - Updated dependencies [e6a93c4] - @ai-sdk/openai@4.0.33 ## @ai-sdk/openai@4.0.33 ### Patch Changes - e6a93c4: feat(openai): support batch APIs with experimental_startTextBatch Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…anslationModel` for consistency (#18423) ## Background As flagged in #18412, speech translation models used shortened `Translation` names that were inconsistent with the `SpeechTranslationModelV4` provider interface and could not be enforced by the existing generic provider conventions. ## Summary - Rename the Google and OpenAI speech translation modules, classes, types, helpers, tests, and fixtures to use `SpeechTranslation` consistently. - Export the new experimental package names while retaining the previous names as deprecated aliases. - Add dedicated konsistent conventions for experimental speech translation model and options files. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work The overall API for speech translation itself continues to use some inconsistent naming, e.g.: - `experimental_streamTranslate` should become `experimental_streamTranslateSpeech` (or `expeirmental_streamSpeechTranslate`) - while not technically part of the spec yet (because experimental), providers should use `speechTranslationModel()` as entry point instead of `translation()` - if we want a shortcut, we should still use `speechTranslation()` because `translation()` is not sufficiently qualified
…r resume (#18461) ## Background Stopping a resumed chat stream did not reliably terminate reconnection or replay processing, allowing detached or overlapping resumptions to continue mutating chat state. ## Root Cause Reconnect requests originally received no abort signal and replay consumption continued after stop. After initial propagation, the controller was still untracked while reconnectToStream was pending, and concurrent resumes had no current-request ownership. Reproductions confirmed post-stop deltas and the pending-reconnection race. ## Summary Added an optional reconnection abort signal to ChatTransport, forwarded it through HTTP fetches, canceled stream consumption on abort, blocked aborted writes and queued jobs, tracked pending resume requests, superseded overlapping resumes, canceled stale returned streams, removed reproduction artifacts, and updated the ai patch changeset. ## Testing Regression coverage verifies stopping active and pending resumed streams, canceling stale overlapping resumes, preventing post-abort state writes, and forwarding reconnection signals through HTTP transport. Focused Node and Edge suites each passed all 37 tests. ## End-to-end Validation - `pnpm -C packages/ai build && pnpm -C examples/ai-functions exec tsx -e "<original slow replay reproduction>"` — stopping at `0 1 2 ` prevented all later replay deltas. - `pnpm -C examples/ai-functions exec tsx -e "<pending reconnect reproduction>"` — the pending signal was aborted and the eventual stale stream applied no messages. ## Related Issues Fixes #18458 Closes #18459 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: yonatan-shorani <5913072+yonatan-shorani@users.noreply.github.com> Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com> Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
## Background `useChat` currently throttles its messages subscription callback, but its `useSyncExternalStore` snapshot always reads the latest `chat.messages` array. Because streaming replaces that array for every chunk, any unrelated React render can observe a new snapshot before the throttled callback publishes it. In high-frequency streams this bypasses `throttle`, causes per-chunk renders, and can contribute to the "Maximum update depth exceeded" failures reported in #6166. ## Summary - Keep a published messages snapshot per `useChat` hook and advance it from that hook's throttled subscription callback. - Publish the latest message snapshot before `ready` or `error` becomes observable, including normal completion and aborts. - Synchronize updates that occur between render and subscription, and ignore delayed callbacks after a hook unsubscribes or changes chat instances. - Add regression coverage for unrelated renders, terminal status/message coherence, aborts, errors, and delayed callbacks after chat replacement. - Turn the existing Next.js throttle route into a deterministic end-to-end reproduction that streams 500 chunks while forcing unrelated renders, reports pass/fail from observed snapshot identities, and verifies the complete message is visible when status becomes `ready`. - Add a patch changeset for `@ai-sdk/react`. ## Contributor Credit - @brahmveda-arkin reported #6166. - @takumiz19 isolated the snapshot/subscription mismatch and proposed #17893. - @ben-reitz demonstrated the practical value of a conservative UI update cadence in cloudflare/agents#2058. ## End-to-End Verification Ran `/chat/throttle` in `examples/ai-e2e-next` in a real browser. The route streams 500 chunks (1,000 assistant characters) with `throttle: 50` while a zero-delay timer independently re-renders the component. - Before: **FAIL**, 255 distinct message snapshots in 1,475ms (maximum expected: 34), across 946 total React renders. - After: **PASS**, 15 distinct message snapshots in 1,144ms (maximum expected: 27), across 602 total React renders. The patched run rendered all 1,000 assistant characters on the same render where status became `ready`, and had no Next.js error overlay or browser error. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work This PR intentionally leaves the current opt-in default unchanged, so it does not protect applications that omit `throttle` from high-frequency unthrottled rendering. For v8, I recommend making a 50ms UI publication cadence the default when `throttle` is omitted, with `throttle: 0` as the explicit unthrottled opt-out. Stream processing, tool handling, and callbacks should remain immediate; only snapshots exposed to React should be paced. The default should also guarantee an immediate leading publication and a terminal flush so the final messages and `ready` status stay coherent. This would cap the normal rendering rate at about 20 updates per second and protect applications that do not know they need to opt in today. The tradeoff is up to 50ms of additional visible text latency and an explicit opt-out for applications that intentionally need per-chunk rendering, which makes the behavior change appropriate for a major release. ## Related Issues Addresses the throttled snapshot bypass discussed in #6166. Reports using the default unthrottled behavior remain outside this PR. Closes #17893. Related to cloudflare/agents#2058.
…18100) ## Background Consumers need per-model-call provider metadata to track granular provider details such as AI Gateway generation IDs, even when later tool execution is aborted. ## Summary Added optional providerMetadata to LanguageModelCallEndEvent, forwarded metadata from generateText, streamText, Workflow, and Harness execution paths, and added opt-in metadata to OpenTelemetry model-call spans. ## Testing Added runtime coverage for non-streaming, streaming, aborted tool execution, Workflow, Harness, and OpenTelemetry behavior, plus compile-time callback type tests. ## End-to-end Validation - Added and successfully ran a focused mock-model example demonstrating provider metadata access from onLanguageModelCallEnd. ## Documentation Updated lifecycle, text-generation, telemetry, generateText, streamText, and AI Gateway documentation with the new callback property and generation-ID usage. ## Related Issues Fixes #18093 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: aletorrado <279292+aletorrado@users.noreply.github.com> Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
## Background Anthropic has a [batch processing API](https://platform.claude.com/docs/en/build-with-claude/batch-processing), and AI SDK has batch APIs ## Summary Added batch support to the Anthropic provider ## End-to-End Verification Added anthropic batch example which works ## Checklist - [X] All commits are signed (PRs with unsigned commits cannot be merged) - [X] Tests have been added / updated (for bug fixes / features) - [X] Documentation has been added / updated (for bug fixes / features) - [X] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [X] I have reviewed this pull request (self-review) ## Future Work - Support per-request models rather than one model for the whole batch
## Background `@ai-sdk/openai` keyed active Responses API reasoning state and emitted stream-part IDs by each event's opaque `item_id`. A real request to GitHub Copilot's `/responses` endpoint with `gpt-5.3-codex` showed that Copilot sends `response.output_item.added`, but rotates the opaque ID on every subsequent reasoning and message event. `output_index` remains stable. That caused the reported `activeReasoningPart.summaryParts` crash. If the crash was bypassed, the same rotation produced the downstream `text part ... not found` error because text start, delta, and end used different IDs. The committed fixture is the complete 69-event SSE sequence captured from the real provider on 2026-08-06. Opaque identifiers, encrypted reasoning payloads, obfuscation padding, and the safety identifier were sanitized; event order, event types, output indexes, deltas, usage, and response structure were preserved. ## Summary - Retain `output_index` when parsing text-delta and reasoning-summary events. - Track the canonical message/reasoning item ID from `response.output_item.added` by `output_index`. - Use that canonical ID for reasoning/text deltas and end events, and avoid dereferencing absent reasoning state. - Add the sanitized live Copilot SSE capture as a regression fixture and assert that it emits no stream errors, preserves one ID per logical reasoning/text part, and returns the complete answer. - Add a public-API end-to-end example that serves the captured ID-rotation pattern over localhost SSE. - Add a patch changeset for `@ai-sdk/openai`. ## Contributor Credit Thanks to @A-S-Manoj for the upstream report and diagnosis; @drmgc and @EntropyParadigm for the Nanocoder reports; @daitmaamar4-png, @OverHash, and @jianminLee for independent downstream reports; and @mussaratshamsher for the related work in #18337. ## End-to-End Verification I first sent an authenticated request to the real GitHub Copilot Responses API using the credential created by `nanocoder copilot login`. Replaying that exact raw response through public `createOpenAI(...).responses(...)` and `streamText(...)` failed before this change with: ```text TypeError: Cannot read properties of undefined (reading 'summaryParts') ``` After rebuilding `@ai-sdk/openai`, replaying the same unsanitized raw response completed successfully. I also ran the checked-in localhost HTTP/SSE reproduction: ```sh cd examples/ai-functions pnpm tsx src/stream-text/openai/responses-reasoning-id-rotation.ts ``` It now prints: ```text Expected: reasoning summary followed by "ok". Thinking through the request.ok ``` This is the complete end-to-end example used for that verification: ```ts import { createServer } from 'node:http'; import { createOpenAI } from '@ai-sdk/openai'; import { streamText } from 'ai'; import { run } from '../../lib/run'; const modelId = 'gpt-5.3-codex'; const responseId = 'resp_copilot_repro'; const reasoningAddedId = 'rs_copilot_added'; const reasoningSummaryAddedId = 'rs_copilot_summary_added'; const reasoningSummaryDeltaId = 'rs_copilot_summary_delta'; const reasoningSummaryDoneId = 'rs_copilot_summary_done'; const reasoningDoneId = 'rs_copilot_done'; const messageAddedId = 'msg_copilot_added'; const messageDeltaId = 'msg_copilot_delta'; const messageDoneId = 'msg_copilot_done'; const response = { id: responseId, object: 'response', created_at: 1, status: 'in_progress', error: null, incomplete_details: null, input: [], instructions: null, max_output_tokens: null, model: modelId, output: [], parallel_tool_calls: true, previous_response_id: null, reasoning: { effort: 'low', summary: 'auto' }, store: true, temperature: null, text: { format: { type: 'text' } }, tool_choice: 'auto', tools: [], top_p: null, truncation: 'disabled', usage: null, user: null, metadata: {}, }; const reasoningItem = { id: reasoningDoneId, type: 'reasoning', summary: [{ type: 'summary_text', text: 'Thinking through the request.' }], }; const messageItem = { id: messageDoneId, type: 'message', status: 'completed', role: 'assistant', content: [{ type: 'output_text', text: 'ok', annotations: [] }], }; const events = [ { type: 'response.created', response }, // A live GitHub Copilot capture used a different opaque item id for every // reasoning and message event while keeping output_index stable. { type: 'response.output_item.added', output_index: 0, item: { id: reasoningAddedId, type: 'reasoning' }, }, { type: 'response.reasoning_summary_part.added', item_id: reasoningSummaryAddedId, output_index: 0, summary_index: 0, }, { type: 'response.reasoning_summary_text.delta', item_id: reasoningSummaryDeltaId, output_index: 0, summary_index: 0, delta: 'Thinking through the request.', }, { type: 'response.reasoning_summary_part.done', item_id: reasoningSummaryDoneId, output_index: 0, summary_index: 0, }, { type: 'response.output_item.done', output_index: 0, item: reasoningItem, }, { type: 'response.output_item.added', output_index: 1, item: { id: messageAddedId, type: 'message' }, }, { type: 'response.output_text.delta', item_id: messageDeltaId, output_index: 1, delta: 'ok', }, { type: 'response.output_item.done', output_index: 1, item: messageItem, }, { type: 'response.completed', response: { ...response, status: 'completed', output: [reasoningItem, messageItem], usage: { input_tokens: 5, input_tokens_details: { cached_tokens: 0 }, output_tokens: 8, output_tokens_details: { reasoning_tokens: 7 }, total_tokens: 13, }, }, }, ]; function toSse(value: unknown) { return `data: ${JSON.stringify(value)}\n\n`; } async function startMockCopilotServer() { const server = createServer((request, response) => { if (request.method !== 'POST' || request.url !== '/v1/responses') { response.writeHead(404).end(); return; } request.resume(); request.on('end', () => { response.writeHead(200, { 'content-type': 'text/event-stream', connection: 'close', }); for (const event of events) { response.write(toSse(event)); } response.end(); }); }); await new Promise<void>((resolve, reject) => { server.once('error', reject); server.listen(0, '127.0.0.1', () => { server.off('error', reject); resolve(); }); }); const address = server.address(); if (address == null || typeof address === 'string') { throw new Error('Mock Copilot server did not bind to a TCP port.'); } return { server, baseURL: `http://127.0.0.1:${address.port}/v1`, }; } run(async () => { const { server, baseURL } = await startMockCopilotServer(); try { const copilot = createOpenAI({ apiKey: 'test-key', baseURL, }); const result = streamText({ model: copilot.responses(modelId), prompt: 'Reply with exactly: ok', }); console.log('Expected: reasoning summary followed by "ok".'); for await (const part of result.stream) { if (part.type === 'reasoning-delta' || part.type === 'text-delta') { process.stdout.write(part.text); } } console.log(); } finally { await new Promise<void>((resolve, reject) => { server.close(error => { if (error != null) { reject(error); return; } resolve(); }); }); } }); ``` ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work #18337 proposes synthesizing `reasoning-start` when a provider truly omits `response.output_item.added`. The real Copilot trace includes that event with a different ID, so this PR keeps that separate behavior out of scope. It can be evaluated independently if a raw provider trace confirms the missing-event variant. ## Related Issues Fixes #18270 - Nano-Collective/nanocoder#719 - Nano-Collective/nanocoder#576 - anomalyco/opencode#21346 - Soju06/codex-lb#398 - cita-777/metapi#269 - Related implementation: #18337
…atus) on the v4 video model (#18384) ## Background #12515 shipped the async video operation protocol on the v4 spec (`doStart`/`doStatus`), and the async-native providers implement it. The AI Gateway serves durable async video jobs over `POST /v4/ai/video-model/start|status`, but `GatewayVideoModel` only implements `doGenerate` — so `experimental_generateVideo({ model: gateway(...), poll: {...} })` cannot use the async flow end-to-end. ## Summary Implements `doStart`/`doStatus` on `GatewayVideoModel` (v4) against the Gateway's async video job endpoints, and makes retried `doStart` calls idempotent in core: - `doStart` → `POST {baseURL}/video-model/start`; the 202 body's `operation` becomes the opaque v4 operation reference. Shares `doGenerate`'s full request-body construction and forwards `webhookUrl` when supplied. - `doStatus` → `POST {baseURL}/video-model/status`, mapping the gateway's `pending`/`completed`/`error` shapes onto `VideoModelV4OperationStatusResult`. The gateway's `cancelled` terminal has no v4 union member, so it surfaces as a terminal `error` (never an infinite poll). - **`doStart` retries are idempotent.** `generateVideo` retries `doStart`, which creates a *billable* generation — a retry after a lost response could start (and charge for) a second one. Core now mints one explicit token per logical start (`aisdk_vid_<id>`, outside the retry closure) and forwards it as an `idempotency-key` header; a caller-supplied key wins over the minted one. `GatewayVideoModel` just forwards headers — the Gateway's start endpoint already deduplicates on this header, and other providers receive a header they can ignore today and honor later. No spec change; if a first-class `idempotencyKey` call option is preferred so non-gateway providers can opt in explicitly, happy to switch — the experimental v4 surface allows it. - `handleWebhookOption` is intentionally **not** implemented: the gateway is polling-first and exposes no provider→SDK webhook completion channel today; presence of the method would make `generateVideo` await a notification that never arrives. Adding webhooks later is additive. - Errors on both calls flow through the existing `asGatewayError` mapping. One recorded contract note: the Gateway can serve a long-completed job whose provider asset has expired as `completed` with empty `videos[]` plus explanatory `providerMetadata`. Unreachable inside a single `generateVideo` run (a just-started operation's result is always fresh; core throws `NoVideoGeneratedError` on empty results as usual) — relevant only if the SDK later exposes resuming an operation by reference. ## Verification - `pnpm --filter @ai-sdk/gateway test` — 509 passed (new `doStart`/`doStatus` tests: request/headers shape, webhookUrl forwarding, pending/completed/error/cancelled mappings, no `handleWebhookOption`). - `generate-video` suite — 62 passed (stable idempotency key across retries, distinct key per call, caller-supplied key preserved). - `tsc --noEmit` clean in both packages; `oxlint` + `ultracite check` clean. ## Tasks - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated — n/a (experimental surface; gateway async video docs land with the gateway feature) - [x] A _patch changeset_ for relevant packages has been added - [x] Formatting issues have been fixed (`ultracite check` clean) ## Related #12515 (protocol), vercel/ai-gateway#2974 + the Option-B stack (server side).
) ## Background `@ai-sdk/xai` was originally built on the shared openai-compatible chat model — the CHANGELOG still records it: `feat (provider/xai): Add grok-2 models, use openai-compatible base impl.` It has since been rewritten to implement its own language model, with its own tool preparation, finish-reason mapping and response-metadata helpers. Nothing in the package imports `@ai-sdk/openai-compatible` any more, in `src` or in tests, but the dependency and a TypeScript project reference to it were both left behind. `@ai-sdk/deepseek` went through the same migration and lists only `@ai-sdk/provider` and `@ai-sdk/provider-utils`; this brings xai in line. ## Summary - Removed `@ai-sdk/openai-compatible` from `dependencies`. - Removed the `../openai-compatible` entry from `references` in `tsconfig.json`. No source changes, no runtime change. ## End-to-End Verification Confirmed the dependency is genuinely unreferenced first — the only remaining mentions anywhere in the package are historical CHANGELOG entries. After removal: reinstalled and confirmed the `node_modules/@ai-sdk` symlink is gone, rebuilt, ran `type-check` and the node suite (384 tests, passing). ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [ ] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.56 ### Patch Changes - 25c9120: Expose provider metadata on language-model-call end callbacks and telemetry spans. - 89080c8: fix (ai/gateway): make retried `doStart` calls idempotent `generateVideo` retries `doStart`, which creates a billable generation, so a retry after a lost response could start a second one. It now mints one idempotency token per logical start — outside the retry closure — and forwards it as an `idempotency-key` header, so a provider that deduplicates (the Vercel AI Gateway does) sees the same key on every attempt. `GatewayVideoModel` simply forwards the caller's headers rather than inferring retry identity from an options object, which would collide across unrelated calls. - 79d6195: Stop pending and active resumed chat streams after cancellation, and prevent overlapping resumptions from applying stale updates. - Updated dependencies [89080c8] - Updated dependencies [89080c8] - @ai-sdk/gateway@4.0.44 ## @ai-sdk/amazon-bedrock@5.0.48 ### Patch Changes - Updated dependencies [e6415bd] - Updated dependencies [73d48d0] - Updated dependencies [bbd9b31] - @ai-sdk/anthropic@4.0.34 - @ai-sdk/openai@4.0.34 ## @ai-sdk/angular@3.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/anthropic@4.0.34 ### Patch Changes - e6415bd: feat(anthropic): add text batch support ## @ai-sdk/anthropic-aws@2.0.26 ### Patch Changes - Updated dependencies [e6415bd] - @ai-sdk/anthropic@4.0.34 ## @ai-sdk/azure@4.0.35 ### Patch Changes - Updated dependencies [73d48d0] - Updated dependencies [bbd9b31] - @ai-sdk/openai@4.0.34 ## @ai-sdk/code-mode@1.0.13 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/gateway@4.0.44 ### Patch Changes - 89080c8: feat (provider/gateway): support the async video operation flow (doStart/doStatus) on the v4 video model - 89080c8: fix (ai/gateway): make retried `doStart` calls idempotent `generateVideo` retries `doStart`, which creates a billable generation, so a retry after a lost response could start a second one. It now mints one idempotency token per logical start — outside the retry closure — and forwards it as an `idempotency-key` header, so a provider that deduplicates (the Vercel AI Gateway does) sees the same key on every attempt. `GatewayVideoModel` simply forwards the caller's headers rather than inferring retry identity from an options object, which would collide across unrelated calls. ## @ai-sdk/google@4.0.37 ### Patch Changes - bbd9b31: chore: rename `*TranslationModel` and its related types to `*SpeechTranslationModel` for consistency ## @ai-sdk/google-vertex@5.0.45 ### Patch Changes - Updated dependencies [e6415bd] - Updated dependencies [bbd9b31] - @ai-sdk/anthropic@4.0.34 - @ai-sdk/google@4.0.37 ## @ai-sdk/harness@1.0.62 ### Patch Changes - 25c9120: Expose provider metadata on language-model-call end callbacks and telemetry spans. - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/harness-claude-code@1.0.63 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/harness-codex@1.0.64 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/harness-deepagents@1.0.61 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/harness-opencode@1.0.63 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/harness-pi@1.0.62 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/langchain@3.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/llamaindex@3.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/minimax@3.0.10 ### Patch Changes - Updated dependencies [e6415bd] - @ai-sdk/anthropic@4.0.34 ## @ai-sdk/openai@4.0.34 ### Patch Changes - 73d48d0: fix(provider/openai): correlate rotating Responses API item IDs by output index - bbd9b31: chore: rename `*TranslationModel` and its related types to `*SpeechTranslationModel` for consistency ## @ai-sdk/otel@1.0.56 ### Patch Changes - 25c9120: Expose provider metadata on language-model-call end callbacks and telemetry spans. - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/policy-opa@1.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/react@4.0.59 ### Patch Changes - 10e8db0: Fix `useChat` throttling so unrelated React renders cannot publish message snapshots ahead of the configured throttle cadence. - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/rsc@3.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/sandbox-just-bash@1.0.62 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/sandbox-vercel@1.0.62 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 ## @ai-sdk/svelte@5.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/tui@1.0.57 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/vue@4.0.56 ### Patch Changes - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/workflow@1.0.56 ### Patch Changes - 25c9120: Expose provider metadata on language-model-call end callbacks and telemetry spans. - Updated dependencies [25c9120] - Updated dependencies [89080c8] - Updated dependencies [79d6195] - ai@7.0.56 ## @ai-sdk/workflow-harness@1.0.62 ### Patch Changes - Updated dependencies [25c9120] - @ai-sdk/harness@1.0.62 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @ai-sdk/xai@4.0.31 ### Patch Changes - 2b1068f: chore(xai): drop the unused `@ai-sdk/openai-compatible` dependency This provider was originally built on the shared openai-compatible model and has since been rewritten to implement its own, with its own tool preparation, finish-reason mapping and response metadata helpers. Nothing in the package imports `@ai-sdk/openai-compatible` any more, but the dependency and the TypeScript project reference to it were both left behind. No runtime change. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… connect to any ACP compatible harness (#18483) ## Background AI SDK harness integrations currently require a dedicated adapter for each coding-agent runtime. ACP provides a common protocol that can support multiple runtimes through one adapter while keeping runtime-specific installation and authentication details in small profiles. Some harnesses only offer an ACP adapter as the sole way for programmatic control over their harness, so for those harnesses having an ACP adapter unblocks supporting them by our harness layer. ## Summary This adds `harness-acp`, a meta adapter for ACP v1 implementations. The adapter owns the generic sandbox bridge, protocol translation, host-tool relay, approvals, and lifecycle behavior, while callers configure the underlying ACP runtime declaratively. - Support simple and lockfile-pinned NPM acquisition for arbitrary ACP implementations. - Support direct and AI Gateway authentication with runtime-resolved environment variables and adapter-specific Gateway routes. - Translate ACP streams, native tools, host tools, approvals, skills, session modes, and resumable lifecycle state into Harness APIs. - Add complete Claude Code, Codex, and Grok Build profiles across documentation and interactive examples. ## End-to-End Verification - Exercised the added Claude Code ACP, Codex ACP, and Grok Build ACP through the interactive Harness example. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Related Issues See #16956.
## Background Two related problems, both from how this provider's usage handling was assembled. **`usage.raw` was filtered.** `raw` is specified as usage "in the shape that the provider returns", but `alibabaUsageSchema` was strict `z.object` at every level, so unmapped fields were dropped before `raw` was built. The motivating case is `prompt_tokens_details.cache_type`: Alibaba runs two mutually exclusive caching modes, priced differently, and populates `cache_type` only under explicit caching, making it the discriminator for which rate a cache read belongs to. It was discarded on both the generate and stream paths. It lives *inside* `prompt_tokens_details`, so loosening only the top level would not surface it. **The provider reached into another package's internals.** Alibaba implements its own language model rather than building on the shared openai-compatible one, but imported four helpers from `@ai-sdk/openai-compatible/internal` — the only package importing helper *functions* from that entry point. Providers in the same position (`deepseek`, `groq`, `mistral`, `xai`) keep local copies and depend on nothing but `@ai-sdk/provider` and `@ai-sdk/provider-utils`. ## Summary **Usage parsing** - `alibabaUsageSchema` is now `z.looseObject`, nested objects included. `cache_type` is also declared explicitly so it is typed rather than merely passed through. - `convertAlibabaUsage` computes the full shape directly instead of delegating to openai-compatible and spreading over the result to patch in the cache-write split. Same arithmetic; matches `convertDeepSeekUsage`. - **Behavior change:** a response carrying no usage now maps to a fully null usage object. Previously it produced `noCache: 0` and `cacheWrite: 0` alongside `total: undefined` and `cacheRead: undefined`. No test covered it. **Dependency removal** - `prepareTools` and the finish-reason mapper are now local, copied faithfully — including the `UnsupportedFunctionalityError` on an unknown tool-choice type. - `getResponseMetadata` needed no copy: it is a one-line re-export of `createLanguageModelResponseMetadata` from `@ai-sdk/provider-utils`, now imported directly. - `prepareTools` uses `AlibabaChatToolChoice`, a type that already existed and was never used — evidently written for this and orphaned when the helper was borrowed. Added `AlibabaFunctionTool` beside it. - Ported the openai-compatible `prepareTools` test suite alongside the function, since the copy would otherwise have landed untested: this package previously had no coverage of tool preparation at all. Added one case the original does not have, for the unknown-tool-choice branch — it is unreachable through the public types, and it is the one place a provider's copy of this function can silently diverge. - Dropped the dependency and its TypeScript project reference. ## End-to-End Verification The schema was the thing dropping the field, so the guard runs through it: a test drives `doGenerate` against a mocked response containing `cache_type` and asserts it reaches `usage.raw`. It fails on the old schema — converter unit tests alone would have passed before this change. For the copied `prepareTools`, "faithful" is verified rather than asserted: swapping the throw for a warning-and-continue (the shape `@ai-sdk/deepseek` uses) fails the new case and nothing else. Confirmed the dependency is gone after reinstall, rebuilt, and ran `type-check` with a cleared `tsconfig.tsbuildinfo` so the project-reference removal was actually checked rather than cached. Node and edge suites: 119 tests, passing. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work Independent of this PR, `@ai-sdk/openai-compatible` has the same nested-strictness problem, affecting the eight providers built on that model: #18561. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
## Summary Brings the cookbook content family into the Geistdocs app (`apps/docs`) across v7/v6/v5, mirroring production's URL model: - **/cookbook/...** — recipe pages on their legacy URLs; canonical for sitemap.xml, sitemap.md, llms.txt, and search. `/cookbook` 308s to `/resources/recipes`, section roots redirect to their first recipe (as on ai-sdk.dev). - **/resources/recipes** — the Recipes landing page (featured guide book covers, filterable recipe list, contribution call-out) plus docs-style recipe pages under `/resources/recipes/[...slug]`. These pages emit a canonical link to their `/cookbook` twin and stay out of the crawl surfaces. Both surfaces serve `.md` variants and participate in version switching. ## Component ports (from the legacy ai-sdk.dev app) - Cookbook MDX components, previously stubs: `Browser`, `ChatGeneration`, `TextGeneration`, `ObjectGeneration`, `WeatherCard`. - Recipes landing components: `Book` (3D cover), `Guides`, `RecipeList`, badges. - Fixed the ported `Snippet` to accept `string[]` (v5 cookbook passes arrays). - Six image/video assets copied to `public/images/` (no third-party marks). ## Content sync - `cookbook` added to the sync families; new transform rule drops frontmatter-only section `index.mdx` files (title/collapsed hoisted into `meta.json`), with tests. ## Validation - `test:site`, `type-check:site`, clean-state `validate:site` (2,962 pages). - Crawled all cookbook + recipes pages across the three versions (518 pages): all 200, zero unported-component markers; redirects, `.md` content types, llms.txt/sitemap/search inclusion verified against production behavior. ## Follow-ups (out of scope) - `/resources` root and the remaining resources families (Tools Registry, Templates, Showcase); navbar Resources dropdown. - Examples/playground link families, edit-source links, feedback wiring.
## Background `isUrlSupported()` evaluates configured URL patterns with `RegExp.test()`. Global and sticky regular expressions retain match state in `lastIndex`, so a shared pattern can make identical URL-support checks depend on previous evaluations and can mutate caller-owned state. ## Summary * Keep the existing direct `.test()` path for ordinary regexes. * Evaluate global and sticky regexes from index zero. * Restore the caller's original `lastIndex` in `finally`. * Add regression coverage to the existing `is-url-supported.test.ts` suite for repeated checks, caller-owned state, mismatch and throw paths, and frozen ordinary regexes. * Add a patch changeset for `@ai-sdk/provider-utils`. The helper uses `finally` so caller-owned state is restored even if custom RegExp execution mutates `lastIndex` and then throws. This does not change URL normalization, media-type matching, wildcard behavior, or the public API. ## End-to-End Verification * `pnpm -C packages/provider build` * `pnpm -C packages/provider-utils test` * `pnpm -C packages/provider-utils type-check` ## Checklist * [x] All commits are signed * [x] Tests have been added / updated * [ ] Documentation has been added / updated * [x] A *patch* changeset for the relevant package has been added * [x] I have reviewed this pull request (self-review) ## Related Issues Fixes #18569 --------- Co-authored-by: Nick Oates <58091943+n1ckoates@users.noreply.github.com>
…s in interleaved subgraph streams (#18506) ## Background LangGraph subgraphs use independent step counters, but interleaving their events with root output caused incorrect global UI step boundaries, split reasoning parts, and lost source namespace attribution. ## Root Cause The adapter discarded namespaces from three-element LangGraph tuples and applied independent namespace step counters to one global cursor. The 5→1→5 reproduction confirmed the counter collision, and UI consumer semantics confirmed that global finish-step chunks also invalidate active parts from concurrent namespaces. ## Summary Preserved LangGraph namespaces in provider metadata, tracked message namespaces, selected one namespace to drive global UI steps, prevented other counters from changing that cursor, restricted transition cleanup to the driving namespace, suppressed unsafe boundaries during concurrent output, retained subgraph-only lifecycles, and added a patch changeset. ## Testing Regression coverage now includes interleaved 5→1→5 reasoning, root advancement while child reasoning remains active, namespace metadata, namespaced tool events, and streams filtered to one subgraph. Node and Edge suites, package and full-workspace type checks, formatting/lint checks, and the package build passed. ## End-to-end Validation - `pnpm -C packages/langchain exec tsx -` replayed interleaved root and child events through the adapter and UI consumer; the child produced one start, two deltas, one end, combined text correctly, and retained its namespace. ## Related Issues Fixes #18504 Closes #18505 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: zjjaxx <28485873+zjjaxx@users.noreply.github.com> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com> Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @ai-sdk/harness-acp@1.0.0 ### Major Changes - ff0f708: feat(harness-acp): introduce ACP harness adapter as a meta adapter to connect to any ACP compatible harness ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## ai@7.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/gateway@4.0.45 ## @ai-sdk/alibaba@2.0.28 ### Patch Changes - 15dce62: fix(alibaba): preserve unmapped usage fields in `usage.raw` Alibaba's usage was parsed with strict `z.object` schemas, so any field the provider does not explicitly map was dropped before reaching `usage.raw` — including `prompt_tokens_details.cache_type`, which names the caching mode and therefore the rate a cache read is billed at. Usage is now parsed loosely, nested objects included, matching what the anthropic provider does. A response carrying no usage now maps to a fully null usage object rather than one with `noCache` and `cacheWrite` zeroed and every other field undefined. This provider no longer depends on `@ai-sdk/openai-compatible`. It implements its own language model rather than building on the shared one, but still reached into that package's internals for usage conversion, tool preparation and finish-reason mapping. Those now live in the provider, alongside the equivalents in `@ai-sdk/deepseek`, `@ai-sdk/groq`, `@ai-sdk/mistral` and `@ai-sdk/xai`. Behavior is unchanged. - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/amazon-bedrock@5.0.49 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/anthropic@4.0.35 - @ai-sdk/openai@4.0.35 ## @ai-sdk/angular@3.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/anthropic@4.0.35 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/anthropic-aws@2.0.27 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/anthropic@4.0.35 ## @ai-sdk/assemblyai@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/azure@4.0.36 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/deepseek@3.0.25 - @ai-sdk/openai@4.0.35 ## @ai-sdk/baseten@2.1.4 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/black-forest-labs@2.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/bytedance@2.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/cartesia@3.0.19 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/cerebras@3.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/code-mode@1.0.14 ### Patch Changes - ai@7.0.57 ## @ai-sdk/cohere@4.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/deepgram@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/deepinfra@3.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/deepseek@3.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/elevenlabs@3.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/fal@3.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/fireworks@3.0.28 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/fish-audio@3.0.2 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/gateway@4.0.45 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/gladia@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/google@4.0.38 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/google-vertex@5.0.46 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/anthropic@4.0.35 - @ai-sdk/google@4.0.38 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/groq@4.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/harness@1.0.63 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/harness-claude-code@1.0.64 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/harness-codex@1.0.65 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/harness-deepagents@1.0.62 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/harness-opencode@1.0.64 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/harness-pi@1.0.63 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/huggingface@2.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/hume@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/klingai@4.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/langchain@3.0.57 ### Patch Changes - a771719: Preserve LangGraph subgraph namespaces and step lifecycles without letting concurrent namespace counters split active text or reasoning streams. - ai@7.0.57 ## @ai-sdk/llamaindex@3.0.57 ### Patch Changes - ai@7.0.57 ## @ai-sdk/lmnt@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/luma@3.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/mcp@2.0.28 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/minimax@3.0.11 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/anthropic@4.0.35 ## @ai-sdk/mistral@4.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/moonshotai@3.0.29 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/open-responses@2.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/openai@4.0.35 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/openai-compatible@3.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/otel@1.0.57 ### Patch Changes - ai@7.0.57 ## @ai-sdk/perplexity@4.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/policy-opa@1.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/prodia@2.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/provider-utils@5.0.24 ### Patch Changes - 1937bef: fix(provider-utils): make URL regex checks stateless ## @ai-sdk/quiverai@2.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/react@4.0.60 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 - @ai-sdk/mcp@2.0.28 ## @ai-sdk/replicate@3.0.25 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/revai@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/rsc@3.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/sandbox-just-bash@1.0.63 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/sandbox-vercel@1.0.63 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/harness@1.0.63 ## @ai-sdk/svelte@5.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/togetherai@3.0.27 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/tui@1.0.58 ### Patch Changes - ai@7.0.57 ## @ai-sdk/valibot@3.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/vercel@3.0.26 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - @ai-sdk/openai-compatible@3.0.26 ## @ai-sdk/voyage@2.0.24 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 ## @ai-sdk/vue@4.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/workflow@1.0.57 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 - ai@7.0.57 ## @ai-sdk/workflow-harness@1.0.63 ### Patch Changes - @ai-sdk/harness@1.0.63 ## @ai-sdk/xai@4.0.32 ### Patch Changes - Updated dependencies [1937bef] - @ai-sdk/provider-utils@5.0.24 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…tly recognize available credentials (#18583) ## Background ACP provider authentication was resolved when the harness was created, so credentials added later, e.g. just before session start were not recognized. ## Summary - Resolve provider authentication and the derived implementation identity from a stable session-start environment snapshot. - Keep lifecycle-state validation structural, while enforcing implementation compatibility when starting or resuming a session. - Remove the session-derived identity from immutable bootstrap metadata and add regression coverage. ## End-to-End Verification End-to-end examples with different auth credentials (provider-direct vs AI Gateway) were run to verify. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
video models whose output ratio is dictated by the input reject an
explicit `{width}:{height}` ratio. seedance is the concrete case: for
first-frame image-to-video, first-and-last-frame, video editing, and
video extension, `ratio` only accepts `adaptive` and any numeric ratio
returns a 400.
widen `aspectRatio` to `${number}:${number} | 'adaptive'` on
VideoModelV3CallOptions, VideoModelV4CallOptions, and
experimental_generateVideo.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ang on certain errors (#18588) ## Background Follow up to #18583, resolving which exposed this problem. An ACP agent can report an unrecoverable response-stream deserialization failure on stderr without rejecting its pending prompt, leaving the harness turn waiting indefinitely. Additionally, bridge errors with their reason being in `error.cause` could have that original cause swallowed, making debugging unnecessarily difficult. ## Summary - Monitor agent stderr while preserving existing bridge logging. - Fail the active turn when the agent reports an unrecoverable response-stream deserialization error. - Preserve underlying error messages in bridge diagnostics and add regression coverage. ## End-to-End Verification Tested with e2e examples against a known and expected error which before this PR caused the process to never terminate. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
## Background See https://github.com/vercel/ai/actions/runs/31205931037/job/92958151151?pr=18588: That CI failure is unrelated to that PR - it's an OpenCode harness test race condition, a test-only problem. ## Summary Inject a frozen `now` value into the four tests that assume an authorization does not expire mid-test. No changeset needed - this is a test-only fix. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [ ] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
replace runtime imports of Zod's `z` namespace with the individual factories used by `ai`, `@ai-sdk/gateway`, and `@ai-sdk/provider-utils` --------- Co-authored-by: Nick Oates <58091943+n1ckoates@users.noreply.github.com>
## Background [Cerebras Chat Completions](https://inference-docs.cerebras.ai/api-reference/chat-completions) documents various options that are supported by the Cerebras provider, but were untyped. ## Summary * added Cerebras api options as a zod schema and exported its type * map `max_tokens` (openai compatible field name) to `max_completion_tokens` (cerebras documented field name) for `maxOutputTokens` option * `max_tokens` worked but cerebras didn't document it ## End-to-End Verification tested `generateText()` against Cerebras with various `providerOptions` ## Related Issues Fixes #19216 Closes #19208 (superseded) Closes #19219 (superseded)
…ollowing API shutdown (#19200) ## Background [Google has shut down its Imagen models](https://ai.google.dev/gemini-api/docs/imagen), leaving the corresponding model IDs and dedicated image API integrations unusable. ## Summary Google and Google Vertex image models now exclusively use the Gemini multimodal image path through `generateContent`. - Remove Imagen model IDs and the dedicated `predict` endpoint implementations. - Remove obsolete Imagen tests, fixtures, examples, and documentation. - Remove Imagen models from the AI Gateway image model list. - Keep Gemini image generation, editing, and Google Search grounding coverage. ## End-to-End Verification Tested Gemini image model examples to ensure they didn't break through this cleanup. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.73 ### Patch Changes - Updated dependencies [f607a12] - @ai-sdk/gateway@4.0.59 ## @ai-sdk/angular@3.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/baseten@2.1.12 ### Patch Changes - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/cerebras@3.0.34 ### Patch Changes - d6a521a: feat(cerebras): add typed provider options and send `maxOutputTokens` as `max_completion_tokens` field - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/code-mode@1.0.30 ### Patch Changes - ai@7.0.73 ## @ai-sdk/deepinfra@3.0.34 ### Patch Changes - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/fireworks@3.0.37 ### Patch Changes - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/gateway@4.0.59 ### Patch Changes - f607a12: chore(google): drop support for Imagen models and their integration following API shutdown ## @ai-sdk/gmicloud@3.0.5 ### Patch Changes - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/google@4.0.49 ### Patch Changes - f607a12: chore(google): drop support for Imagen models and their integration following API shutdown ## @ai-sdk/google-vertex@5.0.60 ### Patch Changes - f607a12: chore(google): drop support for Imagen models and their integration following API shutdown - Updated dependencies [99989ba] - Updated dependencies [f607a12] - @ai-sdk/openai-compatible@3.0.34 - @ai-sdk/google@4.0.49 ## @ai-sdk/harness@1.0.81 ### Patch Changes - 7f50d28: feat(harness): make `destroy` on `HarnessV1NetworkSandboxSession` mandatory - ai@7.0.73 ## @ai-sdk/harness-acp@1.0.19 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/harness-claude-code@1.0.84 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/harness-cline@1.0.8 ### Patch Changes - cb78370: fix(harness-cline): fix bug with reading and writing files - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/harness-codex@1.0.83 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/harness-deepagents@1.0.81 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/harness-grok-build@1.0.18 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 - @ai-sdk/harness-acp@1.0.19 ## @ai-sdk/harness-opencode@1.0.82 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/harness-pi@1.0.83 ### Patch Changes - 00127df: fix(harness-pi): fix incorrect grep use - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/huggingface@2.0.34 ### Patch Changes - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/langchain@3.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/llamaindex@3.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/openai-compatible@3.0.34 ### Patch Changes - 99989ba: feat(provider/openai-compatible): report image generation token usage ## @ai-sdk/otel@1.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/policy-opa@1.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/react@4.0.76 ### Patch Changes - ai@7.0.73 ## @ai-sdk/rsc@3.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/sandbox-just-bash@1.0.81 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/sandbox-vercel@1.0.81 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 ## @ai-sdk/svelte@5.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/togetherai@3.0.35 ### Patch Changes - Updated dependencies [99989ba] - @ai-sdk/openai-compatible@3.0.34 ## @ai-sdk/tui@1.0.74 ### Patch Changes - ai@7.0.73 ## @ai-sdk/vue@4.0.73 ### Patch Changes - ai@7.0.73 ## @ai-sdk/workflow@2.0.3 ### Patch Changes - ai@7.0.73 ## @ai-sdk/workflow-harness@1.0.81 ### Patch Changes - Updated dependencies [7f50d28] - @ai-sdk/harness@1.0.81 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## What
Implements `handleWebhookOption` on the gateway v4 video model so
`experimental_generateVideo({ webhook })` works end to end against the
AI Gateway:
1. The factory's URL is handed to `doStart` as `webhookUrl`, which
already maps onto the gateway's `callbackUrl` wire field (the
completion-webhook contract).
2. The factory's `received` promise passes straight through, so the SDK
awaits the delivery instead of warning (`unsupported: webhook`) and
falling back to polling.
3. On `received` resolving, the SDK's existing flow does one `doStatus`
to fetch the result — matching the gateway's thin webhook payload (no
video bytes).
Note: the gateway's delivery is HMAC-signed (`x-ai-gateway-signature:
t=...,v1=...`); verification stays the receiver's responsibility
(typically inside the factory's `received` promise). The previous
comment on this method described it as intentionally unimplemented
because the URL would be registered but never notified — that is no
longer true: the gateway's async video jobs do deliver to `callbackUrl`
at the terminal state.
## Test plan
- New unit test: URL + `received` pass-through.
- Removed the now-obsolete `does not implement handleWebhookOption`
assertion.
- `pnpm vitest run src/gateway-video-model.test.ts` → 48 passed.
- Verified live against production from the ai-gateway examples repo
(`examples/typescript/async-video/customer-webhook.ts`): webhook.site
receiver, `klingai/kling-v2.5-turbo-t2v` completed in ~85s,
`video.generation.completed` delivered with the stable idempotency key,
HMAC signature verified, `generateVideo` resolved with the video.
## Background
DeepSeek V4 Flash Vision Exp accepts image inputs and Files API
references, but the DeepSeek provider flattened user content to text and
reported file parts as unsupported. The model was also missing from the
AI Gateway model ID registry.
## Summary
- serialize inline image bytes as data URLs and forward image URLs in
DeepSeek chat messages
- add `deepSeek.files()` for multipart image uploads with
`purpose=user_data` and optional expiration
- serialize uploaded DeepSeek provider references as `{ type: "file",
file_id }` content blocks
- preserve the existing string payload for prompts without supported
image parts
- add the direct DeepSeek and AI Gateway model IDs
- add direct-provider, Gateway, and file-upload examples, regression
tests, capability documentation, and patch changesets
## End-to-End Verification
- Inline image example: DeepSeek returned `Cat` with finish reason
`stop`.
- Files API example: uploaded `comic-cat.png`, received a `file-api-…`
provider reference with a one-hour expiration, passed that reference to
`deepseek-v4-flash-vision-exp`, and received `Cat` with finish reason
`stop`.
## Validation
- `pnpm --filter @ai-sdk/deepseek test`
- `pnpm --filter @ai-sdk/deepseek type-check`
- `pnpm --filter @ai-sdk/deepseek build`
- `pnpm check`
- `pnpm type-check:full`
## Checklist
- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
---------
Co-authored-by: Aayush Kapoor <aayushkapoor34@gmail.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.74 ### Patch Changes - Updated dependencies [5941bd6] - Updated dependencies [9a4337d] - @ai-sdk/gateway@4.0.60 ## @ai-sdk/angular@3.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/azure@4.0.47 ### Patch Changes - Updated dependencies [9a4337d] - @ai-sdk/deepseek@3.0.30 ## @ai-sdk/code-mode@1.0.31 ### Patch Changes - ai@7.0.74 ## @ai-sdk/deepseek@3.0.30 ### Patch Changes - 9a4337d: feat: add DeepSeek V4 Flash Vision Exp image input and Files API support ## @ai-sdk/gateway@4.0.60 ### Patch Changes - 5941bd6: feat(gateway): implement `handleWebhookOption` on the video model so `generateVideo({ webhook })` registers the factory URL as the gateway's `callbackUrl` and awaits delivery instead of falling back to polling - 9a4337d: feat: add DeepSeek V4 Flash Vision Exp image input and Files API support ## @ai-sdk/harness@1.0.82 ### Patch Changes - ai@7.0.74 ## @ai-sdk/harness-acp@1.0.20 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/harness-claude-code@1.0.85 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/harness-cline@1.0.9 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/harness-codex@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/harness-deepagents@1.0.82 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/harness-grok-build@1.0.19 ### Patch Changes - @ai-sdk/harness@1.0.82 - @ai-sdk/harness-acp@1.0.20 ## @ai-sdk/harness-opencode@1.0.83 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/harness-pi@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/langchain@3.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/llamaindex@3.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/otel@1.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/policy-opa@1.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/react@4.0.77 ### Patch Changes - ai@7.0.74 ## @ai-sdk/rsc@3.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/sandbox-just-bash@1.0.82 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/sandbox-vercel@1.0.82 ### Patch Changes - @ai-sdk/harness@1.0.82 ## @ai-sdk/svelte@5.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/tui@1.0.75 ### Patch Changes - ai@7.0.74 ## @ai-sdk/vue@4.0.74 ### Patch Changes - ai@7.0.74 ## @ai-sdk/workflow@2.0.4 ### Patch Changes - ai@7.0.74 ## @ai-sdk/workflow-harness@1.0.82 ### Patch Changes - @ai-sdk/harness@1.0.82 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ans (#19252) ## Background `@ai-sdk/otel` emitted aggregate usage on embedding wrapper spans and per-request usage on child spans, causing telemetry backends to double-count tokens and cost. ## Root Cause The OpenTelemetry integration attached `gen_ai.usage.input_tokens` to both embedding wrapper spans and provider-request child spans; reproduced wrapper totals matched the summed child usage. ## Summary Removed input-token usage from embed and embedMany wrapper spans while preserving `embeddings {modelId}`, `gen_ai.operation.name = embeddings`, trace hierarchy, output attributes, and per-request child usage. Added regression coverage and a patch changeset. ## Testing Regression tests cover single and batched embeddings, confirming wrapper spans omit usage and provider-request spans report 14 or 28 plus 14 tokens. The complete `@ai-sdk/otel` test suite passes. ## End-to-end Validation - `pnpm -C packages/otel exec tsx --eval '<embedding usage validation>'` passed against the built `@ai-sdk/otel` package; standard span identities were preserved, wrappers had no usage, and totals were 14 and 42 tokens. ## Related Issues Fixes #19250 Closes #19251 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: zirkelc <950244+zirkelc@users.noreply.github.com> Co-authored-by: Nick Oates <58091943+n1ckoates@users.noreply.github.com>
…r-facing async video submission (#19263) ## The concept The v4 video spec added `doStart`/`doStatus` for async video generation, but the only *user-facing* entry point is `experimental_generateVideo` — which always blocks until the video is terminal. That's the wrong shape for the two canonical async patterns: 1. **Fan-out**: kicking off N jobs at once shouldn't mean parking N promises for minutes. 2. **Durable submission with a webhook receiver**: the process that *submits* the job is often not the process that *handles* the result. The receiver (an HTTP endpoint) wakes on the provider's terminal notification and fetches the result — the submitter should exit immediately. Today both require calling the spec-level `model.doStart()` directly, which takes `VideoModelV4CallOptions`: every key required, all `| undefined`. That type is intentionally exhaustive — it forces provider *implementers* to consciously handle every option — but it leaks into customer code, where the common case is three real fields and a wall of `undefined`s. **This PR adds the missing user-facing layer** — the same layering the SDK already uses for every other capability: sparse user options in, exhaustive spec object out. ```ts import { experimental_startVideo, experimental_videoStatus } from 'ai'; // Submit and walk away. All call options optional. const { operation, providerMetadata } = await experimental_startVideo({ model: gateway.videoModel('klingai/kling-v2.5-turbo-t2v'), prompt: 'A lighthouse beam sweeping across a foggy coast at night', webhookUrl: 'https://my-app.com/api/video-webhook', // notified at terminal state }); // providerMetadata.gateway.asyncJob → { jobId, webhookSigningSecret } // Later, anywhere — a cron, a queue worker, the webhook receiver: const status = await experimental_videoStatus(model, { operation }); if (status.status === 'completed') { /* status.videos */ } ``` ## How it works mechanically - **`experimental_startVideo`** normalizes the same inputs as `generateVideo` (prompt/frameImages/inputReferences precedence rules — now extracted into a shared `normalizeVideoCallInputs`, pure code motion from `generate-video.ts`), builds the full `VideoModelV4CallOptions` object with explicit `undefined`s, mints one `idempotency-key: aisdk_vid_*` per logical start (caller-supplied header wins), calls `doStart` exactly once, and returns `{ operation, warnings, providerMetadata, response }`. The provider's job identity and webhook signing secret ride home in `providerMetadata`, so the receiver can verify deliveries without any out-of-band capture. If `n` exceeds a known `maxVideosPerCall`, it throws with guidance to fan out instead of silently splitting into multiple billed starts. - **`experimental_videoStatus(model, { operation })`** is a single-shot `doStatus` with retries — no polling loop. Poll on your own schedule, or skip polling entirely when a webhook tells you the job is done. - **Spec types are untouched.** `VideoModelV4CallOptions` keeps its required-keys discipline; the optionality lives only at the SDK function layer, exactly like `generateVideo`. - **`generateVideo` is unaffected** and still the right API for "await one video" — including `poll`/`webhook` orchestration (see the companion PR adding `handleWebhookOption` to the gateway provider, which makes `generateVideo({ webhook })` actually await a gateway delivery instead of falling back to polling). ## Test plan - 10 new unit tests: sparse→exhaustive option mapping, `webhookUrl` forwarding, caller-supplied vs minted idempotency keys, key stability across start retries, providerMetadata surfacing, normalization-warning merging, `maxVideosPerCall` guard (static and functional), missing `doStart`/`doStatus` errors, completed-status payload. - Full `generate-video` suite passes (75/75, node config), type-check clean, ultracite clean. Naming is open for bikeshedding (`startVideo`/`videoStatus` vs `submitVideo`/`getVideoStatus` etc.) — flagged as `experimental_` so we can adjust before stabilizing.
## Background useChat rejected a nullish Zod metadata schema when UIMessage used a branded message ID, producing TS2322 for a valid published-package configuration. ## Root Cause InferUIMessageMetadata conditionally inferred metadata from an intersected UIMessage type and dropped the explicit undefined member when the ID was branded. The reproduction diagnostic expected metadata without undefined, while indexed access through UI_MESSAGE['metadata'] preserved the optional metadata type. ## Summary Changed chat metadata schema constraints to use the UIMessage metadata property type, added a patch changeset, and removed reproduction-only artifacts. ## Testing Added a Zod 3 type regression test covering a nullish metadata schema on a UIMessage with a branded ID. ## End-to-end Validation - `git show dd80ecc:examples/ai-functions/src/reproduction/issue-14143-branded-message-id.ts | sed "s#path.resolve(scriptDirectory, '../../../..')#path.resolve(scriptDirectory, '../..')#" | pnpm -C examples/ai-functions exec tsx -` completed successfully and reported that useChat accepts the branded message ID with a nullish metadata schema. ## Related Issues Fixes #14143 Closes #17850 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: lgrammel <lars.grammel@gmail.com> Co-authored-by: lensbart <20876627+lensbart@users.noreply.github.com> Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com> Co-authored-by: Aayush Kapoor <aayushkapoor34@gmail.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.75 ### Patch Changes - 8978ad8: feat(ai): add `experimental_startVideo` and `experimental_videoStatus` — user-facing fire-and-forget wrappers over the video model `doStart`/`doStatus` spec methods, with the same sparse-options DX as `generateVideo` - Updated dependencies [dedac59] - @ai-sdk/gateway@4.0.61 ## @ai-sdk/angular@3.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/code-mode@1.0.32 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/gateway@4.0.61 ### Patch Changes - dedac59: chore(provider/gateway): update gateway model settings files ## @ai-sdk/harness@1.0.83 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/harness-acp@1.0.21 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/harness-claude-code@1.0.86 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/harness-cline@1.0.10 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/harness-codex@1.0.85 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/harness-deepagents@1.0.83 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/harness-grok-build@1.0.20 ### Patch Changes - @ai-sdk/harness@1.0.83 - @ai-sdk/harness-acp@1.0.21 ## @ai-sdk/harness-opencode@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/harness-pi@1.0.85 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/langchain@3.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/llamaindex@3.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/otel@1.0.75 ### Patch Changes - c0a42bc: fix(otel): prevent embedding usage double counting by reporting usage only on provider request spans - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/policy-opa@1.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/react@4.0.78 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/rsc@3.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/sandbox-just-bash@1.0.83 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/sandbox-vercel@1.0.83 ### Patch Changes - @ai-sdk/harness@1.0.83 ## @ai-sdk/svelte@5.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/tui@1.0.76 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/vue@4.0.75 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/workflow@2.0.5 ### Patch Changes - Updated dependencies [8978ad8] - ai@7.0.75 ## @ai-sdk/workflow-harness@1.0.83 ### Patch Changes - @ai-sdk/harness@1.0.83 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Background Published @ai-sdk/mcp SSE clients could leave tools() and callTool() pending indefinitely when the server returned a non-2xx POST response. ## Root Cause SseMCPTransport.send reported HTTP and OAuth failures through onerror but returned successfully. The client therefore never invoked its send rejection handler, and requests without a timeout remained pending. ## Summary SSE POST and OAuth failures now reject with errors, including HTTP status, endpoint URL, and response body details. Added a patch changeset for @ai-sdk/mcp. ## Testing Updated the SSE transport regression test to verify that a non-2xx POST both reports and rejects with the expected MCPClientError metadata. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx src/reproduction/issue-19205-mcp-sse-non-2xx-hang.ts` completed successfully; tools() and callTool() rejected with their HTTP statuses instead of hanging. ## Related Issues Fixes #19205 Closes #19207 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: habibthadev <109099706+habibthadev@users.noreply.github.com> Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
) ## Background Vue useCompletion kept a non-empty initialCompletion visible after manual clearing, during request startup, and after an empty model response. ## Root Cause Two logical-OR fallbacks in useCompletion treated the valid empty string as unset; the reproduction confirmed that both SWRV revalidation and initialization restored initialCompletion instead of preserving ''. ## Summary Changed both completion fallbacks to nullish checks so only undefined restores initialCompletion, removed reproduction artifacts, and added a patch changeset for @ai-sdk/vue. ## Testing Added regression coverage for manual clearing, shared-ID reuse, request-start clearing, and empty completion responses. ## End-to-end Validation - `pnpm -C packages/vue build && pnpm -C examples/ai-functions exec tsx src/reproduction/vue-use-completion-empty-initial-fallback.ts` completed successfully and confirmed all three reproduced empty-completion scenarios. ## Related Issues Fixes #19243 Closes #19245 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: habibthadev <109099706+habibthadev@users.noreply.github.com>
## Background #10150 tracks exposing image generation token usage per provider. `ByteDanceImageModel` did not map `usage`, so `generateImage(...).usage` was `undefined` for Seedream models even though Volcengine Ark does return token counts on image generation. Sub-issue: #17988 ## Summary - Extend `byteDanceImageResponseSchema` with a `.nullish()` `usage` object and map `output_tokens` / `total_tokens` into `ImageModelV4Usage`. - `inputTokens` stays `undefined`. Ark exposes **no** input token count for image generation, and defaulting it to `0` would assert something the API never said. - `generated_images` is deliberately neither parsed nor mapped into `usage`: it counts images, not tokens, and duplicates `images.length`. A dedicated test pins this so the field is not folded into `usage` by a later well-meaning change. - A missing `usage` object yields `undefined` without a warning, consistent with the other providers. Field names come from the official Volcengine SDK — `volcengine/volcengine-python-sdk`, `volcenginesdkarkruntime/types/images/images.py` and `image_gen_completed_event.py`: ```python class Usage(BaseModel): generated_images: int output_tokens: Optional[int] total_tokens: Optional[int] tool_usage: Optional[ToolUsage] ``` One caveat worth recording: the docstrings in `images.py` are copy-paste damaged (`output_tokens` is annotated "The number of images generated by this request"). The same fields in `image_gen_completed_event.py` carry the correct descriptions, and those are what this PR follows. ## Contributor Credit @Kartikayy007 audited which image APIs expose token usage in #10150. That audit concluded no provider outside OpenAI exposed it; ByteDance turns out to be a counter-example, which is what prompted this change. ## End-to-End Verification **Not run against a live Ark endpoint — I have no ModelArk access.** The mapping is derived from the official Volcengine SDK type definitions, which is a primary source but not an observation, so I would not want that overstated. What is verified: unit tests cover usage present, usage absent, partial/`null` fields, and the `generated_images` case. These run through `createTestServer`, which is MSW-backed, so the real `postJsonToApi` call, zod parsing, and mapping all execute — only the upstream response is simulated. If a maintainer with Ark access can confirm the live response shape, that would close the gap. The equivalent mapping for `@ai-sdk/openai-compatible` in #17996 *is* verified end-to-end. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work Ark also returns `tool_usage.web_search`. It is not a token count, so it does not belong in `usage`; surfacing it through `providerMetadata` would need a synthetic `images` array because `ImageModelV4ProviderMetadata` requires that key. Left out deliberately. --------- Co-authored-by: Nick Oates <58091943+n1ckoates@users.noreply.github.com>
## Background reported in #10781 in multi step stream text flows, since there is only one model call being made, `streamText` merges all step streams into one logical stream and forwarded these IDs unchanged, so consecutive steps emitted the same ID ## Summary we now keep the first occurrence as-is and remapping later overlaps to a freshly generated id, while a per-step mapping ensures the matching delta and end parts carry the same remapped ID as their start part ## End-to-End Verification verified by running the following script before and after <details> ```ts import { anthropic } from '@ai-sdk/anthropic'; import { isStepCount, streamText, tool } from 'ai'; import { z } from 'zod'; import { run } from '../../lib/run'; run(async () => { let currentStep = 0; const textStartIds: string[] = []; const result = streamText({ model: anthropic('claude-sonnet-4-5'), instructions: 'Follow this exact sequence: first say "Let me check.", then call getWeather, then summarize the tool result. Call the tool exactly once.', prompt: 'What is the weather in San Francisco?', tools: { getWeather: tool({ description: 'Get the current weather for a city.', inputSchema: z.object({ city: z.string(), }), execute: async ({ city }) => ({ city, temperature: 72, condition: 'sunny', }), }), }, stopWhen: isStepCount(3), }); for await (const part of result.stream) { switch (part.type) { case 'start-step': currentStep++; break; case 'text-start': textStartIds.push(part.id); console.log(`[step ${currentStep}] text-start id="${part.id}"`); break; case 'text-end': console.log(`[step ${currentStep}] text-end id="${part.id}"`); break; } } const duplicateIds = textStartIds.filter( (id, index) => textStartIds.indexOf(id) !== index, ); console.log( duplicateIds.length > 0 ? `\nREPRODUCED: duplicate text ID(s): ${[...new Set(duplicateIds)].join(', ')}` : '\nNOT REPRODUCED: every text-start ID was unique.', ); }); ``` </details> ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Related Issues fixes #10781 closes #17775 closes #17765
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.76 ### Patch Changes - c6d57f3: fix(ai): prevent duplicate text and reasoning part ids - 677a707: fix(ai): allow nullish metadata schemas for UI messages with branded IDs ## @ai-sdk/angular@3.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/bytedance@2.0.31 ### Patch Changes - 5b7da0e: feat(provider/bytedance): report image generation token usage ## @ai-sdk/code-mode@1.0.33 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/harness@1.0.84 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/harness-acp@1.0.22 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/harness-claude-code@1.0.87 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/harness-cline@1.0.11 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/harness-codex@1.0.86 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/harness-deepagents@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/harness-grok-build@1.0.21 ### Patch Changes - @ai-sdk/harness@1.0.84 - @ai-sdk/harness-acp@1.0.22 ## @ai-sdk/harness-opencode@1.0.85 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/harness-pi@1.0.86 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/langchain@3.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/llamaindex@3.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/mcp@2.0.35 ### Patch Changes - 76fb75d: fix(mcp): reject SSE requests when POST responses are unsuccessful ## @ai-sdk/otel@1.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/policy-opa@1.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/react@4.0.79 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [76fb75d] - Updated dependencies [677a707] - ai@7.0.76 - @ai-sdk/mcp@2.0.35 ## @ai-sdk/rsc@3.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/sandbox-just-bash@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/sandbox-vercel@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.84 ## @ai-sdk/svelte@5.0.76 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/tui@1.0.77 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/vue@4.0.76 ### Patch Changes - 8514cff: fix(vue): preserve empty completion values when an initial completion is configured - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/workflow@2.0.6 ### Patch Changes - Updated dependencies [c6d57f3] - Updated dependencies [677a707] - ai@7.0.76 ## @ai-sdk/workflow-harness@1.0.84 ### Patch Changes - @ai-sdk/harness@1.0.84 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… Schema conversion (#18046) ## Background Zod 4 records and object catchalls advertised additionalProperties: false through AI SDK even though their original schemas and runtime validation allowed typed additional values. ## Root Cause The generic Zod 4 conversion helper unconditionally replaced additionalProperties on every object with false. The reproduction confirmed this changed Zod's schema-valued output while validation still accepted populated records. ## Summary Preserved schema-valued additionalProperties while recursively closing nested object schemas, removed reproduction-only artifacts, and added a provider-utils patch changeset. ## Testing Added utility regression coverage plus Zod 4 record and object-catchall conversion tests for Node and Edge runtimes. ## End-to-end Validation - `pnpm -C packages/provider-utils build && pnpm -C packages/ai build`, followed by an `ai` package `asSchema()` reproduction: preserved string record and number catchall schemas, and record validation succeeded. ## Related Issues Fixes #17871 Closes #18042 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: Lars Grammel <205036+lgrammel@users.noreply.github.com> Co-authored-by: MaratFM <99706+MaratFM@users.noreply.github.com>
…ges (#19237) ## Background OpenAI-compatible multimodal providers need video file parts forwarded as video_url content so models can analyze inline or hosted videos. ## Summary Added video_url API content typing and conversion for video/* URL, Uint8Array, and base64 file parts while preserving provider metadata and the existing supportedUrls workflow. ## Testing Added converter, generate, stream, metadata, URL, inline-data, base64, and compile-time coverage for video inputs. ## End-to-end Validation - Added and ran a focused Alibaba Qwen3-VL example using a local MP4; the live model successfully described the video. - Built and tested @ai-sdk/openai-compatible in Node.js and Edge runtimes. ## Documentation Documented video inputs, data URLs, hosted URL pass-through, supportedUrls configuration, and provider-dependent limitations in the OpenAI Compatible Providers guide. ## Related Issues Fixes #19236 Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: jsiu93 <12907730+jsiu93@users.noreply.github.com>
…19249) ## Background Keyed AI state setters and concurrent wrapped actions could silently discard independent state updates, producing incorrect published `@ai-sdk/rsc` behavior. ## Root Cause Plain keyed setters spread a render snapshot captured by a memoized callback, while wrapped actions patched deltas onto state captured before awaiting the action. Regression tests and the original reproduction confirmed that both stale bases overwrote independent updates. ## Summary Keyed plain-value setters and wrapped action delta application now use functional React state updaters against current AI state. The pull request also adds focused regression coverage and a patch changeset for `@ai-sdk/rsc`. ## Testing Regression tests cover same-tick and sequential keyed setters and overlapping wrapped action deltas. The RSC UI suite, package and repository tests, full type checking, RSC build, and focused formatting and lint checks pass. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx src/reproduction/issue-19241-rsc-state-races.ts` — the factory replay exited 0 without the dropped-update signal. ## Related Issues Fixes #19241 Closes #19244 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: habibthadev <109099706+habibthadev@users.noreply.github.com>
## Background `Experimental_StdioMCPTransport` currently uses Node.js `spawn` with `shell: false`. On Windows, npm command shims such as `npx.cmd` cannot be launched directly, so configuring `command: "npx"` fails with `ENOENT` and configuring `command: "npx.cmd"` fails with `EINVAL`. ## Changes - use `cross-spawn` to resolve and invoke Windows command shims while preserving `shell: false` - reject CR/LF in Windows commands and arguments before the command-shell fallback - add Windows-only regression coverage for `npx`, metacharacter escaping, and line-break rejection - run the MCP Node test suite on Windows in CI - add a patch changeset for `@ai-sdk/mcp` ## Verification - `pnpm check` - `pnpm --filter @ai-sdk/mcp type-check` - `pnpm --filter @ai-sdk/mcp test:node` (283 passed, 3 Windows-only tests skipped locally) - `pnpm type-check:full` reaches unrelated existing diagnostics in `examples/nuxt-openai`; the MCP package type check passes Fixes #19157
…de turns (#19070) ## Background Multi-call Claude Code turns overcounted the final finish-step by reporting cumulative turn usage instead of the final model call's usage. ## Root Cause The successful result handler preferred cumulative result usage over state.pendingStepUsage when closing the final open step. The focused regression test failed with 30/5 cumulative tokens instead of 20/3 step tokens, matching the live reproduction. ## Summary Prioritized pending per-step usage when emitting the final finish-step, retained cumulative usage for finish.totalUsage, added a patch changeset, and removed reproduction-only artifacts. ## Testing Added bridge regression coverage simulating a tool round trip and verifying distinct final-step and cumulative turn usage. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx src/reproduction/harness-claude-code-final-step-usage.ts` completed successfully against live Claude; final-step usage was 8,666 input/1 output while cumulative usage was 17,249 input/79 output. ## Related Issues Fixes #19068 Closes #19069 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: mattpocock <28293365+mattpocock@users.noreply.github.com> Co-authored-by: Felix Arntz <felix.arntz@vercel.com>
…eams (#19160) ## Background Approved Pi builtin tools executed successfully, but continueStream().fullStream omitted their tool-result or tool-error outcome. ## Root Cause runPrompt marked builtin approval call IDs as settled host tool calls, causing the replay filter to discard the builtin's first real result. The live reproduction and a focused failing regression test confirmed this path. ## Summary Separated builtin approval replay tracking from host tool result tracking so replayed calls and approval requests remain suppressed while genuine builtin outcomes are emitted. Added a patch changeset for @ai-sdk/harness. ## Testing Added regression coverage verifying that continued builtin approvals suppress replayed input events, submit approval once, and emit exactly one provider tool result. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx src/reproduction/issue-19156-harness-pi-approved-builtin-result.ts` exited successfully and emitted exactly one continued `tool-result` containing the approved bash output. ## Related Issues Fixes #19156 Closes #19159 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: zhaoyouqi <4202819+zhaoyouqi@users.noreply.github.com>
…age via new `install-command` source type (#19292) ## Background ACP harness implementations are not always distributed through NPM, preventing the generic adapter from bootstrapping runtimes such as Cursor or fx. But so far the ACP meta harness required specifying an NPM package as source. This has been a blocker for harnesses like [Cursor](https://cursor.com/cli) and [fx](https://fx.sh). ## Summary - Add the `install-command` source type for trusted Bash installers. - Isolate command-based installations in a deterministic harness-owned home and launch binaries directly from `$HOME/.local/bin`. - Preserve bootstrap caching, lifecycle identity, credential forwarding, and existing NPM source behavior. - Add unit coverage, documentation, and a runnable Cursor ACP example harness. - Align the Codex ACP and Cursor ACP example sets with the other harnesses. ## End-to-End Verification Ran `./tools/run-harness-agent-examples.sh --harness cursor-acp`. ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Related Issues See #16956
## Summary - Add `gateway.tools.takoSearch()` for source-grounded search. - Support search effort, data and web source configuration, localization, and optional inline contents. - Add documentation, examples, and a patch changeset. ## Tests - `pnpm --filter @ai-sdk/gateway test` - `pnpm type-check:full` - `pnpm check` - `pnpm validate:docs`
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## ai@7.0.77 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [a371615] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/gateway@4.0.62 ## @ai-sdk/alibaba@2.0.34 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/amazon-bedrock@5.0.61 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/anthropic@4.0.41 - @ai-sdk/openai@4.0.46 ## @ai-sdk/angular@3.0.77 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/anthropic@4.0.41 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/anthropic-aws@2.0.33 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/anthropic@4.0.41 ## @ai-sdk/assemblyai@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/azure@4.0.48 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/deepseek@3.0.31 - @ai-sdk/openai@4.0.46 ## @ai-sdk/baseten@2.1.13 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/black-forest-labs@2.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/bytedance@2.0.32 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/cartesia@3.0.24 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/cerebras@3.0.35 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/code-mode@1.0.34 ### Patch Changes - ai@7.0.77 ## @ai-sdk/cohere@4.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/deepgram@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/deepinfra@3.0.35 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/deepseek@3.0.31 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/elevenlabs@3.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/fal@3.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/fireworks@3.0.38 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/fish-audio@3.0.7 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/gateway@4.0.62 ### Patch Changes - a371615: feat (provider/gateway): add Tako Search tool support - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/gladia@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/gmicloud@3.0.6 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/google@4.0.50 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/google-vertex@5.0.61 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 - @ai-sdk/anthropic@4.0.41 - @ai-sdk/google@4.0.50 ## @ai-sdk/groq@4.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/harness@1.0.85 ### Patch Changes - fa6af57: fix(harness): emit builtin tool results after approval continuations - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/harness-acp@1.0.23 ### Patch Changes - 6352c2a: feat(harness-acp): support ACP harnesses that do not have an NPM package via new `install-command` source type - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-claude-code@1.0.88 ### Patch Changes - 999d92f: fix(harness-claude-code): report final model call usage for the final step - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-cline@1.0.12 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-codex@1.0.87 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-deepagents@1.0.85 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-grok-build@1.0.22 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [6352c2a] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness-acp@1.0.23 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-opencode@1.0.86 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/harness-pi@1.0.87 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/huggingface@2.0.35 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/hume@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/klingai@4.0.31 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/langchain@3.0.77 ### Patch Changes - ai@7.0.77 ## @ai-sdk/llamaindex@3.0.77 ### Patch Changes - ai@7.0.77 ## @ai-sdk/lmnt@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/luma@3.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/mcp@2.0.36 ### Patch Changes - b352a6a: fix(mcp): support spawning command shims such as `npx` on Windows - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/minimax@3.0.17 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/anthropic@4.0.41 ## @ai-sdk/mistral@4.0.32 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/moonshotai@3.0.37 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/open-responses@2.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/openai@4.0.46 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/openai-compatible@3.0.35 ### Patch Changes - 7dd9ec3: feat(openai-compatible): convert video file parts to `video_url` content parts - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/otel@1.0.77 ### Patch Changes - ai@7.0.77 ## @ai-sdk/perplexity@4.0.31 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/policy-opa@1.0.77 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/prodia@2.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/provider-utils@5.0.29 ### Patch Changes - b74971f: Preserve schema-valued additional properties when converting Zod 4 schemas. ## @ai-sdk/quiverai@2.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/react@4.0.80 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [b352a6a] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/mcp@2.0.36 - ai@7.0.77 ## @ai-sdk/replicate@3.0.30 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/revai@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/rsc@3.0.77 ### Patch Changes - af87f75: Preserve concurrent AI state updates from keyed setters and wrapped actions. - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/sandbox-just-bash@1.0.85 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/sandbox-vercel@1.0.85 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [fa6af57] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/harness@1.0.85 ## @ai-sdk/svelte@5.0.77 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/togetherai@3.0.36 ### Patch Changes - Updated dependencies [b74971f] - Updated dependencies [7dd9ec3] - @ai-sdk/provider-utils@5.0.29 - @ai-sdk/openai-compatible@3.0.35 ## @ai-sdk/tui@1.0.78 ### Patch Changes - ai@7.0.77 ## @ai-sdk/valibot@3.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/voyage@2.0.29 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 ## @ai-sdk/vue@4.0.77 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/workflow@2.0.7 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 - ai@7.0.77 ## @ai-sdk/workflow-harness@1.0.85 ### Patch Changes - Updated dependencies [fa6af57] - @ai-sdk/harness@1.0.85 ## @ai-sdk/xai@4.0.43 ### Patch Changes - Updated dependencies [b74971f] - @ai-sdk/provider-utils@5.0.29 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…mposition, usage metadata, speed passthrough, error parsing (#18942) ## Summary Combined Deepgram provider update (this PR absorbs #18941). One `minor` changeset covers everything. ### Transcription (`/v1/listen`) 1. **Silently dropped options fixed.** `keyterm`, `paragraphs`, `intents`, `sentiment`, and `replace` were parsed from `providerOptions.deepgram` but never mapped into the request. They are now sent as query parameters. `keyterm` is the nova-3-recommended keyword-boosting param. 2. **Behavior change: `diarize` no longer defaults to `true`.** Speaker diarization is a [paid Deepgram add-on](https://deepgram.com/pricing), and the provider previously sent `diarize=true` on every pre-recorded request unless explicitly opted out. It is now only sent when explicitly set — users who relied on the old default must pass `providerOptions: { deepgram: { diarize: true } }`. (This behavior change is why the bump is `minor`.) Also widens the provider callable signature from `'nova-3'` to any transcription model ID. ### Speech (`/v1/speak`) 3. **Voice family IDs + voice/language composition.** `aura-2` / `aura` compose the upstream model ID from the `generateSpeech` `voice` and `language` options (`<family>-<voice>-<language>`, language defaults to `en`), matching voice selection in every other AI SDK speech provider. A family ID without `voice` throws a clear error (Cartesia precedent). Full voice IDs (e.g. `aura-2-thalia-en`) keep passing through unchanged; the union is trimmed to family IDs plus the `(string & {})` escape hatch. 4. **`providerMetadata.deepgram`** carries `modelName` (resolved upstream model), `modelUuid`, `additionalModelUuids`, `charCount` (the billed character count), `breaksApplied`, `pronunciationsApplied`, `pronunciationWarnings` (when present), and `requestId` from response headers. `dg-project-id` is deliberately excluded (account identifier). 5. **`speed` passthrough**: Deepgram's REST API now documents a `speed` parameter (validated live: accepted range 0.7–1.5, 400 outside it). The `generateSpeech` `speed` option maps to it instead of warning as unsupported. ### Both endpoints 6. **Error parsing**: `APICallError.message` now carries Deepgram's real error (`{ err_code, err_msg, request_id }`) instead of the HTTP reason phrase. The legacy `{ error: { message, code } }` schema was dropped after live-probing both endpoints showed it is never returned (it was speculative boilerplate from the original transcribe PR). Docs page, README, and examples updated; new examples: `spanish.ts`, `speed.ts`, `error-handling.ts`; transcribe example exercises `keyterm`. ## Changeset - `minor` (driven by the `diarize` default flip; everything else is additive) ## Test plan - 38 package tests: transcription option mapping incl. no-diarize-by-default, speech composition/passthrough/missing-voice/auto-language, provider metadata extraction, speed passthrough, error-schema unit tests, `doGenerate`-level `APICallError` err_msg surfacing - All examples verified live against the Deepgram API (success + error paths) - `tsc --noEmit` clean, ultracite clean
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @ai-sdk/deepgram@3.1.0 ### Minor Changes - 00fe856: feat(deepgram): transcription option fixes + speech voice/language composition, usage metadata, speed passthrough, and error parsing Transcription: - `keyterm`, `paragraphs`, `intents`, `sentiment`, and `replace` were accepted in `providerOptions.deepgram` but silently dropped from the `/v1/listen` request. They are now sent as query parameters. Also widens the provider callable signature from `'nova-3'` to any transcription model ID. - **Behavior change:** `diarize` no longer defaults to `true`. Speaker diarization is a paid Deepgram add-on, and the provider previously sent `diarize=true` on every pre-recorded request unless explicitly opted out. It is now only sent when explicitly set in `providerOptions.deepgram`. Users who relied on the old default must pass `providerOptions: { deepgram: { diarize: true } }`. Speech: - Bare voice family IDs (`aura-2`, `aura`) compose the upstream model ID from the `generateSpeech` `voice` and `language` options (`<family>-<voice>-<language>`, language defaults to `en`) and require `voice`; full voice IDs (e.g. `aura-2-helena-en`) keep passing through unchanged. The `DeepgramSpeechModelId` union is trimmed to the family IDs plus the string escape hatch. - `providerMetadata.deepgram` carries `modelName`, `modelUuid`, `additionalModelUuids`, `charCount` (the billed character count), `breaksApplied`, `pronunciationsApplied`, `pronunciationWarnings` (when present), and `requestId` from the `/v1/speak` response headers. - The `speed` option is passed through to Deepgram's `speed` parameter (accepted range 0.7–1.5) instead of being ignored with a warning. - API errors now parse Deepgram's `{ "err_code", "err_msg", "request_id" }` error shape, so `APICallError.message` carries the real cause instead of the HTTP reason phrase. The legacy `{ "error": { "message", "code" } }` schema was dropped: no endpoint returns it. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Summary
Manual Verification
Checklist
pnpm changesetin the project root)pnpm prettier-fixin the project root)Future Work
Related Issues