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.

CapabilityClaude on a supported routeClaude through a third-party gatewayNon-Claude route through a gateway
Messages requestSupportedGateway must track the current protocolThird-party translation only
Tools and streamingSupported for the selected Claude modelGateway must preserve current fields and eventsTest the exact model and translated route
MCP tool searchNormal product behaviorNon-Anthropic base URLs have extra forwarding requirementsDo not assume support
Remote ControlProduct and account dependentNon-Anthropic hosts have documented restrictionsDo not promise it
Anthropic supportYes, within the selected serviceLimited to the documented gateway boundaryNo

KeepRouter setup

export ANTHROPIC_BASE_URL=https://keeprouter.com
export ANTHROPIC_AUTH_TOKEN=sk-kr-your-key
claude

The 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. [1] Anthropic Claude Code other LLM gateways
  2. [2] Anthropic Claude Code environment variables
  3. [3] Anthropic Claude Code model configuration

Related guides

Verify it with the live product

Check the live model catalog, create a free-scoped key, and inspect the resulting request evidence.

Create a free key · View live models and pricing · Read as Markdown