> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routor.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Use with Claude Code

> Point Claude Code at Routor so every session routes automatically, and background prompts don't burn flagship pricing.

Claude Code talks in Anthropic's Messages API format. Routor exposes a real Anthropic-compatible endpoint at `POST /v1/messages` specifically for this - it converts the request to Routor's internal pipeline, runs the full routing/fallback/billing logic, and translates the response back to Anthropic's shape (including streaming).

***

## Why Use Routor with Claude Code

A Claude Code session isn't one request - it's dozens. Every tool call, file read, and multi-step edit is its own model call, and on a direct connection every one of them bills at whatever model you're pinned to. Most of that traffic is trivial: reading a file, checking a lint result, confirming a small edit. Routor routes each of those independently instead of paying flagship price for all of them.

Claude Code also sends its own internal bookkeeping prompts between your real turns - things like `[SUGGESTION MODE: ...]`, `[CONTINUE MODE: ...]`, and `[SUMMARIZE MODE: ...]`. Routor recognizes these specifically and routes them to the cheapest tier automatically, since they're not something you asked for - they're the tool talking to itself.

***

## Setup

### 1. Get your API key

1. Sign up at [routor.io](https://routor.io)
2. Go to **API Keys** in the dashboard and create one - it starts with `sk-routor-`

### 2. Point Claude Code at Routor

Claude Code reads its endpoint and key from environment variables. Set these before launching it:

```bash theme={null}
export ANTHROPIC_BASE_URL="https://api.routor.io"
export ANTHROPIC_API_KEY="sk-routor-YOUR_KEY_HERE"
```

No `/v1` on the base URL - Claude Code appends `/v1/messages` (and `/v1/messages/count_tokens`) itself, and Routor's Anthropic-compatible router is mounted at exactly that path.

Routor's auth accepts the key either as `x-api-key` (which is what Anthropic-format clients like Claude Code send by default) or as `Authorization: Bearer` - you don't need to configure which one, both work against the same key.

### 3. Verify it's routing

Start a Claude Code session and check your dashboard's **Logs** page - you should see requests coming in with a routed model, tier, and savings %, the same as any other request. Claude Code's own model field is ignored for routing purposes on this endpoint - Routor always decides, regardless of which Claude model Claude Code thinks it's talking to.

***

## Recommended: Set a Tier Floor

Coding sessions are almost always at least moderately complex. Without a floor, an occasional trivial exchange might route to a very cheap model that's too weak for a real coding task. Create a [Routing Profile](../playground/create-profile) with a `STANDARD` tier floor and use its dedicated API key instead of your main one, the same pattern recommended for [Cline](cline#recommended-set-a-tier-floor) - it keeps every request at least at a capable coding tier while still letting genuinely hard requests escalate to `COMPLEX`.

***

## What You'll See

Every response still carries the full routing decision, even though Claude Code's own UI doesn't surface it - check `/v1/routing/debug` with a sample prompt, or the dashboard Logs page, to see the model, tier, category, confidence, and savings for any request.

***

## Where to Go Next

* [Use with Cline / Roo Code](cline) - same Anthropic-compatible endpoint, different client
* [Set up a routing profile](../playground/create-profile) - lock in a tier floor for coding work
* [How routing decisions are made](../how-it-works)
