unstale

npm / @ai-sdk/provider

@ai-sdk/provider

What changed in @ai-sdk/provider 2 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-12.

19 breaking2 security35 new APIs and options9 behavior and defaults12 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@ai-sdk/provider 446 changes

Breaking changes 4

  • Adds a typed streaming heartbeat part. Consumers with exhaustive stream-part switches must handle the new union variant, even when the opt-in is disabled.

    4.0.36release notes

  • mediaType can be undefined when a provider fetches an audio URL natively, so telemetry integrations should check for missing values before using it as a string.

    4.0.36release notes

  • Arrays passed directly as state are interpreted as decision state parts; wrap JSON arrays in an object or a json part.

    4.0.25release notes

  • Decision refusals are reported as refusal answers, changing how providers represent refusals.

    4.0.24release notes

Security 2

  • Optional request metadata and model-call end events report the actual OpenAI Chat HTTP endpoint; generation results, callbacks, and OpenTelemetry spans expose only sanitized endpoint information.

    4.0.36release notes

  • @ai-sdk/provider-utils has an Uncontrolled Resource Consumption issue

    4.0.33security advisory

New APIs and options 25

  • Provider metadata now exposes structured Score legends.

    4.0.37release notes

  • Accepts an optional intent so server-side callers can align session serialization with endpoint selection.

    4.0.36release notes

  • An optional createTransport interface and provider connection capability support provider-owned realtime transports.

    4.0.36release notes

  • The optional method returns upstream WebSocket connection details for a server-initiated connection and can select an endpoint using intent.

    4.0.36release notes

  • Enables Anthropic streaming heartbeat parts; pings are disabled by default.

    4.0.36release notes

  • Capability catalogs can include video, reranking, and decision sections, including provider options for those operations.

    4.0.36release notes

  • Providers can transcribe audio from a URL natively; Groq sends HTTP(S) URLs without downloading and re-uploading them. A custom download function retains local download behavior.

    4.0.36release notes

  • Adds an exported server connection type for the experimental realtime model specification.

    4.0.36release notes

  • Adds an exported session intent type for the experimental realtime model specification.

    4.0.36release notes

  • Adds a normalized usage type for realtime events, keeping gross totals and modality buckets separate and reporting duration in seconds.

    4.0.36release notes

  • Accepts an optional intent so server-side callers can align event serialization with endpoint selection.

    4.0.36release notes

  • Accepts shared timestamp granularity settings; explicit provider timing settings take precedence. OpenAI sends timestamp_granularities only with verbose_json.

    4.0.36release notes

  • Optional word timings are exposed separately from transcription segments.

    4.0.36release notes

  • Video generation reports videos delivered directly to caller-managed storage without downloading or synthesizing video bytes.

    4.0.36release notes

  • Introduces named capability sections and request configuration for model entries; provider catalogs also declare accepted options and which models support them.

    4.0.35release notes

  • Adds an experimental SpeechModelV4 extension whose doStream() accepts streamed text parts with optional per-part voice and providerOptions, and returns streamed audio parts.

    4.0.33release notes

  • Adds interrupted to the public finish-reason types. Exhaustive switches, mappings, and custom validation must handle it; interrupted responses preserve partial output without an error solely for the interruption.

    4.0.32release notes

  • Experimental decision calls accept maxOutputTokens and forward it to language-model-backed decisions.

    4.0.31release notes

  • Experimental decision calls accept reasoning and forward it to language-model-backed decisions; language-model adapters keep reasoning disabled when omitted.

    4.0.31release notes

  • Adds support for the Perplexity decisions API.

    4.0.30release notes

  • Adds the box decision question type with image bounds for TypeSafe AI.

    4.0.29release notes

  • Adds an optional shared citation representation to generated text and text-end stream events, preserving citations in core result content and UI message text parts, including validation and persistence.

    4.0.27release notes

  • Embedding functions accept a top-level dimensions setting.

    4.0.26release notes

  • Decision state can contain ordered text, file, and JSON parts.

    4.0.25release notes

  • OpenAI Decisions and language model adapters support image input.

    4.0.25release notes

Behavior and default changes 4

  • byteLength can be undefined when a provider fetches an audio URL natively, so telemetry integrations should check for missing values before using it as a number.

    4.0.36release notes

  • Native decision providers warn when maxOutputTokens or reasoning is unsupported.

    4.0.31release notes

  • Public state forms are normalized into an array of parts before provider calls, with text and JSON objects passed as text and json parts.

    4.0.25release notes

  • Decision file bytes are serialized as base64 in state attributes; model-call spans record normalized state parts while outer spans retain public state inputs.

    4.0.25release notes

Fixes and other changes 11

  • Boolean criteria may be null in experimental decision question types.

    4.0.37release notes

  • Box instructions may be omitted or null in experimental decision question types.

    4.0.37release notes

  • Empty criteria and null or undefined Score levels are rejected before a request is sent.

    4.0.37release notes

  • TypeSafe decision requests serialize primitive JSON state values as text.

    4.0.37release notes

  • Groq strips media fragments from URLs and falls back to secure local download and file upload if a redirect is rejected.

    4.0.36release notes

  • Access video only when videos is nonempty when generation reports an uploaded outcome.

    4.0.36release notes

  • Non-streaming structured output now handles multiple assistant messages containing JSON by allowing providers to supply separate parsing text, preserving generated content, annotations, conversation history, and token usage.

    4.0.34release notes

  • Streamed input is marked as text so UI clients can display it progressively without JSON parsing; the encoding is preserved when partial UI messages are saved and resumed.

    3.0.19, 4.0.28release notesrelease notes

  • Raw custom-tool input deltas are restored for consumers that forward them to Responses API clients.

    3.0.19, 4.0.28release notesrelease notes

  • Gateway keeps its existing string and JSON request format and rejects files.

    4.0.25release notes

  • Shared state is labeled in language-model decision prompts.

    4.0.25release notes

@ai-sdk/provider 231 changes

Breaking changes 15

  • doGenerate returns a content array.

    2.0.0release notes

  • Image parts are removed from the provider specification.

    2.0.0release notes

  • logprobs are removed from the provider specification.

    2.0.0release notes

  • maxTokens is renamed to maxOutputTokens.

    2.0.0release notes

  • The mimeType field is renamed to mediaType.

    2.0.0release notes

  • Object generation mode is removed.

    2.0.0release notes

  • The prompt type is removed from the LanguageModelV2 specification.

    2.0.0release notes

  • providerMetadata inputs are renamed to providerOptions.

    2.0.0release notes

  • rawRequest is merged into request, so integrations should use request instead.

    2.0.0release notes

  • The embedding model v2 response gains a body field.

    2.0.0release notes

  • Speech models are upgraded to the v2 specification.

    2.0.0release notes

  • getSupportedUrls is renamed to supportedUrls for LanguageModelV2.

    2.0.0release notes

  • Tool values use input and output instead of args and result.

    2.0.0release notes

  • Transcription models are upgraded to the v2 specification.

    2.0.0release notes

  • V1 providers are removed.

    2.0.0release notes

New APIs and options 10

  • A v2 embedding model interface is added.

    2.0.0release notes

  • Speech generation is available through experimental_generateSpeech.

    2.0.0release notes

  • Transcription is available through experimental_transcribe.

    2.0.0release notes

  • ImageModelV2 gains providerMetadata.

    2.0.0release notes

  • Middleware can change the provider, model, and supported URLs.

    2.0.0release notes

  • Provider-defined tools now have a name for future validation.

    2.0.0release notes

  • Raw chunk support is added.

    2.0.0release notes

  • Tool results support arbitrary media types.

    2.0.0release notes

  • The provider registry adds support for transcription and speech models.

    2.0.0release notes

  • Usage information is refactored and supports reasoning tokens, cached input tokens, and total tokens.

    2.0.0release notes

Behavior and default changes 5

  • File content can be provided as binary data or base64, allowing Uint8Array input without manual conversion.

    2.0.0release notes

  • maxImagesPerCall can be a function returning a number or undefined, optionally as a promise.

    2.0.0release notes

  • Provider-defined tools are collapsed into a single definition.

    2.0.0release notes

  • Warnings are moved into the stream-start part.

    2.0.0release notes

  • Content block streaming now forwards block IDs and streaming start and end events.

    2.0.0release notes

Fixes and other changes 1

  • Reasoning parts are refactored and reasoning support is restructured.

    2.0.0release notes