LLM API Cost Breakdown: Search Fees vs. Token Costs

    A practical breakdown of how large language model API billing works when search is involved. Learn why "free search" does not lower your bill, how to split request costs into retrieval, context, and generation layers, and which levers—off-peak scheduling, model tier selection, context compression, and caching—actually reduce spending. Includes a sample cost model, a worked estimate, and a checklist for cost reviews.

    1. First, clear up a common misreading: free search does not mean a lower bill

    A billing change has recently appeared across the industry: when a model decides on its own to run a web search during inference, the retrieval step itself is no longer billed separately. However, the retrieved web content is assembled into the context and is still charged as input tokens. Meanwhile, if application code directly calls a standalone retrieval or crawling API, those calls are still billed per invocation.

    Many developers see the words “free search” at first glance and read them as an end-to-end cost reduction. The real billing boundary is far more fine-grained, and the key difference is who triggers the action:

    • Model-initiated retrieval: the retrieval action is not billed, but once the fetched content enters the context it is charged as input tokens;
    • Retrieval or crawling explicitly called by application code: billed per invocation, and once the returned content enters the context, input token charges are added on top;
    • Both paths share the same context window, so the “saved retrieval fees” are often simply absorbed by the “extra input fees.”

    An analogy: a cafeteria folds the price of rice into the set-meal price. The total does not change, and you have not eaten one more bite. One line disappearing from the bill does not mean total spending went down.

    2. Split the bill into three layers to see the cost structure

    To judge whether a change actually saves money, you have to break the cost of a single request into three layers:

    1. Retrieval layer: whether it is billed per call, the price per call, and how many rounds a single task triggers;
    2. Context layer: the length of the injected web page text determines the increase in input tokens, and this is the biggest item that is most easily overlooked;
    3. Generation layer: the output token price is usually significantly higher than the input price, and peak/off-peak discounts differ.

    A schematic cost model can be written as:

    1. Total cost = number of retrievals × price per retrieval
    2. + (system prompt + conversation history + injected page text) × input price
    3. + generated content length × output price

    The “injected page text” term is often more expensive than the retrieval fee itself. An ordinary web page body easily runs to thousands of tokens, and fetching a dozen or so pages in one task can inflate the input volume to the hundreds of thousands.

    3. A quantified walkthrough of one medium task

    Using a price range common in the industry as an estimate (the numbers are illustrative and only demonstrate the method): a medium task runs 30 searches, with 200,000 input tokens and 40,000 output tokens, at peak-hour prices. The total cost before the change is about $0.93, and about $0.77 after, with retrieval fees accounting for roughly 17% and savings of about $0.16.

    The conclusion is straightforward: the dominant generation and context portions did not move at all. The retrieval fee is usually only a small item on the total bill, so zeroing it out yields limited benefit. What really determines the bill is the output price, the context length, and the time of day the workload runs.

    4. Time of day and model tier: two underestimated levers

    • Peak and off-peak: the industry generally treats weekday daytime as peak and nights, weekends, and public holidays as off-peak, where the off-peak output price often carries discounts on the order of half;
    • Model tier: the output price of a lightweight tier and a flagship tier can differ by several times, and a lightweight tier is enough for simple tasks.

    So the optimization order should be: first see whether the task can be moved to off-peak hours, then see whether it can be moved down a tier, and only then start trimming retrieval fees.

    5. An actionable optimization checklist

    1. Compress injected content: after fetching, run body extraction and summarization first, keeping only the passages relevant to the question;
    2. Control retrieval rounds: set a maximum number of rounds and a timeout for model-initiated retrieval to avoid runaway loops of a dozen or twenty rounds;
    3. Reuse context: place stable system prompts and tool descriptions in a reusable prefix position to reduce repeated billing;
    4. Cache retrieval results: within the same session, let identical queries hit the cache directly instead of fetching again;
    5. Tiered routing: send simple requests to the lightweight tier and escalate to the flagship tier only for complex reasoning;
    6. Off-peak scheduling: batch offline tasks into off-peak hours;
    7. Observability: use logging services and monitoring alerts to record token consumption and retrieval counts per round, forming a cost dashboard.

    6. Three criteria for decision-makers

    • Look at who triggers the action: what is free is the model-initiated retrieval segment, not all retrieval;
    • Look at the context increase: injected page text is the cost amplifier;
    • Look at time of day and model tier: these two affect the total bill far more than retrieval fees.

    Put these three points into your cost review template, and the next time you run into a billing change that makes “some step free,” you will be able to judge within five minutes what it actually means for your bill.