An embeddings API turns text, and on some models images or video, into vectors of numbers that place similar meanings close together. With a reranker to rescore the best matches, it forms the retrieval step of semantic search and retrieval-augmented generation.
An embedding is a list of numbers, called a vector, that represents the meaning of an input. An embedding model reads a piece of text and returns a vector of fixed length. Inputs with similar meaning produce vectors that point in similar directions, even when they share no words: reset my password and I cannot sign in to my account end up close together, while update my billing address ends up further away.
You compare two vectors with a similarity measure, most often cosine similarity. A higher score means the inputs are closer in meaning. That one operation supports semantic search, retrieval for language models, clustering, duplicate detection, recommendations and classification by nearest example.
On EmpirioLabs AI you send model and input to POST /v1/embeddings. The input is a string or a list of strings, and the response holds one vector per input in data, plus a usage object with the tokens billed. Embedding models bill input tokens only, because they generate no text.
dimensions sets the length of each vector. Larger vectors keep more detail; smaller ones cost less to store and search.encoding_format returns vectors as float arrays or as compact base64 strings.image and video parts, so a text query can retrieve matching images.output_type, and accept an instruct that describes the search task when you embed queries.Two rules keep results meaningful. Embed documents and queries with the same model and the same vector size, since vectors from different models are not comparable. Split long documents into passages that fit the model's maximum input length, and store each vector with the passage it came from. The embeddings API reference lists every field.
Vector search is fast because each document is embedded once, in advance, and a query needs only one new vector. The tradeoff is precision: the query and each document are encoded separately, so the closest vectors make a good shortlist rather than a final ranking.
A reranker reads the query and each candidate together and scores how well that candidate answers the query. That comparison is more accurate and takes more work per document, so you run it on a shortlist, such as the top 50 results from vector search, rather than on a whole collection.
On EmpirioLabs AI you send a query and a list of documents to POST /v1/reranks. The response lists each document's original index with a relevance_score from 0 to 1, most relevant first. Set top_n to return only the best few, and return_documents to include their text. Scores are relative to one request, so use them to order results rather than as a fixed cutoff across different queries. See the reranks API reference for the full request.
Retrieval-augmented generation (RAG) answers questions from your own content by placing the most relevant passages in a language model's prompt. Embeddings and a reranker form its retrieval step:
Reranking keeps the prompt short and relevant: fewer, better passages use fewer input tokens and leave more of the context window for the answer. Browse embedding models and rerankers, or try both in the Playground.
4 models, cheapest first where they share a billing unit. Each model's page has its full rate card, parameters and code.
Endpoints
/v1/embeddingsPer 1M tokens, by input rate
| Model | Input | Output |
|---|---|---|
| Text Embedding v4 Alibaba Cloud | $0.07 | - |
| Tongyi Embedding Vision Flash Alibaba Cloud | $0.09 | - |
| Tongyi Embedding Vision Plus Alibaba Cloud | $0.09 | - |
| Skylark Embedding Vision ByteDance | $0.25 | - |
1 models. Each model's page has its rate card, parameters and code.
Endpoints
/v1/reranksAn embedding model turns each input into a vector on its own, so you can compare a query against a large collection quickly. A reranker reads a query and a candidate document together and scores their relevance more precisely, so it is used on a short list of results.
No. Each model places meaning in its own vector space, so embed your documents and your queries with the same model and the same vector size.
Embedding and rerank models bill the input tokens you send. They generate no text, so there are no output tokens to bill.
It is a number from 0 to 1 that ranks documents for one query, with higher meaning more relevant. Scores are not comparable across requests, so use them to order results within a request.
Yes, with multimodal embedding models. They accept text, image and video inputs, so a text query can retrieve matching images or clips.
Text Embedding v4 lists the lowest input rate of the 4 Embeddings models priced that way, followed by Tongyi Embedding Vision Flash, Tongyi Embedding Vision Plus. The price table on this page shows each model's lowest rate and what it applies to.
Check out our pricing or reach out if you want your own model deployed on our stack.