Embedding and Reranking APIs: Selection and Quota Planning

    Learn how to evaluate embedding and reranking APIs for retrieval quality, token-based costs, rate limits, and data handling. This guide covers hosted versus self-hosted deployment, quota estimation, model migration, and production controls to help assess whether a service can support indexing and real query traffic.

    Understand the Two Capabilities First

    Retrieval-augmented generation (RAG) typically involves two retrieval stages. An embedding model converts document chunks and user queries into vectors, then similarity search retrieves candidates. A reranking model scores a smaller set of candidates more precisely to determine their final order.

    Both models can come from the same provider or be sourced separately, but their evaluation, rate limits, and billing must be assessed independently. Embedding costs depend on input volume, while reranking costs also depend on the number of candidates and query length. Comparing free-tier availability alone will not tell you whether a service suits long Chinese-language documents or bursts of queries.

    Start with four questions:

    • Input modalities: Do you need text only, or also images, audio, and video?
    • Quota resets: Does the allowance reset daily or monthly, or is it defined as a fixed number of calls?
    • Limits: Are constraints based on concurrency, requests per minute, or total monthly usage?
    • Data handling: Can data submitted through the free tier be used to improve the provider’s products?

    The last question determines whether internal material can be sent to a hosted API. Pricing figures alone are not enough.

    Hosted APIs vs. Self-Hosted Models

    Open-weight models can run on your own infrastructure. The weights themselves often carry no per-call charge, but GPUs, memory, storage, and operations are not free. Cold starts, batching, and failure retries all consume compute resources.

    Hosted APIs replace those infrastructure costs with quotas and usage-based prices. They can suit early validation and infrequent tasks. However, when initial indexing, index rebuilds, and live queries overlap, a single full import may exhaust the daily allowance.

    A free tier is neither unlimited access nor a capacity or availability guarantee. Claims that it is “enough for a personal project” must be checked against actual chunk counts, average input length, and daily query volume. Evaluation keys, shared allowances, and account-level rather than application-level quotas can run out early when multiple users or scheduled jobs share them.

    If you connect to an aggregation platform using your own API key, confirm whether requests consume the platform’s promotional allowance or generate charges on your own provider account. These are separate billing sources.

    Standard and batch processing often differ in price, queueing time, and retry policies. Batch processing suits offline indexing, but latency for interactive question answering should still be estimated using the standard request path. If the pricing page lists both modes, evaluate them separately rather than using batch prices to estimate online costs.

    Budget in Tokens, Not Characters

    Budget calculations are illustrative estimates, not performance measurements. Chinese character counts are not equivalent to token counts. Chunk overlap, titles, metadata, and system prompts all add to the input.

    Do not describe an allowance as “just enough” without separately accounting for retries, other model calls, and additional rebuilds. Check the documentation for throughput and rate limits. Convert daily quota reset times from the provider’s stated time zone into your local time rather than assuming the allowance refreshes at local midnight.

    A simple estimate is:

    1. Daily input tokens ≈
    2. Number of chunks × Average tokens per chunk
    3. + Number of queries × Average tokens per query
    4. Quota units consumed ≈
    5. Daily input volume in millions of tokens × Units per million tokens

    For example, an initial index containing 10,000 chunks at an average of 500 tokens each requires 5 million input tokens. Another 1,000 queries at approximately 50 tokens each bring the daily total to about 5.05 million tokens.

    If the published pricing specifies a fixed number of quota units per million input tokens, multiply that volume by the stated rate to estimate daily consumption. This figure excludes failed-request retries and rebuilds. Before launch, leave additional headroom and confirm whether the quota is shared across the account or reserved for an individual application.

    If the provider publishes both a daily shared allowance and a per-million-token consumption rate, you can estimate the input volume the allowance might cover. Treat that calculation as a rough capacity estimate, not a service guarantee. A small monthly credit intended for occasional testing is suitable for sample calls, not full-corpus embedding.

    Evaluate Retrieval Quality Before Price

    Before comparing prices, use around 20 real, manually labeled questions to check whether the top five retrieved results contain the correct answer. Include abbreviations, synonymous phrasing, facts spread across paragraphs, and negatively phrased questions. Do not rely only on demonstration datasets.

    Documents and queries must use the same embedding model. When switching models, create a separate index and retain the previous version. Even if two models produce vectors with the same dimensions, their vectors must not be mixed in one embedding space: similarity scores would not be comparable.

    Evaluate reranking after embedding-based retrieval, using a fixed candidate set. Changing the reranker does not require rebuilding all document vectors, but ranking metrics must be recorded again. This helps avoid mistaking a decline in embedding retrieval quality for a reranking problem.

    Chunk length, overlap, and filtering conditions are experimental variables. Change only one at a time.

    Use the following migration checklist:

    • Confirm the old and new models’ input limits and normalization behavior.
    • Re-embed the entire corpus rather than mixing new vectors into the existing index.
    • Run both indexes in parallel for a period, using the same labeled questions to compare top-five retrieval and human-assessed acceptability.
    • Observe rate limiting, timeouts, and the process for embedding items left incomplete by partial failures.
    • Keep the old index available for rollback until the transition is complete.

    Log embedding, reranking, and application-level filtering latency separately. Otherwise, identifying the bottleneck becomes difficult.

    Practical Controls for Deployment

    During prototyping, prioritize reproducible request records. Save model versions, chunking settings, quotas, and daily usage—not just final answers.

    Before submitting internal data, read the data processing terms and distinguish between data used only for the current inference request and data that may be used to improve products. Free tiers may be unsuitable for contracts, customer information, or unpublished code.

    For production, assess unit prices, batch discounts, service regions, and fallback behavior during failures. If the embedding service becomes unavailable, you can temporarily pause ingestion of new documents. Do not silently switch to a model that uses a different vector space.

    Monitoring should cover at least:

    • Daily token usage
    • Error rates
    • Index rebuild progress
    • Traffic bursts after quota resets

    Supporting cloud infrastructure generally requires standard capabilities: object storage for source documents and chunks, message queues to smooth indexing workloads, container platforms for self-hosted inference, and logging and monitoring alerts to track quotas.

    If you use a managed environment such as Baidu AI Cloud, apply the same checks to embedding and reranking pricing, limits, and data terms. Do not assume that a particular free tier can support full-corpus indexing.

    The decision sequence is straightforward: validate retrieval with labeled questions, check quotas against token volume and reset cycles, and only then choose hosted, self-hosted, or hybrid deployment. Any estimate equivalent to “several million tokens per day” is merely a budgeting starting point. Recalculate it using retries, overlapping chunks, and actual query traffic.