The Engineering Logic Behind Search API Pricing

    This article breaks down what "billing per successful request" actually means for search and content-fetch APIs, and why the headline price is only the starting point. It shows how to convert a per-thousand-call rate into per-request, per-task, and monthly budget figures with a redundancy factor, how to read dual-dimension relevance and authority scores as quality signals, and how to wrap retrieval in a replaceable capability layer with threshold filtering. It also covers cost control through hit rate rather than discounts, the offline evaluation set you need before launch, and the compliance and vendor risks that low prices do not remove.

    1. Behind the Pricing: Why Search Is Billed per Successful Request

    A new pricing signal has appeared in the market: search and content-fetch APIs offered at roughly 5 CNY per thousand successful requests, which works out to about 0.005 CNY per call. Compared with the common per-call schemes on the market (usually a few cents to a few tenths of a currency unit per call, and often higher once overseas options are converted), this sits at the very low end. For developers, though, the point worth attention is not that it is cheap, but the engineering assumptions and integration constraints this billing model implies.

    “Billing per successful request” usually means only results that match the contract on the server side are counted. Parameter errors, authentication failures, and rate limiting are generally not billed. This design shifts the cost of failure from the user side to the platform side, which in turn requires the platform to have stable capacity and well-defined error semantics. For the caller, the bill becomes predictable, but you must still distinguish precisely between “no results” and “the call failed,” otherwise budget attribution will be off.

    2. Converting Unit Price into a Budgetable Metric

    Unit price is only the starting point. Engineering work needs three derived metrics:

    • Cost per call: the per-thousand price divided by 1000. 0.005 CNY per call is a typical magnitude.
    • Cost per task: a single user request often triggers multiple retrieval paths (for example, a main query plus a rewritten query plus a fallback query), so estimate it as “number of retrievals × cost per call.”
    • Monthly budget: daily active users × retrievals per user × cost per call × 30, plus a redundancy factor (1.3 to 1.8 is recommended) to cover retries and traffic spikes.

    Illustrative estimate (method demonstration only, not data from any product):

    1. 100,000 requests per day, averaging 2.2 retrieval paths per request
    2. Daily retrievals = 100,000 × 2.2 = 220,000
    3. Daily cost = 220,000 × 0.005 = 1,100 CNY
    4. Monthly cost ≈ 1,100 × 30 × 1.5 (redundancy) ≈ 49,500 CNY

    The conclusion is straightforward: at an extremely low unit price, cost optimization shifts from pushing the unit price down to pushing ineffective calls down. Hit rate, deduplication rate, and rewrite quality are the real levers on the bill.

    3. Reading Quality Signals in the Response Structure

    Each retrieval result carries two scores: an overall relevance score from 0 to 3 (combining relevance, authority, and freshness, with 1.5 typically treated as the threshold for good quality), and an integer authority score from 0 to 4 (-1 means unknown, with 3 or above typically treated as high authority). Setting aside the specific naming, this kind of two-dimension scoring is a common practice for retrieval services, and its value is turning “ranking” into something “decidable.”

    Recommended usage in engineering:

    1. Two-layer filtering: filter noise by the relevance threshold first, then decide citation priority by the authority threshold.
    2. Dynamic thresholds: Q&A scenarios can relax the relevance threshold to widen recall; medical, financial, and legal scenarios should tighten the authority threshold.
    3. Missing-value policy: when authority is -1, do not discard the result outright; downgrade it to “reference only” and flag the uncertainty in the frontend.
    4. Do not compare scores across queries: score distributions differ per query, so thresholds should be determined from offline evaluation on your own samples rather than hardcoded from experience.

    4. Integration Architecture: Make Search a Replaceable Capability Layer

    Low prices make it feasible to call more, but the architecture must avoid being locked to a single source. The recommendation is to wrap retrieval in an internal capability layer that exposes a unified contract upward and adapts to multiple providers downward:

    1. # Example: unified retrieval contract and threshold filtering
    2. from dataclasses import dataclass
    3. from typing import List
    4. @dataclass
    5. class Doc:
    6. title: str
    7. url: str
    8. snippet: str
    9. relevance: float # 0~3
    10. authority: int # -1~4
    11. class SearchProvider:
    12. def search(self, query: str, top_k: int = 8) -> List[Doc]:
    13. raise NotImplementedError
    14. def filter_docs(docs: List[Doc],
    15. rel_min: float = 1.5,
    16. auth_min: int = 3) -> List[Doc]:
    17. primary = [d for d in docs if d.relevance >= rel_min and d.authority >= auth_min]
    18. secondary = [d for d in docs if d.relevance >= rel_min and d.authority < auth_min]
    19. return (primary + secondary)[:8] # high authority first, the rest as fallback

    Supporting engineering constraints include: separating interface timeouts from retries (retry only idempotent queries), issuing concurrent requests to multiple providers and taking the first result (to hedge against jitter), result caching (normalized query plus a time window), and full-chain logging (recording retrieval counts, the proportion meeting thresholds, and the empty-result rate).

    5. Cost Control: Save Money with Hit Rate, Not Discounts

    • Query normalization: unify case, full-width and half-width characters, whitespace, and punctuation; this can significantly reduce duplicate calls.
    • Semantic caching: build normalized keys for high-frequency phrasings and set a TTL matched to content freshness; short TTL for news, long TTL for encyclopedia-style content.
    • Cascaded retrieval: go local/cache first, then the main retrieval, and only then trigger the fallback retrieval, avoiding “firing all paths every time.”
    • Budget guardrails: set per-tenant per-minute and per-day call limits, and serve degraded results instead of returning errors once exceeded.
    • Separate batch from streaming: route offline batch jobs through a low-priority queue and reserve quota for online interaction.

    6. Quality Evaluation: The Offline Eval Set You Need Before Launch

    No matter how low the price, you should not experiment with live traffic. Build a labeled query set of 200 to 1000 items covering four categories: synonymous rewrites, long-tail queries, freshness-sensitive queries, and ambiguous queries. Measure Recall@K, the effective rate after threshold filtering, the empty-result rate, and citation accuracy. Every time you adjust a threshold or switch providers, run the same evaluation to form a comparable baseline. Also monitor “score distribution drift”: if a provider’s average relevance score keeps declining, it often means the index was updated or the recall strategy changed, and should trigger an alert.

    7. Risk and Compliance: Low Price Does Not Mean No Constraints

    • Content compliance: crawling and citation must respect the target site’s terms and robots conventions, and avoid overstepping on caching and redistribution.
    • Data minimization: if queries contain personal information, redact it before it enters the retrieval layer, and avoid logging raw text.
    • Vendor risk: a single provider’s price advantage can change, so always keep a switchable adapter layer and a degradation path.
    • Cost attribution: write the “failed calls are not billed” rule into your monitoring definitions so network errors are not counted as business cost.

    8. Implementation Checklist

    1. Define a three-tier cost model (per call, per task, monthly) and set a redundancy factor.
    2. Use two-dimension scoring for two-layer filtering, with thresholds coming from offline evaluation rather than experience.
    3. Establish a unified retrieval contract and multi-provider adapters, keeping the ability to switch and degrade.
    4. Reduce ineffective calls with caching, query normalization, and cascaded retrieval.
    5. Put offline evaluation and score-drift alerts in place before launch to form a sustainable quality loop.

    Overall, an extremely low unit price turns search from a scarce resource into an orchestrable foundational capability, and the real competitive edge shows up in call strategy, quality judgment, and stability design. If an organization already uses related Baidu AI Cloud capabilities (such as log services, monitoring and alerting, message queues, and container platforms), the retrieval layer and budget guardrails described above can sit directly on infrastructure that is observable and elastically scalable, giving a more controllable balance between cost and effectiveness.