POST /v1/embeddings
Embeddings API: OpenAI-compatible vectors, processed in the EU
The embeddings endpoint turns text into vectors of numbers that capture its meaning, so that similar passages end up close together. It is the foundation of semantic search, retrieval-augmented generation, deduplication and clustering. The request format matches OpenAI's, and the documents you embed, often your most sensitive data, are processed in European data centres.
- 01API format: OpenAI
- 02EU data centres
- 03Covered by one DPA
curl https://api.inference.eu/v1/embeddings \
-H "Authorization: Bearer $INFERENCE_EU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-embedding-8b",
"input": [
"Die Kündigungsfrist beträgt drei Monate zum Quartalsende.",
"The notice period is three months to the end of a quarter.",
"Le préavis est de trois mois avant la fin du trimestre."
],
"dimensions": 1024,
"encoding_format": "float"
}'What the endpoint does
POST /v1/embeddings takes a model and an input, which is either one string or an array of strings, and returns one vector per input. The response has a data array in which each item carries an index matching the position of the input, and an embedding, a list of floats. usage reports the prompt_tokens used.
Multilingual models such as qwen3-embedding-8b place a German, an English and a French sentence with the same meaning close to each other, so a question in one language finds documents in another. That matters for European companies whose contracts, tickets and wikis are rarely in one language.
Key request fields
Send batches rather than one string per request: an array of inputs is processed together and is far more efficient. Each input must fit within the model's maximum input length, so split long documents into chunks first.
dimensions shortens the vector on models trained to support it, such as the Qwen3 embedding family. Shorter vectors take less storage and make search faster, with a small loss of accuracy; test 512 or 1024 against the full size on your own data. encoding_format can be float or base64; base64 makes large responses smaller over the network. Always use the same model and dimension for documents and queries.
A practical RAG pattern
A typical retrieval pipeline converts documents to clean text, splits them into chunks of a few hundred tokens with some overlap, embeds each chunk and stores the vectors with the source text in a vector database such as pgvector, Qdrant or Weaviate. At query time, embed the question, fetch the 20 to 50 nearest chunks by cosine similarity, and pass them to a reranker to keep the best five or so.
Then give those chunks to a chat model as context. For Qwen3 embeddings, prefix queries with a short task instruction, as the model card recommends, and embed documents without it. Run initial indexing of large collections through the batch API.
Errors and edge cases
An input longer than the model's limit returns a 400 error rather than being silently cut, so chunk before you send. Empty strings are rejected too; filter them out. Sending a chat model id to this endpoint returns an error that names the model type, and an unknown id returns 404.
Vectors from different models, or from the same model at different dimensions, cannot be compared. If you change either, re-embed the whole collection. Most models return normalised vectors, so cosine similarity and dot product give the same ranking. Retry 429 responses with backoff, and spread large indexing jobs over time or use batches.
Embeddings: common questions
The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.
Related
- RerankRe-order search results by relevance with a rerank API for RAG. Cross-encoder reranker models such as bge-reranker-v2-m3, processed in EU data centres.Endpoints
- Document conversionConvert PDF, Word, PowerPoint and Excel files to clean Markdown for RAG and LLM prompts. Tables, headings and scanned pages, processed in the EU.Tools
- BatchesRun thousands of chat or embedding requests as one asynchronous job with an OpenAI-compatible batch API. Upload JSONL, collect results, all in the EU.Endpoints
- List modelsList the open-weight models your inference.eu key can use with GET /v1/models, in the OpenAI format. Pick model ids for chat, embeddings, speech and more.Endpoints
Move your AI workloads to EU infrastructure
Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.
- Reply within one working day
- Pricing for your volume
- DPA ready to sign