Skip to navigation

Create embeddings

OpenAI-compatible embeddings. Batch up to 2048 inputs per call.

model is required. input is a string or a list of strings; multimodal embedding models also take a list of text, image, and video parts, such as {"type": "image", "url": "https://..."}. Token IDs return 400 with param set to input. encoding_format: "base64" works on every embedding model and returns each vector as a base64 string of little-endian 32-bit floats. dimensions sets the vector size on models that offer more than one size; a model with a fixed size returns 400 for any other value.

On models that offer them (see the model page), output_type returns sparse vectors: sparse returns token weights in sparse_embedding with an empty embedding, and dense_and_sparse returns both. instruct takes an instruction describing the search task when you embed search queries; its tokens bill as input.

Authentication

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

Request

This endpoint expects an object.
modelstringRequired

Embedding model id, for example text-embedding-v4.

inputstring or list of strings or list of objectsRequired

Text to embed, or an array of texts. Multimodal embedding models also take an array of text, image, and video parts. Token IDs return 400.

encoding_formatenumOptionalDefaults to float

Vector encoding: float arrays or base64 strings of little-endian 32-bit floats. Both work on every embedding model.

Allowed values:
dimensionsintegerOptional>=1

Vector size, on models that offer more than one. A model with a fixed size returns 400 for any other value. See the model page for the sizes it offers.

output_typeenumOptionalDefaults to dense

On models that offer sparse vectors: dense returns the vector in embedding, sparse returns token weights in sparse_embedding with an empty embedding, and dense_and_sparse returns both. Every output type bills the same tokens.

Allowed values:
instructstringOptional

On models that take one: an instruction describing the search task, set when embedding search queries and left out for documents. Its tokens bill as input.

Response

Embedding vectors.
objectstringOptional
datalist of objectsOptional
modelstringOptional
usageobjectOptional

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error