Skip to main content
POST
Create Embeddings

Authorizations

Authorization
string
header
required

Enter your MeshAPI key (rsk_...) — sent as Authorization: Bearer <key>.

Headers

X-Mesh-Version
enum<string>
default:2026-08

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.

Available options:
2026-08

Body

application/json

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
input
required

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
string | null

Model ID to use for embedding, e.g. perplexity/pplx-embed-v1-4b.

Example:

"perplexity/pplx-embed-v1-4b"

dimensions
integer | null

Number of dimensions for the output embedding vector (model-dependent).

Required range: x >= 1
encoding_format
enum<string> | null

Format of the returned embedding. Defaults to float.

Available options:
float,
base64
input_type
string | null

Intended use of the embedding, e.g. query or document. Some models use this to apply asymmetric embedding.

provider

Provider routing preferences. Pass a provider slug string (e.g. 'perplexity') or a ProviderPreferences object to control fallback and ordering behaviour.

user
string | null

End-user identifier for abuse monitoring.

Maximum string length: 256
instructions
string | null

Inference prompt for BytePlus multimodal embeddings. A default is generated from the input modality if not set.

sparse_embedding
Sparse Embedding · object | null

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