Ollama API Pricing: Local Cost vs Pay per Token
A local Ollama server has no per-token price, but it is not free either. Here is how to compare its real cost with a hosted API billed at $0.15 per 1M input tokens and $0.50 per 1M output tokens.
Updated
Key points
- Local Ollama has no token meter; you pay for hardware, power and your own time.
- The hosted API costs $0.15 per 1M input and $0.50 per 1M output tokens, prepaid, no subscription.
- A typical chat reply of 2,000 tokens in and 500 out costs $0.00055.
- There is no free unlimited tier; new users get a $0.50 trial valid for 7 days.

What "Ollama API pricing" actually means
When people type ollama api pricing into a search box, they are often hunting for a rate card, and with the local software there is none. Ollama is a program you install that runs open-weight models on your own computer and serves them over a local HTTP API. It does not count tokens or send you a bill for them. Ollama also offers hosted options of its own; for those, check their current pricing page, since this article does not speak for them.
That does not make local inference free. The cost moves from a per-token fee to things you already pay for or have to buy: a machine with enough memory, electricity, your time for setup and updates, and the opportunity cost of a GPU that is busy. The useful question is not "what is the price" but "at my volume, which arrangement costs less and works well enough". The rest of this article gives you the numbers for the hosted side so you can answer it.
The cost of running Ollama yourself
There are four lines on the local side of the ledger.
- Hardware. Larger models need more GPU memory or a lot of system RAM. If you already own a suitable machine, this cost is sunk. If you would have to buy or rent one, it is the biggest item.
- Power. Multiply the machine's draw in kilowatts by hours of use and by your electricity rate. A desktop GPU under load draws far more than an idle one, so counting only busy hours is fair.
- Idle capacity. A server that sits unused most of the day still has to exist. Per-token billing charges you only when you call.
- Your time. Pulling models, updating the runtime, watching memory, restarting after crashes.
Measure your own numbers instead of trusting a generic figure. Log how many tokens your workload really uses for a week. That one measurement is also what you need to price the hosted alternative accurately.
Hosted rates and the arithmetic
The hosted API on this site bills two meters. Input tokens (your prompt, including any chat history you resend) cost $0.15 per 1M. Output tokens (the completion) cost $0.50 per 1M. There is no subscription; you add credit and it is drawn down per request. Failed or refused requests are not charged, and credit does not expire.
The formula is short:
cost = input_tokens x 0.15 / 1,000,000 + output_tokens x 0.50 / 1,000,000
Here are common job shapes with the math worked out.
| Job | Input tokens | Output tokens | Cost |
|---|---|---|---|
| One chat reply | 2,000 | 500 | $0.0003 + $0.00025 = $0.00055 |
| 1,000 such replies | 2,000,000 | 500,000 | $0.30 + $0.25 = $0.55 |
| Summarise a long document | 50,000 | 1,000 | $0.0075 + $0.0005 = $0.008 |
| Fill the full context | 100,000 | 4,000 | $0.015 + $0.002 = $0.017 |
| Batch of 10,000 requests | 8,000,000 | 3,000,000 | $1.20 + $1.50 = $2.70 |
The batch row assumes 800 input and 300 output tokens per request. Notice that output is the expensive meter per token, but input usually dominates the count, so long prompts and long chat histories are where money goes.
A chat that grows turn by turn
Chat APIs are stateless, so every turn resends the whole history. That makes cost grow faster than the number of turns. Take a 20-turn conversation where each user message is 150 tokens and each reply is 250 tokens, so each turn adds 400 tokens to the history.
- Turn 1 sends 150 input tokens. Turn 2 sends 150 + 400 = 550. Turn k sends 150 + 400 x (k - 1).
- Across 20 turns the input total is 150 x 20 + 400 x (0 + 1 + ... + 19) = 3,000 + 400 x 190 = 79,000 tokens.
- Output total is 20 x 250 = 5,000 tokens.
- Cost: 79,000 x 0.15 / 1M = $0.01185, plus 5,000 x 0.50 / 1M = $0.0025, for $0.01435 in all.
About a cent and a half for a long conversation. If you double the conversation to 40 turns, the input roughly quadruples, because the history keeps growing. Trimming or summarising old turns is the main way to control cost in chat apps.
Credit, bonuses and the trial
You top up with any whole amount from $20 to $500. Larger top-ups carry a bonus: +5% from $50, +10% from $100 and +15% from $200. In practice that means:
- $50 buys $52.50 of credit.
- $100 buys $110.00.
- $200 buys $230.00.
Payment is by card (Visa, Mastercard, Apple Pay, Google Pay) or crypto (USDT on TRC20, USDC on Base). The pricing page has the current details.
New users can test before paying. After you sign up with Google, or with email and password, the API key page has a button that claims $0.50 of trial credit, one per person, valid for 7 days, with no card needed. At the 2,000-in, 500-out reply size above, $0.50 covers roughly 900 replies, which is plenty to judge whether the output suits your project. A trial key is limited to 2 concurrent requests and 60 requests per minute. You can get your API key in a few minutes.
Comparing the two for your volume
Use your logged token counts and do the sum for a month. Say a project uses 50M input tokens and 10M output tokens per month. Hosted cost: 50 x $0.15 = $7.50, plus 10 x $0.50 = $5.00, so $12.50. Now put your local figure next to it: the monthly share of hardware you would not otherwise own, plus the power for the busy hours, plus the value of your maintenance time. If that total is clearly above $12.50, hosting wins on cost. If you already own idle hardware that handles the model well, local wins on cost.
Cost is not the only axis. Local keeps data on your machine and works offline. Hosted removes the need for a GPU, gives a 100,000-token context window, and lets several services share one backend. The hosted model is a single open-weight model tuned to answer without content refusals for lawful adult use, so it also depends on whether that model fits your task. Prompts are not used for training.
One honest limit: there is no free unlimited tier. After the $0.50 trial, you pay per token from prepaid credit. If your work needs unlimited free calls and you own the hardware, local Ollama is the right tool.
Mistakes that distort the comparison
A few errors show up again and again when people price an LLM workload, and each one can flip the answer.
- Forgetting output tokens. A short prompt with a long answer is mostly an output bill. A 300-token question that produces a 3,000-token story costs 300 x $0.15 / 1M + 3,000 x $0.50 / 1M = $0.000045 + $0.0015 = $0.001545.
- Ignoring resent history. As the 20-turn example shows, chat cost scales with accumulated context, not with the length of the latest message.
- Counting words instead of tokens. English text usually takes somewhat more tokens than words, and code or non-Latin scripts take more again. Read the usage numbers returned with each response and use those, not an estimate.
- Pricing local hardware at zero. A GPU you already own still wears out and still draws power, even if you do not write a cheque for it.
- Comparing different models. A small local model and a larger hosted one do not produce the same quality. Cheaper per token is not cheaper per good answer if you need many retries.
The last point deserves a test rather than an opinion. Take twenty real prompts from your project, run them on both setups, and judge the answers. Then price the winner at your real volume.
Keeping an eye on spend
Every response from the hosted API carries an X-Balance-USD header with your remaining credit, plus X-Request-Id for support questions. You can read it in code and alert yourself before the balance runs out.
import requests
r = requests.post(
"https://api.ollamaapi.cc/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "uncensored",
"messages": [{"role": "user", "content": "Say hello."}],
"max_tokens": 20,
},
timeout=60,
)
print(r.json()["choices"][0]["message"]["content"])
print("Balance:", r.headers.get("X-Balance-USD"))
Setting max_tokens is optional, since a completion may use the rest of the window, but it is a cheap guard against runaway output. The docs cover the other headers and the rate limits.
More guides
Questions and answers
Is the Ollama API free?
The local Ollama software has no per-token fee, but you supply the hardware and power. The hosted API on this site is billed per token, with a $0.50 trial for new users.
How much does 1M tokens cost on the hosted API?
1M input tokens cost $0.15 and 1M output tokens cost $0.50. A job with 1M of each costs $0.65.
Does credit expire?
No. Prepaid credit does not expire, and failed or refused requests are not charged.
What is the minimum top-up?
$20, in any whole amount up to $500. Bonuses of 5%, 10% and 15% apply from $50, $100 and $200.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.