SIGN IN SIGN UP

fix: prevent required tool choice from failing Moonshot Kimi K2.6 and K2.7 requests (#19633)

## Background

Moonshot Kimi K2.6 and K2.7 requests failed with HTTP 400 when the
published provider forwarded unsupported required tool choice.

## Root Cause

Moonshot tool preparation forwarded required tool choice without
considering model capabilities; the immutable replay confirmed all three
unsupported model IDs sent it and reproduced the provider error.

## Summary

The Moonshot provider now omits required tool choice with an actionable
warning for known unsupported models while preserving Kimi K3, custom
model IDs, and other tool-choice modes. Documentation and a patch
changeset were added.

## Testing

Added tool-preparation and request-level regression tests covering
unsupported models, Kimi K3, custom IDs, warnings, request bodies, and
other tool-choice modes.

## End-to-end Validation

- `pnpm -C examples/ai-functions exec tsx
src/reproduction/issue-19553-moonshot-required-tool-choice.ts` via
immutable replay exited successfully, emitted the expected warnings, and
no longer produced the original failure signal.

## Related Issues

Fixes #19553

Closes #19574

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
964525940243564f6379c17fd0eaf1c6c358f300
Parent: 35841f5
Committed by GitHub <noreply@github.com> on 8/25/2026, 10:39:17 PM