"is not a model this version of Claude Code recognizes" - CC Switch
Quick fix
Set CLAUDE_CODE_MAX_CONTEXT_TOKENS or append [1m] to the model name to define the correct context window size.
Symptom
Section titled “Symptom”"deepseek-v4-flash" is not a model this version of Claude Code recognizes, so auto-compact will keep this session within 200k tokens (the context window it assumes). If the model accepts more, append [1m] to the model name for 1M, or set CLAUDE_CODE_MAX_CONTEXT_TOKENS to its real window; to make it recognized, map it in the modelOverrides setting or update Claude Code; CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1 restores the previous wait-for-the-API behavior.When using cc-switch to route requests to third-party models (such as DeepSeek, Kimi, GLM, etc.), the Claude Code client cannot recognize these non-Anthropic official model names. Due to a lack of built-in context window metadata, Claude Code conservatively assumes a context window of 200k tokens and triggers auto-compact within this limit. This leads to two main problems: first, if the model actually supports a larger window (e.g., 1M), the conversation is truncated prematurely; second, auto-compact rewrites historical message prefixes, causing the backend DeepSeek Prefix Cache to fail, thereby increasing Token costs.
Currently, cc-switch has not fully implemented automatic injection of context window environment variables on the Claude Code Desktop side like it does on the Codex side (see PR-3 planning in Issues #5858 and #6962). Therefore, users must manually configure the client to inform it of the correct window size or disable the enforcement.
Set the CLAUDE_CODE_MAX_CONTEXT_TOKENS environment variable in the terminal to the model's actual context window size (e.g., 1000000 for 1M).
.bashrc, .zshrc 或系统环境变量 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000Alternatively, directly append the [1m] suffix to the model name to declare a 1M window.
在 cc-switch 配置或 ANTHROPIC_MODEL 变量中 # 将 deepseek-v4-flash 改为 deepseek-v4-flash[1m]If you want the behavior to be determined entirely by the API response without proactive compression at 200k, set the disable flag.
.bashrc, .zshrc 或系统环境变量 export CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- Is this prompt an error? Must it be fixed?
- This is not a blocking error but a warning. If you do not mind the conservative 200k truncation, or if your model indeed only supports 200k, you can ignore it. However, if the model supports a larger window and you wish to utilize it fully, we recommend configuring according to fix_steps.
- Why did appending [1m] not take effect?
- According to discussions in Issue #6962, if using proxy takeover mode, you may need to ensure the proxy layer correctly handles the appending and stripping of the `[1m]` marker. Additionally, in direct connect mode, this suffix should be recognized by the client. If it still fails, try using the environment variable method or check if your cc-switch version is the latest (e.g., v3.19.2+ may have other routing bugs, see Issue #6221 comments).
- When will cc-switch automatically handle this?
- According to the tracking plan in Issue #6962, PR-3 is under development to add per-model `contextWindows` fields to Claude suppliers and automatically inject environment variables such as CLAUDE_CODE_MAX_CONTEXT_TOKENS during switching. Currently, this feature has not been merged or released, so manual configuration is required.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.