Skip to content

Embeddings

Vectors through the same key, the same limits and the same bill.

4 min read

The endpoint

POST https://api.multigrid.ai/v1/embeddings, in OpenAI’s shape. Point any SDK’s embeddings.create at the base URL and it works; the response is the usual { object, data, model, usage } with a multigrid object added.

bash
curl https://api.multigrid.ai/v1/embeddings \
  -H "Authorization: Bearer $MULTIGRID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/text-embedding-3-small",
    "input": ["the first document", "the second document"]
  }'

Parameters

ParameterTypeRequiredDescription
modelstringRequiredAn EmbeddingA way of turning text into numbers so a computer can find things that mean the same, not just things spelled the same. It is how search over your own documents is built. model id. A chat model here is a 400 that names the right endpoint.
inputstring | string[]RequiredOne string, or up to 2,048 of them in an array. More than that is refused rather than silently truncated.
encoding_format"float" | "base64"OptionalPassed through to the provider.
dimensionsnumberOptionalPassed through. Whether it is honoured is the model’s business, not ours.
providerobjectOptionalThe same provider preferences the chat endpoint takes.
metadataobjectOptionalThe same request labels, stored on the row.

Models

Ask the catalogue rather than trusting a list on a page: GET /models?modality=embedding returns exactly the ids this endpoint accepts, with prices. The filter is not cosmetic — an embedding model in a chat model’s list is a model the router could pick and then fail on upstream, having already committed to it.

bash
curl "https://api.multigrid.ai/v1/models?modality=embedding"

Routing and billing

Everything the chat endpoint does on the way in happens here too, in the same order and with the same code: an inference-scoped key, the key’s per-minute limit on the key’s own bucket, the balance pre-flight against a worst-case estimate, provider preferences, retry and failover, and a requests row with the exact cost.

Embeddings are priced on prompt tokens alone — there is no completion side. Your own provider key pays for them if you have one, at zero cost to your balance, exactly as on chat.

Something here disagrees with what the API actually did? That is a bug in this page, and worth reporting.

Report it