Skip to main content
The /v1/embeddings endpoint converts text into dense numerical vectors that capture semantic meaning. Use embeddings to power semantic search, Retrieval-Augmented Generation (RAG) pipelines, document clustering, duplicate detection, and cross-lingual similarity tasks. The endpoint is OpenAI-compatible, so any library or framework that targets the OpenAI embeddings API works out of the box by pointing base_url at Meliai. Embedding requests default to the :price routing flavor, keeping bulk vectorisation costs low.

Endpoint

Authorization: Bearer sk-mel-<KEY> via Authorization header.

Parameters

string
required
The embedding model ID to use. Check GET /v1/models for available embedding models. Routing flavor suffixes (e.g. :speed) are supported but :price is applied by default for embedding requests.
string | array
required
The text to embed. Pass a single string or an array of strings to embed multiple texts in one request. Batching multiple inputs in a single call is more efficient than sending them individually.
string
Format of the returned vectors:
  • "float" — array of 64-bit floats (default)
  • "base64" — base64-encoded binary representation, useful for reducing response payload size

Example


Response

array
Ordered array of embedding objects, one per input string. Each contains:
  • object — always "embedding"
  • index — position of this item in the input array
  • embedding — the vector as an array of floats (or a base64 string if encoding_format is "base64")
object
Token counts for the request: prompt_tokens and total_tokens.
object
Per-request environmental footprint. Fields: energy_kwh, carbon_g_co2, water_liters, renewable_percent, pue, provider_id, location.
object
Itemised cost: energy (EUR), credits deducted, and paid_with.

Embedding requests automatically use the :price routing flavor. If you need lower latency for real-time retrieval, append :speed to your model ID: "<EMBEDDING_MODEL_ID>:speed".
All embedding computation runs on European infrastructure. Input text never leaves the EU and is never used to train models.