Mixedbread

Embeddings

API reference for Mixedbread's Embeddings endpoint. This documentation covers the request and response structure, supported models, and usage examples for generating embeddings using the Mixedbread API.

POST/v1/embeddings

This endpoint provides access to our embedding models. It returns embeddings for the input you provide, which can be used for various tasks such as text similarity, clustering, and more.

The endpoint is also a superset of the OpenAI embedding API. This means you can use the OpenAI API client, pointing it to https://api.mixedbread.ai. However, note that not all Mixedbread-specific features may be available through the OpenAI client.

    Authentication

  • Authorization
    Authorization
    Type
    string
    Required or Optional
    required
    Description

    This endpoint requires an API key. You can obtain one by signing up for an account on our website.

  • Request Body

  • input
    input
    Type
    string|string[]
    Required or Optional
    required
    Description

    A string or a list of strings, where each string represents a sentence or chunk of text to be embedded.

    • Between 1-256 items.
    • Texts will be truncated if longer than the model's maximum sequence length
  • model
    model
    Type
    string
    Required or Optional
    required
    Description

    The model to be used for generating embeddings.

  • prompt
    prompt
    Type
    string
    Required or Optional
    optional
    Description

    An optional prompt to provide context to the model. Refer to the model's documentation for more information.

    • A string between 1 and 256 characters
  • normalized
    normalized
    Type
    boolean
    Required or Optional
    optional
    Description

    Option to normalize the embeddings. Defaults to true.

  • dimensions
    dimensions
    Type
    number
    Required or Optional
    optional
    Description

    The desired number of dimensions in the output vectors. Defaults to the model's maximum.

    • A number between 1 and the model's maximum output dimensions
    • Only applicable for Matryoshka-based models
  • encoding_format
    encoding_format
    Type
    string|string[]
    Required or Optional
    optional
    Description

    The desired format for the embeddings. Defaults to "float". If multiple formats are requested, the response will include an object with each format for each embedding.

    • Options: float, float16, binary, ubinary, int8, uint8, base64
  • truncation_strategy
    truncation_strategy
    Type
    string
    Required or Optional
    optional
    Description

    The strategy for truncating input text that exceeds the model's maximum length. Defaults to "end". Setting it to "none" will result in an error if the text is too long.

    • Options: start, end, none

Response Body

  • model
    model
    Type
    string
    Required or Optional
    required
    Description

    The embedding model used, which can be one of our hosted models or a custom fine-tuned model.

  • object
    object
    Type
    string
    Required or Optional
    required
    Description

    The type of the returned object. Always "list".

  • data
    data
    Type
    object[]
    Required or Optional
    required
    Description

    A list of the generated embeddings.

  • data[x].embedding
    data[x].embedding
    Type
    number[]|object
    Required or Optional
    required
    Description

    The vector representing the embedding, or an object with different encodings if multiple formats were requested.

  • data[x].index
    data[x].index
    Type
    number
    Required or Optional
    required
    Description

    The index of the input text corresponding to this embedding.

  • data[x].object
    data[x].object
    Type
    number
    Required or Optional
    required
    Description

    The type of the returned object. Always "embedding".

  • usage
    usage
    Type
    object
    Required or Optional
    required
    Description

    Information about API usage for this request.

  • usage.prompt_tokens
    usage.prompt_tokens
    Type
    number
    Required or Optional
    required
    Description

    The number of prompt tokens used to generate the embeddings.

  • usage.total_tokens
    usage.total_tokens
    Type
    number
    Required or Optional
    required
    Description

    The total number of tokens used to generate the embeddings.

  • normalized
    normalized
    Type
    boolean
    Required or Optional
    required
    Description

    Indicates whether the embeddings are normalized.