Skip to main content
POST
Create Embeddings

Authorizations

Authorization
string
header
required

Enter your MeshAPI key (rsk_...) or, for the admin-keys endpoints, a dashboard session token — sent as Authorization: Bearer <token>.

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,
2026-09,
2026-11,
2026-11-12

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 preference, accepted for compatibility and not forwarded to any upstream. A provider slug string (e.g. 'perplexity') or a ProviderPreferences object is validated and then dropped; it neither pins nor narrows which provider serves. Pin the API key to serve embeddings from exactly one provider.

safety_identifier
string | null

A stable, anonymised identifier for the end user making this request, recorded on the usage row and available as a filter and a group-by dimension in the usage API. Supersedes the deprecated user field. Use an opaque id, not an email address or a name.

Maximum string length: 256
user
string | null
deprecated

Deprecated — use safety_identifier.

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.

tags
Tags · object | null

Your own labels for this request, echoed back on the usage row and available as a filter and a group-by dimension in the usage API. String keys to string values. Never put personal or sensitive data here — tags are stored with the usage record and are not redacted.

Example:

Response

Embedding response