Create Embeddings

View as Markdown

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
inputstring or list of strings or list of integers or list of lists of integers or list of objectsRequired

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).

modelstring or nullOptional

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

dimensionsinteger or nullOptional>=1

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

encoding_formatenum or nullOptional

Format of the returned embedding. Defaults to float.

input_typestring or nullOptional

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

providerstring or object or nullOptional

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

userstring or nullOptional<=256 characters

End-user identifier for abuse monitoring (forwarded to OpenRouter).

instructionsstring or nullOptional
Inference prompt for BytePlus multimodal embeddings. A default is generated from the input modality if not set.
sparse_embeddingmap from strings to any or nullOptional

Sparse vector switch for BytePlus text embeddings. Pass {“type”: “enabled”} to return both dense and sparse vectors, or {“type”: “disabled”} for dense only.

Response

Successful Response