Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Ways to Use Claude  ›  Lesson

Subscription or API?

Subscription 12 minA subscription gives a person a predictable usage allowance, while API billing charges per token and suits unattended scripts and jobs, whose keys must be kept out of code.

Subscription or API?

There are two main ways to pay for Claude Code, and picking the wrong one gives you either a surprise bill or a "limit reached" message halfway through a task. The choice comes down to who is using it and how steadily.

The rule

A subscription buys an allowance; an API key pays for every token.

Subscription. You sign in with a Claude account on a plan that includes Claude Code. You pay a fixed monthly price and get usage limits that refill over time. When you run out, you wait for the refill or move to a larger plan. It suits a person who codes most days, because the cost is predictable.

API (pay as you go). You sign in with an Anthropic API account, or supply an API key, and every request is billed by the tokens going in and coming out. There is no allowance to run out of, only a bill, so set a spending limit on the account. It suits automation, scripts, scheduled jobs and company billing. Some organisations reach the same models through their cloud provider's billing instead.

Why tokens matter either way. A token is a small chunk of text, often part of a word. Every request carries the conversation so far — your messages, the files Claude has read, command output — so a long session full of big files sends more tokens per request. Fresh, focused sessions are cheaper on both routes.

Inside a session, /cost reports what the session has spent, which matters most on API billing, and /usage shows how much of a plan's allowance you have used. /status shows which account the session is signed in with. Command names shift a little between versions, and /help lists yours.

A classic surprise: an API key left in your shell's environment can end up being used instead of your subscription. If the bills look wrong, check /status.

The shortcut

Ask "Who is using it, and how steadily?" A person, most days: subscription. A program, unattended: API key. Occasional light use: either, so compare what you would actually spend.

Paying for Claude Code at the tiffin kitchenStep 1 of 4
  1. Your evening coding

    You work on tiffin most evenings. A subscription gives a flat monthly cost, and you rarely hit the limit.

Drills

Answer fast — trust the rule.

quick drill

A nightly CI job runs Claude Code with nobody watching. How should it pay?

quick drill

On a subscription plan, what happens when you use up your allowance?

quick drill

On API billing, why does a long session that has read many files cost more per message?

quick drill

Where should the nightly job's API key live?

Remember

  • A subscription buys an allowance; an API key is billed for every token.
  • Shortcut: a person working steadily means subscription; a program running unattended means API key.
  • Trap: keys written into code, or left in an environment variable you forgot about.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainAdvise the kitchen on billing

Advise the tiffin kitchen: which billing route should you use for your evening coding, and which for the nightly order-summary job? Explain the trade-offs and give one safety rule for API keys.