The formula
Any claude api cost calculator, whether a web page or a spreadsheet, does the same thing:
cost = (input tokens / 1,000,000) x input rate + (output tokens / 1,000,000) x output rate
The rates are the part you must look up. For Claude, read Anthropic's current pricing page, because rates differ by model and change over time, and features such as caching may alter the bill. I do not quote them here. For this endpoint the rates are fixed: $0.15 per 1M input tokens and $0.50 per 1M output tokens. Credit is prepaid, never expires, and failed or refused requests are not charged.
Step 1: estimate your tokens
You need four numbers per task: requests per month, average input tokens, average output tokens and a retry factor. A few rules of thumb help when you have no logs yet. English text is around 4 characters per token, so a page of 500 words is roughly 650 to 750 tokens. System prompts and chat history count as input on every call. For output, use the length you ask for plus about 10%.
Once you have traffic, stop guessing. Every response includes a usage block with prompt and completion tokens, and this API also returns the X-Balance-USD header after each call, so you can watch spending live.
Step 2: three worked examples on this endpoint
Support draft bot
20,000 conversations a month, 1,200 input and 300 output tokens each.
- Input: 20,000 x 1,200 = 24M tokens, 24 x $0.15 = $3.60
- Output: 20,000 x 300 = 6M tokens, 6 x $0.50 = $3.00
- Monthly total: $6.60
Document summaries
3,000 documents a month, 20,000 input and 800 output tokens each.
- Input: 60M tokens x $0.15 = $9.00
- Output: 2.4M tokens x $0.50 = $1.20
- Monthly total: $10.20
Fiction chat app
100,000 turns a month, 3,000 input and 300 output tokens each.
- Input: 300M tokens x $0.15 = $45
- Output: 30M tokens x $0.50 = $15
- Monthly total: $60
To compare with Claude, put its current rates into the same lines for the same token counts. The difference between the two totals is your saving, or your premium for a stronger model. Both are legitimate outcomes. This endpoint serves one open-weight model, uncensored, run by an independent provider. It is not Claude and not an Anthropic product, so the right question is whether its quality is enough for your task.
Step 3: a script that does the math from real usage
This Python script sends a request and prints the exact cost from the returned usage numbers. Change the rates to compare any provider.
from openai import OpenAI
RATE_IN, RATE_OUT = 0.15, 0.50 # dollars per 1M tokens, this endpoint
client = OpenAI(base_url="https://api.claudeapicost.com/v1", api_key="YOUR_KEY")
def cost(usage, rate_in=RATE_IN, rate_out=RATE_OUT):
return usage.prompt_tokens / 1e6 * rate_in + usage.completion_tokens / 1e6 * rate_out
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Explain tokens in two sentences."}],
)
print(r.usage.prompt_tokens, r.usage.completion_tokens)
print(f"this call: ${cost(r.usage):.6f}")
# What the same call would cost at other rates, e.g. numbers from another pricing page:
# print(cost(r.usage, rate_in=YOUR_IN, rate_out=YOUR_OUT))
For a monthly forecast, multiply the average per-call cost by your request count. Add a safety margin of 20 to 30% for growth and longer conversations.
Checking the balance from the shell
To see spending without code, read the balance before and after a batch. The header X-Balance-USD is on every response, and GET /v1/balance returns it on its own.
curl -s https://api.claudeapicost.com/v1/balance \
-H "Authorization: Bearer YOUR_KEY"
curl -si https://api.claudeapicost.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","max_tokens":50,"messages":[{"role":"user","content":"Hi"}]}' | grep -i x-balance
The difference between two readings, divided by the number of calls, is your real cost per call.
What spreadsheets forget
- Output tokens. They cost more per token than input here ($0.50 against $0.15), and reasoning-heavy prompts produce long answers.
- History. A chat resends earlier turns on every call, so input grows with conversation length.
- Retries. Failed calls are free here but still cost you time; refusals elsewhere can multiply the real number of calls.
- Peaks. Rate limits matter: a full key allows 8 concurrent requests and 300 per minute.
- Minimum top-up. Credit is bought in whole amounts from $20 to $500, so plan your first top-up.
The pricing myths versus facts article goes through these traps in more detail.
Topping up and trying it first
Top-ups run from $20 to $500, any whole amount, with +5% from $50, +10% from $100 and +15% from $200. Pay by crypto (USDT on TRC20, USDC on Base). See the pricing page for the full table.
To test your estimate on real prompts, claim the $0.50 trial on the key page. It lasts 7 days, needs no card and is one per person. The docs list the usage fields and error codes. If you hit a 429, you went over a rate or concurrency limit, so slow down or retry after the Retry-After value.

