# Can Claude Code use non-Claude models?

> Yes, Claude Code can point at an Anthropic-compatible gateway and select a non-Claude model when that model has a configured Messages-compatible route. Set the gateway base URL and token, then test the complete coding workflow because accepting the protocol does not guarantee Claude-equivalent tools, reasoning, vision, or output behavior.

_Last reviewed 2026-08-15 · [Editorial review](https://keeprouter.com/editorial-policy#editorial-team)_

## KeepRouter setup

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

Inside Claude Code, select a catalog ID supported by the Anthropic-compatible Messages route. Use the [Claude Code guide](/use-cases/claude-code) for current setup details and the [live catalog](/models) for current IDs, route compatibility, limits, and prices.

## What compatibility means

Claude Code sends Messages requests with content blocks, tools, streaming events, and multi-turn state. A gateway can preserve the client-facing shape and translate supported fields to an eligible route. It cannot add a capability the model lacks or make its tool decisions match Claude.

## 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.

### Will every non-Claude model work?

No. It needs a configured Messages-compatible route and must pass the tool and workflow behavior you require.

### 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 LLM gateway configuration](https://code.claude.com/docs/en/llm-gateway)

## Related guides

- [Anthropic-compatible API](https://keeprouter.com/features/anthropic-compatible-api.md)
- [claude code](https://keeprouter.com/use-cases/claude-code.md)
- [agent builders](https://keeprouter.com/built-for/agent-builders.md)
- [Compare Claude Code model costs without a static price snapshot](https://keeprouter.com/blog/cut-claude-code-costs.md)

## 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](https://keeprouter.com/login?returnTo=%2Fconsole%2Fkeys%3Fmodel%3Dfree) · [Live models and pricing](https://keeprouter.com/models.md)
