EmbeddingsBeta

Embeddings

POST https://models.mixlayer.ai/v1/embeddings

Create vector embeddings from text or token inputs using an embedding model. The endpoint follows the OpenAI-compatible embeddings response shape and is currently in beta.

⚠️

Embeddings support is in beta. Use an embedding model authorized for your API key; chat/generation models are rejected on this endpoint.

Authentication

Every request requires a Bearer token in the Authorization header. Create one in the Mixlayer console.

Authorization: Bearer $MIXLAYER_API_KEY

Minimal request

curl https://models.mixlayer.ai/v1/embeddings \
  -H "Authorization: Bearer $MIXLAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "$MIXLAYER_EMBEDDING_MODEL",
    "input": "The food was delicious and the service was fast."
  }'

Request parameters

This page is the canonical reference for supported embeddings parameters.

ParameterTypeRequiredDescription
modelstringYesEmbedding model identifier. The model must be available to your API key and marked as an embedding model.
inputstring, string array, token array, or array of token arraysYesInput to embed. Text strings must be non-empty. Arrays must contain 1-2048 items. Token inputs must be non-empty and fit the model context window.
dimensionsintegerNoRequested output vector size. Must be greater than 0 when provided. See Embedding model-specific behavior below.
encoding_format"float" or "base64"NoFormat for returned embedding vectors. Defaults to "float".
input_typestringNoOptional model-specific embedding task hint. See Embedding model-specific behavior below.
normalizebooleanNoRequests normalized vectors when supported by the model server.
truncatebooleanNoRequests truncation behavior when supported by the model server.

Embedding model-specific behavior

Qwen3 Embedding 8B

Supported dimensions values: integers from 32 to 4096.

Supported input_type values:

ValueUse for
querySearch queries, questions, or other text used to retrieve matching documents.
documentDocuments, passages, or other corpus text being retrieved.

Omit input_type when you do not want a model-specific prompt applied.

Input formats

Text input:

{
  "model": "$MIXLAYER_EMBEDDING_MODEL",
  "input": "Embed this text"
}

Batched text input:

{
  "model": "$MIXLAYER_EMBEDDING_MODEL",
  "input": ["First document", "Second document"]
}

Token input:

{
  "model": "$MIXLAYER_EMBEDDING_MODEL",
  "input": [101, 7592, 102]
}

Batched token input:

{
  "model": "$MIXLAYER_EMBEDDING_MODEL",
  "input": [[101, 7592, 102], [101, 2088, 102]]
}

Response

A successful response returns a list of embedding objects:

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [0.0023064255, -0.009327292, 0.015797347],
      "index": 0
    }
  ],
  "model": "$MIXLAYER_EMBEDDING_MODEL",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}

When encoding_format is "base64", each embedding value is a base64 string instead of an array of floats.

Errors

Errors use the OpenAI error envelope:

{
  "error": {
    "message": "input strings must not be empty",
    "type": "invalid_request_error",
    "code": "invalid_input"
  }
}

Common validation errors include:

CodeCause
invalid_inputEmpty input, empty text, too many batch items, or token input longer than the model context window.
invalid_dimensionsdimensions was 0.
invalid_encoding_formatencoding_format was not "float" or "base64".
model_kind_mismatchThe requested model is not an embedding model.