Embedding and Rerank Model API Selection: A Practical Guide
This guide explains how to choose and operate Embedding and Rerank model APIs for RAG, semantic search, and knowledge base Q&A. It breaks down the responsibilities and evaluation metrics of both model types, shows a general method for estimating free-tier quotas and costs, and highlights data usage terms, index consistency, and chunking details. It also includes a selection checklist and engineering practices for keeping retrieval quality stable while controlling cost.
1. Background: Why “Free Quota” Does Not Mean “Unlimited Use”
In retrieval-augmented generation, semantic search, and knowledge base Q&A, vectorization (Embedding) and reranking (Rerank) usually work as a pair. Embedding maps text into dense vectors and quickly recalls candidates from a large pool; Rerank reorders the recalled results to improve hit rates at the top positions. When selecting services, developers most often ask which services are available and whether they offer a free quota. However, what really determines whether a project runs reliably is the quota conversion method, rate limiting policy, data usage terms, and migration cost.
One premise must be clear first: open-weight models can be self-deployed, but compute, storage, and operations are not free; a trial quota on a hosted API does not mean unlimited calls. Any judgment that “it is enough for a personal project” must be calculated against real call volume, retry rate, and rebuild frequency. It is not a capacity commitment and does not constitute a service guarantee.
2. Capabilities: Responsibilities and Evaluation Metrics of the Two Model Types
The core metrics of an embedding model are recall quality, dimensions and maximum input length, the range of multimodal support, and whether a batch API exists. Engineering considerations also include the text limit per request, the maximum number of items per batch, concurrency and rate limits, whether normalization is supported, and whether the returned vector dimension is configurable.
A rerank model usually takes query-document pairs as input and outputs relevance scores or an ordering. Its value is correcting semantic bias in vector retrieval, but the cost is that cross-encoding computation is required every time, with significantly higher latency and cost than embedding. A common practice is therefore to recall the top N candidates coarsely, then rerank to the top M, forming a funnel structure.
For evaluation, it is recommended to build a small annotated set: prepare twenty real business questions, manually annotate the documents expected to be hit, and observe whether the target appears in the top five recalls. This step is inexpensive but extremely effective, and it can quickly reveal degradation when switching models or chunking strategies.
3. A General Method for Estimating Quota and Cost
Free-tier policies vary widely across vendors: some offer a free tier with a certain quota, some give a very small monthly trial credit, some bill by “compute units” rather than tokens, and some enforce dual limits on call count and rate. Regardless of the form, the estimation can be abstracted into three steps.
Step one: unify everything to a token basis. Chinese character count and token count are not equivalent, and chunk overlap adds extra input, so you should measure the average token count from real samples rather than estimating by character count.
Step two: convert using the “compute units per million tokens” factor. An illustrative example: the initial index build has ten thousand chunks averaging five hundred tokens each, and one thousand new queries are added that day at fifty tokens each, so the total is
10000 × 500 + 1000 × 50 = 5,050,000 token
If the conversion factor is 1075 compute units per million tokens, the consumption that day is about
5.05 × 1075 ≈ 5428.75 compute units
If the account shares ten thousand compute units per day, it may look like there is ample headroom, but this is only a budget example, not a performance measurement, and it does not account for failed retries, calls to other models, or extra rebuilds.
Step three: confirm the reset time zone and rate-limiting dimensions. On many platforms, the daily quota resets at midnight UTC (8:00 a.m. Beijing time), while throughput and concurrency must be checked separately in the documentation. Because reranking is billed per query-document pair, its cost scales linearly with the number of candidates and must be modeled separately.
4. Data Terms and Compliance: An Easily Overlooked Layer
Free tiers often come with conditions, for example that input content may be used for product improvement; some platforms allow you to bring your own vendor key, so the platform’s gifted quota is not consumed. When dealing with enterprise documents, customer information, or regulated data, prefer options that explicitly do not use data for training and that offer regional storage and audit logging, and write data classification, masking, and retention policies into the design document. If you use general capabilities on a public cloud, you can build a closed loop with common categories such as object storage, key management, logging services, and monitoring alerts, avoiding putting sensitive source text directly into the request body.
5. Index Consistency: Switching Models Requires a Rebuild
The embedding model determines the geometry of the vector space. Documents and queries must use the same model and the same preprocessing; even if two models have the same dimension, their vectors must never be mixed. The recommended approach is versioned indexes: write the new model into a separate index, keep the old version for comparison and rollback, and switch gradually through traffic canary.
# Example: index versioning and canary switchindex_version = "v2" # bound to the embedding_model versioncollection = f"kb_{index_version}"def upsert(chunks):vecs = embed(chunks, model="embedding-v2")store.upsert(collection, ids=chunk_ids(chunks), vectors=vecs)def search(query, ratio=0.1):q = embed([query], model="embedding-v2")[0]hits = store.search(collection, q, top_k=50)return rerank(query, hits, top_n=5) # rerank only handles a few candidates
6. Engineering Details of Chunking and Recall
Chunk granularity affects the recall ceiling: chunks that are too large dilute semantics, while chunks that are too small break context. A common strategy is to split at semantic boundaries with a small overlap, and attach metadata such as title and section path to each chunk for filtering and reranking. In the recall stage, combining keyword retrieval with vector retrieval and then scoring uniformly with reranking can noticeably ease exact-match needs such as proper nouns and model numbers.
7. Selection Checklist
- Does it support the required modalities (text, image, audio, video) and is Chinese performance verified;
- Is the free quota based on tokens, compute units, or call count, and what time zone is used for reset;
- Is there a batch API and rate limit, and do retries amplify consumption;
- Is data used to improve the service, and can you bring your own key or choose a region where data is not persisted;
- Do the rerank candidate scale and latency budget match the business;
- Are index versioning, canary, and rollback mechanisms available;
- Is a small annotated set and online monitoring metrics (recall hit, post-rerank click, failure rate) prepared.
8. Conclusion
The core of selection is not finding the API with the “most free” quota, but putting quota conversion, rate limiting, data terms, and migration cost into the same budget table. Use a self-built annotated set to drive evaluation, use versioned indexes to guarantee rollback, and use a funnel structure to control rerank overhead, so that stable retrieval quality is achieved under controllable cost. General cloud capabilities from vendors such as Baidu AI Cloud can serve as the foundation for such a pipeline, but specific billing and quotas should still be verified in real time against the official documentation.
