mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
feat(kimi): declare the 256K context window for Kimi For Coding
Claude Code caps unknown model ids at 200K, so the preset's standalone CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144 was clamped by min(window, value) and never took effect. Pair it with CLAUDE_CODE_MAX_CONTEXT_TOKENS and route the endpoint's kimi-for-coding alias on every tier, since both context envs are ignored for claude-* prefixed model ids. Saved providers get the same context defaults injected into effective live settings at switch time, with a mirror-inverse strip on backfill so injected values never harden into provider config. Explicit user values always win over the injected defaults.
This commit is contained in:
@@ -486,10 +486,23 @@ export const providerPresets: ProviderPreset[] = [
|
||||
env: {
|
||||
ANTHROPIC_BASE_URL: "https://api.kimi.com/coding/",
|
||||
ANTHROPIC_AUTH_TOKEN: "",
|
||||
// CLAUDE_CODE_MAX_CONTEXT_TOKENS 只对非 claude- 前缀模型 id 生效,
|
||||
// 必须显式路由端点别名 kimi-for-coding(与 codex/hermes/opencode 预设一致)
|
||||
ANTHROPIC_MODEL: "kimi-for-coding",
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "kimi-for-coding",
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "kimi-for-coding",
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "kimi-for-coding",
|
||||
CLAUDE_CODE_MAX_CONTEXT_TOKENS: "${CLAUDE_CODE_MAX_CONTEXT_TOKENS}",
|
||||
CLAUDE_CODE_AUTO_COMPACT_WINDOW: "${CLAUDE_CODE_AUTO_COMPACT_WINDOW}",
|
||||
},
|
||||
},
|
||||
templateValues: {
|
||||
CLAUDE_CODE_MAX_CONTEXT_TOKENS: {
|
||||
label: "Max Context Tokens",
|
||||
placeholder: "262144",
|
||||
defaultValue: "262144",
|
||||
editorValue: "262144",
|
||||
},
|
||||
CLAUDE_CODE_AUTO_COMPACT_WINDOW: {
|
||||
label: "Auto Compact Window",
|
||||
placeholder: "262144",
|
||||
|
||||
Reference in New Issue
Block a user