We use cookies to improve your experience and measure traffic. Cookie policy

    Scalor
    CONVINCE US →
    back to blog
    Applied AI

    How token pricing works in AI APIs: input, output and what you really pay

    How token pricing really works: input, output, caching, batch, and model selection.

    Henrique Baeta
    Commercial & Doer
    6/4/20263 min read
    Share

    How token pricing works in AI APIs: input, output and what you really pay

    When talking about AI pricing, most people look at a single number in a table and assume that's what they'll pay. The reality is more nuanced. The actual cost of an artificial intelligence API depends on several multiplying factors, and those who only look at the list price often face surprises.

    This article explains how token pricing truly works in AI APIs, so you can accurately estimate costs and understand where the levers are.

    The basics: price per million tokens

    Almost all AI APIs charge in the same way: per million tokens processed, with separate values for input and output. Remember that one million tokens is equivalent to about 750,000 words.

    The calculation for a call is straightforward:

    cost = (input tokens ÷ 1 million × input price) + (output tokens ÷ 1 million × output price)

    Practical example: a call with 10,000 input tokens and 2,000 output tokens, using a model priced at $3 for input and $15 for output per million, costs about 3 cents for input plus 3 cents for output. Six cents in total. Seems like nothing. Multiply that by one million calls per month and you're talking tens of thousands of dollars.

    Input costs less, output costs more

    The rule that all providers follow: output is more expensive than input, typically in a five-to-one ratio. It makes sense; generating text requires more computational work than reading it.

    The practical consequence is important. Applications that generate long responses, such as content writing or reports, have their cost dominated by output. Applications that process a lot of context but respond little, such as classification or data extraction, have their cost dominated by input. Knowing which category you're in indicates where to optimize.

    The levers that change the real price

    Here's what almost no one sees in the price table. Providers offer mechanisms that drastically alter the effective cost.

    Prompt caching. If you reuse the same part of the prompt in multiple calls, such as long system instructions or a context document, caching allows you to store it in memory. Subsequent reads of that part become up to 90 percent cheaper. For agents and applications with repeated context, this is the most significant saving.

    Batch processing. If your tasks don't require an immediate response, you can send them in a batch and accept that they will be processed within a certain timeframe, typically up to 24 hours. In return, the price drops by 50 percent across all models. Ideal for processing large volumes asynchronously.

    Model selection. This is the biggest lever of all. The price per token varies by more than a hundred times between the cheapest and most expensive model from the same provider. Using a top-tier model for a simple task is pure waste.

    Hidden costs to consider

    Beyond the price per token, there are factors that inflate the bill without appearing on the headline:

    • Growing context. In long conversations, each new turn resends the entire history as input. The cost of a conversation grows with each message.
    • Extended reasoning. Models that think more before responding generate internal tokens that are also billed.
    • Tokens per language. The same text in Portuguese generates more tokens than in English, thus costing a little more.

    How to think about cost the right way

    The professional way to look at this is not the isolated list price, but the cost per completed task. A task that needs a lot of context and long responses from an expensive model can cost cents. The same task, optimized with caching, batching, and the appropriate model, can cost a fraction of that, with the same quality.

    Conclusion

    The price of an AI API is not a number; it's an equation. Input and output have different prices, output may or may not dominate depending on the use case, and mechanisms like caching, batching, and model selection can reduce the effective cost by 90 percent or more. Those who master these levers build sustainable products. Those who only look at the table risk an uncontrolled budget.

    The next step is to compare the actual prices among the main providers and understand where each makes the most sense.

    Henrique Baeta
    Written by
    Henrique Baeta
    Commercial & Doer

    Writes about applied AI, operations, GEO/SEO and how to turn companies into machines that keep running even when no one is watching.

    related services

    Services tied to this article

    keep reading

    More on Applied AI

    All articles
    Newsletter

    Real-time knowledge

    No spam.

    By subscribing you accept our privacy policy.