fix: add Kimi K3 1M context window to DEFAULT_CONTEXT_LENGTHS - #67685
datachainsystems wants to merge 1 commit into
Conversation
Kimi K3 ships with a 1M-token context window (verified against platform.kimi.ai/docs/overview) but was falling through to the generic 'kimi': 262144 catch-all. Added 'kimi-k3': 1_000_000 before the catch-all so longest-key-first substring matching resolves K3 to 1M while older Kimi models still hit the 256K default. Added matching test_kimi_k3_context_1m test covering native, vendor-prefixed (kimi/, moonshotai/), and older model fallback.
|
Thanks for the triage. I reviewed #67115 and believe #67685 is the correct approach — here's why: #67115 fixes #67685 fixes The endpoint-scoped path already handles the bare If there's a concern about legacy Moonshot keys that don't serve K3 returning 1M for |
…aces Follow-up widening for salvaged PRs #67115, #67685, #67620: - _PROVIDER_MODELS: add kimi-k3 atop kimi-coding / moonshot / opencode-go curated lists (kimi-coding-cn covered by cherry-picked #67620) - setup.py _DEFAULT_PROVIDER_MODELS: kimi-k3 for kimi-coding(-cn) + opencode-go - model_metadata: align DEFAULT_CONTEXT_LENGTHS kimi-k3 entry to 1,048,576 (matches endpoint-scoped override, models.dev, and OpenRouter live metadata) - anthropic_adapter: classify the bare Coding Plan slug 'k3' (and k3.x/k3-*) as Kimi family so adaptive thinking applies on proxied endpoints - moonshot_schema: is_moonshot_model matches bare 'k3' so tool-schema sanitization runs on the chat-completions path - contributor mappings for githubespresso407, datachainsystems, Punyko8 Tests: 582 passed across 11 targeted files; hermetic E2E verifies picker order (kimi-k3 first), no dupes, and 1M context resolution.
|
Merged via PR #68108 — your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks for the fix! The salvage also widened the rollout to the remaining Kimi-direct catalog surfaces (curated picker lists, setup defaults, and bare-slug family classification). |
…aces Follow-up widening for salvaged PRs NousResearch#67115, NousResearch#67685, NousResearch#67620: - _PROVIDER_MODELS: add kimi-k3 atop kimi-coding / moonshot / opencode-go curated lists (kimi-coding-cn covered by cherry-picked NousResearch#67620) - setup.py _DEFAULT_PROVIDER_MODELS: kimi-k3 for kimi-coding(-cn) + opencode-go - model_metadata: align DEFAULT_CONTEXT_LENGTHS kimi-k3 entry to 1,048,576 (matches endpoint-scoped override, models.dev, and OpenRouter live metadata) - anthropic_adapter: classify the bare Coding Plan slug 'k3' (and k3.x/k3-*) as Kimi family so adaptive thinking applies on proxied endpoints - moonshot_schema: is_moonshot_model matches bare 'k3' so tool-schema sanitization runs on the chat-completions path - contributor mappings for githubespresso407, datachainsystems, Punyko8 Tests: 582 passed across 11 targeted files; hermetic E2E verifies picker order (kimi-k3 first), no dupes, and 1M context resolution.
…aces Follow-up widening for salvaged PRs NousResearch#67115, NousResearch#67685, NousResearch#67620: - _PROVIDER_MODELS: add kimi-k3 atop kimi-coding / moonshot / opencode-go curated lists (kimi-coding-cn covered by cherry-picked NousResearch#67620) - setup.py _DEFAULT_PROVIDER_MODELS: kimi-k3 for kimi-coding(-cn) + opencode-go - model_metadata: align DEFAULT_CONTEXT_LENGTHS kimi-k3 entry to 1,048,576 (matches endpoint-scoped override, models.dev, and OpenRouter live metadata) - anthropic_adapter: classify the bare Coding Plan slug 'k3' (and k3.x/k3-*) as Kimi family so adaptive thinking applies on proxied endpoints - moonshot_schema: is_moonshot_model matches bare 'k3' so tool-schema sanitization runs on the chat-completions path - contributor mappings for githubespresso407, datachainsystems, Punyko8 Tests: 582 passed across 11 targeted files; hermetic E2E verifies picker order (kimi-k3 first), no dupes, and 1M context resolution.
…aces Follow-up widening for salvaged PRs NousResearch#67115, NousResearch#67685, NousResearch#67620: - _PROVIDER_MODELS: add kimi-k3 atop kimi-coding / moonshot / opencode-go curated lists (kimi-coding-cn covered by cherry-picked NousResearch#67620) - setup.py _DEFAULT_PROVIDER_MODELS: kimi-k3 for kimi-coding(-cn) + opencode-go - model_metadata: align DEFAULT_CONTEXT_LENGTHS kimi-k3 entry to 1,048,576 (matches endpoint-scoped override, models.dev, and OpenRouter live metadata) - anthropic_adapter: classify the bare Coding Plan slug 'k3' (and k3.x/k3-*) as Kimi family so adaptive thinking applies on proxied endpoints - moonshot_schema: is_moonshot_model matches bare 'k3' so tool-schema sanitization runs on the chat-completions path - contributor mappings for githubespresso407, datachainsystems, Punyko8 Tests: 582 passed across 11 targeted files; hermetic E2E verifies picker order (kimi-k3 first), no dupes, and 1M context resolution.
Summary
Kimi K3 ships with a 1M-token context window (verified: platform.kimi.ai/docs/overview) but was falling through to the generic
"kimi": 262144catch-all inDEFAULT_CONTEXT_LENGTHS.Change
"kimi-k3": 1_000_000before the"kimi": 262144catch-all inagent/model_metadata.pytest_kimi_k3_context_1mcovering native, vendor-prefixed (kimi/,moonshotai/), and older model (kimi-k2.6, kimi-k2) fallback verificationVerification
Pattern
Same longest-key-first approach used by DeepSeek V4 (#...), GLM-5.2 (#...), and others.