Skip to main content
Docs · API reference

Embeddings and rerank

POST /embeddings and POST /rerank. The policy's pool decides the model; `auto` takes the first one of that type.

Browse docs · API referenceEmbeddings and rerank
On this page
  1. Embeddings
  2. Request
  3. Example
  4. Response
  5. Policy
  6. Rerank
  7. Request
  8. Example
  9. Response
  10. Policy
  11. Errors

Neither endpoint routes. A vector index is only comparable to vectors from the model that built it, and a relevance score means something only against other scores from the same model, so nothing here chooses a model on evidence.

What a request may name is the routing policy's pool, the same pool chat models live in. Name a model the pool holds, or send auto and get the first model of that type in the pool's order. The model that served is in the response.

Embeddings

Method and pathPOST /embeddings
PurposeEmbeddings from the served embedding catalog, OpenAI shape.
AuthenticationAPI key or session
Limitsinput is a string or a list of up to 512 strings. Billed on input tokens.

Request

FieldMeaning
modelAn embedding model the policy's pool holds, or auto for the first one in it. Required.
inputA string or a list of strings.
encoding_formatfloat or base64.
dimensions, userForwarded when set.
input_type, task, task_type, title, output_dimension, embedding_types, normalized, truncateProvider-specific parameters that are part of an embedding's identity, forwarded untouched for the provider to accept or reject.

A misspelled field is a 422, as on chat completions.

Example

bash
curl https://api.inferbase.ai/api/v1/inference/embeddings \
  -H "Authorization: Bearer inf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen3-Embedding-4B",
    "input": ["first text to embed", "second text to embed"]
  }'

Response

The OpenAI shape: data carries one embedding per input, in input order, and usage carries input tokens. The response adds served_by: the provider, the route, and whether the policy pinned the provider or the call fell back to another. Tag an index with it, because the same model on another host is not the same embedding space.

Policy

The pool decides. A model outside it is refused with 403, and auto on a pool holding no embedding model is refused the same way, naming the pool. When a model is served by more than one host, the cheapest route wins and a substitute has to be the same model and the same variant; a different quantisation is a different embedding space.

Rerank

Method and pathPOST /rerank
PurposeScore documents against a query, best first, from the served rerank catalog. Cohere shape.
AuthenticationAPI key or session
LimitsUp to 1,000 documents per call. Billed on input tokens.

The request and response follow Cohere's shape, because OpenAI defines no rerank endpoint and Cohere's is what the hosts that serve this surface mirror. Errors stay in the Inferbase envelope.

Request

FieldMeaning
modelA rerank model id from GET /models. Required.
queryThe query string.
documentsUp to 1,000 strings.
top_nKeep only the best N.
return_documentsEcho each document's text beside its score.

Example

bash
curl https://api.inferbase.ai/api/v1/inference/rerank \
  -H "Authorization: Bearer inf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen3-Reranker-4B",
    "query": "What is the capital of France?",
    "documents": [
      "Paris is the capital of France.",
      "Bananas are yellow.",
      "Berlin is the capital of Germany."
    ],
    "top_n": 2
  }'

Response

results comes back ranked. Each row carries index, into the documents you sent, and relevance_score. served_by says which provider and route scored them.

Two things to know before comparing scores. Hosts disagree about the scale even when they agree about the order, so a threshold tuned on one host is not portable to another. And not every host meters this surface; where the provider reports no token count, Inferbase bills its own estimate of what the model read, the query once per document plus the documents.

Policy

The pool decides, exactly as it does for embeddings: a model outside it is refused, and auto takes the first rerank model in it. Scores differ between hosts of one model even when the ordering agrees, so a caller comparing scores across calls should name the model rather than reorder the pool.

Errors

A chat model on either endpoint, or an embedding model on the other, is a 404. A pinned provider that is down with fallback refused is a 503. See Errors.

Last updated September 10, 2026.