Claude Code · Pay as you go

Use Claude Code without a subscription: pay as you go

You don't need a Claude Pro or Max plan to use Claude Code. Give it an API key and it bills per token from a prepaid balance: no monthly fee, no 5-hour window, and you stop paying in the weeks you don't code. Here is what that costs in practice, how to set it up, and when a plan is still cheaper.

Last checked

Can you use Claude Code without a subscription?

Yes. Claude Code supports two ways to authenticate: signing in with a Claude plan, or an API key. With an API key there is no plan involved. Claude Code sends each request to the endpoint you configure and the cost of the tokens is deducted from your balance.

Claude Pro / Max planPay as you go
What you payA fixed monthly priceOnly the tokens you use
Allowance5-hour session allowance plus a weekly allowanceYour balance; rate and concurrency limits apply
Quiet monthsSame priceClose to nothing
Busy sprintsYou may hit the cap and wait for a resetKeep going while the balance lasts
Teams and CIOne login per personOne key per person or pipeline, each with its own spend cap

How plan limits work

What pay as you go costs per month

Cost depends on the model and on how much context each turn sends. Three example workdays, priced live at Anthropic list price, with the lowest aicodewith rate next to them:

Example Claude Code costs per day and per month
UsageModelTokens per active dayAt Anthropic list price / day22 days / monthaicodewith Economy channel / month
LightClaude Sonnet 5.515M cache read, 0.6M cache write, 0.15M input, 0.15M output$4.80$106from $20.06
ModerateClaude Opus 5.515M cache read, 0.6M cache write, 0.15M input, 0.15M output$9.60$211from $40.13
HeavyClaude Opus 5.540M cache read, 1.2M cache write, 0.3M input, 0.4M output$23.20$510from $96.98

Token mixes are illustrative (most Claude Code tokens are cache reads). Run /cost in Claude Code to see your own numbers. More detail on the usage limits page.

  • Light: everyday edits and questions on Claude Sonnet 5.5.
  • Moderate: the same day on Claude Opus 5.5.
  • Heavy: long Opus sessions with large repos and subagents.
Claude model prices in USD per 1M tokens
Model (USD per 1M tokens)Anthropic list price, input / outputCache read / 5-min cache write (list)aicodewith Economy channel, input / output
Claude Opus 5.5$4.00 / $20.00$0.20 / $5.00from $0.76 / from $3.80
Claude Sonnet 5.5$2.00 / $10.00$0.10 / $2.50from $0.38 / from $1.90
Claude Haiku 5.5$0.10 / $0.50$0.01 / $0.125from $0.019 / from $0.095

"From" prices are based on the Economy channel, the lowest-priced Claude channel currently listed (about 19% of Anthropic list price). Other channels cost more; the rate depends on the channel you choose, and the models page is always the source of truth.

Pay as you go vs Pro and Max: when each wins

The table shows how many active days of each usage level add up to one month of each plan. Fewer active days than that, and per-token billing is cheaper.

How many active days of per-token usage equal one month of a Claude plan
Plan (USD / month)Light days (Claude Sonnet 5.5) at list price / at aicodewith Economy channelModerate days (Claude Opus 5.5) at list price / at aicodewith Economy channelHeavy days (Claude Opus 5.5) at list price / at aicodewith Economy channel
Claude Pro ($20)4.2 days / 21.9 days2.1 days / 11.0 days0.9 days / 4.5 days
Claude Max 5x ($100)20.8 days / 31+ days10.4 days / 31+ days4.3 days / 22.7 days
Claude Max 20x ($200)31+ days / 31+ days20.8 days / 31+ days8.6 days / 31+ days

Read it as: if you have fewer active days per month than the number shown, per-token billing costs less than that plan. If you work more days than that and stay inside the plan's allowance, the plan is usually cheaper. "31+ days" means per-token billing costs less than the plan even if you code every day. Heavy days may not fit inside a plan's 5-hour and weekly allowance at all. Plan prices from claude.com/pricing; token prices are live.

Pay as you go is usually the better deal whenA plan is usually the better deal when
You code a few days a week, or in burstsYou code most days and use most of the allowance
You keep hitting the 5-hour cap during sprintsYou rarely hit the cap
You want per-key budgets for a team or CIYou also rely on claude.ai chat, Projects and the apps
You mostly use Sonnet or HaikuYou run Opus all day, every day

You can mix both: keep a plan for daily work and switch Claude Code to an API key only when you hit the cap. Remove the variables and run /login to switch back.

Set it up in three steps

  1. 1. Top up and create a key

    Sign up, top up your balance (card via Stripe in USD, or Alipay in CNY for mainland China accounts), then create a key on the API Keys page. Add a daily or monthly spend cap if you like.

  2. 2. Add the key to ~/.claude/settings.json

    Windows: %USERPROFILE%\.claude\settings.json. ANTHROPIC_BASE_URL is the bare domain, with no /v1.

    ~/.claude/settings.json
    {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
        "ANTHROPIC_API_KEY": "",
        "ANTHROPIC_BASE_URL": "https://api.aicodewith.ai"
      }
    }
  3. 3. Restart and check

    Close every Claude Code session, run claude, then /status to confirm the endpoint is api.aicodewith.ai. /cost shows what the session has cost so far.

Full Claude Code setup guideAPI key setup in detail

Seeing "no active subscription" or a login prompt?

That message means Claude Code is still trying to use a Claude plan login and has not picked up an API key. It is a configuration issue, not a billing one.

  1. Check that ~/.claude/settings.json exists, is valid JSON, and has ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN inside the env block.
  2. On a fresh install, add "hasCompletedOnboarding": true to ~/.claude.json so Claude Code skips the sign-in screen.
  3. Make sure ANTHROPIC_API_KEY is empty and no old value is exported in your shell.
  4. Close every Claude Code session and start it again, then run /status.

What happens when the balance runs out

  • Requests fail with an insufficient-balance error, and Claude Code shows it as an API error. Nothing else happens.
  • Nothing is charged to your card automatically. You top up when you choose.
  • The same applies when a key hits its own daily, monthly or total spend cap.
  • Turn on the low-balance email alert in the dashboard to get a reminder before it happens.
  • Unused balance can be refunded within 90 days of the top-up, with a 10% fee deducted.

Top-up optionsRefund policy

FAQ

Does Claude Code require a subscription?

No. Claude Code also works with an API key. Set ANTHROPIC_BASE_URL to https://api.aicodewith.ai and ANTHROPIC_AUTH_TOKEN to your key, and usage is billed per token from your balance.

How much does Claude Code cost on pay as you go?

It depends on the model and how much context you send. The cost table on this page shows light, moderate and heavy workdays priced from live data; run /cost in Claude Code to see your own numbers.

Is pay as you go cheaper than Claude Max?

Not always. If you code most days and use most of the Max allowance, Max is usually cheaper. If you code in bursts, mostly use Sonnet or Haiku, or keep hitting the cap, per-token billing usually costs less.

Does pay as you go have a 5-hour limit?

It does not use a Claude plan's 5-hour or weekly allowance. Rate and concurrency limits still apply, and requests above them get a 429 response.

What happens when my balance runs out?

Requests stop with an insufficient-balance error. Nothing is charged automatically; top up and continue.

Can I switch back to my Claude plan?

Yes. Remove the env block from ~/.claude/settings.json and run /login in Claude Code.

How do I pay?

International accounts pay in USD by card through Stripe. Mainland China accounts pay in CNY through Alipay.

Is aicodewith affiliated with Anthropic?

No. aicodewith is an independent API platform. Claude and Claude Code are trademarks of Anthropic.

Ready to try it?

Billing is per token from a prepaid balance. Rate and concurrency limits apply, and you can set daily, monthly or total spend caps on each API key.

Related

Sources

Claude and Claude Code are trademarks of Anthropic PBC. aicodewith is an independent platform and is not affiliated with or endorsed by Anthropic. Token prices are pulled from live pricing data; list prices are Anthropic list prices. Plan prices from claude.com/pricing, checked 2026-10-10.