Claude Code API Credits Explained: Prepaid Balance
Claude code api credits are, in plain terms, a prepaid dollar balance that each request draws down. This article explains how that works on this OpenAI-compatible service: what uses credit, how top-ups and bonuses add to it, and how to watch the balance from code.
Last updated

What credits are
Credits here are not points or tokens in a bundle. They are dollars you have paid in advance. You add money to your account, the balance shows a dollar figure, and each request takes a few fractions of a cent off it. There is no subscription and no monthly minimum. If you stop using the API, the balance sits there until you come back.
One clarification for people who arrived through the phrase claude code api credits. Claude Code is Anthropic's coding tool, and its billing is handled by Anthropic, so check their documentation for how it charges. This site is an independent, OpenAI-compatible API for a different model. It offers POST /v1/chat/completions, POST /v1/responses and GET /v1/models. Credits here apply only to this service.
What burns credit and what does not
A request costs money for the tokens in it, in two parts:
- Input tokens at $0.15 per 1M. This is everything you send: the system prompt, the conversation so far, tool definitions and any pasted files.
- Output tokens at $0.50 per 1M. This is what the model writes back, including the arguments of a tool call.
Two habits drive most spending. First, chats resend history. The tenth turn of a conversation carries the nine before it as input. Second, long outputs are the pricey side, so a verbose reply costs more than a long prompt of the same size.
Several things do not cost anything. Failed requests and refused requests are not charged. Idle time is free, since there is no fee for holding the account. And credit does not expire, so the balance you load in January is still there in December. The only expiring credit is the $0.50 trial, which lasts 7 days.
A single request is easy to price. With 4,000 input tokens and 800 output tokens, input is 4,000 / 1,000,000 x $0.15 = $0.0006 and output is 800 / 1,000,000 x $0.50 = $0.0004. The request takes $0.001 off the balance, so $1 of credit pays for 1,000 of them.
Adding credit: amounts, bonuses and crypto
You can top up any whole dollar amount between $20 and $500. Bigger top-ups add a bonus to the credit you receive:
- from $50: +5%, so $50 becomes $52.50;
- from $100: +10%, so $100 becomes $110;
- from $200: +15%, so $200 becomes $230.
Payment is in crypto only. You can pay with USDT on the TRC20 network or USDC on Base. Pick the network that matches the coin you hold, and send on exactly that network, because funds sent on a different one may not arrive. Send the amount shown at checkout. If you pay from an exchange, check whether it takes a withdrawal fee out of the amount, so that the full top-up arrives.
Once payment is confirmed on the network, the credit appears in your balance. Topped-up accounts can also hold up to 5 keys, each with a label, all drawing from the account's credit. You can revoke any key without touching the others.
The pricing page shows the current top-up options and the rates. Start with $20 if you are not sure, then watch a week of real use before adding more.
Check the balance from code
There are three ways to see what is left. Every response carries an X-Balance-USD header. Two endpoints return the balance on demand: GET /v1/balance and the OpenAI-style GET /v1/dashboard/billing/credit_grants. Try them with curl and look at the raw output:
curl https://api.claudecodeapi.com/v1/balance \
-H "Authorization: Bearer $LLM_API_KEY"
curl https://api.claudecodeapi.com/v1/dashboard/billing/credit_grants \
-H "Authorization: Bearer $LLM_API_KEY"
The header is the cheapest way to monitor, since it arrives with responses you are already making. This wrapper warns when the balance drops under a threshold:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.claudecodeapi.com/v1",
api_key=os.environ["LLM_API_KEY"],
)
LOW_BALANCE = 2.00
def ask(prompt: str) -> str:
raw = client.chat.completions.with_raw_response.create(
model="uncensored",
messages=[{"role": "user", "content": prompt}],
)
balance = raw.headers.get("X-Balance-USD")
if balance is not None and float(balance) < LOW_BALANCE:
print(f"Low balance: ${float(balance):.2f}, top up soon")
return raw.parse().choices[0].message.content
print(ask("Give me one tip for naming functions."))
Swap the print for a message to your team chat or an email, and you have an alert that needs no extra service. If many workers share one key, read the header in all of them. Concurrent requests finish in any order, so the last value you see may not be the lowest.
Plan how long a top-up lasts
Runway is the balance divided by what you spend per day. Take a support assistant that handles 6,000 requests a day, with 2,000 input tokens and 500 output tokens each. A request costs 2,000 / 1,000,000 x $0.15 + 500 / 1,000,000 x $0.50 = $0.0003 + $0.00025 = $0.00055. A day costs 6,000 x $0.00055 = $3.30.
A $100 top-up gives $110 of credit with the 10% bonus, which lasts $110 / $3.30, or about 33 days. A $20 top-up lasts about 6 days. A $200 top-up gives $230 and lasts about 70 days.
Keep a margin. Traffic grows, prompts get longer, and a retry loop can double usage without anyone noticing. A good rule is to top up when you have about a week of runway left, and to set the alert threshold at one day of spending, which here is $3.30.
Trial credit and topped-up credit
The two kinds of credit behave differently, so it helps to keep them apart. The trial is $0.50, claimed with one click on the API key page after sign-up. It is valid for 7 days, needs no card, and is limited to one per person. Its key has lower limits, 2 concurrent requests and 60 requests per minute.
Topped-up credit is the lasting kind. It does not expire, and the account gets the full-key limits of 8 concurrent requests and 300 requests per minute. A reasonable path is to use the trial to confirm that your prompts work, check the cost per request with the formulas above, and only then decide how much to load. Spending the trial first costs nothing, and it tells you whether a $20 top-up will last you days or months.
If the balance hits zero
When credit runs out, requests can no longer be paid for and the API stops serving them, so an app without a fallback will show errors. Add a top-up to restore service. Because credit does not expire, there is no hurry caused by a deadline, only by your own traffic.
To avoid surprises, combine the alert above with a habit: check the balance when you check your deployment. For production apps, treat low credit like low disk space, an operational alarm with an owner. The docs list the endpoints and error responses to handle, and the API key page is where you claim the one-click $0.50 trial if you have not used it yet. The trial needs no card and allows 2 concurrent requests and 60 per minute. For a wider view of per-token costs, the article on production checklists for pricing covers the planning side.
More guides
Support queries
Do API credits expire?
Credit from top-ups never expires. The $0.50 trial credit is valid for 7 days, and there is one trial per person.
What can I pay with?
Crypto only: USDT on TRC20 or USDC on Base. Top-ups are any whole amount from $20 to $500.
Am I charged for failed requests?
No. Failed or refused requests are not charged. You pay only for requests that complete.
How do I check my remaining credit?
Read the X-Balance-USD response header, or call GET /v1/balance or GET /v1/dashboard/billing/credit_grants with your key.
Are these credits for Anthropic's Claude Code?
No. They apply only to this independent OpenAI-compatible service. Claude Code is billed by Anthropic, so check their documentation.
Access key via sign-up
Register, copy the token, update the base URL. That covers the entire configuration.