Skip to content
← All posts
Guides

How to Use Claude Code With a Cheaper API Key in 2026

Run Claude Code on a cheaper API key: what each route costs, a 5-minute setup with ANTHROPIC_BASE_URL, and when a Claude Max plan is the better deal.

GuidesHow to Use Claude Code With a Cheaper API Key in 2026Sidrune AI

TL;DR

Claude Code can run on any API key that accepts the Anthropic Messages format. Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, then check the connection with /status. On Sidrune AI, Claude Opus 5.5 costs $0.72 / $3.60 per 1M tokens on the Claude Code route, 82% below the official $4 / $20.

Can you run Claude Code on your own API key? ​

Yes. Claude Code sends every request to the address in ANTHROPIC_BASE_URL and authenticates with the key in ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY. Anthropic's documentation calls this connecting to an LLM gateway, and any gateway that accepts the Anthropic Messages format works.

While a gateway key is set, Claude Code uses it instead of your claude.ai subscription. Requests are billed per token to the owner of the key, and the subscription's usage limits no longer apply to them.

Anthropic does not endorse third-party gateways, so pick one that serves real Claude models and publishes its prices per route.

What does Claude Code cost? ​

Across enterprise deployments, Anthropic puts the average Claude Code cost at about $13 per developer per active day and $150 to $250 per developer per month, with 90% of users under $30 per active day (Manage costs). The model you pick, the size of the codebase and running several sessions at once move that number a lot.

OptionHow you payPrice
Claude ProSubscription with usage limits$20 per month, or $17 per month billed yearly
Claude MaxSubscription with higher limitsFrom $100 per month
Anthropic APIPer token, list priceOpus 5.5: $4 / $20 per 1M tokens
Sidrune AI, Claude Code routePer token, 0.18x of listOpus 5.5: $0.72 / $3.60 per 1M tokens

Subscription prices are from claude.com/pricing, Sidrune AI prices from Model Plaza on 15 October 2026.

As a rough guide, if your usage costs $150 to $250 a month at list price, the same tokens cost about $27 to $45 on a 0.18x route and $60 to $100 on a 0.4x route. The cost on Claude Code's /usage screen covers the current session and is calculated at list price, so multiply it by your route's multiplier to see what Sidrune AI charges. Fable 5.1 on Claude-Max routes has extra charges, listed below the route table.

Claude prices per route on Sidrune AI ​

Sidrune AI sells Claude through several routes. Each route has its own multiplier on the official price and its own ratings for intelligence, stability and speed in Model Plaza. Prices per 1M tokens, input / output:

RouteOpus 5.5Sonnet 5.5Fable 5.1
Official Anthropic price
1x
$4.00 / $20.00$2.00 / $10.00$10.00 / $50.00
Claude-Max-STANDARD INJECT-ONLY CC
0.18x, Claude Code only
$0.72 / $3.60$0.36 / $1.80$2.16 / $10.80
Claude-Max-LIMIT INJECT
0.22x, any client
$0.88 / $4.40$0.44 / $2.20$2.64 / $13.20
Claude-Anthropic-Reverse
0.35x
$1.40 / $7.00$0.70 / $3.50$3.50 / $17.50
Claude-Max-NO INJECT
0.4x, any client
$1.60 / $8.00$0.80 / $4.00$4.80 / $24.00
Claude-Anthropic-Official
0.7x
$2.80 / $14.00$1.40 / $7.00$7.00 / $35.00

Read these notes before you pick a route:

  • INJECT routes add a system prompt. INJECT routes add an instruction to each request to keep the account pool running, and Model Plaza says it may lower output quality in some cases. On LIMIT INJECT the instruction is under 0.4k tokens. NO INJECT adds nothing.
  • Fable 5.1 costs more on Max routes. Claude-Max routes bill Fable 5.1 on a base 20% above list, $12 / $60 instead of $10 / $50, and requests with reasoning effort set to max cost 3.5x on top of that.
  • Fast mode doubles the Opus price. Opus 5.5 in fast mode is billed at 2x on every route, the same as on Anthropic's own API. When Claude Code signs in with ANTHROPIC_AUTH_TOKEN, it keeps /fast off by default.
  • Cheaper routes have lower ratings. Model Plaza also lists Claude routes from 0.05x to 0.15x, each rated lower for intelligence or stability. Among the routes rated five stars on all three, the 0.18x Claude Code route is the cheapest.

If you also call Claude from scripts or other apps, use a key on a route that Model Plaza lists with no client limit, such as LIMIT INJECT or NO INJECT.

How to set up Claude Code with a Sidrune AI key ​

The setup takes about five minutes.

Step 1. Create a key in a Claude group ​

Sign up at global.sidrune.ai, add balance, then open API Keys and create a key in a Claude group, for example Claude-Max-STANDARD INJECT-ONLY CC. Each key belongs to one group, so create a separate key if you also use GPT.

Step 2. Test the key ​

Run this in your terminal, with your key in place of YOUR_SIDRUNE_API_KEY:

bash
export ANTHROPIC_BASE_URL=https://global.sidrune.ai
export ANTHROPIC_AUTH_TOKEN=YOUR_SIDRUNE_API_KEY

curl -sS -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 16,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

A reply that starts with {"id":"msg_ means the address and key work. A 401 means the key was rejected. The Claude Code route may refuse requests that do not come from Claude Code, so if this test fails on that route, go to step 4 and check inside Claude Code.

Step 3. Save the settings ​

Add both values to the env block of ~/.claude/settings.json, so every terminal and session picks them up:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://global.sidrune.ai",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_SIDRUNE_API_KEY"
  }
}

Use the file in your home folder. A project's .claude/settings.json is often committed to git, and its env block applies only after the first-run setup, so Claude Code may still ask you to log in.

Step 4. Check inside Claude Code ​

Start claude and run /status. The Anthropic base URL line should show https://global.sidrune.ai, and the Auth token line should name ANTHROPIC_AUTH_TOKEN. Send a short message to confirm that replies come back.

If you switch between several providers, CC Switch can keep each one as a profile.

Troubleshooting ​

ProblemLikely causeFix
401 errorThe key is wrong, revoked or in a header the gateway does not readCopy the key again from API Keys, or move it from ANTHROPIC_AUTH_TOKEN to ANTHROPIC_API_KEY
model_not_foundThe key's group does not serve that modelCopy the exact model name from Model Plaza and check that your group lists it
Claude Code asks you to log inClaude Code did not see the key at startupPut the values in ~/.claude/settings.json or export them before you run claude
/status shows no base URL lineANTHROPIC_BASE_URL did not reach the sessionStart claude from the terminal where you exported it, or use the settings file
Remote Control or voice dictation is missingBoth rely on a claude.ai loginUnset the gateway variables and log in with claude.ai when you need them

When is a Claude Max plan the better deal? ​

A per-token key suits light, irregular or shared use, because you pay only for the tokens you use. A Claude Max plan from $100 a month can cost less if you work in Claude Code for hours every day and stay inside its limits, because its price does not grow with your usage.

To decide, use Claude Code on a key for a week of normal work, check how much balance you spent and multiply by four. If the result is well above $100, compare it with Claude Max before you top up for the month.

Frequently asked questions

1) Can I use Claude Code with my own API key?

Yes. Claude Code reads two environment variables: ANTHROPIC_BASE_URL for the API address and ANTHROPIC_AUTH_TOKEN for the key. Set them in your shell or in the env block of ~/.claude/settings.json, and Claude Code bills that key per token instead of using your claude.ai subscription.

2) How much does Claude Code cost per month on the API?

Across enterprise deployments, Anthropic reports an average of about $13 per developer per active day and $150 to $250 per developer per month, with 90% of users under $30 per active day. On a route priced at 0.18x of list, the same token usage costs 82% less.

3) Is a Claude Max subscription cheaper than an API key for Claude Code?

It depends on how much you use Claude Code. Claude Max starts at $100 per month with usage limits. Light or irregular use is usually cheaper on a per-token key, while someone who works in Claude Code for hours every day may get more from a Max plan.

4) Which environment variable does Claude Code use for a custom API endpoint?

ANTHROPIC_BASE_URL sets the endpoint. The key goes in ANTHROPIC_AUTH_TOKEN, sent as an Authorization Bearer header, or in ANTHROPIC_API_KEY, sent as an x-api-key header. Run /status inside Claude Code to see which base URL and credential are active.

5) Does Claude Code work with Sidrune AI?

Yes. Create a key in a Claude group on global.sidrune.ai and set ANTHROPIC_BASE_URL to https://global.sidrune.ai. The Claude Code route, Claude-Max-STANDARD INJECT-ONLY CC, costs 0.18x of the official price and accepts requests from Claude Code only.

6) What stops working when Claude Code runs on an API key?

Remote Control and voice dictation rely on a claude.ai login, so both are unavailable while a gateway key is active. To use them again, unset the gateway variables and log in with claude.ai.

Sidrune AI: API access to GPT, Claude, Gemini, DeepSeek, Kimi, GLM and more.