Why Free Web Search in LLM APIs Shifts the Cost to Input Tokens

    This article explains why some LLM platforms now offer free web search and page fetching while charging only for processed tokens, and what that means for developers. It breaks down the two inference stages—prefill and decode—to show why retrieval workloads concentrate compute on prefill, offers a simplified cost model demonstrating that input tokens still dominate the bill, and outlines five engineering practices: reranking and trimming, prefix caching, offline summarization, streaming with timeouts, and observability. It also covers how rate-limiting dimensions reveal a platform's compute bottlenecks and why managing free-tier load can improve the paid experience.

    1. The Pattern: Search and Fetching Are Free, Only Token Processing Is Billed

    A billing change worth watching has appeared in the industry: one LLM platform now makes the actions of “web search” and “fetching page content” free when opening up model access, charging only for the number of text tokens the model actually processes. Retrieval itself is not priced separately; the fetched page content is counted as input tokens on the bill only after it enters the model context.

    For developers, this directly changes the cost structure. In the past, building retrieval-augmented generation (RAG) meant accounting for hidden costs beyond model calls: search API call counts, fetching quotas, and retries after parsing failures. Now those actions are separated out of billing, and cost is concentrated almost entirely on a single variable: context length. Understanding this is the prerequisite for judging whether your bill is reasonable.

    2. The Root Cause: Compute Is Concentrated in the Prefill Stage

    To understand why a platform can afford to make retrieval free, you first need to distinguish the two stages of LLM inference.

    • Prefill: The model performs one parallel forward pass over all input tokens, generates the first token, and builds the key-value cache. This stage is compute-intensive, and compute consumption is roughly proportional to input length.
    • Decode: The model generates subsequent tokens one at a time, processing only one new token per step but reading the entire history cache. This stage is memory-access-intensive, and latency is constrained by GPU memory bandwidth.

    The typical chain for web search and page fetching is: search returns several results, the content is fetched and cleaned, thousands or even tens of thousands of tokens of prompt are assembled, and the model is asked to summarize. Almost all of the pressure in this chain falls on prefill, while the output may be only a few hundred tokens. In other words, the input-to-output ratio of a single “search + summarize” call can reach dozens to one.

    The same load profile appears in ultra-long-context conversation scenarios: session windows of hundreds of thousands of characters, repeated regeneration, and using the model as an instant-messaging tool for short chats all trigger prefill repeatedly. Once the user base for these high-consumption scenarios declines, spare prefill compute opens up in the cluster, and the platform has room to make retrieval free—trading higher resource utilization for developer activity. This is not charity; it is a natural result of a shift in the supply-and-demand structure of compute.

    3. Cost Estimation: Why “Free Retrieval” Does Not Mean “Free Usage”

    What developers care about most is the bill. A simplified model can estimate it:

    1. Cost per request ≈ input token price × (system prompt + conversation history + retrieved snippets + user question)
    2. + output token price × generation length
    3. + fixed cost of retrieval and fetching (0 this time)

    Assume 8,000 tokens of retrieved snippets, 2,000 tokens of history and system prompt, and 500 output tokens. The input-to-output ratio is about 20:1. Even with retrieval free, input token cost still accounts for more than ninety percent of the total. What really determines the bill is not “how many searches” but “how much content is stuffed in each time.”

    So the optimization direction is clear: compress the context, reduce repeated prefill, and improve cache hit rate.

    4. Engineering Practice: Turning the Free Bonus into Performance and Cost Advantages

    1. Rerank and trim retrieval results. Recall a larger set of candidates first, then use a reranking model or rules to filter down to the three to five most relevant; extract passages by paragraph rather than stuffing in whole articles. This can usually compress the context by more than half.
    2. Keep the prefix stable and reuse the cache. Put the system prompt, tool descriptions, and fixed knowledge at the very front of the prompt and keep it byte-level stable so the prefix cache can be reused; move volatile content such as timestamps and random IDs to the end.
    3. Segment context and summarize. Summarize long documents offline into structured key points, and inject only the relevant points at runtime, avoiding repeated prefill of the full text on every request.
    4. Stream output and control timeouts. The retrieval chain carries external uncertainty, so set fetching timeouts, content length limits, and fallback strategies; fall back to no-retrieval mode on failure.
    5. Observability. Instrument input tokens, output tokens, cache hit rate, and retrieval latency separately, and use monitoring alerts to locate abnormal growth.

    An illustrative call structure is shown below (pseudocode, expressing only the layering idea):

    1. def answer(query):
    2. docs = search_and_fetch(query, top_k=5, max_chars=6000)
    3. context = build_prompt(system=STABLE_PREFIX, docs=rerank(docs, query))
    4. return model.chat(context, stream=True, max_tokens=800)

    5. The Right Approach to Rate Limiting

    If the platform’s goal is to protect decode compute, the reasonable means are limiting concurrency, single-response output length, and request frequency. If the goal is to control prefill pressure, it will constrain ultra-long contexts, history window length, and total input tokens per unit of time. Observing a platform’s rate-limiting dimensions lets you infer which type of compute is currently most constrained. The takeaway for developers: do not build business stability on “unlimited context length”; instead, use segmentation, caching, and summarization to keep input size within a predictable range.

    6. Rethinking the Relationship Between Free and Paid Users

    The original discussion raised a practical question: when a platform tightens heavy, low-value, or high-consumption free usage, the experience for paid users actually improves. From a resource-scheduling perspective, this is not contradictory. Free traffic is not all “low value,” but it does include usage with extremely high input-to-output ratios that repeatedly trigger prefill. Governing this portion of the load well lets spare cluster compute turn into longer context quotas, higher concurrency limits, or lower unit prices. The rational approach is to watch changes in billing dimensions and rate-limiting rules rather than taking sides emotionally.

    7. Conclusion and Action Checklist

    • Free retrieval is essentially a migration of billing items, with the cost center shifting to input tokens.
    • Prefill is the main compute bottleneck; optimizing context means optimizing the bill.
    • Land five practices: reranking and trimming, prefix caching, offline summarization, streaming output, and observability.
    • Watch the platform’s rate-limiting dimensions to judge where its compute is constrained, and design business chains that can degrade gracefully.
    • On compliant cloud platforms such as Baidu AI Cloud, you can combine general capabilities like object storage, message queues, log services, and monitoring alerts to build a stable retrieval-augmented production environment.