unstale

npm / @ai-sdk/moonshotai

@ai-sdk/moonshotai

What changed in @ai-sdk/moonshotai 0.0 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

45 breaking11 deprecations16 new APIs and options2 performance16 behavior and defaults1 tooling16 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/moonshotai 756 changes

Breaking changes 34

  • OpenTelemetry span collection is no longer built into the ai package. Install this package and register an OpenTelemetry instance globally to continue receiving traces.

    7.0.0upgrade guide

  • System messages in prompt or messages are rejected by default; set allowSystemInMessages to true to retain the previous behavior for trusted messages.

    7.0.0upgrade guide

  • CommonJS exports are removed; consumers using require() must switch to ESM import syntax.

    3.0.0, 7.0.0release notesupgrade guide

  • Tool callbacks receive tool-specific context, inferred from contextSchema and supplied through toolsContext, replacing experimental_context. Shared generation or agent state now flows through runtimeContext.

    7.0.0upgrade guide

  • Use customProvider instead of the removed experimental_customProvider export; its options and behavior are unchanged.

    7.0.0upgrade guide

  • The deprecated option has been removed; replace it with activeTools.

    7.0.0upgrade guide

  • The deprecated experimental_prepareStep option was removed; replace it with prepareStep.

    7.0.0upgrade guide

  • The tracer property is removed from experimental_telemetry; pass a custom tracer to the OpenTelemetry constructor instead.

    7.0.0upgrade guide

  • Use generateImage instead of the removed experimental_generateImage export.

    7.0.0upgrade guide

  • Use GenerateImageResult instead of the removed Experimental_GenerateImageResult type export.

    7.0.0upgrade guide

  • Top-level content, tool calls and results, files, sources, and warnings now accumulate values across every step. Use finalStep for final-step-only values.

    7.0.0upgrade guide

  • Use isStepCount instead of stepCountIs in tool-loop stop conditions.

    7.0.0upgrade guide

  • The deprecated function has been removed; replace usages with isToolUIPart.

    7.0.0upgrade guide

  • CallSettings is split into LanguageModelCallOptions for model-facing options and RequestOptions for transport options.

    7.0.0upgrade guide

  • The top-level cachedInputTokens field is removed; use inputTokenDetails.cacheReadTokens instead.

    7.0.0upgrade guide

  • The top-level reasoningTokens field is removed; use outputTokenDetails.reasoningTokens instead.

    7.0.0upgrade guide

  • The deprecated tool-result content part type has been removed. Use the file variant for inline tool-result file content.

    7.0.0upgrade guide

  • The minimum supported Node.js version is raised to 22; supported versions are 22, 24, and 26.

    3.0.0, 7.0.0release notesupgrade guide

  • Replaces onEmbedFinish in telemetry integrations and tracing-channel events for individual embedding model calls.

    7.0.0upgrade guide

  • The callback follows the updated result shape: usage and content-related properties cover all steps, while final-step-only values are available on finalStep.

    7.0.0upgrade guide

  • Replaces onRerankFinish in telemetry integrations and tracing-channel events for individual reranking model calls.

    7.0.0upgrade guide

  • The generation start callback for generateText, streamText, and agents is renamed from experimental_onStart to onStart.

    7.0.0upgrade guide

  • The per-step start callback for generateText, streamText, and agents is renamed from experimental_onStepStart to onStepStart.

    7.0.0upgrade guide

  • The deprecated experimental_output option and result property were removed; use output for call options and read result.output.

    7.0.0upgrade guide

  • Instructions returned from prepareStep now carry forward to future steps until another instructions or system override is returned.

    7.0.0upgrade guide

  • Messages returned from prepareStep now become the base for subsequent steps, combined with the prior step's response messages.

    7.0.0upgrade guide

  • Register a telemetry integration globally at application startup; this is required to receive OpenTelemetry traces and enables telemetry for AI SDK calls.

    7.0.0upgrade guide

  • Request bodies are no longer included in generateText and streamText step results by default; generateText response bodies are also excluded. Opt in with include.requestBody and, for generateText, include.responseBody.

    7.0.0upgrade guide

  • Each step's response.messages now contains only messages produced by that step, rather than accumulated history. Use result.responseMessages for the full response message history.

    7.0.0upgrade guide

  • onChunk now receives every TextStreamPart, including lifecycle, boundary, and terminal parts; handlers that assume the previous subset should guard chunk types.

    7.0.0upgrade guide

  • Telemetry becomes enabled by default for AI SDK calls once an integration is registered. Set isEnabled to false to opt out of a specific call, or register no integration to disable telemetry globally.

    7.0.0upgrade guide

  • The deprecated type has been removed; replace usages with ToolExecutionOptions.

    7.0.0upgrade guide

  • Replace totalUsage with usage, which now contains token usage across all steps.

    7.0.0upgrade guide

  • generateText and streamText usage now totals token usage across all steps, matching the former totalUsage behavior. Use finalStep.usage for final-step-only usage.

    7.0.0upgrade guide

Deprecations 10

  • Tool-result file content now has a canonical variant with a tagged data union and required mediaType; legacy image-* and file-* variants are deprecated and auto-migrated at runtime.

    7.0.0upgrade guide

  • Final-step reasoning, request, response, and provider metadata are available through finalStep; their top-level result aliases are deprecated.

    7.0.0upgrade guide

  • The user-message image part is deprecated; use a file part with image mediaType instead.

    7.0.0upgrade guide

  • Move raw chunk inclusion from the top-level includeRawChunks option into include.rawChunks. The old option continues to work as a deprecated alias.

    7.0.0upgrade guide

  • The top-level system prompt option and related prepareStep, repair, and lifecycle fields are renamed to instructions; system remains a deprecated fallback, and instructions takes precedence when both are provided.

    7.0.0upgrade guide

  • The tool() and dynamicTool() property is deprecated. Move approval logic to the per-call or agent toolApproval setting.

    7.0.0upgrade guide

  • Replaces onFinish as the final lifecycle callback for generateText, streamText, agents, embed, embedMany, and rerank. The old name remains a deprecated alias; onEnd takes precedence when both are provided.

    7.0.0upgrade guide

  • Replaces onStepFinish for per-step lifecycle callbacks across generation, agents, and UI message stream helpers. The old name remains a deprecated alias for user-facing callbacks; onStepEnd takes precedence.

    7.0.0upgrade guide

  • The full event stream returned by streamText is now available as stream. fullStream remains available as a deprecated alias.

    7.0.0upgrade guide

  • Result methods for converting or piping UI and text streams are deprecated but still work in v7. Use stateless helpers exported from ai instead.

    7.0.0upgrade guide

New APIs and options 2

  • The top-level option is the provider-agnostic way to control reasoning effort; overlapping providerOptions settings take precedence and can bypass it.

    7.0.0upgrade guide

  • Models can return files in reasoning traces as a distinct part type. Update exhaustive part handling and account for these files in content or reasoning rather than result.files or step.files.

    7.0.0upgrade guide

Behavior and default changes 9

  • mediaType accepts a full IANA type or a top-level segment; a subtype is auto-detected from inline bytes where possible.

    7.0.0upgrade guide

  • The speech generation function graduated from experimental status and is now named generateSpeech; the old name remains a deprecated alias.

    7.0.0upgrade guide

  • Replaces experimental_include for generateText, streamText, and ToolLoopAgent. The old name remains a deprecated alias; include takes precedence if both are provided.

    7.0.0upgrade guide

  • Replaces experimental_onToolCallFinish as a tool execution callback for generateText and streamText. The old name remains a deprecated fallback.

    7.0.0upgrade guide

  • Replaces experimental_onToolCallStart as a tool execution callback for generateText and streamText. The old name remains a deprecated fallback.

    7.0.0upgrade guide

  • The speech result type is now named SpeechResult; the old name remains a deprecated alias.

    7.0.0upgrade guide

  • Replaces experimental_telemetry as the stable telemetry configuration option for AI SDK functions and agents. The old name remains a deprecated alias, and telemetry behavior is otherwise unchanged.

    7.0.0upgrade guide

  • The transcription API graduated from experimental status and is now named transcribe; the old name remains a deprecated alias.

    7.0.0upgrade guide

  • The transcription result type is now named TranscriptionResult; the old name remains a deprecated alias.

    7.0.0upgrade guide

Tooling 1

  • Run the v7 codemod command from the project root to apply the available v6-to-v7 code transformations.

    7.0.0upgrade guide

@ai-sdk/moonshotai 68 changes

Breaking changes 7

  • The function is async in AI SDK 6, so callers must await its result.

    6.0.0upgrade guide

  • Provider method textEmbedding was renamed to embedding; update calls that select an embedding model.

    6.0.0upgrade guide

  • Provider method textEmbeddingModel was renamed to embeddingModel; update calls that select an embedding model.

    6.0.0upgrade guide

  • Function tool definitions no longer accept a name property; use the key in the tools object to set the function tool name.

    6.0.0upgrade guide

  • The parameter is now an object with an output property; update implementations to destructure output.

    6.0.0upgrade guide

  • Replaces Experimental_Agent; its system parameter is now instructions, and stopWhen defaults to isStepCount(20).

    6.0.0upgrade guide

  • The unknown finish reason is removed and is now returned as other.

    6.0.0upgrade guide

Deprecations 1

  • Renames ToolCallOptions; update references to the type.

    6.0.0upgrade guide

@ai-sdk/moonshotai 323 changes

Breaking changes 3

  • For Kimi K3 models, unsupported reasoning levels now map to the closest supported level, rounding down when possible. Disabling reasoning maps to the model's lowest level with a compatibility warning.

    3.0.81release notes

  • Affected provider, parsing, and transport error paths that previously left the finish reason as other now report error.

    3.0.75release notes

  • Moonshot AI streams that end cleanly without the provider completion signal now report interrupted and preserve partial output without emitting an error solely for the interruption. Applications must handle this finish reason.

    3.0.75release notes

New APIs and options 7

  • Provider API key settings now support promises and synchronous or asynchronous callbacks, resolving credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.

    3.0.82release notes

  • Provider token settings now support promises and synchronous or asynchronous callbacks, resolving credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.

    3.0.82release notes

  • Reports cache write tokens.

    2.0.69, 3.0.77release notesrelease notes

  • Adds support for the kimi-k3.1-pro model.

    0.0.33, 2.0.69, 3.0.77release notesrelease notesrelease notes

  • Adds support for the kimi-k3.1-pro-highspeed model.

    0.0.33, 2.0.69, 3.0.77release notesrelease notesrelease notes

  • Adds support for prompt cache options.

    2.0.69, 3.0.77release notesrelease notes

  • Adds max as a portable reasoning level, widening LanguageModelV4CallOptions['reasoning'] and the derived ReasoningLevel type. Exhaustive switches and mappings must handle it.

    3.0.64release notes

Performance 1

Behavior and default changes 3

  • Known model ID suggestions now derive from each provider’s model catalog declarations, so catalog updates automatically update autocomplete while preserving existing suggestions, endpoint-specific lists, and support for custom model IDs.

    3.0.93release notes

  • Unknown model IDs retain JSON schemas for structured output instead of silently falling back to JSON object mode, supporting future Moonshot models.

    0.0.31, 2.0.63, 3.0.68release notesrelease notesrelease notes

  • Provider config types make headers optional, allowing custom provider implementations to omit them when constructing model configs.

    3.0.0release notes

Fixes and other changes 9

  • Tool and response schemas now accept root unions of objects, including local $ref branches, while keeping a root type: "object" beside anyOf.

    0.0.34, 2.0.69, 3.0.77release notesrelease notesrelease notes

  • The User-Agent header now complies with standards.

    3.0.60release notes

  • Fixes streamed tool calls when their IDs are missing, blank, or repeated.

    3.0.59release notes

  • Preserves reasoning streams across empty tool-call deltas.

    3.0.49release notes

  • Preserves documented Moonshot API error codes in HTTP and streaming errors.

    0.0.24, 2.0.53, 3.0.41release notesrelease notesrelease notes

  • Preserves complete raw usage objects.

    2.0.53, 3.0.41release notesrelease notes

  • Prevents negative text output token counts when providers report reasoning tokens by treating Perplexity reasoning tokens separately from completion tokens.

    2.0.49, 3.0.38release notesrelease notes

  • Fixes handling of empty string tool call IDs.

    3.0.36release notes

  • Provider model classes include WORKFLOW_SERIALIZE and WORKFLOW_DESERIALIZE static methods, enabling models to cross workflow step boundaries without serialization errors.

    3.0.0release notes

@ai-sdk/moonshotai 215 changes

Breaking changes 1

  • Strict validation is enabled by default for Moonshot structured outputs.

    2.0.51release notes

New APIs and options 5

  • Adds provider-specific names for Moonshot AI system, user, and assistant messages.

    0.0.24, 2.0.53release notesrelease notes

  • Adds first-class support for Moonshot V1 auto and vision-preview model IDs while retaining support for custom and retired model IDs.

    0.0.24, 2.0.53release notesrelease notes

  • Adds Moonshot AI Partial Mode support for continuing a final assistant message.

    2.0.53release notes

  • Adds predicted output support.

    2.0.53release notes

  • Adds the Moonshot AI provider for use with the AI SDK.

    2.0.0release notes

Behavior and default changes 3

  • Adds support for Kimi K3 dynamic tool-loading system messages.

    0.0.24, 2.0.53release notesrelease notes

  • Maximum output tokens are sent using the current Moonshot request field.

    2.0.51release notes

  • Official Moonshot V1 models use native JSON Schema structured outputs.

    2.0.51release notes

Fixes and other changes 6

  • Choice-level usage is preserved in Moonshot streaming responses.

    2.0.51release notes

  • Moonshot streaming tool calls without indices are accepted.

    2.0.51release notes

  • Moonshot structured output schemas are normalized.

    2.0.51release notes

  • Unsupported image and video media types are rejected before Moonshot chat requests are sent.

    2.0.51release notes

  • Non-object root schemas now fail with a clear client-side error instead of Moonshot's opaque 400.

    2.0.47release notes

  • Tool schemas are normalized for Moonshot's MFJS validator: tuple items become prefixItems, and type next to anyOf moves into the branches. The original schema remains in use for AI SDK result validation.

    2.0.47release notes

@ai-sdk/moonshotai 0.05 changes

New APIs and options 2

Performance 1

  • Moonshot tool and response schemas normalize object items and rewritten tuple items once, avoiding repeated normalization.

    0.0.38release notes

Behavior and default changes 1

  • Supports Partial Mode for final assistant message prefixes.

    0.0.24release notes

Fixes and other changes 1

  • Preserves Moonshot chat response metadata in generated and streamed responses.

    0.0.24release notes