Embedding and Rerank API Selection and Cost Budgeting Guide
This guide explains why Embedding and Rerank models solve different problems and carry different cost structures, then classifies the main API supply forms available on the market. It shows how to convert daily token demand into quota consumption with a reusable formula, walks through the engineering checks to run before launch, and lays out the latency and cost tradeoffs of Rerank. The goal is to help you choose a cascade architecture and budget capacity from measured usage rather than chasing the largest free tier.
1. Two Different Jobs: Embedding for Recall, Rerank for Precision
Many selection debates end in confusion because they weigh two different model types on the same scale. They solve different problems and have different cost structures.
- Embedding (vectorization): Maps inputs such as text, images, audio, and video into fixed-length vectors, used for offline index building and online approximate nearest-neighbor retrieval. Its profile is high call volume, long single inputs, and sensitivity to throughput, and cost grows roughly linearly with input tokens.
- Rerank (reordering): Takes query-plus-candidate pairs and outputs relevance scores, used to fine-order the recall results. Its profile is each call contains multiple text segments, the candidate count is fixed (commonly Top 20–100), and it is latency-sensitive, so cost scales with “candidate count × document length.”
The sensible architecture is therefore a cascade: first use Embedding for coarse recall to compress candidates down to a few dozen or a few hundred, then use Rerank for fine ordering and pass the top few to the generation model. Skipping Rerank is often not saving money—it shifts the ranking error onto downstream generation quality.
2. A Neutral Classification of Supply Forms
Setting specific brands aside, the APIs offering these two capabilities fall into roughly five forms, each with distinct constraints:
- Free tiers of international cloud vendors’ model APIs: Usually offer free calls with quotas and broad input modality support (text/image/audio/video). Two constraints matter most: free-tier content may be used for product improvement, and free and paid tiers differ in rate limits, concurrency, and data-retention policies.
- Edge/serverless inference platforms: Billed in “quota units” rather than dollars, with one shared daily allowance per account, consumed at a rate converted per million input tokens. The upside is no self-managed GPUs; the downside is a shared daily quota reset at UTC, so peak loads across time zones can hit the wall easily.
- Inference credits from model-hosting communities: Granted as a small monthly credit, suitable for low-frequency tasks and experiments; if you bring your own upstream provider key and connect directly, it typically does not consume that platform credit.
- Vertical Embedding providers: New accounts often get a one-time free token package, and multilingual support plus document parsing (including PDF and images) are common selling points—good for prototype validation.
- Model service platforms from cloud vendors: Platforms such as Baidu AI Cloud typically offer embedding and rerank as model service categories, with billing and compliance flows closer to local business scenarios—suitable for enterprises with requirements around data residency and invoicing.
Note that all of the above are general form descriptions. Specific quotas, rate limits, and billing rules change at any time, so always re-check the official pricing and rate-limit pages before integrating.
3. Free Quota Is Not Unlimited Calls: Turn the Budget into a Formula
A reusable estimation method splits the day’s total input tokens into “index build/rebuild” and “query” parts:
Daily input tokens = chunks × avg tokens per chunk + queries × avg tokens per queryDaily quota consumption = daily input tokens / 1,000,000 × quota unit price per million tokens
Consider a purely hypothetical example (the numbers only demonstrate the method and do not represent any platform’s real pricing): suppose each million input tokens consumes 1,000 quota units and the account shares 10,000 units per day. The first index build has 10,000 chunks at 500 tokens each, plus 1,000 queries that day at 50 tokens each:
Input tokens = 10000×500 + 1000×50 = 5,050,000Quota consumption = 5.05 × 1000 = 5050 units (~half of the daily quota)
This example exposes three often-overlooked facts:
- Chinese character count is not equal to token count; actual tokens are usually higher than the “word count” intuition, and chunk overlap is counted repeatedly in the input.
- Retries, failed replays, and other model calls are not in the formula above; in production, reserve a 30%–50% margin.
- Rebuilding the index is bursty consumption; a single full rebuild can eat the entire daily quota, so schedule it during off-peak hours or run it in batches.
4. Two Engineering Actions to Take Before Launch
Action 1: Run a small-sample evaluation with your own labeled real questions. Prepare 20+ questions from real business use, manually label the top 5 correct chunks for each, then inspect the recall results. Track both Recall@5 and MRR: the former measures “did we retrieve it,” the latter measures “did we rank it high enough.” The sample need not be large, but it must be real—public leaderboard scores cannot substitute.
Action 2: Documents and queries must use the same model, and switching models requires rebuilding a separate index. Even if different models output the same dimension, their vector spaces are not interchangeable, and mixing them makes similarity computation meaningless. The recommended approach is versioned indexes, old and new coexisting, with a gradual switch:
# Example: index and query are bound to the same model versionindex = load_index(model="embed-v1", dim=1024) # keep the old version for rollbacknew_index = build_index(docs, model="embed-v2", dim=1024)if recall_at_5(new_index, eval_set) > recall_at_5(index, eval_set):swap(index, new_index) # retire the old index only after this passes
5. Rerank: Latency and Cost Tradeoffs
Rerank uses a cross-encoder structure and cannot be precomputed like vector retrieval; it can only score pairs online, so the candidate count directly determines latency and cost. Practical recommendations:
- Widen recall to Top 50–100, then keep only 3–5 after fine ordering; overall this is still cheaper and more accurate than “send Top 10 recall straight to generation.”
- Truncate and deduplicate candidates to avoid long documents eating the budget.
- Set a timeout and fallback path for Rerank: on timeout, fall back to the original Embedding order to preserve availability.
- Bring Rerank call volume and P95 latency into monitoring and alerting, observed on the same dashboard as the token budget.
6. Selection Checklist
- Does the free tier allow commercial use, is content used for training, and does it meet compliance requirements?
- Is the rate limit based on RPM, TPM, or concurrency, and does the daily quota reset at UTC or local time?
- Are the required modalities and Chinese/multilingual quality supported?
- Is a batch interface available (Batch usually has a lower unit price but higher latency)?
- Can you bring your own upstream key, and is it billed separately?
- Do the vector dimension and max input length match your existing vector store?
- Is there an SLA and data-retention commitment, and what is the fallback plan when the quota is exhausted?
Conclusion: Selecting Embedding and Rerank is not about finding the “cheapest free quota.” First settle the cascade architecture and candidate scale, then use the formula to convert daily token demand into quota consumption, and finally validate quality with a self-labeled small sample and control switch risk with versioned indexes. Free tiers suit prototypes and low-frequency scenarios; production capacity and stability still need to be planned separately based on measured usage.
