Create Embeddings
Turn text into embedding vectors.
OpenAI-compatible: point the OpenAI SDK’s embeddings client at this gateway and it
works unchanged. input takes a single string or a batch, and the response keeps
the input order so you can zip results back to your records.
model is required and must name a specific embedding model — auto is rejected,
because a vector is only comparable to other vectors from the same model, so
silently choosing one for you would corrupt an index. Provider failover and BYOK
keys apply as they do to chat.
Authorizations
Enter your MeshAPI key (rsk_...) — sent as Authorization: Bearer <key>.
Headers
Dated version of the API contract to pin this request to. Omit it and the request is served under 2026-08 — the oldest supported version, so an existing integration is never moved by a release. A malformed or unsupported value is rejected with 400 invalid_api_version rather than falling back silently. The version actually served is echoed as X-Mesh-Version on every response, including errors.
2026-08 Body
Request body for POST /v1/embeddings.
Mirrors the OpenAI embeddings API. The input field accepts
four shapes:
- string — a single text to embed
- list[string] — a batch of texts
- list[int] — a single pre-tokenised input (token IDs)
- list[list[int]] — a batch of pre-tokenised inputs
Text(s) to embed. Accepts a string, list of strings, list of token IDs, list of token ID lists, or a list of MultimodalEmbeddingInput objects (for BytePlus multimodal embedding models).
Model ID to use for embedding, e.g. perplexity/pplx-embed-v1-4b.
"perplexity/pplx-embed-v1-4b"
Number of dimensions for the output embedding vector (model-dependent).
x >= 1Format of the returned embedding. Defaults to float.
float, base64 Intended use of the embedding, e.g. query or document. Some models use this to apply asymmetric embedding.
Provider routing preferences. Pass a provider slug string (e.g. 'perplexity') or a ProviderPreferences object to control fallback and ordering behaviour.
End-user identifier for abuse monitoring.
256Inference prompt for BytePlus multimodal embeddings. A default is generated from the input modality if not set.
Sparse vector switch for BytePlus text embeddings. Pass {"type": "enabled"} to return both dense and sparse vectors, or {"type": "disabled"} for dense only.
Response
Embedding response