How to Calculate the Real Cost of Web-Connected Q&A: Tool Fees vs. Token Fees
This article breaks down the true cost of web-connected Q&A by separating tool invocation fees from token fees. It compares two integration patterns—letting the model browse on its own versus orchestrating retrieval in your own code—and shows why per-million-token pricing alone cannot determine which is cheaper. You will find a baseline estimate for 1,000 requests, a linear scaling table, the crossover point between built-in and self-built retrieval, and four engineering techniques to reduce spend.
Web-Connected Q&A: Why You Should Split Tool Fees and Token Fees into Two Separate Bills
A recent industry change is easy to misread: a cloud provider announced it would open up existing in-app capabilities such as search, file parsing, link fetching, and speech through an API, and that it would subsequently remove the tool invocation fee for “search and web page fetching triggered by the server when calling the model.” Once the news spread, many people’s first reaction was “web search is now free.” But if you focus on that single point alone, you will most likely get your budget wrong.
Here is the conclusion up front: what was removed is the tool invocation fee, not the token fee. What really determines whether a web-connected Q&A request is expensive is the input context length, the output length, whether you hit the cache, and whether you choose to “let the model go online itself” or “have your program fetch the material and feed it to the model.” Put these items on the same bill, and the cost of 1,000 Q&A requests can differ by three to four times.
1. Two Integration Patterns, Two Billing Logics—Do Not Mix Them
Pattern A: Let the model schedule the web capability itself. During the answer process, the model decides it needs external information and initiates retrieval, opens web pages, and reads the body text on its own. In this case, the “retrieval and fetching” action itself incurs no tool fee, but the fetched content participates in inference as context, so it all counts as input tokens. This is also the most easily underestimated part: the user asks only one sentence, yet the bill may show thousands or even tens of thousands of input tokens.
Pattern B: Your program orchestrates the retrieval pipeline. Business code first calls a search-type API to get candidate results, then calls a web-fetch-type API to get the body text, cleans, truncates, and reranks it, stitches it into the prompt, and finally requests the model to generate the answer. These APIs are usually billed by successful request count (for example, text search and web fetching are each priced at a certain amount per thousand successful requests); failed, timed-out, or empty-result requests are generally not counted, and model fees are settled separately.
To summarize the difference in one sentence: Pattern A pushes the cost onto tokens, while Pattern B splits the cost into “search fee + fetch fee + a more controllable token fee.” Therefore, looking only at the “per-million-token unit price” cannot tell you which approach is better; you must do a full-pipeline calculation.
2. Baseline Estimate for 1,000 Built-In Web-Connected Q&A Requests
Take a general-purpose text model that supports built-in web access as an example. A common tiered pricing structure in the industry looks like this (unit: CNY per million tokens; this only illustrates the price structure, and the official page should be the source of truth):
| Billing item | Off-peak | Peak |
|---|---|---|
| Input, cache miss | 1 | 2 |
| Input, cache hit | 0.02 | 0.04 |
| Output | 4 | 8 |
Peak hours usually refer to several hour ranges during weekday daytime and afternoon; the rest of the time falls into the off-peak tier.
Assumptions: each task accumulates 6,000 cache-miss input tokens + 1,000 billed output tokens (including reasoning usage), with no retries and no other paid services stacked on top. For 1,000 tasks, that is 6 million input + 1 million output, with a tool fee of 0:
- Off-peak:
6 × 1 + 1 × 4 = 10CNY - Peak:
6 × 2 + 1 × 8 = 20CNY
Spread across a single task, that is about 1 cent or 2 cents. Three points need emphasis: first, 6,000 input is the cumulative billable input for the entire task, not the length of the user’s single question; second, whether the model actually went online for a given call should be judged by the call logs, not by subjective impression; third, this is a budgeting assumption, not measured data, and not a commitment from any vendor.
3. Linear Extrapolation as Usage Scales, and the Inflection Point
When the unit price stays unchanged, cost grows linearly with usage and can be scaled up directly by proportion:
| Input per task | Output per task | Off-peak (1,000 requests) | Peak (1,000 requests) |
|---|---|---|---|
| 6000 | 1000 | 10 CNY | 20 CNY |
| 12000 | 1000 | 20 CNY | 40 CNY |
| 12000 | 2000 | 28 CNY | 56 CNY |
| 30000 | 2000 | 62 CNY | 124 CNY |
The real inflection point appears where “self-built retrieval pipeline” crosses “built-in tools.” In Pattern B, if each Q&A request triggers an average of 3 searches and 5 fetches, estimated at 5 CNY per thousand successful requests, the tool-side cost is about (3+5)/1000 × 5 × 1000 = 40 CNY, and adding the model fee on top can easily exceed the built-in approach’s 10–20 CNY. Conversely, if you can compress retrieval and fetching to 1–2 times and improve the cache hit rate, Pattern B is actually cheaper in long-context, multi-round deep-reading scenarios, and the context is cleaner and more controllable.
4. Four Categories of Engineering Techniques to Push Costs Down
- Context budget and truncation strategy. Set a hard cap for web results (for example, 1,500 characters per document, 6,000 tokens injected in total), and prioritize keeping titles, summaries, and key paragraphs rather than dumping the entire page body.
- Prompt prefix caching. Put system instructions, tool descriptions, and fixed knowledge blocks at the very front and keep them byte-for-byte stable, so cached input is billed at about 1/50 of the price; the benefit is most obvious in scenarios with long fixed prefixes.
- Batching and off-peak scheduling. Move offline summarization, knowledge ingestion, and batch Q&A to off-peak hours, which directly halves the cost; keep only the parts that truly require real-time behavior in the online pipeline.
- Observability so failures are not billed repeatedly. Record the success/failure of each request, the number of searches, the number of fetches, and the input/output tokens, and produce bills with a consistent standard, avoiding vague judgments of “feels cheap/expensive.”
The illustrative accounting logic can be very simple:
# Pseudocode: cost aggregation for a single web-connected Q&A requestdef cost_of(task):in_tok, out_tok = task.input_tokens, task.output_tokens # includes injected retrieval resultscached_ratio = task.cached_input / max(in_tok, 1)model_fee = (in_tok * (1 - cached_ratio) * P_IN+ in_tok * cached_ratio * P_IN_CACHE+ out_tok * P_OUT) / 1_000_000tool_fee = (task.search_ok + task.fetch_ok) / 1000 * P_TOOL # successful requests onlyreturn model_fee + tool_fee
5. Selection Recommendations
- Short Q&A, unpredictable number of retrievals, and a desire for zero operations: prioritize built-in web access, where cost is predictable and the tool fee is 0.
- Need to precisely control sources, perform reranking and deduplication, and do deep reading of long documents: build your own retrieval pipeline, accepting the tool fee in exchange for quality and controllability.
- Either way, first establish “cost per task” as the North Star metric, then talk about optimization.
Finally, a reminder: the prices and tiers in this article are only used to demonstrate the calculation method. For actual billing items, unit prices, and the definition of peak hours, refer to the official billing documentation of the cloud platform you choose. If you use the relevant models and search-type capabilities from Baidu AI Cloud, it is likewise recommended to first run a small-traffic test using the approach above, then scale up to production.
