Use Claude Code Without a Subscription: Pay Per Token with an API Key
Claude Code is one of the best agentic coding tools available, but the default way to pay for it is a Max or Pro monthly subscription. If Claude Code feels too expensive for how you actually use it — a few sessions a week, an occasional big refactor, or a team where not everyone codes every day — a fixed monthly plan can be the wrong billing model. The good news: you can run Claude Code without a subscription and pay per token instead, using your own API key from ApiTopMix.
This page is about the money angle: subscription vs. pay-per-token, who benefits from each, and how to switch Claude Code to an API key so there is no monthly fee — you pay only for the tokens you use. If you just want the full step-by-step setup for both Claude Code and Cursor, read the complete Use Claude Code guide; this page focuses on why and when pay-as-you-go wins.
ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. Set ANTHROPIC_BASE_URL=https://apitopmix.com and ANTHROPIC_AUTH_TOKEN=<your ApiTopMix key>, run claude, and you are billed per token with no monthly plan. See the pricing page for current rates.
Subscription vs. pay-per-token: two ways to pay for Claude Code
There is nothing wrong with a monthly plan — it is simple and predictable. But a subscription and a pay-as-you-go API key optimize for different kinds of users. Here is the honest comparison, without invented numbers (see the ApiTopMix pricing page for real rates):
| Max / Pro monthly plan | ApiTopMix API key (pay per token) | |
|---|---|---|
| Billing model | Fixed fee every month, whether you use it or not | No monthly fee; you pay only for the input/output tokens you actually use |
| Best for what usage | Heavy, near-daily use that reliably maxes out the plan's value | Light, occasional, or bursty use; teams wanting per-seat / per-project control |
| Cost when idle | You still pay the full monthly amount on a quiet week | A quiet week costs almost nothing — usage-based |
| Usage limits | Governed by plan usage caps; heavy days can hit limits | No plan cap; each request is billed on its own tokens |
| Model access | Depends on plan tier | One key reaches the coding Claude models (Sonnet, Opus, and lighter models) — pick per request |
| Reversibility | Cancel/renew each cycle | Set two env vars to switch; unset to go back anytime |
The short version: a subscription is a bet that you will use enough every month to come out ahead. A pay-per-token API key removes that bet — a slow week simply costs less. For exact break-even math, put your own token volume against the live rates on the pricing page.
Who should switch Claude Code to pay-per-use?
Paying per token instead of a subscription tends to win for these situations:
- Light or occasional users — if you open Claude Code a few times a week, a full monthly plan is often more than you need. Pay-as-you-go means a quiet week is nearly free, so Claude Code stops feeling too expensive for casual use.
- People who hit subscription usage limits — if you regularly bump into plan caps mid-task, a per-token key removes the ceiling: each request is billed on its own tokens, so a heavy day just costs what it costs instead of blocking you.
- Teams wanting per-seat or per-project control — issue one key per developer or per project, watch spend per key in the console, and avoid paying full seats for people who only occasionally touch the codebase.
- Anyone comparing a cheaper alternative — if you want Claude in your terminal but the monthly commitment does not fit, an API key is the cheaper alternative to a flat plan for many usage patterns. Confirm with your own numbers on the pricing page.
Who should probably keep a subscription? Anyone doing steady, all-day heavy coding that consistently extracts more value than the monthly fee. If that is you, still worth comparing — but the plan may already be the better deal.
How it works: an API key instead of a subscription
Claude Code is configured entirely through environment variables, which is what makes running it without a subscription straightforward. Two variables control where requests go and how they authenticate:
ANTHROPIC_BASE_URL— the base URL Claude Code sends Anthropic-protocol requests to.ANTHROPIC_AUTH_TOKEN— the key used to authenticate those requests.
Pointing these at ApiTopMix is a supported, standard way to use a custom Anthropic-compatible endpoint with your own key. ApiTopMix provides both an OpenAI-compatible endpoint at https://apitopmix.com/v1 and a native Anthropic endpoint at /v1/messages, so Claude Code speaks its usual protocol and everything — tool use, streaming, long context — behaves as normal. The only change is the billing model: per token, no monthly plan.
On macOS or Linux, set the two variables and launch Claude Code:
export ANTHROPIC_BASE_URL=https://apitopmix.com
export ANTHROPIC_AUTH_TOKEN=sk-your-apitopmix-key
claude
On Windows PowerShell:
$env:ANTHROPIC_BASE_URL = "https://apitopmix.com"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-apitopmix-key"
claude
export lines to your ~/.zshrc or ~/.bashrc to make it permanent, or unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN to return to the default endpoint and a subscription at any time. Switching to use Claude Code with an API key changes nothing about your projects or prompts.
Quick recap of the setup
- Get a key — sign up at apitopmix.com/register, open the console, go to Tokens, and create one that starts with
sk-. - Export the two variables —
ANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKEN, as shown above. - Run
claude— you are now paying per token, with no monthly fee.
That is the condensed version. For the complete walkthrough — including Cursor, choosing between claude-sonnet-4-6 and claude-opus-4-6, and making the config permanent — follow the full Use Claude Code guide.
Verify it before you commit
Want to confirm the key works before wiring it into Claude Code? Fire a one-line request at the OpenAI-compatible endpoint:
curl https://apitopmix.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-apitopmix-key" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"Say hi from Claude"}]}'
A normal chat completion means your key is live and billed per token. For Claude Code itself, export the two variables above and run claude — a reply confirms the native Anthropic endpoint is wired up, no subscription involved.
Frequently asked questions
Can I use Claude Code without a subscription?
Yes. Claude Code does not require a Max or Pro monthly plan. It reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, so you can point it at an Anthropic-compatible endpoint with your own key. Set ANTHROPIC_BASE_URL=https://apitopmix.com and ANTHROPIC_AUTH_TOKEN=<your key>, run claude, and you are billed per token instead of a fixed monthly subscription.
Is using Claude Code with a third-party key allowed, or against the ToS?
Claude Code is built to be configured with a custom endpoint — the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN variables are part of its supported configuration, and pointing the client at a custom Anthropic-compatible endpoint with your own key is a normal setup. ApiTopMix simply provides that compatible endpoint and a key. Nothing here asks you to bypass any restriction; you are choosing a pay-per-token endpoint instead of a plan. As always, review and follow the current terms of the tools and providers you use.
How is pay-per-token different from the Max or Pro plan?
A subscription charges a fixed amount every month no matter how much you use it, and access is governed by plan usage limits. A pay-per-token ApiTopMix key has no monthly fee — you pay only for the input and output tokens you consume. Light users often spend far less; heavy users get predictable per-request costs instead of hitting plan caps. Compare both against your volume on the pricing page.
Is Claude Code too expensive on a monthly plan for occasional use?
If you only code with Claude a few times a week, a flat monthly plan can cost more than the value you get. Pay-as-you-go fits occasional use better: a quiet week costs almost nothing and a busy week costs only what you run. For steady all-day heavy use, check both models on the pricing page to see which is cheaper at your volume.
Do I need an Anthropic account to use Claude Code this way?
You need the Claude Code CLI installed and an ApiTopMix account and key. Setting ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN routes requests to ApiTopMix instead of the default endpoint, so a separate paid Anthropic subscription is not required for this setup. Install the CLI, create an ApiTopMix key, export the two variables, and run claude.
Which Claude models can I use without a subscription?
One ApiTopMix key reaches the coding-oriented Claude models — claude-sonnet-4-6 for everyday work, claude-opus-4-6 for hard problems, plus lighter models for cheap bulk tasks. No plan tier gates which model you can call; you pick per request and pay for the tokens it uses. See the pricing page for the current model list.
Can I switch back to a subscription later?
Yes, it is fully reversible. Because Claude Code reads the two environment variables, you can unset them anytime to return to the default endpoint and your subscription. Your projects, prompts, and workflow are untouched by routing through a pay-per-token key.
Run Claude Code with no monthly fee
Grab a key, set two variables, and pay only for the tokens you use — no subscription required.
Related guides
- Use Claude Code & Cursor — the complete step-by-step setup for both tools.
- Cheap Claude API — how to run the Claude family at a lower cost.
- ApiTopMix Pricing — the current pay-per-token rate for every model.
- API Documentation — endpoints, headers, and full code examples.
Conclusion
You do not need a Max or Pro subscription to use Claude Code. The tool is designed to accept a custom endpoint and key through ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, and ApiTopMix provides a compatible endpoint so you can pay per token instead of a monthly plan. For light, occasional, or bursty use — and for teams that want per-seat control — that usually means paying less and never hitting a plan cap.
Set it up once, and every Claude Code session runs on a pay-as-you-go key with no monthly fee. Start by creating a key, run the verification request, then follow the full Use Claude Code guide to make it permanent — and check the pricing page to confirm the savings for your own usage.
ApiTopMix