Cost for API Key per Month: Estimate Your LLM Bill
The cost for api key per month is not a fixed fee. It is requests times tokens times rate, and you can compute it before you spend anything. This walkthrough gives you the method, a small Python script and sample numbers at $0.15 per 1M input and $0.50 per 1M output tokens.

Summary
- Estimate tokens per request first; roughly four English characters make one token.
- Chat apps resend history, so input tokens grow with every turn.
- Add 20 to 30 percent headroom for retries and busy days.
- Check the X-Balance-USD header to compare your estimate with real spend.
Step 1: estimate tokens per request
Tokens are chunks of text, and for English prose one token is roughly four characters, or about three quarters of a word. A 600-word prompt is therefore close to 800 tokens. Do not forget what you send besides the user's message: the system prompt, retrieved documents, tool definitions and earlier turns all count as input.
For output, decide your typical answer length. A short reply is 100 to 200 tokens, a paragraph-long answer is 300 to 400, and a long story section can reach 1,500 or more. If you set max_tokens, that is your ceiling; leaving it unset lets the model use the rest of the 100,000-token window, so cap it if cost control matters.
| Text | Approximate tokens (English) |
|---|---|
| A 150-word email | 200 |
| A 500-word page | 650 |
| A 3,000-word article | 4,000 |
| A 50,000-word novel manuscript | 65,000 |
These are rules of thumb. The 100,000-token window comfortably holds the manuscript in the last row, but that single prompt would cost 65,000 x 0.15 / 1M = $0.00975 in input before the model writes a word.
Step 2: account for chat history
Stateless calls are easy to price. Chats are not, because every turn resends the whole conversation. Take a 10-turn conversation with a 300-token system prompt, 100 tokens per user message and 200 tokens per reply.
Input on turn k is 300 + 300 x (k - 1) + 100 tokens, so turn 1 sends 400 and turn 10 sends 3,100. Summed over ten turns the input is 17,500 tokens, and the output is 2,000. The cost is 17,500 x 0.15 / 1M = $0.002625 for input plus 2,000 x 0.50 / 1M = $0.001 for output, which is $0.003625 per conversation. A thousand conversations a month cost $3.625.
Notice that input grew far faster than the visible text. If conversations run long, trim or summarize old turns before sending.
Step 3: apply the formula
Put the pieces together:
- Requests per month = requests per day x days.
- Cost per request = input tokens x 0.15 / 1,000,000 + output tokens x 0.50 / 1,000,000.
- Monthly cost = requests per month x cost per request.
Two examples. A support bot handles 800 chats a day at 1,800 input and 350 output tokens each. Cost per request is $0.00027 + $0.000175 = $0.000445. Over 24,000 requests that is $10.68 a month. A batch job summarizes 10,000 documents once, each with 6,000 input and 400 output tokens: 60M input tokens cost $9.00 and 4M output tokens cost $2.00, so the run costs $11.00 in total.
Step 4: put it in a script
This script prices a workload from your own numbers, then makes one live call so you can compare the estimate with the usage the API reports.
from openai import OpenAI
IN_RATE = 0.15 / 1_000_000 # dollars per input token
OUT_RATE = 0.50 / 1_000_000 # dollars per output token
def monthly(requests_per_day, in_tokens, out_tokens, days=30, headroom=1.25):
per_request = in_tokens * IN_RATE + out_tokens * OUT_RATE
return requests_per_day * days * per_request * headroom
print(f"support bot: ${monthly(800, 1800, 350, headroom=1.0):.2f}")
print(f"with 25% headroom: ${monthly(800, 1800, 350):.2f}")
client = OpenAI(
base_url="https://api.howmuchisanapikey.com/v1",
api_key="YOUR_KEY",
)
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
u = r.usage
print(u.prompt_tokens, u.completion_tokens,
u.prompt_tokens * IN_RATE + u.completion_tokens * OUT_RATE)
The first line prints $10.68 and the second $13.35, which is 10.68 x 1.25. Replace the sample numbers with yours and the output is your budget.
Mistakes that make estimates too low
Estimates usually go wrong for the same few reasons, and each one is easy to fix once you know it.
Forgetting the fixed part of the prompt
A system prompt of 800 tokens looks small on one request. Across 24,000 requests it is 19.2M input tokens, or $2.88 a month at $0.15 per 1M. Tool definitions behave the same way: a set of function schemas that adds 1,500 tokens to each of 10,000 calls is 15M tokens, or $2.25.
Using averages for a spiky workload
If traffic spikes on weekends or after a launch, the monthly total follows the spikes, not the typical day. Use your busiest realistic day as the basis, then multiply by the number of such days.
Ignoring output length
Output tokens cost $0.50 per 1M, which is more than three times the input rate. A feature that quietly doubles the average answer length can move the bill more than doubling the prompt does. Check the length distribution of real answers, rather than only the mean.
Assuming streaming changes the price
It does not. Streaming changes when the text arrives, and you are billed for the same tokens. It does affect concurrency, though: a streamed request keeps its slot until the stream ends, and a full key allows 8 requests at once.
Counting words instead of tokens
A 1,000-word document is about 1,300 tokens in English, but code, tables and non-English text can use noticeably more. When in doubt, read the usage field of a real response.
Step 5: add headroom and watch the balance
Real traffic is never flat. Retries after a timeout, a viral day, a prompt that grows because someone added instructions: plan for 20 to 30 percent above the estimate. Failed or refused requests are not charged here, which removes one source of waste, but a retried success still counts twice.
To compare the estimate with reality, read the X-Balance-USD response header, or call GET /v1/balance.
curl -i https://api.howmuchisanapikey.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","messages":[{"role":"user","content":"ping"}],"max_tokens":5}'
Check the balance before and after a day of normal use, divide the difference by requests, and you have your true cost per request.
A weekly habit helps more than a perfect model. Each Monday, note the balance, the number of requests and the average token counts from your logs, and compare them with last week. If cost per request creeps up, the usual cause is a prompt that grew or a feature that produces longer answers. Catch it while the numbers are small.
Turning the estimate into a top-up
Pay as you go means you fund only what you expect to use. Top-ups are any whole amount from $20 to $500, and credit never expires, so overshooting costs you nothing but idle balance. Larger top-ups add a bonus: 5% from $50, 10% from $100 and 15% from $200. A $100 top-up, for example, becomes $110 of credit. Payment is in crypto, USDT on TRC20 or USDC on Base.
Start with the $0.50 trial on the API key page to measure your own token counts, then size the first top-up from the numbers. For rate limits, endpoints and streaming, see the docs, and for the full price list the pricing page. If you are weighing this against Claude, our Claude API key myths and facts article covers what keys do and do not cost.
More guides
Common questions
How many tokens are in a page of text?
A page of about 500 words is roughly 650 to 700 tokens in English. Code and non-English text usually take more tokens per word.
Why is my real bill higher than my estimate?
The usual causes are chat history being resent each turn, long system prompts and retries. Log the usage field of each response to see which one it is.
Can I cap spending?
Because billing is prepaid, spending cannot exceed your balance. You can also set max_tokens on each request to limit output length.
Is there a monthly fee?
No. There is no subscription. You pay only for tokens used, from prepaid credit that never expires.
Generate your key in one form
Sign up, copy the key, update the base URL. That is the entire configuration.