* kimi: rewrite refused sampling params to the accepted values
VS Code Copilot's chat hardcodes temperature 0.1 and top_p 1, which Kimi
Code's per-model whitelist refuses with 400 "invalid temperature: only 1
is allowed for this model" before any token is read. Rewrite them to the
accepted values (1, 0.95) in the body before forwarding, and add them when
absent; a request already carrying them, or going to another provider, is
left as it was. Tested with the four cases: refused, absent, accepted,
another provider.
* kimi: drop temperature/top_p before forwarding to Kimi Code K models
VS Code Copilot chat sends temperature:0.1 and top_p:1, which Kimi Code rejects
with 400 "invalid temperature: only 1 is allowed for this model". Instead of
rewriting to fixed accepted values, remove the fields for Kimi Code K models
only, so the server fills in the value each model and mode wants.
Scope is narrowed to the Kimi Code membership endpoints (kimi-code presets and
api.kimi.com/ai/coding) and K models (kimi-*, kN), so Moonshot pay-as-you-go
(api.moonshot.ai/cn) and moonshot-v1-* keep the user temperature.
Tests cover the refused Copilot request, absent fields, already-accepted
values, Anthropic endpoint, Moonshot pay-as-you-go keeping user temperature,
and another provider left untouched.
* kimi: drop locked sampling fields on both Kimi platforms, for the models that lock them
A review of the last commit found the rewrite missed Moonshot's pay-as-you-go API: kimi-k2.5 and later there lock temperature and top_p the same as Kimi Code's models (400 "invalid temperature: only 1 is allowed for this model", CherryHQ/cherry-studio#19601), so a Copilot user on a Moonshot key with kimi-k2.6 was still refused. The host check is isKimi again — both platforms — and the model check narrows to the ones that lock the fields: kimi-for-coding* and k3* on Kimi Code, kimi-k2.5 and later on either. moonshot-v1-*, kimi-k2-0905-preview, kimi-k2-thinking and kimi-latest take a range and keep the user's values.
TestKimiLockedSampling adds Moonshot host cases both ways (kimi-k2.6 loses the fields, kimi-k2-0905-preview keeps 0.1), so swapping the host check between the platforms fails a test, and each case asserts its own upstream body.
* kimi: test the locked-sampling boundaries and the k3 and vendor-prefixed names
TestKimiLockedSampling now covers the cases a mutation could slip past:
Kimi Code's k3 (the bare-k branch), kimi-k2.5 (the minor >= 5 boundary),
kimi-k2-thinking keeping its temperature (k2 without a version dot is not
locked), and a relay's vendor-prefixed moonshotai/kimi-k2.6 (the vendor
strip). Each of the three surviving mutants from review — minor >= 6, no
bare-k branch, no vendor strip — now fails its subtest.