Guide

Claude Code cheaper: seven ways to cut the bill, including a custom endpoint

Prices checked Nov 26, 2026 · 4 min read

Claude Code cheaper: a terminal window beside a small stack of coins on a dark desk

To make Claude Code cheaper, first spend fewer tokens: clear context between tasks, use Sonnet instead of Opus for routine work, and lower the effort level on easy jobs. Second, pay less per token: Claude Code can point at another endpoint with ANTHROPIC_BASE_URL, and our API lists an Anthropic-compatible /v1/messages route. That second route has one trap, cache billing, and this guide explains it.

What Claude Code costs

Claude Code bills by API token consumption. Anthropic's costs page puts the enterprise average at around $13 per developer per active day and $150 to $250 per developer per month, and 90 percent of users stay below $30 per active day. Use those figures as a reference point. Model choice, codebase size and habits move them a lot, so they won't predict your own bill. Run /usage to see the figure for your session.

Four habits Anthropic documents

None of these need a new account or a new key.

  1. Clear between tasks. /clear starts fresh. Stale context costs tokens on every message that follows.
  2. Compact with instructions. /compact Focus on code samples and API usage tells Claude what to keep.
  3. Pick the model for the job. Anthropic says Sonnet handles most coding tasks and costs less than Opus, so save Opus for complex architecture or multi-step reasoning. Switch with /model. For simple subagent tasks, set model: haiku.
  4. Lower the effort. Extended thinking is billed as output tokens. Use /effort or /model for simple tasks. The page notes that thinking cannot be turned off on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models.

Trim MCP servers you don't use, and keep your CLAUDE.md short. On long sessions, a fifth habit helps: hand test runs and log reads to subagents so their verbose output stays out of the main context.

What model choice is worth

Here are Anthropic's list prices per 1M tokens, with our catalog prices beside them:

ModelAnthropic input / outputTapModels input / output
Claude Haiku 5.5$0.10 / $0.50$0.06 / $0.30
Claude Sonnet 5.5$2.00 / $10.00$0.80 / $4.00
Claude Opus 5.5$4.00 / $20.00$1.60 / $8.00

Per token, Sonnet costs half what Opus does. Take a session that uses 2M input tokens and 0.4M output tokens, and leave caching out so the sum stays simple. At list price, Opus 5.5 comes to 2 x $4 + 0.4 x $20 = $16.00 and Sonnet 5.5 to 2 x $2 + 0.4 x $10 = $8.00. Move routine work from Opus to Sonnet and that part of the bill halves, with no new account needed.

Pointing Claude Code at another endpoint

Anthropic documents this as an LLM gateway setup. Anthropic says any gateway that exposes a supported API format works, though it "doesn't endorse, maintain, or audit" third-party gateway products, and it does not support routing Claude Code to non-Claude models through any gateway. TapModels' contract lists POST /v1/messages as Anthropic-compatible and bills by token, so this applies to our Claude models. It is a separate service. We do not issue Anthropic keys, and our key works on our endpoint only.

Claude Code's gateway page sends its test request to $ANTHROPIC_BASE_URL/v1/messages, so the base URL is the host without /v1. Our credential is a bearer token, so use ANTHROPIC_AUTH_TOKEN:

export ANTHROPIC_BASE_URL=https://api.tapmodels.com
export ANTHROPIC_AUTH_TOKEN=$TAPMODELS_API_KEY

You can also set them once in the env block of ~/.claude/settings.json. Anthropic warns against putting the credential in a project's committed .claude/settings.json. Before opening Claude Code, check the setup with the one-token curl from the docs:

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": 1, "messages": [{"role": "user", "content": "."}]}'

Then start claude and run /status. You should see the base URL line and an Auth token line. Anthropic's docs note two consequences. An active gateway credential replaces your claude.ai login, and subscription limits stop applying, so you pay per token for that traffic. If you want to stay on a flat monthly subscription, don't set a credential.

We have not tested Claude Code against our endpoint for this page. Each Claude Code release adds features that a gateway has to forward, so test it yourself before you rely on it.

The cache-billing check

Claude Code resends the whole conversation every turn and depends on prompt caching. Anthropic prices a cache read at 0.1 times base input on most models, and 0.05 times on Sonnet 5.5 and Opus 5.5. Its costs page shows one session line with 1.2k input tokens and 940.0k cache-read tokens.

Our contract bills chat per token at the model's price and states no cache rate. Take 940,000 cache-read tokens on Sonnet 5.5:

  • At Anthropic's cache-read price of $0.10 per MTok: 0.94 x $0.10 = $0.094.
  • If a provider billed them as plain input at our $0.80 per MTok: 0.94 x $0.80 = $0.752.

The second figure is eight times the first. On any reseller, ask first whether your tokens are billed as cache reads. To test it, run a 15-minute session, compare /usage with your balance drop, and keep the route only if the cost is lower.

Choosing

Start with the habits. If you work mostly in Sonnet or Haiku, test an endpoint after that. Read how to judge a third-party provider and the price table before you decide. Next step: compare Opus and Sonnet on the model comparison page.

Frequently asked questions

How much does Claude Code cost?

Claude Code charges by API token consumption. Anthropic's costs page says the average across enterprise deployments is around $13 per developer per active day and $150 to $250 per developer per month, with costs below $30 per active day for 90 percent of users. Your own cost depends on model, codebase size and habits.

Can I use Claude Code with a different API key and endpoint?

Yes. Claude Code reads ANTHROPIC_BASE_URL and a credential variable such as ANTHROPIC_AUTH_TOKEN, and Anthropic documents using a gateway. TapModels lists POST /v1/messages as Anthropic-compatible, so the setup applies, but Anthropic does not endorse or audit third-party gateways. Test one short session first.

Does a gateway key replace my Claude subscription?

While a gateway credential is active, Anthropic's docs say requests carry it in place of your claude.ai login, the subscription's usage limits do not apply, and the traffic is billed per token to the credential's owner. Setting only the base URL, without a credential, does not replace the subscription.

What is the quickest way to cut Claude Code cost?

Clear context between unrelated tasks with /clear, pick Sonnet over Opus for routine work, lower the effort level on simple tasks, and delegate noisy work to subagents on a smaller model. These come from Anthropic's costs page and need no new account.

Is a cheaper endpoint always cheaper for Claude Code?

Not always. Claude Code reads a large cached prompt on most turns, and Anthropic prices cache reads at a fraction of base input. If a reseller bills cached tokens as ordinary input, your bill can rise. Run one short session and compare the usage report with your balance before switching.

Sources