Inteligencia-artificial 21 Sep 2026 6 min de lectura 76 views

LLM Token Costs: How to Control Your AI Spending

How tokens are billed for ChatGPT and Claude via API, what inflates the bill, and which tactics cut the cost of your AI project without losing quality.

The first bill of an AI project usually brings a surprise: what cost pennies in testing becomes a serious expense with real users. The good news is that the cost of language models is quite controllable once you understand where it comes from.

Short answer: Language model providers charge for tokens processed, with separate rates for input tokens (what you send) and output tokens (what the model generates). To control spending, choose the model by task, trim the history and documents you send, use caching, and set limits per user and per agent.

What is a token and how is it billed?

A token is the smallest unit of text that a language model processes: a fragment that is sometimes a whole word and sometimes only part of one. In Spanish, as a very rough rule, one word equals more than one token because the language uses longer words than English. Providers charge for tokens processed, and they do so separately:

  • Input tokens: everything you send (instructions, history, retrieved documents, the question).
  • Output tokens: what the model generates. They usually cost more per unit than input tokens.

Prices change frequently and vary by model. Always check the provider's current price table; we do not give exact figures here because they would become outdated.

What inflates the AI bill?

Conversation history

On each turn you normally resend the entire previous conversation. A long chat costs more every time.

Long instructions

A 3,000-word system prompt is paid for on every call (more in system prompts for agents).

Whole documents

Sending an 80-page PDF to answer a specific question is the fastest way to burn through a budget. With RAG you send only the relevant passages (see RAG: AI with your company's knowledge).

Agents with many steps

An agent that reasons, calls tools, and retries multiplies the calls. Every step resends context.

The wrong model

Using the most powerful model for simple tasks such as classifying or extracting a field is overpaying.

Long outputs

Asking for lengthy answers when a paragraph or a short JSON was enough.

How do you reduce token costs?

  1. Choose the model by task. A small model for classifying, routing, and extracting; a larger one only for complex reasoning or delicate writing. Large savings are common from this change alone.
  2. Use prompt caching. Several providers offer reduced prices for the repeated part of the context, such as fixed instructions. Check whether your provider supports it and how to enable it.
  3. Trim the history. Summarize old turns and keep only what is necessary.
  4. Retrieve less, and better. In RAG, tune how many chunks you send and use reranking to send the best ones.
  5. Limit the output. Ask for concise formats and set a maximum number of response tokens.
  6. Batch processing. If you do not need an immediate response, some providers offer discounted batch modes.
  7. Avoid unnecessary calls. If a simple rule in code solves the case, do not call the model. Validate and normalize data with traditional code.
  8. Cache repeated answers. Identical or very frequent questions can be resolved with a stored answer.
  9. Set per-user limits. Daily or monthly caps prevent abuse and unexpected bills.

How do you estimate AI cost before building?

Do a simple calculation:

  • Average input tokens per request.
  • Average output tokens per request.
  • Number of requests per month.
  • Price per million tokens of the chosen model (input and output).

Multiply and add. Then add a margin of 30 to 50 percent for retries, testing, and peaks. Test with a real batch of a few hundred cases to measure the averages instead of guessing them. And remember that the exchange rate matters: providers bill in US dollars and your budget may be in local currency, such as Mexican pesos (MXN).

As a rough reference, low-volume tasks such as classifying emails or summarizing documents for a small or midsize business can stay at hundreds or a few thousand pesos a month, while an assistant with thousands of daily conversations can reach tens of thousands. It depends entirely on the model, the volume, and the design.

How do you monitor AI spending?

  • Record tokens and cost per call, per function, and per customer or department.
  • Set alerts when daily spending exceeds a threshold.
  • Review monthly which flows consume the most and whether the chosen model is still the right one; every so often cheaper models with similar quality appear.
  • Re-evaluate with your test set before switching models to confirm that quality holds; the method is in AI agent evaluation.

Common mistakes

  • Optimizing cost without measuring quality: a cheap model that fails ends up costing more in rework.
  • Not separating costs by project or department.
  • Letting the history grow without limit.
  • Forgetting that an agent's loops can spiral; set a maximum number of steps.
  • Ignoring the cost of development and maintenance, which usually weighs more than tokens.
  • Committing to a single model without an abstraction layer to change it.

When is it worth optimizing token costs?

If your volume is low, token cost is probably marginal compared to the value of the time you save, and it is not worth over-optimizing. If your volume is high or your margin is tight, the design of consumption must be part of the architecture from day one. Hosting your own models only makes sense at very large volumes or with strict privacy requirements, because infrastructure and maintenance also cost money.

At DaltoAura we design solutions with cost measurement from the start and the ability to switch models according to the task.

Frequently asked questions

Why do output tokens cost more than input tokens?

Generating text requires more computation than reading it, which is why many providers set a higher price per output unit. This makes asking for long answers one of the fastest ways to make a solution more expensive. Prices change frequently, so always check the provider's current price table.

How many tokens is a word in Spanish?

There is no exact number: it depends on the model and the text. As a very rough rule, a Spanish word equals more than one token because words tend to be longer than in English. To estimate precisely, measure a real sample of your own requests instead of guessing averages.

What is prompt caching and how much does it save?

It is a feature from several providers that offers a reduced price for the repeated part of the context, such as the agent's fixed instructions. The savings depend on the size of that repeated part and how many calls reuse it; check your provider's current documentation to see whether it is available and how to enable it.

Is it worth hosting my own model to save on tokens?

Only at very large volumes or with strict privacy requirements. Hosting your own model means infrastructure, maintenance, and generally lower quality than frontier models. For most small and midsize businesses, choosing the right model per task and trimming context delivers bigger savings with far less effort.

Let's talk

If your AI consumption is already a concern or you want to properly estimate a new project, tell us the use case and the approximate volume and we will help you calculate and optimize the spending.

Tags:

#tokens #costs #LLM #optimization #API

Share this article

← Previous

AI Costs and ROI for a Mexican SME: Ballpark Range...

Next →

How Much Does a WhatsApp Chatbot Cost in Mexico? 2...

Related Articles