npm / @ai-sdk/moonshotai
@ai-sdk/moonshotai
What changed in @ai-sdk/moonshotai 0.0 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
1 breaking7 new APIs and options5 behavior and defaults14 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@ai-sdk/moonshotai 39 changes
New APIs and options 1
Adds max as a portable reasoning level, widening LanguageModelV4CallOptions['reasoning'] and the derived ReasoningLevel type. Exhaustive switches and mappings must handle it.
Behavior and default changes 1
Unknown model IDs retain JSON schemas for structured output instead of silently falling back to JSON object mode, supporting future Moonshot models.
Fixes and other changes 7
The User-Agent header now complies with standards.
Fixes streamed tool calls when their IDs are missing, blank, or repeated.
Preserves reasoning streams across empty tool-call deltas.
Preserves documented Moonshot API error codes in HTTP and streaming errors.
Preserves complete raw usage objects.
Prevents negative text output token counts when providers report reasoning tokens by treating Perplexity reasoning tokens separately from completion tokens.
Fixes handling of empty string tool call IDs.
@ai-sdk/moonshotai 214 changes
Breaking changes 1
Strict validation is enabled by default for Moonshot structured outputs.
New APIs and options 4
Adds provider-specific names for Moonshot AI system, user, and assistant messages.
Adds first-class support for Moonshot V1 auto and vision-preview model IDs while retaining support for custom and retired model IDs.
Adds Moonshot AI Partial Mode support for continuing a final assistant message.
Adds predicted output support.
Behavior and default changes 3
Adds support for Kimi K3 dynamic tool-loading system messages.
Maximum output tokens are sent using the current Moonshot request field.
Official Moonshot V1 models use native JSON Schema structured outputs.
Fixes and other changes 6
Choice-level usage is preserved in Moonshot streaming responses.
Moonshot streaming tool calls without indices are accepted.
Moonshot structured output schemas are normalized.
Unsupported image and video media types are rejected before Moonshot chat requests are sent.
Non-object root schemas now fail with a clear client-side error instead of Moonshot's opaque 400.
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.
@ai-sdk/moonshotai 0.04 changes
New APIs and options 2
Adds support for chat log probabilities.
Adds support for Moonshot predicted outputs.
Behavior and default changes 1
Supports Partial Mode for final assistant message prefixes.
Fixes and other changes 1
Preserves Moonshot chat response metadata in generated and streamed responses.