GATEWAY & INTEGRATION

Claude Code API: run Claude Code on a cheaper key

Use Claude Code with a Tokely API key. Native Anthropic Messages endpoint, streaming, tools and prompt caching, billed per token from one balance with no subscription.

THE SHORT ANSWER

Set ANTHROPIC_BASE_URL=https://api.tokely.me and ANTHROPIC_AUTH_TOKEN to your Tokely key, then map Claude Code's model slots to enabled Claude models. Tokely serves the native /v1/messages endpoint with streaming, tool use and prompt caching, and bills each request per token from your prepaid balance.

Connect in one request

export ANTHROPIC_BASE_URL=https://api.tokely.me
export ANTHROPIC_AUTH_TOKEN=sk-your-tokely-key
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5-5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-5-5
claude

Base URL https://api.tokely.me/v1. Create a key in the dashboard and keep it in an environment variable. Quickstart · Model IDs and endpoints

Claude API price comparison

USD per 1M tokens. Example: 1M uncached input + 250K output. Tokely rates dated 2026-10-12; model developer references checked 2026-10-05. Platform/checkout fees, taxes, special units and context tiers excluded. Different models are not quality equivalents. Methodology.
ModelTokely input / outputTokely examplemodel developer exampleDiscount vs model developer
Claude Haiku 5.5Anthropic$0.042353 / $0.211764Cache read: $0.042353$0.095294$0.225$0.1 / $0.5 per 1M57.6% off
Claude Sonnet 5Anthropic$1.5 / $7.5Cache read: $0.15$3.375$4.5$2 / $10 per 1M25.0% off
Claude Sonnet 5.5Anthropic$1.5 / $7.5Cache read: $0.075$3.375$4.5$2 / $10 per 1M25.0% off
Claude Sonnet 4.6Anthropic$2.25 / $11.25Cache read: $0.225$5.0625$6.75$3 / $15 per 1M25.0% off
Claude Opus 5.5Anthropic$3 / $15Cache read: $0.15$6.75$9$4 / $20 per 1M25.0% off
Claude Opus 4.6Anthropic$3.75 / $18.75Cache read: $0.375$8.4375$11.25$5 / $25 per 1M25.0% off
Claude Opus 4.7Anthropic$3.75 / $18.75Cache read: $0.375$8.4375$11.25$5 / $25 per 1M25.0% off
Claude Opus 4.8Anthropic$3.75 / $18.75Cache read: $0.375$8.4375$11.25$5 / $25 per 1M25.0% off
Claude Opus 5Anthropic$3.75 / $18.75Cache read: $0.375$8.4375$11.25$5 / $25 per 1M25.0% off
Claude Opus 4.5Anthropic$3.75 / $18.75Cache read: $0.375$8.4375$11.25$5 / $25 per 1M25.0% off
Claude Fable 5Anthropic$7.5 / $37.5Cache read: $0.75$16.875$22.5$10 / $50 per 1M25.0% off
Claude Fable 5.1Anthropic$7.5 / $37.5Cache read: $0.1875$16.875$22.5$10 / $50 per 1M25.0% off

Change the token mix in the calculator →

Pay per token instead of a seat

Claude Code through an API key is billed by usage: input, output, cache reads and cache writes at the model's published rate. There is no subscription or weekly cap; you top up one USD balance and can set daily and monthly spending limits for the account or a single key.

Prompt caching keeps agent sessions affordable

Coding agents resend the same system prompt, tools and project context on every turn. Claude Code marks those prefixes with cache_control; Tokely passes it through and bills cache reads at the cache-read rate instead of the full input rate. Usage in each response shows cache reads and writes.

Pick the model for each slot

Claude Code uses separate model slots for its main and background work. Map Sonnet, Opus and Haiku slots to enabled Tokely IDs with ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL; Claude Haiku 5.5 keeps background calls inexpensive. Unmapped or disabled model IDs return a clear model_not_available error.

What is not included

Anthropic server tools such as web search, the Files and Batch APIs and /v1/messages/count_tokens are not available. Images and PDFs must be sent inline. A Claude Pro or Max subscription is separate and does not fund API usage.

One key for every model

Every model on this page is available through one OpenAI-compatible endpoint and one balance, with routing modes, bounded fallback, spending limits and request logs.

Questions before you switch

Does Claude Code work with Tokely?

Yes. Point ANTHROPIC_BASE_URL at https://api.tokely.me and use your Tokely key as ANTHROPIC_AUTH_TOKEN. Claude Code calls the native /v1/messages endpoint with streaming and tools.

How much does Claude Code cost through the API?

You pay the published per-token rate of the model each request uses, including cache reads and writes. Long agent sessions depend mostly on context size and caching; the usage of each request is in your dashboard logs.

Is prompt caching supported?

Yes. cache_control blocks are passed through, and cache reads and writes are billed at their own rates. Cached tokens are not charged again as regular input.

Can I use the Anthropic SDK?

Yes. Set base_url to https://api.tokely.me and api_key to your Tokely key, then call messages.create with an enabled Claude model ID.

START WITH YOUR OWN WORKLOAD

Know the price.
Then make the call.

Check the model, compare the rate, and connect with a Tokely key.