Mistral AI Embeddings API

The Mistral AI Embeddings API allows developers to compute document and text embeddings using Mistral's embedding models. These embeddings can be used for semantic search, clustering, classification, and retrieval augmented generation workflows. The API accepts text inputs and returns high-dimensional vector representations suitable for a variety of natural language processing tasks.

OpenAPI Specification

mistral-ai-embeddings-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Mistral AI Embeddings API
  description: >-
    The Mistral AI Embeddings API allows developers to compute document and
    text embeddings using Mistral's embedding models. These embeddings can be
    used for semantic search, clustering, classification, and retrieval
    augmented generation workflows. The API accepts text inputs and returns
    high-dimensional vector representations suitable for a variety of natural
    language processing tasks.
  version: '1.0.0'
  contact:
    name: Mistral AI Support
    url: https://docs.mistral.ai
  termsOfService: https://mistral.ai/terms
externalDocs:
  description: Mistral AI Embeddings Documentation
  url: https://docs.mistral.ai/capabilities/embeddings
servers:
  - url: https://api.mistral.ai/v1
    description: Mistral AI Production Server
tags:
  - name: Embeddings
    description: >-
      Endpoints for generating vector embeddings from text inputs using
      Mistral embedding models.
security:
  - bearerAuth: []
paths:
  /embeddings:
    post:
      operationId: createEmbedding
      summary: Create embeddings
      description: >-
        Creates an embedding vector representing the input text. The input can
        be a single string or an array of strings for batch processing. Returns
        high-dimensional vector representations suitable for semantic search,
        clustering, and classification tasks.
      tags:
        - Embeddings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbeddingRequest'
      responses:
        '200':
          description: Successful embedding response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbeddingResponse'
        '400':
          description: Bad request due to invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized due to missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
  schemas:
    EmbeddingRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: >-
            ID of the model to use for generating embeddings.
          example: mistral-embed
        input:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          description: >-
            Input text to embed. Can be a single string or an array of strings
            for batch processing.
        encoding_format:
          type: string
          description: >-
            The format to return the embeddings in.
          enum:
            - float
          default: float
    EmbeddingResponse:
      type: object
      properties:
        id:
          type: string
          description: >-
            A unique identifier for the embedding request.
        object:
          type: string
          description: >-
            The object type, always list.
          enum:
            - list
        data:
          type: array
          description: >-
            A list of embedding objects.
          items:
            $ref: '#/components/schemas/EmbeddingObject'
        model:
          type: string
          description: >-
            The model used to generate the embeddings.
        usage:
          $ref: '#/components/schemas/Usage'
    EmbeddingObject:
      type: object
      properties:
        object:
          type: string
          description: >-
            The object type, always embedding.
          enum:
            - embedding
        embedding:
          type: array
          description: >-
            The embedding vector as an array of floats.
          items:
            type: number
            format: float
        index:
          type: integer
          description: >-
            The index of the embedding in the list of embeddings.
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
          description: >-
            Number of tokens in the input.
        total_tokens:
          type: integer
          description: >-
            Total number of tokens used in the request.
    Error:
      type: object
      properties:
        message:
          type: string
          description: >-
            A human-readable error message.
        type:
          type: string
          description: >-
            The type of error.
        code:
          type: integer
          description: >-
            The HTTP status code.