fix: serialize Moonshot maxOutputTokens using the supported request field (#19605)
## Background Moonshot requests using the generic maxOutputTokens option sent the deprecated max_tokens field instead of max_completion_tokens in streaming and non-streaming calls. ## Root Cause The shared Moonshot chat request argument builder explicitly mapped maxOutputTokens to max_tokens; the recorded reproduction and request-body tests confirmed that both generation paths inherited this incorrect mapping. ## Summary Mapped maxOutputTokens to max_completion_tokens, removed reproduction-only artifacts, and added a patch changeset for @ai-sdk/moonshotai. ## Testing Added streaming and non-streaming regression tests covering defined values, deprecated-field exclusion, and omission when maxOutputTokens is undefined. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx -e '<fixture-backed generateText/streamText validation>'` confirmed both paths send only max_completion_tokens and omit undefined values. - `pnpm -C examples/ai-functions exec tsx -e '<live Moonshot generateText/streamText validation>'` completed both live requests successfully with maxOutputTokens set to 17; each reported length termination and 17 output tokens. ## Related Issues Fixes #19556 Closes #19588 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: gr2m <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
d354a4260d930759d9a45e5bcde260c13825a42a
Parent: 81bebaf
Committed by GitHub <noreply@github.com>
on 8/26/2026, 5:21:06 PM