// How-to · Switch models: your own key, Chinese or local models
Use Claude Code with other models (Chinese models, your own gateway)
Claude Code can send requests to any Anthropic-compatible endpoint set via environment variables. Many model vendors offer Anthropic-compatible APIs, and gateways such as LiteLLM or claude-code-router can translate formats.
verified 2026-10-103 official sources
Scenario: Switch models: your own key, Chinese or local models →
Symptoms
- You want Claude Code to use a company gateway or another vendor’s model
Common causes
- By default requests go straight to Anthropic
How to fix
- Check that the vendor’s official docs offer an Anthropic-compatible API and get the base URL and key they provide
- Set
ANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKEN(or put them underenvin Claude Code’s settings.json) and set the model name as the vendor documents - If the vendor only offers the OpenAI format, translate with LiteLLM or claude-code-router
- Use a tool such as cc-switch to switch between configurations
- Test tool calling and long context on small tasks first; tool-calling quality varies a lot between models
Notes
- Use only official or compliant endpoints, never unknown relays or shared accounts
Official references
Compiled from official documentation and public discussions on 2026-10-10; not yet reproduced in our own environment. Follow the official docs if they differ.