Most LLM APIs charge by the token: you pay for every piece of text the model reads and every piece it writes, at a rate set per million tokens. Some charge a fixed fee for each answer instead. Both can be cheap or expensive; the difference is how predictable the bill is and which kinds of requests it favors.
This guide explains how per-token pricing works, where its costs hide, how a per-answer model compares, and how to decide which suits your app.
What an LLM API is
An LLM API lets your software send text to a large language model and get its reply back, without running the model yourself. Your app sends a request, usually a list of messages, and the provider runs inference on its hardware and returns the answer. You pay for that use.
Many providers now accept requests in the same format as OpenAI's chat API, which means the same code and SDK can talk to different providers by changing the address the requests go to and the API key.
How per-token pricing works
A token is a small piece of text, often part of a word. Per-token APIs list two rates for each model:
Input tokens: everything the model reads, including the system instructions, the whole conversation so far and any documents you attach.
Output tokens: everything the model writes back. Output usually costs several times more per token than input.
Prices are quoted per million tokens, and each request's cost is the input count times the input rate plus the output count times the output rate.
A worked example

Take a model priced, for illustration, at $1 per million input tokens and $5 per million output tokens.
A short question (200 tokens in) with a short answer (150 tokens out) costs $0.0002 + $0.00075 = $0.00095.
The tenth turn of a chat, where the app resends the whole conversation (4,000 tokens in) and gets a long answer (800 tokens out), costs $0.004 + $0.004 = $0.008, more than eight times as much.
Same model, same rates, very different bills. That is the core trade-off of per-token pricing: you pay exactly for what you use, but you only know the cost after the answer comes back.
Where per-token costs hide
Conversation history. Chat apps resend earlier messages with every turn, so input grows as a conversation goes on.
Long system prompts and documents. Instructions and context are billed on every request.
Reasoning models. Some models write hidden reasoning before the answer, and those tokens are usually billed as output.
Retries. A cheaper model that needs two tries can cost more than a pricier one that gets it right the first time.
Providers offer ways to cut these costs, such as discounts for cached prompts or batch jobs, but they add their own rules to budget around.
How per-answer pricing works
With per-answer pricing, each model has one fee per request. A short question and a long one cost the same, as long as they fit within the model's limits, so the cost of a request is known before it is sent.
Lightchain AI's Developer API, live on mainnet and testnet, prices this way. Each completion is a job on the Lightchain blockchain, and each model's fee is a setting stored on chain where anyone can read it. On the network's published list (as of October 21, 2026, subject to change), the text models cost:
llama3-8b — 0.02 LCAI per answer, up to 2,048 output tokens
gemma4:e2b — 0.02 LCAI per answer, up to 2,048 output tokens
glm-4.7-flash — 0.02 LCAI per answer, up to 8,192 output tokens
gpt-oss:20b — 0.04 LCAI per answer, up to 8,192 output tokens
gemma4:26b — 0.04 LCAI per answer, up to 8,192 output tokens
qwen3-coder-next — 0.05 LCAI per answer, up to 16,384 output tokens
mistral-small:24b — 0.05 LCAI per answer, up to 4,096 output tokens
qwen3.6:27b — 0.06 LCAI per answer, up to 8,192 output tokens
deepseek-r1:32b — 0.08 LCAI per answer, up to 8,192 output tokens
llama3-70b — 0.15 LCAI per answer, up to 4,096 output tokens
gpt-oss:120b — 0.20 LCAI per answer, up to 8,192 output tokens
The current list is on the contract addresses page.
The limits that come with a flat fee
A fixed fee only works with fixed limits. On Lightchain's API:
Output is capped per model, at the max output tokens in the table above.
Input is capped per job at about 124 KiB of conversation. Past that, the oldest turns are dropped. A request whose system messages plus last message are larger than that is rejected.
Sampling settings are ignored. Parameters such as temperature and max_tokens are accepted but have no effect.
Text only. No images, tools or function calling, and one answer per request.
How payment works
Prepaid balance. You fund a balance in native LCAI with one wallet transaction, then mint API keys. Calls draw on the balance with no further signing.
Spend caps. Each API key can carry a lifetime spending limit.
Refunds. If no worker answers a job, the fee goes back to your balance. A call that fails gives its fee back to the key's spend cap.
Pay per call (experimental). An x402-inspired pay-per-call option lets a client pay for each request without a key, using Lightchain's SDK. The documentation says this method may change.
Rate limits. By default, 60 requests a minute and 4 in flight per key.
Per token vs per answer: which fits your app
Cost known before the request
Per token — You only get an estimate.
Per answer — Each model has a fixed fee.
Long prompts and long chats
Per token — They cost more as they grow.
Per answer — The fee stays the same up to the input limit.
Many tiny requests
Per token — Each request costs very little.
Per answer — Each request pays the full fee.
Fine control (max tokens, tools)
Per token — Usually supported.
Per answer — Support varies by provider and is limited on Lightchain.
Budgeting
Per token — Track token usage.
Per answer — Multiply the number of requests by the fee.
Per-token pricing suits apps with many short calls, such as classification or autocomplete, and apps that need tools or fine control over output. Per-answer pricing suits apps with long prompts or long conversations, such as chat over documents or support assistants, and teams that want to know the cost of a feature before they ship it.
Price is not the only factor. Check where your prompts go too: on Lightchain's API, the operator of the API can read prompts and answers, while Lightchain Chat keeps the encryption key in your browser. Our guide to what Lightchain AI is covers how requests move through the network.
Switching an OpenAI-compatible app
Because Lightchain's API accepts the OpenAI chat format, an existing app can try it on one feature by changing three things:
The base URL, to https://chat-api.mainnet.lightchain.ai/v1 (or the testnet address to experiment).
The API key, to one minted after signing in with your wallet.
The model name, to one from the list, such as llama3-8b.
Only the chat completions and model list endpoints are supported, so check that your feature does not rely on tools, images or embeddings before you switch.
Frequently asked questions
How is LLM API pricing calculated?
Most providers multiply the tokens a request reads and writes by a per-million-token rate for each. Per-answer providers charge one fee per request for each model, within set limits.
Why do output tokens cost more than input tokens?
The model reads the whole input in one pass, but it writes the answer one token at a time, running once for every token. Writing takes more GPU time per token.
What is the cheapest LLM API?
It depends on your requests. For many tiny calls, a small model with low per-token rates is usually cheapest. For long prompts, a flat fee per answer can cost less than paying for every input token.
What is an OpenAI-compatible API?
An API that accepts requests in the same format as OpenAI's chat API, so apps built with OpenAI's SDK can use it by changing the base URL, API key and model name.
Does the Lightchain Developer API support function calling?
No. It is text only, with no tools, function calling or images.
Try it
Follow the Developer API quickstart to fund a balance, mint a key and send your first request on testnet, then compare the answer and the fee with what your current provider charges.
This article is for informational purposes only and is not financial advice.



