Packages

ai

7.0.176 · 17 Nov 2026Apache-2.048.6M / weekRepositoryHomepagenpmAtom feed

Your version

5.0.0

major31 Jul 2025Where it was published

5.0.292 is the newest release of 5.x.

In short

75 breaking3 removed26 new119 fixed13 internal

  • Breaking

    @ai-sdk/rsc: Extract to separate package

  • Breaking

    Rename reasoning to reasoningText etc

  • Breaking

    Chore (ai): remove automatic conversion of UI messages to model messages

  • Breaking

    Remove setting temperature to 0 by default

  • Breaking

    Feat (ui): typed tool parts in ui messages

  • Breaking

    Feat (ai): automatic tool execution error handling

  • Breaking

    Chore (provider,ai): tools have input/output instead of args,result

  • Breaking

    Chore (ai): change source ui message parts to source-url

Security

1 advisory affects 5.0.0; 5.0.52 fixes them

Release note

Major Changes

  • Breaking

    @ai-sdk/rsc: Extract to separate package

  • Breaking

    Rename reasoning to reasoningText etc

  • Breaking

    Chore (ai): remove automatic conversion of UI messages to model messages

  • Breaking

    Remove setting temperature to 0 by default

    • remove null option from DefaultSettingsMiddleware

    • remove setting defaults for temperature and stopSequences in ai to enable middleware changes

  • Breaking

    Feat (ui): typed tool parts in ui messages

  • Breaking

    Feat (ai): automatic tool execution error handling

  • Breaking

    Chore (provider,ai): tools have input/output instead of args,result

  • Breaking

    Chore (ai): change source ui message parts to source-url

  • Breaking

    AI SDK 5

  • Breaking

    Chore (ai): remove "data" UIMessage role

  • Breaking

    Refactoring (ai): restructure message metadata transfer

  • Breaking

    Chore (ai): remove exports of internal ui functions

  • Breaking

    Chore (ui): inline/remove ChatRequest type

  • Breaking

    Chore (ai): stable activeTools

  • Breaking

    Feat (ui): introduce ChatStore and ChatTransport

  • Breaking

    Chore (ui): remove managed chat inputs

  • Breaking

    Chore (ai): remove StreamCallbacks.onCompletion

  • Breaking

    Chore (ai): remove getUIText helper

  • Breaking

    Chore (ai): remove useChat keepLastMessageOnError

  • Breaking

    Chore (ai): improve consistency of generate text result, stream text result, and step result

  • Breaking

    Chore (ui): remove useAssistant hook (breaking change)

  • Breaking

    Chore (ai): send reasoning to the client by default

  • Breaking

    Chore (ai): remove onResponse callback

  • Breaking

    Chore (ai): replace Message with UIMessage

  • Breaking

    Chore (ai): rename default provider global to AI_SDK_DEFAULT_PROVIDER

  • Breaking

    Chore (ai): remove content from ui messages

  • Breaking

    Refactor file towards source pattern (spec)

  • Breaking

    Chore (ai): remove data and allowEmptySubmit from ChatRequestOptions

  • Breaking

    Chore (ai): replace useChat attachments with file ui parts

  • Breaking

    Chore (ai): flatten ui message stream parts

  • Breaking

    Chore (ai): separate TextStreamChatTransport

  • Breaking

    Chore (ai): remove redundant mimeType property

  • Breaking

    Chore (ai): remove ui message toolInvocations property

  • Breaking

    Chore (ai): remove deprecated experimental_providerMetadata

  • Breaking

    Chore (ui): rename experimental_resume to resumeStream

  • Breaking

    Chore (ui): data stream protocol v2 with SSEs

  • Breaking

    Chore (ai): refactor and use chatstore in svelte

  • Breaking

    Move Image Model Settings into generate options

    Image Models no longer have settings. Instead, maxImagesPerCall can be passed directly to generateImage(). All other image settings can be passed to providerOptions[provider].

    Before

    await generateImage({
      model: luma.image('photon-flash-1', {
        maxImagesPerCall: 5,
        pollIntervalMillis: 500,
      }),
      prompt,
      n: 10,
    });

    After

    await generateImage({
      model: luma.image('photon-flash-1'),
      prompt,
      n: 10,
      maxImagesPerCall: 5,
      providerOptions: {
        luma: { pollIntervalMillis: 5 },
      },
    });

    Pull Request: #6180

  • Breaking

    Chore (ai): remove sendExtraMessageFields

  • Breaking

    Feat (ai): simplify default provider setup

  • Breaking

    Feat (ai): add args callbacks to tools

  • Breaking

    Chore (ai): change file to parts to use urls instead of data

  • Breaking

    Chore (ai): stable sendStart/sendFinish options

  • Breaking

    Chore (ai): rename DataStreamToSSETransformStream to JsonToSseTransformStream

  • Breaking

    Feat (ai): streamText/generateText: totalUsage contains usage for all steps. usage is for a single step.

  • Breaking

    Chore (ui): replace chat store concept with chat instances

  • Breaking

    Chore (ai): rename continueUntil to stopWhen. Rename maxSteps stop condition to stepCountIs.

  • Breaking

    Chore (ai): remove steps from tool invocation ui parts

  • Breaking

    Chore (ai): rename id to chatId (in post request, resume request, and useChat)

  • Breaking

    Feat (ui): extended regenerate support

  • Breaking

    Feat (ai): inject message id in createUIMessageStream

  • Breaking

    Feat (ui): use UI_MESSAGE generic

  • Breaking

    Chore (ai): always stream tool calls

  • Breaking

    Feat (ai): use console.error as default error handler for streamText and streamObject

  • Breaking

    Chore (ai): rename DataStream_ to UIMessage_

  • Breaking

    Feat (ai): add ui data parts

  • Breaking

    Chore (ai): restructure prepareRequest

  • Breaking

    Feat (ui): UI message metadata

  • Breaking

    Fix (ai): update source url stream part

  • Breaking

    Remove StreamTextResult.mergeIntoDataStream method
    rename DataStreamOptions.getErrorMessage to onError
    add pipeTextStreamToResponse function
    add createTextStreamResponse function
    change createDataStreamResponse function to accept a DataStream and not a DataStreamWriter
    change pipeDataStreamToResponse function to accept a DataStream and not a DataStreamWriter
    change pipeDataStreamToResponse function to have a single parameter

  • Breaking

    Chore (ui): rename RequestOptions to CompletionRequestOptions

  • Breaking

    Feat (ai): replace maxSteps with continueUntil (generateText)

  • Breaking

    Chore (ai): rename reasoning UI parts 'reasoning' property to 'text'

  • Breaking

    Feat (ai): restructure chat transports

  • Breaking

    Chore (ai): remove deprecated useChat isLoading helper

  • Breaking

    Chore (ai): refactor header preparation

  • Breaking

    Chore (ai): remove StreamData and mergeStreams

  • Breaking

    Feat (ai): replace maxSteps with continueUntil (streamText)

  • Breaking

    Chore (ai): remove ui message reasoning property

  • Breaking

    Rename maxTokens to maxOutputTokens

  • Breaking

    Chore (ai): remove ui message data property

  • Breaking

    Chore (ai): remove experimental continueSteps

  • Breaking

    Chore (ai): rename reasoning to reasoningText, rename reasoningDetails to reasoning (streamText, generateText)

  • Breaking

    Chore (ai): rename CoreMessage to ModelMessage

  • Breaking

    Chore (ai): rename UIMessageStreamPart to UIMessageChunk

Minor Changes

  • Feat (core): Add finishReason field to NoObjectGeneratedError

  • Feat (ai): add content to generateText result

  • Feat (ai): add content to streamText result

  • Feat (ai): add filename to file ui parts

Patch Changes

  • ai: Add provider and provider registry middleware functionality

  • smooth-stream: Chunking callbacks

  • Feat (ai): expose http chat transport type

  • Feat (ai): introduce dynamic tools

  • Feat (ui): add generics to ui message stream parts

  • Fix (ai): send null as tool output when tools return undefined

  • Chore (ai): remove provider re-exports

  • Chore (ai): remove cli

  • Chore (rsc): move HANGING_STREAM_WARNING_TIME constant into @ai-sdk/rsc package

  • Feat (ai): add array support to stopWhen

  • Chore (ai): push stream-callbacks into langchain/llamaindex adapters

  • Fix (ai): use user-provided media type when available

  • Feat (ai): export InferUIMessageChunk type

  • cli: Add ai command line interface

  • Allow destructuring output and errorText on ToolUIPart type

  • Feat (ai): support system parameter in Agent constructor

  • Feat (ai): add ignoreIncompleteToolCalls option to convertToModelMessages

  • Fix (ui): tool input can be undefined during input-streaming

  • providers/fal: Add transcribe

  • Chore (ai): rename text and reasoning chunks in streamText fullstream

  • Support for zod v4 for schema validation

    All these methods now accept both a zod v4 and zod v3 schemas for validation:

  • Feat (ai): expose ui message stream headers

  • Fix (ui): avoid caching globalThis.fetch in case it is patched by other libraries

  • Feat (ai): infer tool call types in the onToolCall callback

  • Feat (ai): add readUIMessageStream helper

  • Fix (ai/mcp): prevent mutation of customEnv

  • Feat (ai): export mock image, speech, and transcription models

  • Feat (ui): resolvable header, body, credentials in http chat transport

  • Feat (ai): add static/dynamic toolCalls/toolResults helpers

  • Fix (ai): add tests and examples for openai responses

  • Feat (ai): validate ui stream data chunks

  • Chore (ai): make ui stream parts value optional when it's not required

  • streamObject: Add enum support

  • Feat (ai): add experimental Agent abstraction

  • Feat (ui): add onFinish to createUIMessageStream

  • utils/detect-mimetype: Add support for detecting id3 tags

  • Feat (ui): add sendAutomaticallyWhen to Chat

  • ai: re-export zodSchema from main package

  • Fix (ui): inject generated response message id

  • selectTelemetryAttributes more robustness

  • Fix (provider/openai): multi-step reasoning with text

  • Fix (ai): respect content order in toResponseMessages

  • Chore (ai): move maxSteps into UseChatOptions

  • Feat (ai): introduce GLOBAL_DEFAULT_PROVIDER

  • Feat (ui): update Chat tool result submission

  • Fix (ui/react): update messages immediately with the submitted user message

  • Add transcription with experimental_transcribe

  • Feat (ai): support string model ids through gateway

  • Feat (ai): improve prompt validation error message

  • embed-many: Respect supportsParallelCalls & concurrency

  • Fix (ai): handle errors in 2nd streamText doStream call

  • Removed

    Remove deprecated experimental_wrapLanguageModel

  • Fix (ai): do not send id with start unless specified

  • react-native: Support experimental_attachments without FileList global

  • Ai sdk cli documentation + adjusted default model

  • packages: Export node10 compatible types

  • ai: Remove jsondiffpatch dependency

  • Fix (ai/core): refactor toResponseMessages to filter out empty string/content

  • embedding-model-v2/embedMany: Add response body field

  • Fix (image-model): specificationVersion: v1 -> v2

  • Feat (ai): add data ui part schemas

  • Allow zod 4.x as peer dependency

  • Fix custom fetch in HttpChatTransport

  • Fix error thrown when emptying messages in onError or onFinish

  • Feat (ai): export Chat callback types

  • Refactor (image-model): rename ImageModelV1 to ImageModelV2

  • Feat (ai/core): add terminateOnError option to readUIMessageStream

  • Core (ai): change transcription model mimeType to mediaType

  • Avoid job executor deadlock when adding tool result

  • Feat (ai): step input message modification in prepareStep

  • otel: Change back toolCall attributes of input/output back to args/result for compatibility

  • Feat (ui): add onData callback to Chat

  • Feat (ai): Add finishReason as a promise on StreamObjectResult to match StreamTextResult

  • Removed

    Remove deprecated CoreTool* types

  • Add speech with experimental_generateSpeech

  • Fix use with Google APIs + zod v4's .literal() schema

    Before zod@3.25.49, requests to Google's APIs failed due to a missing type in the provided schema. The problem has been resolved for the ai SDK by bumping our zod peer dependencies to ^3.25.49.

    pull request: #6609

  • Feat (ai): allow sync prepareStep

  • Add support for audio/webm to detect-media-type

  • Feat (ai): improved error messages when using gateway

  • Fix (ai/mcp): better support for zero-argument MCP tools

  • Fix (ai): send start part in correct position in stream (streamText)

  • Feat (ai): support changing the system prompt in prepareSteps

  • Add transcription and speech model support to provider registry

  • Fix (provider/openai): multi-step reasoning with tool calls

  • Feat (ui): transient data parts

  • Feat (ui): add state for text and reasoning ui message parts

  • Fix (ui): tool part metadata support in ui messages

  • Fixed date formatting for updated mcp protocol version

  • ai-cli: Fix bundling and improve authentication error handling

  • Feat (ai): allow async prepareRequest on HttpChatTransport

  • Update mcp protocol version

  • Expose provider metadata as an attribute on exported OTEL spans

  • Chore (ai): use JSONValue definition from provider

  • ai: Record tool call errors on tool call spans recorded in generateText and streamText.

  • Fix (ai): fix experimental sendStart/sendFinish options in streamText

  • Release alpha.5

  • Release alpha.4

  • Feat (ai): add InferUITools helper

  • Fix (ai): throw error for v1 models

  • ai/core: Properly handle custom separator in provider registry

  • Feat (ai): add experimental repairText function to streamObject

  • Fix (ai): merge data ui stream parts correctly

  • provider-executed tools

  • Feat (ai): make streamText toUIMessageStream async iterable

  • Feat (ai): add prepareSteps to streamText

  • Fix (ui): text message metadata support in ui messages

  • Fix (core): send buffered text in smooth stream when stream parts change

  • Feat (provider): add providerMetadata to ImageModelV2 interface

    The experimental_generateImage method from the ai package now returnes revised prompts for OpenAI's image models.

    const prompt = 'Santa Claus driving a Cadillac';
    
    const { providerMetadata } = await experimental_generateImage({
      model: openai.image('dall-e-3'),
      prompt,
    });
    
    const revisedPrompt = providerMetadata.openai.images[0]?.revisedPrompt;
    
    console.log({
      prompt,
      revisedPrompt,
    });
  • Chore (ai/mcp): add assertCapability method to experimental MCP client

  • Fix (ui): add message metadata in Chat.sendMessage

  • Feat (ai): add streamText onAbort callback

  • ai: Unexpected reasoning-start event in extract reasoning middleware

  • Fix (ai): catch errors in ui message stream

  • Fix (ai): use correct generateMessageId in streamText toUIMessageStream

  • Using Zod 4 for internal stuff

  • ai: Add support for MCP protocol version 2025-06-18

  • Fix (ai): fix invalid fetch call

  • Feat (ui): support message replacement in chat via messageId param on sendMessage

  • Fix (ui): call sendAutomaticallyWhen with updated messages

  • Feat (ai): add experimental prepareStep callback to generateText

  • Fix (ui): support tool names with dash

  • Feat (ai): export SourceDocumentUIPart

  • Fix (core): improve error handling in streamText's consumeStream method

  • Fix (ai): support abort during retry waits

  • Improve Zod compatibility

  • Feat (ui): allow asynchronous onFinish in createUIMessageStream

  • Fix (ui): do not send changing assistant message ids when onFinish is provided

  • Feat (ai): allow sync tool.execute

  • Feat (ai): add consumeSseStream option to UI message stream responses

  • Removed

    Removed deprecated options.throwErrorForEmptyVectors from cosineSimilarity(). Since throwErrorForEmptyVectors was the only option the entire options argument was removed.

    - cosineSimilarity(vector1, vector2, options)
    +cosineSimilarity(vector1, vector2)
  • Feat (ai): export experimental MCPClient and MCPClientConfig interfaces

  • Feat (ai): allow using provider default temperature by specifying null

  • Feat (ai): support model message array in prompt

  • Fix (ai): remove outdated sendStart jsdoc

  • Fix (ai/telemetry): Avoid JSON.stringify on Uint8Arrays for telemetry

  • tool-calling: Don't require the user to have to pass parameters

  • Feat (ai): support dynamic tools in Chat onToolCall

  • Feat (provider/anthropic): cache control for tools

  • Feat (ai): add isAborted to onFinish callback for ui message streams

  • Feat (provider/gateway): Add providerMetadata to embeddings response

  • Chore (ai): stable prepareStep

  • Automatically respect rate limit headers in retry logic

    Added automatic support for respecting rate limit headers (retry-after-ms and retry-after) in the SDK's retry logic. When these headers are present and contain reasonable values (0-60 seconds), the retry mechanism will use the server-specified delay instead of exponential backoff. This matches the behavior of Anthropic and OpenAI client SDKs and improves rate limit handling without requiring any API changes.

  • Feat (ui): add Chat.clearError()

  • Fix (ai): fix sync tool execute with streamText

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.