HomeGuide
Claude Code API Pricing vs Pay-As-You-Go Tokens
Searching for claude code api pricing usually means one thing: you want to know what a day of coding with an AI model will cost. Here is how to work that out, with real numbers for a prepaid alternative.
Updated

How to read any coding-API price
Before comparing numbers, get the units right. Token-priced APIs list two prices: one per million input tokens (what you send) and one per million output tokens (what the model writes back). A subscription replaces that with a monthly fee and usage limits. The two models are not directly comparable until you know your own usage, so the first job is to estimate it.
Coding work has a lopsided shape. Each turn of an editor or agent sends the instructions, the relevant files and the conversation so far. The reply may be a few hundred tokens. Over a long session, input can outweigh output by ten to one or more. That is why the input price deserves more attention than the output price when you shop around.
I am not going to quote Claude Code's or any other vendor's prices. They change, they differ by plan and model, and a stale number does more harm than none. Open the vendor's pricing page, copy the current figures, and plug them into the formulas below next to ours.
The prices here
This service bills pay as you go from prepaid credit.
- Input: $0.15 per 1M tokens.
- Output: $0.50 per 1M tokens.
- No subscription, and credit never expires.
- Failed or refused requests are not charged.
- Prompts are not used for training.
The formula is short: cost = (input tokens / 1,000,000 x 0.15) + (output tokens / 1,000,000 x 0.50). Everything below is that formula applied to different workloads. The same figures are listed on the pricing page.
One note on the model: this is a single open-weight model run by an independent provider, not a Claude model. If you need Anthropic's models, you are comparing different products, and the cheaper one is only better if its quality is enough for your task.
Worked examples
One chat-style request
You paste a 300-line file (about 4,000 tokens) with instructions and ask for a fix. The reply is 800 tokens.
Input: 4,000 / 1,000,000 x $0.15 = $0.0006. Output: 800 / 1,000,000 x $0.50 = $0.0004. Total: $0.0010, a tenth of a cent.
A heavy request with a large context
You send 20,000 tokens of code and docs and receive 2,000 tokens back.
Input: 0.02 x $0.15 = $0.003. Output: 0.002 x $0.50 = $0.001. Total: $0.004.
A full-window request
The window is 100,000 tokens, prompt plus completion. Fill it with 95,000 tokens of input and 5,000 of output.
Input: 0.095 x $0.15 = $0.01425. Output: 0.005 x $0.50 = $0.0025. Total: $0.01675, under two cents even at the limit.
An agent session of 30 turns
The context grows from 10,000 to 40,000 tokens, so the average input per turn is about 25,000. Each turn writes about 800 tokens.
Input: 30 x 25,000 = 750,000 tokens, so 0.75 x $0.15 = $0.1125. Output: 30 x 800 = 24,000 tokens, so 0.024 x $0.50 = $0.012. Total: $0.1245, about 12 cents for the whole session.
Where the money goes in practice
Once you start logging usage, a pattern appears. A few habits account for most of the spend, and they are easy to change.
- Resending whole files. Pasting a 1,500-line module for a one-line question puts 20,000 tokens or more on the input side. Send the function and its callers instead.
- Long conversations. Every turn repeats the history. By turn 40 you may be paying to resend the first ten turns again and again. Start a new chat when the topic changes.
- Oversized system prompts. A 3,000-token instruction block costs $0.00045 per call on input. Across 1,000 calls that is $0.45, which is small, but it is waste you can trim in a minute.
- Unneeded long replies. Output costs more per token than input, at $0.50 against $0.15. If you only want a diff, say so, and set
max_tokenswhen you want a hard ceiling. It is optional, because the completion may otherwise use whatever is left of the window.
Even after these fixes, do not expect a monthly figure to match your first estimate. Real usage is bursty: some days are ten requests, some are two hundred. Look at a month of data before you commit to a budget. Because there is no subscription, a quiet month costs less, and a busy one costs only what it used.
From requests to a monthly budget
Take the 30-turn agent session at about $0.1245. If you run five of them every working day for 22 days, that is 110 sessions, or about $13.70 for the month. Run two a day and it is 44 sessions, about $5.48.
Your numbers will differ. The way to get them is to log the usage object that comes back with each response, or the final usage chunk when you stream. Multiply by the two prices and you have actual cost per task, not a guess. The X-Balance-USD response header also shows the remaining balance after each call, which is handy for a quick check in a terminal.
A few habits keep input cost down. Send only the files that matter. Trim old turns from long conversations. Keep the system prompt short. Every token you send is billed as input, so shortening the context saves real money.
Top-ups, bonuses and payment
You add credit in any whole amount from $20 to $500. Larger top-ups earn a bonus: +5% from $50, +10% from $100 and +15% from $200.
| You pay | Bonus | Credit you get |
|---|---|---|
| $20 | none | $20.00 |
| $50 | 5% | $52.50 |
| $100 | 10% | $110.00 |
| $200 | 15% | $230.00 |
| $500 | 15% | $575.00 |
At $0.15 per 1M input tokens, $20 buys roughly 133 million input tokens, or 40 million output tokens if you spend it all on output. Payment is by crypto (USDT on TRC20, USDC on Base). Because credit never expires, a bigger top-up carries no penalty if you use it slowly.
Try it before you pay
New users can claim $0.50 of trial credit with one click on the API key page after sign-up. It needs no card, is valid for 7 days, and is limited to one per person. Sign-up works with Google or with email and password.
What does $0.50 buy? Using the 20k-in, 2k-out request at $0.004, it covers 125 requests. With the lighter 4k-in, 800-out request at $0.0010, it covers 500. That is enough to run your own side-by-side test on real tasks.
The trial key allows 2 concurrent requests and 60 per minute. A full key allows 8 concurrent and 300 per minute. If you exceed a limit you get HTTP 429 with the error code rate_limited or concurrency, and a temporary overload returns 429 with a Retry-After: 5 header. Streams hold their concurrency slot until they finish. The key guide walks through the claim step by step.
Measure your own usage with a few lines of code
This script prints the cost of each call from the usage the API returns, using the two prices above.
from openai import OpenAI
client = OpenAI(base_url="https://api.claudecodeapikey.com/v1", api_key="YOUR_API_KEY")
IN_PRICE = 0.15 / 1_000_000
OUT_PRICE = 0.50 / 1_000_000
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Explain what this regex does: ^(?:\\d{3}-){2}\\d{4}$"}],
)
u = resp.usage
cost = u.prompt_tokens * IN_PRICE + u.completion_tokens * OUT_PRICE
print(u.prompt_tokens, u.completion_tokens, round(cost, 6))
Run it on a day of normal work, add up the results, and you have your own monthly estimate. Compare that with the other provider's current pricing and make the call on facts. If you want setup help first, the docs cover editors and clients.
More guides
Questions and answers
How much does this API cost per request?
It depends on token counts. A request with 20,000 input and 2,000 output tokens costs $0.004 at $0.15 and $0.50 per 1M tokens.
Is there a monthly subscription?
No. You pay as you go from prepaid credit, and the credit never expires.
Do failed requests cost anything?
No. Failed or refused requests are not charged.
How do I compare this to Claude Code pricing?
Check the vendor's current pricing page, then apply the same formula to your own measured token usage. This site does not quote other vendors' prices.
What is the minimum top-up?
$20, in any whole amount up to $500. Bonuses of 5%, 10% and 15% apply from $50, $100 and $200.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.