How Developers Should Calculate Costs as Search and Web Scraping Shift to Token-Based Billing
With AI platforms shifting server-side search and web scraping costs from per-call fees to token-based billing, developers must reassess their application expenses. This article breaks down the new billing boundaries, compares the pros and cons of per-call versus token-based models, provides a mathematical breakdown using specific examples to identify the cost break-even point, and outlines the impact on application architecture and technical decision-making.
1. Background: Why Search and Scraping are Shifting to Token-Based Billing
When building AI agents, models frequently need to fetch real-time information, such as stock prices, news, policy texts, and web content. Previously, these external capabilities were treated as add-ons and charged per call. As application scenarios became more complex, the number of calls surged, making bills hard to predict. Developers had to constantly trade off between cost control and feature richness.
Recently, an AI platform adjusted its billing rules. Starting at 12:00 PM on November 18th, server-side search and web scraping triggered during model calls will no longer be charged separately per call. Instead, the tokens of the scraped content will be counted towards model usage and billed alongside regular input and output tokens. This adjustment changes the cost composition, requiring developers to recalculate their expenditures.
2. New Rule Boundaries: What Changed and What Didn’t
Only by understanding these boundaries can you predict how your bill will change.
Model-Triggered Search and Scraping: Search and scraping initiated autonomously by the model or via tool-calling protocols are no longer charged per call. Input tokens generated when search results enter the context, as well as output tokens consumed by the model to generate a response, are counted as model usage. For example, if a user asks, “What is today’s closing price of stock X?”, the model automatically searches for the market data and generates a response. Developers no longer pay separately for the search, only for the tokens of the search results and the response.
Standalone Search API and Fetch API: Interfaces directly called by developers without going through model inference remain billed at 5 yuan per 1,000 successful requests. (Note: This price is based on the original announcement; refer to the official documentation for actual pricing.)
SDK Default Behavior: The officially pre-released SDK changed its default search method from “must explicitly declare a call” to “model decides whether to search based on context.” This lowers the integration barrier but may also increase token consumption.
3. Pros and Cons of Both Models
Per-call billing offers the advantage of fixed costs per action, simplifying budgeting. However, it has two downsides: First, when the model autonomously searches multiple times, costs scale linearly with the number of searches. Second, the fixed fee is independent of the returned content size. A very short search result and a long web page cost the same, making the cost per unit of data relatively high for small content requests.
Token-based billing ties the cost directly to the actual volume of information the model processes. Scraping a short page consumes fewer tokens and costs less. Scraping multiple long web pages consumes more tokens and costs more, but it eliminates the rigid fixed fee per search. The downside is that token consumption is difficult to predict precisely. When a model searches multiple times during complex reasoning, intermediate tokens accumulate continuously, requiring developers to control context length and search frequency more meticulously.
4. Calculating the Costs with Numbers
The following example assumes 100,000 model requests per day, of which 20% trigger a search, resulting in 20,000 searches daily. The token unit price of 0.002 yuan per 1,000 tokens is a hypothetical value for demonstration and does not represent the platform’s actual price. The table only calculates the newly added tokens from search, excluding the response tokens the model would originally generate.
| Item | Old Model (Per Call) | New Model (Per Token) |
|---|---|---|
| Daily search triggers | 20,000 times | 20,000 times |
| Search call fee per time | 0.005 yuan | 0 yuan |
| New input tokens per search (typical result) | Not counted | 2,000 tokens |
| Fee per new token | Not counted | 2000 ÷ 1000 × 0.002 = 0.004 yuan |
| Total cost per search | 0.005 yuan | 0.004 yuan |
| Daily search-related cost | 20,000 × 0.005 = 100 yuan | 20,000 × 0.004 = 80 yuan |
If each search brings back about 8,000 tokens of long web page content, the new model’s cost per search is 8 × 0.002 = 0.016 yuan, totaling 20,000 × 0.016 = 320 yuan daily, which is 3.2 times the old model. Conversely, when the new tokens are under 2,500, the new model is cheaper. The break-even point for the two models is 0.005 ÷ 0.002 = 2.5k tokens, or 2,500 tokens.
The conclusion is whether the new rule is cost-effective depends on the volume of tokens each search brings into the context; there is no one-size-fits-all answer. Developers should first calculate their average search result length and plug it into the above formula.
5. Impact on Application Architecture and Technical Selection
1. Cost Structure Shifts from Fixed to Variable
Once fixed fees become variable, costs are simultaneously affected by result length and search frequency. Application design must manage both variables.
2. Autonomous Calls Require Clear Boundaries
If the model searches autonomously, it may over-search. Developers should specify trigger conditions in the system prompt, such as only allowing searches when involving time-sensitive information like dates, prices, or news. Additionally, limit the number of searches and control the maximum length of scraped content to prevent entire web pages from being stuffed into the context.
3. Standalone APIs Still Have Value
Tasks like data collection, sentiment monitoring, and regular snapshots do not require model inference for each action. In these scenarios, standalone APIs remain a more predictable and often more cost-effective choice compared to routing everything through the model’s context.
