Bug Description
When selecting Settings > Providers > API Provider > Kimi Code > OAuth, the Max Output field shows 32,768 for all Kimi Code models. According to Kimi's official documentation, the correct values are:
- kimi-k3 (Kimi Code model ID:
k3): max_completion_tokens defaults to 131,072, context window 1,048,576 (1M)
- kimi-k2.7-code (Kimi Code model ID:
kimi-for-coding): max output = 256K - prompt_tokens, context window 262,144 (256K)
The Context Window displays correctly (values come from the server's /models API context_length field), but Max Output does not.
Root Cause
Three issues in the codebase:
- Hardcoded default:
kimiCodeDefaultModelInfo.maxTokens is set to 32_768 instead of 131_072
- Missing schema field: The Zod schema in
kimiCodeModelSchema doesn't include a max_tokens field, so even if the server returns it, it gets silently stripped
- No override logic:
mapKimiCodeModel() overrides contextWindow from the server response but does NOT override maxTokens
Impact
All Kimi Code models (kimi-for-coding, k3, k3-256k, kimi-for-coding-highspeed) display incorrect Max Output values. This affects the UI display and potentially the max_tokens parameter sent to the API.
Fix
A fix is ready in branch fix/kimi-code (commit 69f3ce3a8) with the following changes:
- Update
kimiCodeDefaultModelInfo.maxTokens from 32_768 to 131_072
- Add
kimiCodeModelDefaults for per-model fallback values
- Add
max_tokens to kimiCodeModelSchema for server response parsing
- Override
maxTokens in mapKimiCodeModel(): server value > model default > global default
- Add 4 new tests covering all fallback paths
Bug Description
When selecting Settings > Providers > API Provider > Kimi Code > OAuth, the Max Output field shows 32,768 for all Kimi Code models. According to Kimi's official documentation, the correct values are:
k3):max_completion_tokensdefaults to 131,072, context window 1,048,576 (1M)kimi-for-coding): max output = 256K - prompt_tokens, context window 262,144 (256K)The Context Window displays correctly (values come from the server's
/modelsAPIcontext_lengthfield), but Max Output does not.Root Cause
Three issues in the codebase:
kimiCodeDefaultModelInfo.maxTokensis set to32_768instead of131_072kimiCodeModelSchemadoesn't include amax_tokensfield, so even if the server returns it, it gets silently strippedmapKimiCodeModel()overridescontextWindowfrom the server response but does NOT overridemaxTokensImpact
All Kimi Code models (kimi-for-coding, k3, k3-256k, kimi-for-coding-highspeed) display incorrect Max Output values. This affects the UI display and potentially the
max_tokensparameter sent to the API.Fix
A fix is ready in branch
fix/kimi-code(commit69f3ce3a8) with the following changes:kimiCodeDefaultModelInfo.maxTokensfrom32_768to131_072kimiCodeModelDefaultsfor per-model fallback valuesmax_tokenstokimiCodeModelSchemafor server response parsingmaxTokensinmapKimiCodeModel(): server value > model default > global default