Skip to main content

Mistral AI API (0.0.1)

Download OpenAPI specification:Download

Chat Completion and Embeddings APIs

Create Chat Completions

Request Body schema: application/json
required
model
required
string

ID of the model to use. You can use the List Available Models API to see all of your available models, or see our Model overview for model descriptions.

required
Array of objects

The prompt(s) to generate completions for, encoded as a list of dict with role and content. The first prompt role should be user or system.

temperature
number or null [ 0 .. 1 ]
Default: 0.7

What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

We generally recommend altering this or top_p but not both.

top_p
number or null [ 0 .. 1 ]
Default: 1

Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both.

max_tokens
integer or null >= 0
Default: null

The maximum number of tokens to generate in the completion.

The token count of your prompt plus max_tokens cannot exceed the model's context length.

stream
boolean or null
Default: false

Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

safe_prompt
boolean
Default: false

Whether to inject a safety prompt before all conversations.

random_seed
integer
Default: null

The seed to use for random sampling. If set, different calls will generate deterministic results.

Responses

Request samples

Content type
application/json
{
  • "model": "mistral-tiny",
  • "messages": [
    ],
  • "temperature": 0.7,
  • "top_p": 1,
  • "max_tokens": 16,
  • "stream": false,
  • "safe_prompt": false,
  • "random_seed": null
}

Response samples

Content type
application/json
{
  • "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
  • "object": "chat.completion",
  • "created": 1702256327,
  • "model": "mistral-tiny",
  • "choices": [
    ],
  • "usage": {
    }
}

Create Embeddings

Request Body schema: application/json
required
model
string

The ID of the model to use for this request.

input
Array of strings

The list of strings to embed.

encoding_format
string
Value: "float"

The format of the output data.

Responses

Request samples

Content type
application/json
{
  • "model": "mistral-embed",
  • "input": [
    ],
  • "encoding_format": "float"
}

Response samples

Content type
application/json
{
  • "id": "embd-aad6fc62b17349b192ef09225058bc45",
  • "object": "list",
  • "data": [
    ],
  • "model": "string",
  • "usage": {
    }
}

List Available Models

Responses

Response samples

Content type
application/json
{
  • "object": "string",
  • "data": [
    ]
}