The Real Cost of Failed Web Search Requests: A Billing Model for AI Applications
When built-in web search keeps returning "system busy" errors, developers often treat it as a downtime problem. This article reframes it as a cost modeling problem, breaking a single web-augmented query into three billing layers: model inference, search, and page fetching. It compares two integration paths, shows how to calculate costs per task and per thousand calls across peak and off-peak tiers, and outlines engineering responses such as failure classification, fallback, caching, and context trimming.
1. Stop Waiting for a “Service Restored” Notice: Turn Uncontrollable Outages into a Controllable Cost Model
Feedback like “web search never succeeds, it’s always ‘system busy’—when will it work again?” treats a capacity and scheduling problem as a timing problem. Server-side retrieval depends on external search sources, crawling pipelines, and concurrency quotas. During peak hours, queuing, timeouts, and rate limiting all surface to the caller as “busy.” For developers, the recovery time is unpredictable, but three things can be calculated in advance and built into the architecture: the cost structure of a single query, whether failed requests are billed, and how to degrade gracefully.
The conclusion first: the cost of one web-augmented query is not a single price but three stacked bills—model inference, search, and page fetching. Judging whether it is expensive by looking only at the “price per million tokens” will inevitably lead to a wrong conclusion.
2. Two Integration Paths That Should Not Share One Bill
In engineering, there are usually only two ways to integrate web capability into an application, and they are billed very differently.
Path A: Let the model call the retrieval tool autonomously. The model initiates searches and opens pages during inference. The tool actions themselves carry no tool fee, but the fetched content enters the context and is billed as tokens as usual. This path’s bill contains only the model charge.
Path B: The application orchestrates retrieval and fetching itself. The app first calls the search API for a result list, then calls the fetch API for page content. Both APIs are billed per successful request (a common industry rate is 5 CNY per 1,000 successful requests each for text search and page fetching). Failed, timed-out, or empty-result requests are not billed. The collected material is then fed to the model to generate the answer, and the model charge is settled separately.
Illustrative pseudocode showing the boundary between the two paths:
# Path A: tools are scheduled on the model side; the app only bears model usageresp = chat.completions.create(model="<model-name>",messages=[{"role": "user", "content": question}],tools=[{"type": "builtin_web_search"}], # illustrative, not a specific API)# Path B: app-side orchestration; search/fetch billed per successful requesthits = search_api(query=question) # 1 success => 1 search chargepages = [fetch_api(u) for u in hits[:3]] # 3 successes => 3 fetch chargesanswer = chat.completions.create( # longer context => more input tokensmodel="<model-name>",messages=[{"role": "user", "content": question + "\n" + join(pages)}],)
Key difference: Path A’s cost varies with “how much material the model reads,” while Path B’s cost is driven by both the “number of successful requests” and the “context length.”
3. How to Estimate a Single Task and a Thousand Calls
Take a lightweight model with built-in web search as an example. The provider typically publishes two price tiers, peak and off-peak (in CNY per million tokens). The off-peak tier is commonly 1 for uncached input, 0.02 for cache-hit input, and 4 for output; the peak tier is 2 / 0.04 / 8. Peak generally means Beijing time, weekdays 9:00–12:00 and 14:00–18:00; all other times are off-peak.
Assume a single task accumulates 6,000 uncached input tokens plus 1,000 billed output tokens (including reasoning usage), with no retries and no other billable services stacked on top:
- 1,000 tasks = 6 million input + 1 million output tokens, tool fee is 0;
- Off-peak: 6×1 + 1×4 = 10 CNY;
- Peak: 6×2 + 1×8 = 20 CNY;
- About 0.01 / 0.02 CNY per task.
Two points must be stressed. First, the 6,000 input tokens are the total billable input for the entire task, not just the user’s opening sentence. Second, whether the model actually goes online should be checked in the call logs, not judged subjectively. The above are budgeting assumptions, not measured results or official commitments.
If you switch to Path B, adding search and fetch successful-request fees on top of the same model usage, the total cost typically lands in the 30–40 CNY per thousand calls range. The difference is not a model price cut but a different integration path.
4. Double the Usage, and the Bill Scales Proportionally
| Input per task | Output per task | Off-peak (1,000 calls) | Peak (1,000 calls) |
|---|---|---|---|
| 6,000 | 1,000 | 10 CNY | 20 CNY |
| 12,000 | 2,000 | 20 CNY | 40 CNY |
| 20,000 | 3,000 | 32 CNY | 64 CNY |
Real agent tasks read a lot of material and have long reasoning chains. When the input multiplies several times over, the model fee rises roughly in proportion. Budgets should be estimated by P95 input length rather than the average.
5. Engineering Responses During Unstable Periods
- Classify failure types: handle rate limiting, timeouts, and empty results separately. Only “success” incurs search/fetch fees; failed retries need a cap and backoff.
- Multi-level fallback: when built-in web search is unavailable, degrade in order to “answer using model knowledge only, with a timeliness risk note,” “prompt the user to retry later,” and “switch to app-side orchestration.”
- Cache first: cache results and summaries for high-frequency queries, reducing both tokens and successful request counts.
- Context trimming: extract relevant passages from fetched content before feeding it to the model, avoiding unbounded input token growth.
- Observability: instrument model fees, search fees, and fetch fees separately, and use logging and monitoring alerts to pinpoint which layer the “busy” condition occurs in.
6. Conclusion
“When will it work again?” depends on the provider’s capacity scheduling and cannot be promised. But by splitting the bill into three layers—model, search, and fetch—extrapolating from a single-task assumption to a thousand-call total, and then scaling linearly by input length, you can make predictable budgeting and fallback decisions even during unstable periods. If you need managed model services with supporting logging and monitoring capabilities, you can look into Baidu AI Cloud’s general product categories, subject to their publicly stated billing and quota documentation.
