The formula
Pricing on this API is pay as you go from prepaid credit. You pay for the tokens you send (input) and the tokens the model writes back (output), at two different rates:
- Input: $0.15 per 1M tokens, which is $0.00000015 per token.
- Output: $0.50 per 1M tokens, which is $0.0000005 per token.
For one request, the cost is input_tokens x 0.15 / 1,000,000 + output_tokens x 0.50 / 1,000,000. For a month, multiply by the number of requests. There is no subscription fee and no minimum per request, and failed or refused requests are not charged. The pricing page lists the current rates and top-up bonuses.
A quick way to remember the ratio: one output token costs the same as 3.33 input tokens. If your replies are about as long as your prompts, output will be roughly three quarters of the bill. If your prompts are much longer than your replies, as in summarising or classification, input dominates.
Step 1: estimate your tokens
Tokens are pieces of words. For English text, a rough rule is that 1 token is about 4 characters, or three quarters of a word, so 1,000 words is close to 1,300 tokens. Other languages and code usually use more tokens per word. The rule is fine for a first estimate, but measure before you commit to a budget.
The reliable method is to send ten or twenty real requests and read the usage object in each response, which reports prompt and completion tokens. Average them. The balance header X-Balance-USD on every response also lets you watch the real spend fall as you test. If you are new to the API, this introduction to using AI models covers how to send those first requests.
Also count the parts of the prompt that you forget about: the system prompt, any examples you include, tool definitions, and retrieved documents. These repeat on every request and are often larger than the user's message.
Worked example 1: a support bot
A bot answers 10,000 questions a month. Each request sends about 2,000 input tokens (system prompt, a few knowledge-base snippets, the question) and gets back about 400 output tokens.
Input: 10,000 x 2,000 = 20,000,000 tokens -> 20 x $0.15 = $3.00
Output: 10,000 x 400 = 4,000,000 tokens -> 4 x $0.50 = $2.00
Total per month: $5.00 (about $0.0005 per request)
That works out to roughly 333 questions a day for about 17 cents. Even at ten times the volume, 100,000 questions, the bill is $50 a month.
Worked example 2: a chat that resends history
This is where estimates go wrong. A chat API is stateless, so every turn sends the full history again. Take a 20-turn conversation with a 500-token system prompt, where each user message is 100 tokens and each reply is 300 tokens.
Turn 1 sends 600 input tokens. Turn 2 sends 1,000. Each turn adds 400 more, so turn 20 sends 8,200. The input total is 20 x 600 + 400 x (0 + 1 + ... + 19) = 12,000 + 400 x 190 = 88,000 tokens. Output is 20 x 300 = 6,000 tokens.
Input: 88,000 tokens -> 0.088 x $0.15 = $0.0132
Output: 6,000 tokens -> 0.006 x $0.50 = $0.0030
One 20-turn chat: $0.0162
1,000 such chats a month: $16.20
The input share (81 percent here) grows with conversation length. A user who roleplays for 100 turns costs far more than five users with 20 turns each. To cap that, trim old messages or summarise them once the history passes a size you choose.
A heavier case: a long-running story that keeps 30,000 tokens of context and writes 300 tokens per turn, 100 turns a day for 30 days. That is 3,000 turns, 90,000,000 input tokens ($13.50) and 900,000 output tokens ($0.45), so $13.95 for the month.
Worked example 3: batch generation
A batch job writes 50,000 product descriptions. Each call sends 500 tokens of instructions and gets 1,500 tokens back.
Input: 50,000 x 500 = 25,000,000 tokens -> 25 x $0.15 = $3.75
Output: 50,000 x 1,500 = 75,000,000 tokens -> 75 x $0.50 = $37.50
Total: $41.25 for the whole batch
Here output is 91 percent of the cost. Shorter replies save real money in this shape of workload, and setting a sensible max_tokens acts as a ceiling. Mind the rate limits as well: a full key allows 8 requests at once and 300 per minute, so 50,000 calls need at least 167 minutes at the per-minute cap, whatever the budget. Compare with other options on the pricing comparison page, and check each provider's current pricing yourself.
Four ways to lower the number
Once the formula is in front of you, the levers are easy to see.
Trim the history
In the chat example, input tokens grow with every turn. Keep the system prompt and the last 10 to 20 messages, and replace older ones with a short summary. The context window is 100,000 tokens, so you rarely hit the limit, but you pay for every token you resend.
Shorten the standing prompt
A 2,000-token system prompt sent 100,000 times is 200 million tokens, or $30 of input. Cutting it to 800 tokens saves $18 over those requests. Remove examples the model does not need and rules it follows anyway.
Cap the reply
Output is the expensive side. Ask for the length you want in the prompt ("answer in under 120 words") and set max_tokens as a backstop. A cap that is too low cuts replies off mid-sentence, so test it on real prompts.
Avoid retries from your own bugs
A loop that resends a request after a timeout can pay twice for the same answer. Handle HTTP 429 with a pause instead of an instant retry, and log the X-Request-Id of each call so duplicates are easy to spot.
A calculator in Python
Put the formula in a function, then feed it real numbers from your logs.
IN_PER_M = 0.15
OUT_PER_M = 0.50
def request_cost(input_tokens, output_tokens):
return input_tokens * IN_PER_M / 1_000_000 + output_tokens * OUT_PER_M / 1_000_000
def monthly_cost(requests, avg_in, avg_out):
return requests * request_cost(avg_in, avg_out)
print(round(monthly_cost(10_000, 2_000, 400), 2)) # 5.0
print(round(monthly_cost(50_000, 500, 1_500), 2)) # 41.25
Add a safety margin of 20 to 30 percent to the result. Real traffic has longer prompts and more retries than your test set, and a margin is cheaper than running out of credit during a busy week.
Turning the estimate into a top-up
Top-ups are any whole amount from $20 to $500, paid by crypto (USDT on TRC20, USDC on Base). A bonus applies from $50: +5% from $50, +10% from $100 and +15% from $200. Credit never expires, so buying a bigger top-up for the bonus carries no penalty if usage is lower than planned.
Some examples: $50 becomes $52.50 of credit, enough for ten months of the support bot above. $100 becomes $110, which pays for two full batch jobs of $41.25 and leaves $27.50. The $13.95 story workload would last almost eight months on $110.
To test the numbers before paying anything, sign up for a key and claim the $0.50 trial credit: one click, no card, valid for 7 days. At the support bot's $0.0005 per request, that is about 1,000 test requests.

