Skip to content

Claude Code CLI Guide via ZenMux

Claude Code is Anthropic’s official coding agent. Through its integration with ZenMux, you can access more model options beyond the official Claude API.

Compatibility Notes

ZenMux fully supports the Anthropic API protocol and can be seamlessly integrated with tools like Claude Code and Cursor. You only need to modify two parameters.

Note that the Anthropic protocol base_url is "https://zenmux.ai/api/anthropic".

Configuration Guide

Install Claude Code

bash
# Install with pnpm (recommended)
pnpm install -g @anthropic-ai/claude-code

# Or install with npm
npm install -g @anthropic-ai/claude-code

Configure Claude Code

Claude Code supports using a configuration file to set environment variables. Edit or create the ~/.claude/settings.json file and add the following configuration:

bash
# If the .claude directory does not exist, create it first
mkdir -p ~/.claude

# Create or edit the configuration file
nano ~/.claude/settings.json  # Or use other editors like vim, code, etc.

Add the following content to the configuration file:

json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-ai-v1-xxx",
    "ANTHROPIC_BASE_URL": "https://zenmux.ai/api/anthropic",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-4.5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-4.5"
  }
}

Important Configuration

Make sure to replace sk-ai-v1-xxx with your actual ZenMux API Key. You can obtain the API Key from the ZenMux Console.

Configuration Notes

  • ANTHROPIC_AUTH_TOKEN: Your ZenMux API Key
  • ANTHROPIC_BASE_URL: ZenMux Anthropic API endpoint
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: Disable nonessential traffic
  • ANTHROPIC_DEFAULT_HAIKU_MODEL: Set the default Haiku model (for quick tasks)
  • ANTHROPIC_DEFAULT_SONNET_MODEL: Set the default Sonnet model (for general tasks)
  • ANTHROPIC_DEFAULT_OPUS_MODEL: Set the default Opus model (for complex tasks)

Start Using Immediately

After configuring settings.json, go to your project directory and start Claude Code:

bash
# Navigate to the project directory
cd my-project

# Start Claude Code
claude

Convenient Usage

Using a configuration file is more convenient—no need to manually set environment variables each time. The configuration will be automatically loaded whenever you start Claude Code.

Supported Models

Anthropic Protocol Supported Models

Models that support the Anthropic protocol are being adapted in batches. You can view currently supported models by filtering "Anthropic API Compatible" in the official model list: anthropic-support Alternatively, check the model detail page: anthropic-support

Below is a recommended list of models with strong coding capabilities. For the complete set of models supporting the Anthropic protocol, please use the methods described above.

模型 slug
anthropic/claude-sonnet-4.5
anthropic/claude-opus-4.5
google/gemini-3-pro-preview
openai/gpt-5.1-codex
openai/gpt-5.1-codex-mini
anthropic/claude-opus-4.1
baidu/ernie-5.0-thinking-preview
volcengine/doubao-seed-code
moonshotai/kimi-k2-thinking
moonshotai/kimi-k2-thinking-turbo
minimax/minimax-m2
kuaishou/kat-coder-pro-v1
anthropic/claude-haiku-4.5
google/gemini-2.5-pro
openai/gpt-5-codex
openai/gpt-5
x-ai/grok-4-fast
x-ai/grok-code-fast-1
x-ai/grok-4-fast-non-reasoning
deepseek/deepseek-chat
qwen/qwen3-coder-plus
moonshotai/kimi-k2-0905
z-ai/glm-4.6
z-ai/glm-4.5-air
inclusionai/ring-1t
inclusionai/ling-1t

For more models, refer to the Anthropic protocol support notes above!

Usage Experience

Once configured, you can use ZenMux’s diverse models within Claude Code:

Claude Code

You can use the '/model' command to verify the currently active model:

Claude Code Model

Troubleshooting

Common Issues

API Key Error

Issue: API Key is reported as invalid or unauthorized

Solution:

  • Check whether the ZenMux API Key in your environment variables is correct
  • Ensure the API Key is active and has sufficient balance
  • Verify the API Key format starts with sk-ai-v1-
Model Not Compatible with Anthropic Protocol

Issue: When using a model, you are prompted that it does not support the Anthropic protocol

Solution:

  • Filter "Anthropic API Compatible" in the ZenMux model list to see currently supported models
  • Or visit the specific model’s detail page to confirm Anthropic protocol support
  • Choose a model from the supported list above
Connection Failure

Issue: Claude Code fails to connect to the ZenMux service

Solution:

  • Check whether your network connection is normal
  • Verify ANTHROPIC_BASE_URL is correctly set to https://zenmux.ai/api/anthropic
  • Confirm that firewall settings are not blocking outbound connections
Configuration File Not Taking Effect

Issue: settings.json configuration is set but not applied

Solution:

  • Confirm the configuration file path is ~/.claude/settings.json
  • Check whether the JSON format is valid (note: the JSON standard does not support comments; remove any comments)
  • Use cat ~/.claude/settings.json to verify the file contents
  • Restart Claude Code to load the latest configuration
VSCode Claude Code Extension Configuration

Issue: Issues encountered in the VSCode Claude Code extension’s GUI mode

Solution:

You can configure Claude Code’s model directly in the VSCode extension settings by setting it to the model slug from your configuration file. See the screenshots below:

VSCode Claude Code Extension ConfigurationVSCode Claude Code Extension Configuration

Advanced Configuration

Configure Models of Different Sizes

You can configure different model sizes in ~/.claude/settings.json based on task requirements:

json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-ai-v1-xxx",
    "ANTHROPIC_BASE_URL": "https://zenmux.ai/api/anthropic",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-4.5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-4.5"
  }
}
json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-ai-v1-xxx",
    "ANTHROPIC_BASE_URL": "https://zenmux.ai/api/anthropic",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-sonnet-4.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-opus-4.5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "google/gemini-2.5-pro"
  }
}
json
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-ai-v1-xxx",
    "ANTHROPIC_BASE_URL": "https://zenmux.ai/api/anthropic",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek/deepseek-chat",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "moonshotai/kimi-k2-0905",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen/qwen3-coder-plus"
  }
}

This approach helps you achieve the best balance of performance and cost across different usage scenarios.

More Models

See the ZenMux model list for all available models and their details.

Contact Us

If you encounter any issues during use or have suggestions and feedback, feel free to contact us:

For more contact options and details, please visit our Contact Us page.