How Much Does an LLM Cost? Per-Token Math and Examples
The price of an LLM depends on how you use it: you pay per token through an API, or you pay for hardware to run it yourself. This guide shows the formula and worked examples with real numbers.

Key points
- API cost = input tokens x input price + output tokens x output price. Output usually costs more.
- On this API the rates are $0.15 per 1M input tokens and $0.50 per 1M output tokens, prepaid with no subscription.
- A 1,000-in, 500-out request costs $0.0004; 1,000 of them cost $0.40.
- Chat history resent on every turn is the most common reason a bill is higher than expected.
Three ways to pay for an LLM
If you are wondering how much does an LLM cost, the first step is to pick which kind of cost you mean. There are three, and they are not comparable until you put them on the same scale.
| Model | You pay for | Cost shape |
|---|---|---|
| Hosted API | Tokens sent and received | Zero when idle, grows with use |
| Chat subscription | A monthly plan for a chat app | Flat fee, no API access in most cases |
| Self-hosting | GPU, power, setup and upkeep | High fixed cost, low cost per extra request |
This article focuses on the hosted API case, because it is the one where you can calculate the answer in advance. For other vendors, check their current pricing pages; prices change and are not repeated here.
The formula for API cost
Every request has an input side (your prompt, system message and any chat history) and an output side (what the model writes). Both are counted in tokens, and a token is roughly three quarters of an English word. The cost is:
cost = (input tokens / 1,000,000 x input price) + (output tokens / 1,000,000 x output price)
On this service, the input price is $0.15 per 1M tokens and the output price is $0.50 per 1M tokens. Output is a little over three times as expensive as input, so a long answer costs far more than a long question.
Here is one request done by hand. A prompt of 1,000 tokens and a reply of 500 tokens:
- Input: 1,000 / 1,000,000 x $0.15 = $0.00015
- Output: 500 / 1,000,000 x $0.50 = $0.00025
- Total: $0.0004
That is four hundredths of a cent. Scale it: 1,000 such requests cost $0.40, and 100,000 cost $40.
Worked examples for real workloads
A support chatbot
Say 10,000 conversations a month. Each one sends 3,000 input tokens in total (system prompt plus history across turns) and receives 800 output tokens. Input: 30M tokens x $0.15 per 1M = $4.50. Output: 8M tokens x $0.50 per 1M = $4.00. Monthly total: $8.50.
Summarizing documents
A 50,000-token document and a 1,000-token summary. Input: 0.05M x $0.15 = $0.0075. Output: 0.001M x $0.50 = $0.0005. That is $0.008 per document, so 1,000 documents cost $8.00. Filling the whole 100,000-token context window with input alone costs $0.015.
A long roleplay or companion session
The prompt starts at 500 tokens and grows by 350 tokens each turn, because the history is resent. Over 20 turns the model reads 76,500 input tokens and writes 5,000 output tokens. Input: 0.0765M x $0.15 = about $0.0115. Output: 0.005M x $0.50 = $0.0025. About $0.014 for the whole session.
A batch classifier
200 input tokens and 10 output tokens per item, one million items. Input: 200M x $0.15 per 1M = $30. Output: 10M x $0.50 per 1M = $5. Total: $35. Here the volume is large, but the cost is still small because the outputs are tiny.
Monthly budget at three usage levels
Using the 1,000-input, 500-output request at $0.0004 each, here is what a month of 30 days looks like at different volumes.
| Usage | Requests per day | Requests per month | Monthly cost |
|---|---|---|---|
| Hobby bot | 1,000 | 30,000 | $12 |
| Small product | 10,000 | 300,000 | $120 |
| Busy service | 100,000 | 3,000,000 | $1,200 |
The table scales linearly, so if your average request is twice as long, double the cost. A hobby bot also fits easily in the minimum top-up: $20 pays for 50,000 requests of this size, and credit never expires, so unused balance simply waits.
Why a bill ends up higher than the estimate
Estimates fail in predictable ways. Check these before you decide a tool is expensive.
- History resent every turn. Each new message carries all the earlier ones. A chat of 50 turns is not 50 small requests; the later ones are large. The roleplay example above shows the growth.
- Verbose outputs. Output tokens cost more. If you only need a label or a short answer, say so in the prompt and set
max_tokens. - Retries in your own code. A loop that resends a request after a timeout can double spend. Note that on this API failed or refused requests are not charged.
- Large pasted context. Putting a 60,000-token file into every call is easy to do and easy to forget.
Ways to cut the cost
Most savings come from sending fewer tokens, not from finding a cheaper model.
- Trim or summarize old chat turns once they stop mattering.
- Put stable instructions in one short system message instead of repeating them in every user message.
- Ask for structured output with JSON mode (
response_format: {"type":"json_object"}) so you do not pay for chatty prose around the data. - Use
stopsequences to end generation where your parser needs it. - Batch small items into one request when each item is tiny.
You can track the effect directly. Each response includes an X-Balance-USD header, and streaming responses report usage at the end. This script prints the cost of one call:
from openai import OpenAI
client = OpenAI(base_url="https://api.uncensoredlocalllm.com/v1", api_key="YOUR_API_KEY")
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Explain tokens in two sentences."}],
max_tokens=150,
)
u = r.usage
cost = u.prompt_tokens / 1_000_000 * 0.15 + u.completion_tokens / 1_000_000 * 0.50
print(u.prompt_tokens, u.completion_tokens, round(cost, 6))Estimate your own cost before you build
Count your real tokens on a handful of typical requests, then multiply. A short function does the arithmetic for any average size.
from openai import OpenAI
client = OpenAI(base_url="https://api.uncensoredlocalllm.com/v1", api_key="YOUR_API_KEY")
def monthly_cost(requests_per_month, avg_in, avg_out):
return requests_per_month * (avg_in * 0.15 + avg_out * 0.50) / 1_000_000
print(monthly_cost(30_000, 1000, 500)) # 12.0
print(monthly_cost(10_000, 3000, 800)) # 8.5
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Say hello."}],
max_tokens=10,
)
print(r.usage.prompt_tokens, r.usage.completion_tokens)
Run twenty typical prompts through the trial, average the usage numbers, and plug them into the function. That gives you a figure grounded in your product and not in a generic example.
Self-hosting: when it makes sense
Running an open-weight model yourself removes the per-token fee, but it replaces it with fixed costs: a GPU with enough memory, electricity, setup time and updates. Those costs are paid whether the machine is busy or idle. Self-hosting tends to win when you have steady, high volume or a strict need to keep everything on your own machine. For occasional use, spiky traffic or a prototype, paying per token is simpler and usually cheaper, because an idle API costs nothing.
A fair comparison needs your own numbers: your monthly token volume, the hardware price and what your time is worth. Use the formulas above for the API side, then price the hardware side from real quotes. If you want the broader picture of running open models, the uncensored LLM chat guide covers integration options.
Pricing and top-ups on this service
Billing is prepaid and pay as you go. You can top up any whole amount from $20 to $500, and larger top-ups add a bonus: +5% from $50, +10% from $100 and +15% from $200. A $100 top-up becomes $110 of credit. Payment is in crypto: USDT on TRC20 or USDC on Base. Credit never expires, and there is no subscription.
New users can claim $0.50 of trial credit with one click on the API key page. It is valid for 7 days, needs no payment details, and is one per person. At $0.0004 per 1,000-in, 500-out request, it covers about 1,250 requests, which is enough to measure your own average cost before you pay anything. The pricing page lists the rates, and the docs show the request format.
More guides
Questions and answers
What does one LLM message cost?
On this API a message with 1,000 input tokens and 500 output tokens costs $0.0004. Short messages cost less, and long histories cost more because the input grows.
Is it cheaper to run an LLM locally?
Only at steady high volume or when you need everything on your own machine. You pay for hardware and power whether or not you use it, while an API costs nothing when idle.
What is a token?
A token is a chunk of text, roughly three quarters of an English word. Both your prompt and the model's reply are counted in tokens.
Do I pay for failed requests?
No. On this API failed or refused requests are not charged.
Is there a subscription?
No. You buy prepaid credit from $20 to $500, and it never expires.
uncensoredlocalllm.com
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.