Skip to content

Proxy billing model not proxied, then error 405 - Claude Code

Quick fix

Modify env vars like ANTHROPIC_DEFAULT_SONNET_MODEL to the target model name, as cc-switch proxy only reads this field for mapping.

Error output
代理时,出现计费模型没有代理,然后报错405
English translation

When using a proxy, the billing model is not proxied, then error 405

When configuring a local proxy (e.g., DeepSeek) with cc-switch, users find that the actual request model set in the UI does not take effect, and `~/.claude/settings.json` still retains the original Claude model name. This is because the cc-switch proxy only reads the `ANTHROPIC_DEFAULT_*_MODEL` environment variable for model mapping when forwarding requests, and does not read `ANTHROPIC_DEFAULT_*_MODEL_NAME`. If the `_MODEL` field remains at its default value such as `claude-sonnet-4-6`, the proxy requests a non-existent Claude model from the DeepSeek endpoint, causing a 405 error or mapping failure.

  1. Open `~/.claude/settings.json` and directly modify the value of `_MODEL` environment variables such as `ANTHROPIC_DEFAULT_SONNET_MODEL` to the target model name (e.g., `deepseek-v4-pro`). Do not rely on the `_NAME` field.

    // ~/.claude/settings.json
    {
    "env": {
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro"
    }
    }
ToolClaude Code
Version3.15.0
PlatformsLinux
Why does `settings.json` show the original Claude model even though I set the actual model in the cc-switch interface?
The cc-switch interface may write the target model into the `ANTHROPIC_DEFAULT_*_MODEL_NAME` field, but the proxy actually only reads the `ANTHROPIC_DEFAULT_*_MODEL` field. You need to manually modify the `_MODEL` field in `settings.json`.
Mapping works accurately when opening in the cc-switch terminal, why does it fail externally?
When running inside the cc-switch terminal, environment variables may be correctly overridden or injected. However, when used in an external terminal, Claude Code reads the persistent configuration from `~/.claude/settings.json`. Therefore, you must ensure the `_MODEL` field in that file is correctly modified to the target model.

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.