npm / @ai-sdk/provider-utils
@ai-sdk/provider-utils
What changed in @ai-sdk/provider-utils 3 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
86 breaking6 security9 deprecations37 new APIs and options2 performance14 behavior and defaults1 tooling35 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@ai-sdk/provider-utils 751 changes
Breaking changes 36
OpenTelemetry span collection moved out of the ai package; install this package and register an OpenTelemetry instance to receive traces.
CallSettings is split into LanguageModelCallOptions and RequestOptions; replace usages with LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>.
Tool callback context is now stable, scoped per tool, and inferred from contextSchema; provide tool-specific values through toolsContext rather than the shared runtime context.
The deprecated export has been removed; use customProvider instead. Its options and behavior are unchanged.
The deprecated export was removed; use generateImage instead.
The deprecated result type export was removed; use GenerateImageResult instead.
The deprecated option and generateText result property were removed; use output for both call options and result access.
The deprecated option was removed; use prepareStep instead.
Removes the tracer property; pass a custom OpenTelemetry Tracer to the OpenTelemetry constructor instead.
The speech generation function graduated from experimental status and is available under the stable name generateSpeech.
Request bodies are no longer included in generateText and streamText step results by default; set include.requestBody to true to access them.
generateText no longer includes response bodies by default; set include.responseBody to true to access them.
Removes the deprecated top-level cachedInputTokens field; use inputTokenDetails.cacheReadTokens instead.
Removes the deprecated top-level reasoningTokens field; use outputTokenDetails.reasoningTokens instead.
Minimum supported Node.js version is 22; supported versions are 22, 24, and 26.
Renames the telemetry integration callback and tracing-channel event type from onEmbedFinish to onEmbedEnd.
Renames the per-call callback for completed embed and embedMany operations from experimental_onFinish to onEnd.
Renames the per-call callback for completed rerank operations from experimental_onFinish to onEnd.
Renames the telemetry integration callback and tracing-channel event type from onRerankFinish to onRerankEnd.
The generation start callback is available under the stable name onStart instead of experimental_onStart.
Renames the per-step lifecycle callback from onStepFinish to onStepEnd across generation, streaming, agents, and UI message stream helpers; telemetry integrations should implement onStepEnd.
The per-step start callback is available under the stable name onStepStart instead of experimental_onStepStart.
Instructions returned from prepareStep now carry forward to future steps until prepareStep returns another instructions or system override.
Messages returned from prepareStep now form the base for subsequent steps, together with response messages from the previous step.
System messages in prompt or messages are rejected by default; move instructions to the top-level instructions option or opt in with allowSystemInMessages.
This field was removed from generateText and streamText responses. Read cache write and read token counts from result.usage.inputTokenDetails instead.
When reasoning is set to a value other than 'none', reasoningSummary now defaults to 'detailed'. Set it to null to keep reasoning summaries disabled.
Register a telemetry integration globally at application startup to continue receiving telemetry events.
All AI SDK packages are ESM-only; CommonJS require() is no longer supported.
Use runtimeContext for shared generation or agent state visible to orchestration, events, and step results; shared top-level context usage moves to this name.
The stop-condition helper is renamed to isStepCount; update imports and tool-loop stop-condition usage.
Each step's response.messages now contains only messages produced by that step; use result.responseMessages for the full response message history.
onChunk now receives every TextStreamPart, including lifecycle, boundary, and terminal parts; handlers should guard the chunk types they process.
Provide per-tool context values through toolsContext, keyed by tool name; it is required when at least one tool declares contextSchema.
The transcription API graduated from experimental status and is available under the stable name transcribe.
xai(modelId) now uses the xAI Responses API by default instead of Chat Completions; use xai.chat(modelId) to keep using Chat Completions.
Deprecations 8
Renamed to createGoogle; the old name remains available as a deprecated alias.
Renamed to GoogleProvider; the old name remains available as a deprecated alias.
Renames the final lifecycle callback from onFinish to onEnd for text generation, streaming, and agents; onFinish remains a deprecated alias, and onEnd takes precedence when both are provided.
Renames experimental_onToolCallFinish for generateText and streamText; the old name remains a deprecated fallback.
Renames experimental_onToolCallStart for generateText and streamText; the old name remains a deprecated fallback.
Move the deprecated top-level includeRawChunks option into include.rawChunks.
Renames fullStream to stream; fullStream remains available as a deprecated alias.
The top-level system prompt option and related prepareStep, repair, and lifecycle fields are renamed to instructions; system remains a deprecated fallback, with instructions taking precedence.
New APIs and options 1
Declare tool-specific context fields with contextSchema so tool callback context is inferred and limited to declared fields.
Behavior and default changes 5
Renames experimental_include to include for generateText, streamText, and ToolLoopAgent; the old name remains a deprecated alias.
The speech result type is available under the stable name SpeechResult; the old type remains a deprecated alias.
Telemetry is enabled by default for AI SDK calls once an integration is registered; set isEnabled to false to opt out of a specific call.
Renames experimental_telemetry to telemetry; the old option remains a deprecated alias during the migration window.
The transcription result type is available under the stable name TranscriptionResult; the old type remains a deprecated alias.
Tooling 1
Run this command to add the migration skill and guide your agent.
@ai-sdk/provider-utils 5124 changes
Breaking changes 49
Arrays passed directly as state are interpreted as decision state parts; wrap JSON arrays in an object or a json part.
The API previously named evaluate is renamed to decide.
Packages are compiled for an ES2022 runtime target, which may affect runtime compatibility.
Use addToolOutput in place of addToolResult, passing output and the tool name for type safety.
LangChainAdapter moved to this package, which provides toUIMessageStream for UI message stream responses.
LlamaIndexAdapter was extracted to this package, which follows the UI message stream pattern.
Update the package to the version required for AI SDK 5.0.
The package has been removed and its exports moved to the ai package.
The useChat configuration body is captured at first render and stays static; pass changing values at request time or use function configuration.
The Vue integration replaces the useChat composable with a Chat class.
The Svelte constructor now takes a function that returns configuration, using a transport in the shown pattern.
The allowEmptySubmit option has been removed from ChatRequestOptions.
The data option has been removed; move its contents into body.
RequestOptions has been renamed to CompletionRequestOptions.
Renamed experimental_context to context.
The deprecated CoreToolCall type has been removed; use ToolCall instead.
The deprecated CoreToolCallUnion type has been removed; use TypedToolCall instead.
The deprecated CoreToolChoice type has been removed; use ToolChoice instead.
The deprecated CoreToolResult type has been removed; use ToolResult instead.
The deprecated CoreToolResultUnion type has been removed; use TypedToolResult instead.
createIdGenerator now requires size in its options and generates IDs at that fixed size, rather than accepting a size when the generator is called.
createToolNameMapping no longer accepts resolveProviderToolName; tool names are static and based on tools keys.
The data property has been removed from the useCompletion hook.
CommonJS exports were removed and all packages are ESM-only; consumers using require() must switch to ESM imports.
Renamed Experimental_Sandbox to Experimental_SandboxSession.
Changed the file part data property to be tagged with a type and removed the image part type.
The type name changed from IDGenerator to IdGenerator.
The Svelte integration no longer manages input; manage input state manually and send messages yourself.
The deprecated helper has been removed in favor of status.
The option has been removed because it is no longer needed.
The parameter has been removed from the Chat component and useChat hook; use server-side stopWhen conditions for multi-step execution.
The image and file content field mimeType was renamed to mediaType for consistency.
The callback has been removed from useChat and useCompletion.
Returning values from onToolCall no longer automatically submits tool results; explicitly call addToolOutput instead.
Vue messages now expose a parts array instead of a content string.
The experimental_attachments property has been replaced by message parts, including file parts for attachments.
This transport configuration option replaces experimental_prepareRequestBody for preparing chat request bodies.
The API was removed entirely; use readUIMessageStream or Chat/useChat APIs instead.
Embedding model settings now belong in providerOptions instead of model parameters.
The rawResponse property has been renamed to response.
Resume functionality has moved from experimental_resume to resumeStream.
Renamed Sandbox.executeCommand to Sandbox.runCommand.
The option has been removed because sending extra message fields is now the default behavior.
Svelte properties are readonly; use setter methods such as setMessages to update them.
Streaming now uses start/delta/end phases with unique IDs for each content block; text-delta carries an id and uses delta instead of textDelta.
The deprecated ToolCallOptions export was removed; use ToolExecutionOptions instead.
The deprecated media type part was removed; use the supported file part types instead.
ToolSet, InferToolSetContext, and UnionToIntersection were moved into @ai-sdk/provider-utils.
The hook has been removed; use useChat with a configured route instead.
Security 5
Default Node.js downloads retain DNS validation and connection pinning when frameworks or instrumentation wrap global fetch before or after the SDK loads.
Prevents SSRF in OAuth metadata discovery.
download and downloadBlob validate final URLs after redirects to prevent SSRF bypasses through open redirects.
Added isSameOrigin; affected provider clients send credentials only when response-supplied URLs share the configured API origin.
Hardened URL validation against hostname and redirect bypasses, including private and reserved IPv4/IPv6 ranges; redirects are revalidated before each request.
Deprecations 1
The method remains available but is deprecated and will be removed in version 6.
New APIs and options 34
Adds the box decision question type with image bounds for TypeSafe AI.
Experimental decision state now supports ordered text, file, and JSON parts, and public state forms are normalized into parts before providers are called.
Image input is supported in OpenAI Decisions and language model adapters.
Adds the portable max reasoning level, widening LanguageModelV4CallOptions['reasoning'] and ReasoningLevel; exhaustive consumers must handle max.
Experimental streaming lifecycle callbacks were added for speech generation and transcription.
Adds a shared structured language-model evaluation adapter for Choice, Score, and Boolean evaluations, preserving exact labels and metadata, validating score bounds, and returning prompted Boolean P(true) estimates validated to be in [0, 1].
Code-mode supports discovering and updating tools during a conversation.
Upload results now expose the file's byte size.
Upload results now expose the file's creation time.
Adds an optional file deletion operation to FilesV4.
Adds an optional streaming file download operation to FilesV4.
Upload results now expose the file's expiration time.
Adds abortSignal as a FilesV4 call option so calls can receive an abort signal.
Adds headers as a FilesV4 call option.
Adds a
{ type: 'stream' }variant for upload data.Adds an optional FilesV4 operation for retrieving file metadata.
Adds streaming multipart uploads with deterministic part ordering and failure-path stream teardown.
UI messages retain the approval request's reason separately from an approver's response reason.
Manual tool approval statuses can include a reason, which is preserved across core, model, and UI approval requests and surfaced for OPA requires-approval decisions.
Sandbox command execution accepts optional abortSignal parameters.
Added a new custom content type.
Added an env option to the spawn and run methods of Experimental_SandboxSession.
embedMany now makes parallel requests, with maxParallelCalls available to limit concurrency.
Usage data is attached as metadata to individual messages through messageMetadata in toUIMessageStreamResponse.
Added support for provider references and uploading files as supported per provider.
Added readFile and writeFile, plus convenience wrappers, to the Experimental_Sandbox abstraction.
Added support for the reasoning-file type for files that are part of reasoning.
Added a top-level reasoning parameter to the specification, supported by generateText and streamText.
Use this option with lastAssistantMessageIsCompleteWithToolCalls for automatic tool result submission.
Added serializeModel to extract serializable properties from a model instance so third-party provider authors can support workflows.
Added spawnCommand to Experimental_Sandbox for detached command execution.
Extracted the shared StreamingToolCallTracker class into @ai-sdk/provider-utils for reuse across OpenAI-compatible providers.
Added toolMetadata for tool-specific metadata.
Sandbox command execution accepts an optional workingDirectory parameter.
Performance 2
Avoids excessive memory usage when base64 encoding byte arrays.
Update the peer dependency to 4.1.8 or later; this is recommended to avoid TypeScript performance issues.
Behavior and default changes 9
Decision choice responses now accept exact criteria labels.
Decision file bytes are serialized as base64 in state attributes; model-call spans record normalized state parts, while outer spans retain public state inputs.
Bedrock Nova 2 maps portable xhigh to maxReasoningEffort: 'high' and returns a compatibility warning; Fireworks maps max to high and returns warnings for minimal, xhigh, and max in generation and streaming results.
Provider usage is propagated for speech generation and transcription telemetry.
Telemetry was added to speech generation and transcription.
Language-model evaluation adapters now default to reasoning: 'none' using each provider's existing reasoning mapping; explicit providerOptions reasoning settings still override it.
The type of experimental_context changed from unknown to a generic, improving context type inference.
Tool result output content file part types were aligned with top-level message file part types.
headers is now optional in provider config types, allowing manually constructed model configs to omit it.
Fixes and other changes 24
URL paths and query values now retain case sensitivity.
Shared state is labeled in language-model decision prompts.
TypeSafe AI preserves native JSON state when state contains one JSON part.
Rows are limited to 64 MB during batch result downloads.
Parallel tool calls are preserved when stream labels are missing or reused.
Hostname parts are validated using isValidHostnamePart.
Use a standards-compliant User-Agent header.
Fixes streamed tool calls with missing, blank, or repeated IDs.
Prompt conversion preserves original opaque URI strings in tagged file URLs.
Prompt conversion matches supported URL MIME types exactly so unsupported subtypes are not forwarded to providers.
Keeps per-value multimodal content aligned across automatic batches, including text-only entries, and validates content length and provider options after middleware transforms.
Executes manually approved tool inputs produced by schema transforms, preserves approved inputs during revalidation, and rejects histories whose reconstructed output differs.
Audio detection now recognizes AAC audio with ADTS headers.
Image detection now handles AVIF and HEIC images with variable ftyp box sizes.
Following validated redirects no longer waits for response clone cancellation.
Makes the lazy Undici import visible to deployment tracers.
Avoids crashing when DOMException is not a global constructor.
Plain text prefixes are no longer detected as BMP or GIF images.
The core uploadFile() helper now forwards abortSignal to the provider call.
The core uploadFile() helper now forwards headers to the provider call.
Transient network errors while reading successful response bodies are now marked retryable.
Preserves schema-valued additional properties when converting Zod 4 schemas.
Fixes handling of empty string tool call IDs.
Download rejection paths now cancel response bodies, returning sockets to the connection pool and avoiding file descriptor exhaustion.
@ai-sdk/provider-utils 413 changes
Security 1
Adds opt-in URL validation and credential origin handling for URL-based image responses, including redirect validation, unsafe header stripping, and dropping credentials on cross-origin redirects; existing unvalidated requests are preserved.
New APIs and options 2
A MaybePromiseLike type is added.
Provider-defined tools gain needsApproval support.
Fixes and other changes 10
Preserves streamed tool calls when their IDs and indices are unreliable.
Matches full MIME types exactly when checking native URL support.
Preserves media types on file URLs in tool results.
Preserves approved inputs during revalidation, rejects histories whose reconstructed schema output differs, and validates transformed UI tool inputs against the reconstructed output.
OpenAI and Azure OpenAI embedding requests are split by a conservative UTF-8 byte budget derived from their aggregate token limit, in addition to input count limits.
Imports now work in runtimes without a global fetch function.
Header normalization is consolidated and custom headers are preserved.
DelayedPromise is moved into provider utils.
Calling ReadableStream.cancel() now properly finalizes async iterators.
Compatibility is fixed for V8 readonly execution environments.
@ai-sdk/provider-utils 32 changes
Breaking changes 1
Stops re-exporting createTestServer and TestResponseController; import these APIs from @ai-sdk/test-server/with-vitest instead.
Fixes and other changes 1
Transient network errors while reading successful response bodies are now marked retryable, including for AI Gateway responses.