Direct answer
Can Claude Code use non-Claude models?
A third-party gateway can technically translate Claude Code's Anthropic-shaped requests to a compatible non-Claude route, but Anthropic explicitly says it does not support routing Claude Code to non-Claude models through any gateway. Treat such use as a third-party compatibility experiment, not an Anthropic-supported configuration. Tools, MCP tool search, Remote Control, streaming, caching, and future Claude Code protocol changes need separate verification.
Last reviewed 2026-08-26 · Editorial review: KeepRouter Editorial
Start with Anthropic's support boundary
Anthropic's current gateway documentation says a gateway with a supported API format can connect to Claude Code. The same page says Anthropic does not endorse, maintain, or audit third-party gateway products and does not support routing Claude Code to non-Claude models through any gateway. A protocol translation can work for a tested request while remaining outside Anthropic's product-support scope.
| Capability | Claude on a supported route | Claude through a third-party gateway | Non-Claude route through a gateway |
|---|---|---|---|
| Messages request | Supported | Gateway must track the current protocol | Third-party translation only |
| Tools and streaming | Supported for the selected Claude model | Gateway must preserve current fields and events | Test the exact model and translated route |
| MCP tool search | Normal product behavior | Non-Anthropic base URLs have extra forwarding requirements | Do not assume support |
| Remote Control | Product and account dependent | Non-Anthropic hosts have documented restrictions | Do not promise it |
| Anthropic support | Yes, within the selected service | Limited to the documented gateway boundary | No |
KeepRouter setup
export ANTHROPIC_BASE_URL=https://keeprouter.com
export ANTHROPIC_AUTH_TOKEN=sk-kr-your-key
claudeThe base URL, gateway credential, and model are separate controls. Anthropic notes that setting only ANTHROPIC_BASE_URL without a gateway credential can leave a saved claude.ai login active. Verify both variables and the selected model before assuming the serving or billing path changed.
Use a Claude model from the live catalog when you need the clearest Anthropic support boundary. If you deliberately select a non-Claude Messages-compatible route, record it as a third-party compatibility test and keep a direct rollback to Claude. The Claude Code guide covers current setup and failure diagnosis.
Compatibility is a test result
Claude Code sends Messages requests with content blocks, tools, streaming events, multi-turn state, evolving headers, and model-specific features. A gateway can preserve or translate supported fields. It cannot add a model capability, make tool decisions match Claude, or guarantee that a later Claude Code release behaves the same way.
Test a real repository task
Start a fresh session from the same commit, use the same prompt and allowed tools, and set a clear completion criterion. Record whether the task finished, which tools ran, human corrections, input and output tokens, latency, and charge. Test long history, tool-result continuation, errors, and any screenshot input your workflow uses.
Protect automated loops
Create a key limited to the evaluated coding models and set a spend boundary. Keep application or session step limits, avoid automatically replaying side-effecting commands, and distinguish authentication, credit, rate-limit, and upstream failures.
When to keep Claude
Keep a Claude model when its provider-specific behavior, support contract, or tested task performance is required. A non-Claude model is an additional evaluated option, not an automatic drop-in claim.
Frequently asked questions
Which environment variables are required?
Set ANTHROPIC_BASE_URL to the gateway and ANTHROPIC_AUTH_TOKEN to a scoped gateway key.
Does Anthropic support non-Claude models in Claude Code?
No. Anthropic's current gateway documentation says it does not support routing Claude Code to non-Claude models through any gateway.
Can third-party translation still work technically?
It can for a tested request path, but that does not change Anthropic's support boundary or prove tools, streaming, model features, and future versions will work.
Can I compare cost from a static article?
Use the live model pages and your own measured task usage because rates and token behavior can change.
Should I reuse my general production key?
Prefer a separate key restricted to evaluated coding models with an appropriate spend boundary.
Sources reviewed
- [1] Anthropic Claude Code other LLM gateways
- [2] Anthropic Claude Code environment variables
- [3] Anthropic Claude Code model configuration