How Are Web Search Q&A Costs Actually Calculated?
A practical breakdown of what "free web search" really means for LLM applications. Learn how costs split across model inference, tool calls, and data transfer, compare built-in retrieval versus a self-orchestrated pipeline, and see sample math for 1,000 requests, scaling inflection points, cost-reduction levers, and budget guardrails.
1. First, Correct a Common Assumption: The Tool Fee Is Free, Not the Inference Fee
When a cloud provider announces that it is opening App-side capabilities such as web search, web page fetching, and file parsing to APIs, and that server-side retrieval triggered during model calls will no longer be billed separately, many teams immediately conclude that “web search Q&A is going to be free.” That conclusion is wrong. It conflates two completely different billing targets into one thing.
Break a single web search Q&A request apart, and the cost can only come from three places:
- Model inference fee: billed by input and output tokens, usually with a distinction between cache hits and cache misses;
- Tool call fee: actions such as search and fetch are billed by “number of successful requests”;
- Data transfer and surrounding resource fee: general cloud resources such as logs, monitoring, object storage, and message queues, billed under their own rules.
“Free tool fees” applies only to item 2. Item 1 is charged in full. More importantly, web search stuffs a large amount of external text into the context, so input tokens expand significantly. The tool fees you save may be overtaken by the newly added input token fees. So the right question is not “is search expensive,” but “what is the total bill for this entire task.”
2. Two Integration Approaches, Two Completely Different Bills
In the industry, there are essentially only two ways to build web search Q&A, and their cost models are fundamentally different.
Approach A: Let the Model Use Retrieval Itself (Built-in Web Search)
The developer sends a single request. During inference, the model decides on its own whether to retrieve, what to retrieve, and which page to read. The server side completes the search and fetch, and merges the results into the context to continue inference.
- Tool fee: 0 (within the scope of the free policy)
- Model fee: charged normally. The input includes “the original question + system prompt + conversation history + fetched web page text + templates and tool descriptions”
- Advantage: extremely low integration cost, no need to maintain your own retrieval pipeline
- Risk: token usage cannot be precisely estimated, and whether it actually went online can only be seen from call records
Approach B: The Program Orchestrates Retrieval Itself (Self-Built Pipeline)
Business code first calls the search API to get a result list, then calls the fetch API to get the page text, cleans and truncates it, stitches it into the prompt, and finally feeds it to the model all at once.
- Tool fee: billed by successful requests. Text search and web page fetching are usually each priced at “a few yuan per thousand successful requests.” Failures, timeouts, and empty results are not billed.
- Model fee: charged as well, and the input additionally contains the text you stitched in yourself.
- Advantage: every step can be cached, trimmed, and audited, and the cost is predictable.
- Risk: the pipeline is long with a large failure surface, and engineering complexity is high.
The conclusion is clear: choosing a solution based only on the “price per million tokens” will inevitably produce a wrong calculation. You must put the model fee, search fee, and fetch fee on the same bill.
3. 1,000 Web Search Q&A Requests, Calculated Line by Line
The following estimates use generic unit price assumptions, only to demonstrate the calculation method. They do not represent any vendor’s actual pricing. Please refer to the official pricing page.
Assume a general-purpose large model charges input at “1 yuan per million tokens for cache misses / 0.02 yuan per million tokens for cache hits” and output at “4 yuan per million tokens,” doubling during peak hours (input 2 yuan / 0.04 yuan, output 8 yuan). Peak hours generally refer to the two business-concentrated periods during weekday daytime and evening; the rest are off-peak periods.
Single-task assumption: 6,000 cache-miss input tokens + 1,000 billed output tokens (including thinking usage), no retries, no other paid services used.
- Total for 1,000 requests: 6 million input + 1 million output
- Off-peak: 6 × 1 + 1 × 4 = 10 yuan
- Peak: 6 × 2 + 1 × 8 = 20 yuan
- Per request: about 0.01 yuan / 0.02 yuan
Self-built pipeline comparison: under the same model usage, the model fee is unchanged, but you must additionally add the successful request fees for search and fetch. If each task triggers an average of 1 search + 2 fetches, estimated at “5 yuan per thousand successful requests,” the tool fee is about 15 yuan, for a total of about 25 yuan off-peak and about 35 yuan at peak. The gap does not come from a model price cut, but from a different integration approach.
It must be emphasized: 6,000 input is the entire billable input for the whole task, not that first sentence from the user; whether the model actually went online can only be determined by call records. The above are all budgeting assumptions, not measured values.
4. Usage Scaling: Linear Extrapolation and Inflection Points
A single-point estimate has no decision value. Just scale linearly at the same unit price:
| Input per task | Output per task | Off-peak (1,000 requests) | Peak (1,000 requests) | Self-built pipeline off-peak (incl. tool fees) |
|---|---|---|---|---|
| 6000 | 1000 | 10 yuan | 20 yuan | about 25 yuan |
| 12000 | 1000 | 20 yuan | 40 yuan | about 35 yuan |
| 6000 | 2000 | 14 yuan | 28 yuan | about 29 yuan |
| 24000 | 2000 | 40 yuan | 80 yuan | about 55 yuan |
Two inflection points are worth remembering:
- When input doubles, the model fee doubles linearly, but the self-built pipeline’s tool fee stays unchanged, so the self-built approach is actually more cost-effective in long-context scenarios;
- Doubling output usually has less impact on total cost than doubling input, because in web search scenarios input is far larger than output.
5. Four Levers to Bring Costs Down
- Caching: put the system prompt, tool descriptions, and fixed background in the prefix. The input unit price for cache hits may be only a few hundredths of a cache miss. This is the biggest saving point in long-context scenarios.
- Time-of-day scheduling: put offline batch processing, daily report generation, and knowledge base rebuilding in off-peak periods, and the cost is cut in half directly.
- Context trimming: denoise and truncate fetched page text first, keeping only paragraphs relevant to the question; keep retrieval results to a single-digit number of items.
- Output constraints: limit the maximum output tokens, turn off unnecessary deep thinking, and use structured templates to reduce redundant expression.
Illustrative pseudocode:
def estimate_cost(tasks, in_tok, out_tok, peak=False, self_hosted=False,search_calls=1, fetch_calls=2):in_price = (2 if peak else 1) * 1e-6out_price = (8 if peak else 4) * 1e-6model = tasks * (in_tok * in_price + out_tok * out_price)tools = 0 if not self_hosted else \tasks * (search_calls + fetch_calls) * 5 / 1000return round(model + tools, 2)
6. Budget Guardrails and Observability Checklist
- Record per request: whether web search was triggered, input/output tokens, cache hit status, and number of successful tool calls;
- Set a per-task token cap and daily budget alerts, and automatically downgrade to non-web-search mode on abnormal usage;
- Deduplicate retrieval results and apply frequency limits to avoid repeatedly fetching the same question;
- Use a general logging service and monitoring alerts to turn “cost per request” into a dashboard metric, instead of looking at the total bill at the end of the month.
7. Conclusion
“Free web search” is a shift in fee structure, not a drop in total cost. What really determines the bill is the integration approach, context length, cache hit rate, and call time. First write down the single-task cost model clearly, then do linear extrapolation and load-test validation, so that you can deliver a budget number at scales from 1,000 to tens of millions of requests.
