NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm
npm, #2684 most downloaded on npm
AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.
Latest stable
7.0.169
Last release 12 days ago
10 Nov 2026
Ships on a steady schedule
a new release about every 8 days
Some releases are documented
notes for 27 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
1654 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
4311fa1: Use Zod Mini for internal validation schemas to reduce bundle size while preserving the public message schemas' classic Zod methods, error me
65aa669: add experimental_queue to useChat to queue messages sent while a response is in progress
toUIMessageStream onError once per invalid tool callYour coding agent can read these notes before it upgrades. Set up the MCP server →
### Patch Changes - Updated dependencies [44db225] - @ai-sdk/gateway@4.0.139
883fcde: remove transcription word timings from telemetry when recordOutputs is false
### Patch Changes - Updated dependencies [bace553] - Updated dependencies [6737c77] - Updated dependencies [bb4e2d0] - @ai-sdk/gateway@4.0.137
933dae3: fix (ai): download deprecated file-url and image-url tool result content
5d18351: fix(ai): detect downloaded audio types from bytes when servers return a generic or non-audio content type such as application/octet-stream
8da48db: Respect recordInputs and recordOutputs when delivering telemetry events to integrations and the ai:telemetry channel. Filter nested content and omit raw span results when content recording is disabled, while preserving application results.
fd7e8a7: Preserve the order of text and complete function calls in streamed Google responses, including standalone thought signatures on empty text or reasoning parts.
Keep provider metadata on empty text parts when converting results to response messages so it can be passed back in subsequent requests.
Omit foreign-provider empty signature text when replaying history through Anthropic or Bedrock, preserving Bedrock’s existing native reasoning-history handling.
36802d4: Support native URL transcription with an optional provider capability, keeping existing file-generation contracts unchanged. Groq sends HTTP(S) audio URLs through its url parameter without downloading and re-uploading them, avoiding the attachment upload limit. Supplying a custom download function retains local download behavior.
For telemetry integrations, TranscriptionEndEvent.audio.byteLength and audio.mediaType can now be undefined when a provider fetches the audio URL natively. Check for missing values before using them as a number or string. Downloaded and inline audio continue to report their metadata; streaming transcription metadata is unchanged.
Strip media fragments before sending URLs to Groq. If Groq rejects a redirect, fall back to the existing secure local downloader and file upload rather than failing previously working URL inputs. Other provider errors are preserved.
933dae3: fix (ai): download deprecated file-url and image-url tool result content
Tool result content parts that use the deprecated file-url and image-url
types were converted to file parts with { type: 'url' } data, but they were
never passed to the download function. When the model does not support the URL,
the provider received a bare URL instead of the file contents, even though the
replacement file part with { type: 'url' } data was downloaded and inlined.
Downloaded legacy URL parts now use the same media type normalization as file parts, resolving generic types from the response header or image bytes. Legacy base64 data URLs also normalize to inline data with the media type from their data URL, matching replacement file parts.
e0143b0: feat(ai): support provider-owned realtime transports
Add an optional createTransport interface and provider connection capability.
934100c: Report the actual OpenAI Chat HTTP endpoint (also used by Azure Chat and Bedrock Mantle Chat) through optional request metadata and model-call end events. Record its host and port on OpenTelemetry chat spans without exposing URL credentials, paths, queries, or fragments. Expose only the sanitized HTTP origin in text and object generation results and step/finish callbacks. Providers that do not report an endpoint leave these attributes unset.
c389374: fix(ai): infer union output types when passing a union of schemas to Output.object and Output.array
Previously, passing a schema whose type is a union of schemas (e.g. a schema selected from a map at runtime) failed to type-check because the output type was inferred from the first union member only. The output type is now inferred as the union of the schemas' output types.
892af4d: feat (ai): re-export realtime server-connection and usage types
Adds Experimental_RealtimeServerConnection, Experimental_RealtimeSessionIntent, and Experimental_RealtimeUsage aliases for the new experimental RealtimeModelV4 server-side spec types.
1a1da8d: stream steering messages to the ui and keep them in converted messages
41465fd: Expose optional transcription word timings separately from segments and accept shared timestampGranularities. Explicit provider timing settings take precedence. OpenAI now sends timestamp_granularities only with verbose_json and warns when a requested timing is unavailable or excluded.
9754014: Add typed streaming heartbeat parts. Anthropic emits them only with includePings: true (disabled by default), without requiring raw chunks. Core forwards pings through stream retries without storing them as generated content or sending them to UI message streams. Consumers with exhaustive stream-part switches must handle the new ping union variant when upgrading, even when the opt-in is disabled. Typed pings do not flush partial words during stream smoothing.
2e44144: Represent videos delivered directly to caller-managed storage with an explicit uploaded outcome. Video generation reports uploadedVideos without downloading or synthesizing video bytes; access video only when videos is nonempty.
Updated dependencies [722d4a9]
Updated dependencies [acea2b5]
Updated dependencies [89aff56]
Updated dependencies [41465fd]
Updated dependencies [2e44144]
Updated dependencies [36802d4]
Updated dependencies [ef2dfb5]
Updated dependencies [e0143b0]
Updated dependencies [934100c]
Updated dependencies [892af4d]
Updated dependencies [892af4d]
Updated dependencies [89aff56]
Updated dependencies [32acf43]
Updated dependencies [41465fd]
Updated dependencies [9754014]
Updated dependencies [4bb73b0]
Updated dependencies [2e44144]
857ca45: Restore server-defined tool metadata, dynamic status, and title when validating tool approval continuations so approval policies receive the
WorkflowAgent runs, including the prompt, final output, steps, and tools. Events recorded in the workflow are reported on completion or suspension with their original timestamps. For OpenTelemetry, pass the same OpenTelemetryIdGenerator instance as the tracer provider's idGenerator and sampler and as new OpenTelemetry({ durable }). This explicit bridge carries parent trace context and sampling across steps, reports model spans live with provider requests nested beneath them, and reconstructs the enclosing invoke_agent tree when the run completes. Without the bridge, existing live per-model tracing is preserved. Add typed experimental durable context hooks for telemetry integrations; remove reliance on process-global ID-generator detection.51ca5b7: fix(ai): support cross-realm Uint8Array and ArrayBuffer in DefaultGeneratedFile
a71172d: fix(ai): clarify inverted smoothStream prefix error message
a71172d: fix(ai): clarify inverted smoothStream prefix error message
cf27969: add steering.queue() to send a message once the current task is done
17b6923: fix(ai): validate streamed data parts against dataPartSchemas
processUIMessageStream looked up dataPartSchemas by the full chunk type (data-weather) instead of the bare part name (weather), so useChat / Chat never validated streamed data parts. Invalid data parts now raise a TypeValidationError.
Updated dependencies [2099d45]
Updated dependencies [d05ff62]
### Patch Changes - Updated dependencies [cbc9ac0] - @ai-sdk/gateway@4.0.132
8ba3a5c: fix(ai): repair partial JSON that ends with a minus sign at the start of an array
8ba3a5c: fix(ai): repair partial JSON that ends with a minus sign at the start of an array
5c247e9: feat(sandbox): add stat, listDirectory, and deleteFile to Experimental_SandboxSession, and specify that relative paths in every method resolve against the directory run and spawn start in
The just-bash and Vercel Sandbox adapters implement the new methods. Both now resolve a relative workingDirectory for run and spawn against the sandbox's working directory, and the just-bash adapter rejects writes to a directory instead of replacing it with a file.
Updated dependencies [7716e18]
Updated dependencies [f850782]
Updated dependencies [5c247e9]
Updated dependencies [dcd2f8d]
0cc4921: graduate LanguageModelStreamPart to stable and deprecate Experimental_LanguageModelStreamPart
filterActiveTools from experimental. It is now exported as filterActiveTools; experimental_filterActiveTools remains as a deprecated alias.### Patch Changes - Updated dependencies [9f19c79] - @ai-sdk/gateway@4.0.129
b6b9dca: chore(ai): remove runtime validation of inputs that TypeScript types already guarantee
b6b9dca: chore(ai): remove runtime validation of inputs that TypeScript types already guarantee
streamText, generateText, generateObject and streamObject no longer validate messages against the ModelMessage schema. This removes a cost that grew linearly with message history and was paid on every streamText step. Type checks on call settings, steering messages, tool caller configuration, smoothStream chunking, experimental_streamSpeech text input, the shape of decide state and questions, and the batch reference version have also been removed. Value constraints that types cannot express, such as integer ranges, non-empty collections, unknown keys, and non-finite numbers or cycles in decide JSON input, are still validated.
Updated dependencies [57086ff]
Updated dependencies [01d7a03]
Updated dependencies [95348b3]
47236dd: add onStepError callback to generateText, streamText, ToolLoopAgent and telemetry integrations, and onError and onAbort to ToolLoopAgent
aiVersion to telemetry events so tracing-channel subscribers and telemetry integrations can identify the emitting ai package version, including in bundled applications and applications with multiple SDK versions.5475347: Fix non-streaming Responses API structured output failing when multiple assistant messages contain JSON. Providers can supply separate struct
final_answer while preserving all generated content, annotations, conversation history, and token usage.### Patch Changes - Updated dependencies [a706678] - @ai-sdk/gateway@4.0.125
### Patch Changes - Updated dependencies [1bf6d85] - @ai-sdk/gateway@4.0.124
8e18d59: feat(ai): add experimental_streamSpeech
8e18d59: feat(ai): add experimental_streamSpeech
Streams speech audio from a string, or an array, iterable, or stream of text deltas and/or text parts (each with an optional voice and providerOptions) using speech models that implement the experimental Experimental_StreamingSpeechModelV4 extension. Returns a single-consumer audioStream / fullStream plus usage, warnings, responses, and providerMetadata promises. Provider error parts are non-fatal and reported through onError (default console.error). A user abort or a cancel rejects the result promises immediately. Exports the Experimental_SpeechTextPart, Experimental_SpeechStreamPart, Experimental_SpeechStreamUsage, and Experimental_StreamSpeechResult types, adds an optional cause to NoSpeechGeneratedError, and adds Experimental_MockStreamingSpeechModelV4 to ai/test.
Updated dependencies [8202f5b]
Updated dependencies [85d84a1]
1727442: fix(ai): process only the first approval response per tool call, so repeated or conflicting responses in the final tool message no longer exe
1727442: fix(ai): process only the first approval response per tool call, so repeated or conflicting responses in the final tool message no longer execute a tool twice or both execute and deny it
0a5d0e7: Fix toolChoice: 'none' by forwarding it to the Hugging Face Responses API and rejecting tool calls before local execution in generateText, streamText, and WorkflowAgent. Streamed tool parts are withheld so client-side tools cannot act on them, and repairToolCall and experimental_refineToolInput are not invoked for rejected tool calls.
10026d1: Add the interrupted finish reason for provider streams that end without a completion signal. Preserve partial output without introducing an error solely for interruption, and stop tool execution, agent continuation, and automatic UI follow-ups for interrupted responses, including late tool results and approvals. Provider detection and emission will be added separately.
Compatibility notice: Adding interrupted to the public finish-reason types can break type checking after upgrading, even though this is a patch release. Exhaustive switches (for example, using an assertNever fallback) and mappings such as Record<FinishReason, string> must handle the new value. Update any custom validation or application logic that assumes the existing set of finish reasons is exhaustive.
When providers begin emitting interrupted, a stream ending without a completion signal will preserve partial output and report this finish reason without emitting an error solely for the interruption. Applications that need to detect incomplete responses should check finishReason === 'interrupted' as well as their existing error handling.
Updated dependencies [101ce42]
Updated dependencies [e104368]
Updated dependencies [eb1f056]
Updated dependencies [10026d1]
Updated dependencies [5893e99]
### Patch Changes - Updated dependencies [b089ce8] - Updated dependencies [39a776b] - Updated dependencies [f1b550e] - @ai-sdk/provider-utils@5.0.65 -
66e74dc: fix(ai): preserve repaired tool names in streamed UI message parts
0c2a9de: Add maxOutputTokens and reasoning to experimental decision calls and forward them to language-model-backed decisions. Language-model adapters
maxOutputTokens and reasoning to experimental decision calls and forward them to language-model-backed decisions. Language-model adapters keep reasoning disabled when omitted. Native decision providers warn when either setting is unsupported.undefined member to tool call, result, error, denied output, and execution event types.### Patch Changes - Updated dependencies [1c47fee] - @ai-sdk/gateway@4.0.118
60cc252: feat(perplexity): add decisions api support
streamText return types for reusable options and ReturnType by moving low-memory streaming to experimental_streamTextLowMemory. Replace experimental streamText({ experimental_lowMemory: true, ...options }) calls with experimental_streamTextLowMemory(options).8a5233b: Generate default chat IDs on first access so useChat() can prerender without reading a random value when the ID is not used during rendering.
useChat() can prerender without reading a random value when the ID is not used during rendering.experimental_lowMemory: true to streamText for single-consumer streaming without a replay buffer or retained final-content results, reducing memory retention.box decision question type with image bounds for TypeSafe AI.130e871: Restore raw OpenAI custom-tool input deltas for consumers that forward them to Responses API clients. Mark streamed input with inputEncoding:
inputEncoding: 'text' so UI clients can display it progressively without JSON parsing. Preserve the encoding when partial UI messages are saved and resumed. Final provider tool-call inputs remain JSON-encoded.88ea0d7: fix(workflow): pass runtime context allowed by 'telemetry.includeRuntimeContext'
9523eb0: feat(ai): add configurable tool call execution concurrency
### Patch Changes - Updated dependencies [685667c] - Updated dependencies [bdbeba3] - Updated dependencies [ec2af7b] - @ai-sdk/gateway@4.0.112
eab278a: fix: resume interrupted chat streams when the page becomes visible again
eab278a: fix: resume interrupted chat streams when the page becomes visible again
useChat with resume: true no longer starts a second resume request on mount when the chat is already submitted or streaming, e.g. when remounting with a shared Chat instance mid-stream.
26d64e9: fix(ai): update tool outputs in the message containing the matching tool call
75b3ea2: fix(ai): prevent duplicate message parts when resuming replayed streams
69f4b82: fix(ai): prevent global type conflicts across SDK versions
e57803c: Add an optional shared citation representation to generated text and text-end stream events, separate from retrieved sources. Preserve citations in core result content and UI message text parts, including validation and persistence, without changing content or stream event discriminants.
4c705d9: Fix validation of rounded choice probabilities in experimental_decide.
5150d50: fix(ai): update streaming chat messages by stable ID
9aef724: fix(workflow): report incomplete no-output model streams as errors
7d0458b: fix(ai): reject approved tool calls without results before sending later context to providers
Updated dependencies [9667bf2]
Updated dependencies [e57803c]
Updated dependencies [81663cc]
e27cc64: fix(ai): discard unrelated message state when reading resumed streams
7b5497c: Fix streaming output timeouts: stop chunkMs and firstChunkMs when the model response ends, so long-running local tools do not trigger model o
chunkMs and firstChunkMs when the model response ends, so long-running local tools do not trigger model output timeouts. Give each retry fresh output timeout budgets. stepMs continues to cover the complete step, including local tools.5ddbb70: fix(ai): prevent duplicate continuation requests for repeated tool approval responses
8281ec4: fix(ai): propagate async sendAutomaticallyWhen failures from tool updates
9184a35: Add ordered text, file, and JSON parts to experimental decision state. Support image input in OpenAI Decisions and language model adapters. G
9184a35: Add ordered text, file, and JSON parts to experimental decision state. Support image input in OpenAI Decisions and language model adapters. Gateway retains its existing string and JSON request format and rejects files, as does TypeSafe AI.
Arrays passed directly as state now contain decision state parts. Wrap JSON arrays in an object or a json part.
Normalize all public state forms into an array of parts before calling decision providers. Providers receive text and JSON objects as text and json parts.
Serialize decision file bytes as base64 in OpenTelemetry state attributes. Model-call spans record normalized state parts, while outer spans retain public state inputs.
Preserve native JSON state in TypeSafe AI when state contains one JSON part. Label shared state in language-model decision prompts.
Updated dependencies [9184a35]
3ebefff: feat(ai): introduce 'onUIMessageStepEnd' callback to persist messages
### Patch Changes - Updated dependencies [866e884] - Updated dependencies [04fdf5e] - @ai-sdk/gateway@4.0.107
6f6b9c0: fix(ai): reject pending result promises and cancel the pending stream when the abort signal fires
e37d213: feat(ai): emit deprecation warnings with stable codes and deduplicate them
e37d213: feat(ai): emit deprecation warnings with stable codes and deduplicate them
73d8343: fix(ai): preserve V2 provider-reported total tokens in raw usage
268225c: feat(provider): add a portable max reasoning level with native provider mappings, compatibility coercions, and budget-based fallback support.
Compatibility notes:
max widens LanguageModelV4CallOptions['reasoning'] and the derived ReasoningLevel type. Third-party providers and consumers with exhaustive switches or Record<ReasoningLevel, ...> mappings must handle max before upgrading. Ordinary calls using existing reasoning levels remain accepted.reasoning: 'xhigh' now send maxReasoningEffort: 'high' instead of the unsupported 'max', and return a compatibility warning. Anthropic and OpenAI Bedrock effort mappings retain their existing xhigh behavior. Partial Bedrock reasoning configurations continue to preserve explicit values and derive missing fields; explicit effort/budget overrides and disabled thinking no longer emit warnings for portable mappings that are not sent.minimal and xhigh calls keep their request mappings to low and high, respectively, and now return compatibility warnings in generation and streaming results. Portable max maps to high with the same warning behavior.Release classification: This remains a patch changeset under the repository's explicit release policy, which uses patch releases for both fixes and features. The TypeScript source-compatibility caveat for exhaustive consumers is disclosed above. Maintainers can override this classification with a major label if they decide to align the provider-spec addition with a future AI SDK major release.
d83366e: fix(ai): publish the latest error after repeated failed stream resume attempts
34905a2: fix(ai): preserve provider options from approval-only tool messages
16ab882: fix(ai): recognize WebKit network errors
f810ea3: fix(ai): prevent unavailable tools from exposing persisted output to models
19a127b: fix(ai): avoid duplicate slashes in chat reconnect URLs
0af2f7c: chore: upgrade to TypeScript 6
4c6979c: fix(harness): preserve adapter warnings in agent stream results and declare their compatibility warning shapes
Updated dependencies [fc1e19e]
Updated dependencies [5094ebd]
Updated dependencies [753f2e1]
Updated dependencies [268225c]
Updated dependencies [0af2f7c]
Updated dependencies [ad64697]
Updated dependencies [0c82824]
0fe8c67: fix: preserve tool approval state when resuming streams
evaluate to decideWorkflowAgent.generate() with a shared tool loop, a 20-step default, typed output, and core generation result semantics. Reuse core result and content construction through internal exports while preserving existing Workflow streaming behavior. Transport-independent approval creation remains separate follow-up work.InvalidResponseDataError instead of a generic Error when a generated audio file's format cannot be determined from its media type, so callers can identify the failure with AISDKError.isInstance.158a718: feat(ai): select and rank eligible deferred tools via 'search()' callback in tool search
4f3d236: fix: clear tool approvals when addToolOutput runs
addToolOutput runs8c65988: feat(ai): add telemetry to speech generation and transcription, including provider usage propagation and experimental streaming lifecycle cal
05cdac6: fix(ai): keep idle UI message streams open with optional SSE heartbeats
f3575f8: Clarify that provider-executed tool execution errors bypass the UI stream's onError callback to preserve provider error data and harness runt
onError callback to preserve provider error data and harness runtime messages. Stream errors and invalid tool calls still use the callback. Runtime behavior is unchanged.. and .. IDs before fetching. Custom URLs returned by prepareReconnectToStreamRequest remain unchanged.b032d70: fix(ai): preserve tool metadata from tool output chunks
33e94ba: fix(ai): cancel response streams when clients disconnect
33e94ba: fix(ai): cancel response streams when clients disconnect
34d869e: fix(ai): prevent unhandled stream completion rejections in non-Node runtimes
def4df8: fix(ai): store static tool input errors in the current input field
525efc5: feat(provider): advertise image model file and mask input support
Use confirmed model IDs for capability declarations so unrecognized model names remain unknown. Include Together AI FLUX.2 Pro and Flex single-image editing, and allow asynchronous capability lookups and middleware overrides to resolve to unknown.
Advertise QuiverAI Arrow 2 and Arrow 2 Telos file-input support, and mark Together AI Gemini image inputs unsupported by the current single-image request mapping.
Updated dependencies [e3605f6]
Updated dependencies [525efc5]
### Patch Changes - Updated dependencies [e6a7996] - Updated dependencies [e19f0fc] - @ai-sdk/gateway@4.0.96
### Patch Changes - Updated dependencies [b67b1b7] - @ai-sdk/gateway@4.0.95
af9597b: Compile packages for ES2022 runtime target
b5679a7: fix(ai): filter tracing-channel context with telemetry allowlists
allowSystemInMessages permits all system messages, including instruction text.dcdb011: fix(ai): route completed streamed tool input callbacks to repaired tools
dcdb011: fix(ai): route completed streamed tool input callbacks to repaired tools
8f72832: fix(ai): preserve video models from legacy fallback providers
fe07867: Fix Google embedMany calls with more than 100 values by keeping per-value multimodal content aligned across automatic batches, including text-only entries. Validate content length before sending requests and validate each batch's provider options after middleware transforms them.
b74c0cb: fix(ai): resume tool approvals from earlier messages
a4b0940: fix(ai): execute manually approved tool inputs produced by schema transforms
Preserve approved inputs during revalidation and reject histories whose reconstructed schema output differs, including signed approvals with missing original input. Validate transformed UI tool inputs against the reconstructed output before returning them as static tool parts.
2693319: Add Gemini 3.8 TTS support with structured speech metadata and per-turn speaker and style controls for prebuilt voices. Preserve native WAV responses without adding a second header, support explicit raw PCM, mu-law, and A-law output, and identify headerless audio formats correctly. Add the Gemini 3.8 speech model IDs to Google and Gateway types.
Share transcript and custom-voice inspection through the Google provider internal export, and reject empty speech transcripts before sending a request. Default newer and custom model IDs to structured speech while preserving the legacy format for Gemini 2.5 and 3.1.
c93ee90: fix(ai): preserve message history for direct transport stream callbacks
771e74b: chore: enable dead code lint rules
Updated dependencies [fe07867]
Updated dependencies [a4b0940]
Updated dependencies [2693319]
Updated dependencies [b73f2f9]
Updated dependencies [771e74b]
9a98fd9: fix(ai): prune reasoning file parts when removing reasoning
31d24ce: feat: add telemetry support to experimental_evaluate
experimental_evaluate### Patch Changes - Updated dependencies [49295bb] - @ai-sdk/gateway@4.0.89
0343bb1: fix(ai): keep replacement completion requests loading and cancellable when an earlier request settles
toolsContext to host-executed tools in alignment with ToolLoopAgent3f6852a: fix(ai): prevent direct execution of tools governed by tool callers
streamText from executing tool calls that violate tool choice79681c4: fix(ai): preserve provider file and skill upload APIs in wrapProvider
4775577: fix(ai): preserve provider metadata when simulating text streams
One column per quarter.