npm / @ai-sdk/deepseek
@ai-sdk/deepseek
What changed in @ai-sdk/deepseek 1 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
48 breaking13 deprecations32 new APIs and options19 behavior and defaults26 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@ai-sdk/deepseek 71 changes
Breaking changes 1
The codemod migrates named Google imports and direct re-exports to the new API names while preserving local bindings and application export names as aliases. Namespace member access remains unchanged.
@ai-sdk/deepseek 3125 changes
Breaking changes 45
Affected error paths that previously reported other now report error; actual provider, parsing, and transport errors retain their error paths.
OpenTelemetry span collection moved out of the ai package. Install this package and register an OpenTelemetry instance globally to receive traces.
Opt in to accepting system messages in prompt or messages for existing chat histories; use only with trusted messages.
CallSettings is split into LanguageModelCallOptions and RequestOptions; replace usages with LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>.
Top-level content, tool-call and result collections, files, sources, and warnings on generateText and streamText results now accumulate values across every step; use finalStep for final-step-only values.
Tool callbacks now use stable, tool-specific context instead of experimental_context. Declare its shape with contextSchema and provide values through toolsContext.
Declare tool-specific context fields with contextSchema; tool callback context is inferred from that schema.
The package is ESM-only; consumers using require() must switch to ESM import syntax.
The deprecated option is removed; use activeTools in generateText and streamText calls.
The deprecated export is removed; replace it with customProvider.
The deprecated export is removed; replace it with generateImage.
The deprecated type export is removed; replace it with GenerateImageResult.
The deprecated option and generateText result property are removed; use output for both call options and result access.
The deprecated option is removed; replace it with prepareStep.
The tracer property was removed from experimental_telemetry; pass a custom tracer to the OpenTelemetry constructor instead.
File part data is now tagged with a type, and the image part type is removed.
The stable include option replaces experimental_include for generateText, streamText, and ToolLoopAgent; include takes precedence if both are set.
Move streamText's deprecated top-level includeRawChunks option into include.rawChunks.
Request bodies are no longer included in generateText and streamText step results by default; opt in with include.requestBody.
generateText no longer includes response bodies by default; opt in with include.responseBody.
Use isStepCount instead of stepCountIs in tool-loop stop conditions.
The deprecated function is removed; use isToolUIPart instead.
The top-level cachedInputTokens field has been removed; use inputTokenDetails.cacheReadTokens instead.
The top-level reasoningTokens field has been removed; use outputTokenDetails.reasoningTokens instead.
The deprecated { type: 'media' } tool-result content part is removed; use a file part with tagged data instead.
Raises the minimum supported Node.js version to 22; supported versions are 22, 24, and 26.
Replaces onEmbedFinish in telemetry integrations and tracing-channel events for individual embedding model calls.
Use onEnd instead of experimental_onFinish for completed embed and embedMany operations.
Use onEnd instead of experimental_onFinish for completed rerank operations.
The callback follows the result changes: usage and content collections include all steps, while final-step-only properties are available on finalStep.
Replaces onRerankFinish in telemetry integrations and tracing-channel events for individual reranking model calls.
The generation start callback is renamed from experimental_onStart to onStart for generateText, streamText, and agents.
Replaces onStepFinish as the per-step lifecycle callback across text and object generation, agents, workflow agents, and UI message stream helpers. Telemetry integrations should implement onStepEnd.
The per-step start callback is renamed from experimental_onStepStart to onStepStart for generateText, streamText, and agents.
Instructions returned from prepareStep carry forward to future steps until another instructions or system override is returned.
Messages returned from prepareStep become the base for subsequent steps, combined with response messages from the previous step.
Some models can return files in reasoning under this distinct content type; exhaustive part handling should support it.
MCPTransportConfig redirect now defaults to error rather than follow, rejecting HTTP redirects by default to prevent SSRF; set it to follow if redirects are required.
Shared generation or agent runtime data now flows through runtimeContext, separate from tool-specific context.
Each step's response.messages now contains only messages produced by that step. Use result.responseMessages for the accumulated response history.
onChunk now receives every emitted TextStreamPart, including lifecycle, boundary, and terminal parts, so handlers may need to guard chunk types.
System messages in prompt or messages are rejected by default; pass system instructions through the top-level instructions option.
The deprecated type is removed; replace imports and type references with ToolExecutionOptions.
Provide tool-specific context values through toolsContext, keyed by tool name; when a tool declares contextSchema, toolsContext becomes required.
generateText and streamText result usage now totals tokens across all steps; use finalStep.usage for final-step-only usage.
Deprecations 13
The @ai-sdk/vue Chat class is deprecated in favor of useChat, which provides reactive refs and recreates the underlying chat when its init object changes.
Tool-result image-* and legacy file-* variants are deprecated in favor of one file variant with mediaType and tagged data; legacy outputs are auto-migrated at runtime.
The user-message { type: 'image' } part is deprecated; use a file part with an image mediaType instead.
The tool() and dynamicTool() property is deprecated; move approval logic to toolApproval on the call or agent so policy can vary by request.
Replaces onFinish as the final lifecycle callback for generateText, streamText, agents, and ToolLoopAgent settings. onFinish remains a deprecated alias; onEnd takes precedence when both are provided.
The streamText result method is deprecated; use the stateless helper with a text stream.
The streamText result method is deprecated; use the stateless helper with a UI message stream.
Top-level reasoning, reasoningText, request, response, and providerMetadata result properties are deprecated; read final-step values from result.finalStep.
The full event stream is now available as stream instead of fullStream; fullStream remains a deprecated alias.
totalUsage is deprecated; use usage, which now contains usage across all steps.
The streamText result method is deprecated; use toTextStream and createTextStreamResponse instead.
The streamText result method is deprecated; use the stateless top-level helper with result.stream.
The streamText result method is deprecated; compose toUIMessageStream with createUIMessageStreamResponse instead.
New APIs and options 29
Adds a Responses API model to the DeepSeek provider.
Adds a web search tool to the DeepSeek provider.
Adds max as a portable reasoning level, with native provider mappings, compatibility coercions, and budget-based fallback support.
provider-utils adds deleteFromApi.
FilesV4 call options now support abortSignal.
FilesV4 gains an optional deleteFile operation.
FilesV4 gains an optional streaming downloadFile operation.
FilesV4 gains an optional getFileMetadata operation.
FilesV4 call options now support headers.
provider-utils adds postMultipartStreamToApi for streaming multipart uploads with deterministic part ordering and failure-path stream teardown.
Upload data now accepts a { type: 'stream' } variant.
Upload results now expose byteSize.
Upload results now expose createdAt.
Upload results now expose expiresAt.
Adds support for beta assistant prefix completion through message provider options.
Adds support for requesting and receiving chat completion log probabilities.
Adds support for image detail and inline file-data content parts.
Adds provider-specific names for system, user, and assistant messages.
Exposes response system fingerprints in provider metadata for generated and streamed text.
Adds model IDs for DeepSeek V4 Flash and Pro.
Adds the chat option userId and serializes it as user_id.
DeepSeek V4 Flash Vision Exp gains Files API support.
Adds reasoning effort support for DeepSeek V4.
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.
The callback receives instructions for the current state and initialInstructions for the original top-level value.
The provider supports the new top-level reasoning parameter.
Accepts thinking.type: 'adaptive' and the full reasoningEffort enum, including low, medium, high, xhigh, and max.
The Vue composable exposes reactive refs for messages, status, and error, and can recreate the underlying chat when reactive initialization inputs change.
Provider model classes can cross workflow step boundaries using WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE.
Behavior and default changes 17
Known model ID suggestions are derived from provider model catalog declarations, so catalog updates automatically update autocomplete while preserving existing suggestions, endpoint-specific model lists, and support for custom model IDs.
Endpoints with unspecified strict-tool support now allow strict tools, while explicit endpoint restrictions remain in effect.
Provider API key and token settings now support promises and synchronous or asynchronous callbacks, resolving credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.
Preserves reasoning content on all assistant turns for future DeepSeek models, using current reasoning-enabled defaults; known pre-V4 versions and legacy chat/reasoner aliases retain previous handling.
Deprecated or ineffective sampling options now trigger warnings and are omitted, while penalty sampling is preserved for Azure-hosted DeepSeek models.
Aligns thinking and reasoning effort options with documented API values and maps legacy options with compatibility warnings.
DeepSeek V4 Flash Vision Exp gains image input support.
The speech generation function graduates from experimental status under the stable name generateSpeech; the old name remains a deprecated alias.
Provider config types make headers optional, allowing manually constructed model configs to omit them when auth is provided separately.
Replaces experimental_onToolCallFinish for tool execution callbacks in generateText and streamText; the old name remains a deprecated fallback alias.
Replaces experimental_onToolCallStart for tool execution callbacks in generateText and streamText; the old name remains a deprecated fallback alias.
The top-level reasoning option controls reasoning effort; overlapping providerOptions settings take precedence and can bypass it.
The speech result type is available under the stable name SpeechResult; the old name remains a deprecated alias.
Telemetry events are emitted by default on AI SDK calls after a telemetry integration is registered; set isEnabled: false to opt out for a call.
The telemetry option replaces experimental_telemetry. The old name remains a deprecated alias, and telemetry takes precedence when both are provided.
The transcription API graduates from experimental status under the stable name transcribe; the old name remains a deprecated alias.
The transcription result type is available under the stable name TranscriptionResult; the old name remains a deprecated alias.
Fixes and other changes 21
Preserves string tool call arguments and safely serializes BigInt and circular structures in tool calls and outputs.
DeepSeek streams that end cleanly without a provider completion signal now report interrupted and preserve partial output without emitting an error solely for the interruption.
Fixes cached input token reporting for OpenAI-compatible DeepSeek responses.
Uses a standards-compliant User-Agent header.
Fixes streamed tool calls with missing, blank, or repeated IDs.
Tool-result images are now sent as image content parts.
Non-streaming responses without choices now return a typed error.
The deepseek-flash alias is treated as a V4 model so prior-turn reasoning_content is preserved in multi-turn requests.
Preserves reasoning streams across empty tool-call deltas.
The core uploadFile() helper now forwards abortSignal.
The core uploadFile() helper now forwards headers.
Preserves complete raw chat usage objects.
Preserves documented chat response metadata for generate and stream.
Validates file response discriminators and numeric metadata while remaining compatible with omitted optional metadata.
Validates upload formats, sizes, and filename lengths before sending requests.
Validates strict tool calls against beta endpoint requirements.
Preserves the file object discriminator in upload provider metadata.
Prevents negative text output token counts when providers report reasoning tokens; Perplexity reasoning tokens are treated as separate from completion tokens.
Handles empty string tool call IDs.
Preserves reasoning_content for DeepSeek V4 in multi-turn requests.
Tool calls are finalized only after the stream is fully consumed, preventing execution with incomplete arguments when partial JSON is already parsable.
@ai-sdk/deepseek 26 changes
Breaking changes 1
The DeepSeek provider was rewritten; developers may need to adapt integrations to the updated provider implementation.
New APIs and options 2
DeepSeek image detail support is added.
DeepSeek supports inline file-data content parts.
Behavior and default changes 2
Adds image input support for DeepSeek V4 Flash Vision Exp.
A JSON instruction is automatically injected when the provider is deepseek.chat, which affects how JSON output requests are handled.
Fixes and other changes 1
Complete raw chat usage objects are now preserved, so developers retain all usage data.
@ai-sdk/deepseek 16 changes
Breaking changes 1
The OpenAI-compatible provider integration converts to providerOptions.
New APIs and options 1
Raw chunk support is added.
Fixes and other changes 4
String tool call arguments are preserved instead of being altered.
Treats the deepseek-flash alias as a V4 model so prior-turn reasoning_content is preserved in multi-turn requests.
The release includes AI SDK 5, which may affect how developers use the provider with the SDK.
Zod compatibility is improved.