Embeddings

Turn text into vectors for search, clustering and similarity — 1024 dimensions, one call for a batch.

POST /v1/embeddings turns text into a fixed-length vector — the numeric form most search, clustering and recommendation code actually wants. It's served by BAAI's bge-m3, running on the same GPU as everything else.

POST/v1/embeddings
ParameterTypeDescription
input
Required
string | string[]The text to embed. A single string or an array — sending an array is one request, one round trip, and the natural way to embed a batch.
model
Optional
stringThe only embedding model this deployment serves.
Default: larsa-embed
encoding_format
Optional
"float" | "base64"How each vector is encoded in the response. base64 is smaller on the wire; float is a plain JSON array of numbers.
Default: float
Embedding text
curl -s https://api.console.larsa.larsima.com/v1/embeddings \
  -H "Authorization: Bearer $LARSA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "larsa-embed",
    "input": ["Notice of termination must be given in writing.",
               "El aviso de terminación debe darse por escrito."]
  }'

1024 dimensions, already normalised

Every vector bge-m3 returns has exactly 1024 numbers, and it's already unit-length — the vector's own magnitude is 1.0. That means cosine similarity and a plain dot product give you the same ranking, so most similarity code can skip the normalisation step entirely.

Batching and the token ceiling

Send up to a few hundred short passages as one input array — they're processed in a single call and usage.total_tokens counts the whole batch. The server's context is shared across every item in the request, capped at 8192 tokens total; go over it and you get the server's own message back, unfiltered:

JSON
{"error":{"code":500,"message":"input (9002 tokens) is too large to process. increase the physical batch size (current batch size: 8192)","type":"server_error"}}

There's no batch-count limit as such — 50 short sentences in one call cost 500 tokens and came back in one round trip in testing. The ceiling that matters is the sum of every item's token count, not how many items there are.

Embed a small corpus once, embed the query, rank by dot product — no vector database required for a handful of documents.

Similarity search
# One request embeds the corpus and the query together;
# ranking happens client-side (see the Python/JS tabs) since bge-m3's
# vectors are already unit length -- a dot product is the cosine score.
curl -s https://api.console.larsa.larsima.com/v1/embeddings \
  -H "Authorization: Bearer $LARSA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "larsa-embed",
    "input": [
      "The tenant may terminate the lease with thirty days written notice.",
      "An appeal must be filed within twenty days of the judgment.",
      "The buyer is entitled to a refund if the goods are defective.",
      "Interest on the unpaid balance accrues at the statutory rate.",
      "How many days do I have to appeal a court decision?"
    ]
  }'
Navigate Open esc Close