mistralM

Docs

Agents

Agents API.

POST /v1/agents/completions

Agents Completion

Agents Completion

Request Example

{
  "agent_id": "ipsum eiusmod",
  "messages": [
    {
      "content": "consequat do"
    }
  ]
}

Request Body

agent_id
string* required

The ID of the agent to use for this completion.

frequency_penalty
number | null

The frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.

guardrails
array<GuardrailConfig> | null
GuardrailConfig
block_on_error
boolean

If true, return HTTP 403 and block request in the event of a server-side error

Default Value: false

moderation_llm_v1
ModerationLLMV1Config | null
ModerationLLMV1Config
action
"none" | "block"
custom_category_thresholds
ModerationLLMV1CategoryThresholds | null
ModerationLLMV1CategoryThresholds
dangerous_and_criminal_content
number | null
financial
number | null
hate_and_discrimination
number | null
health
number | null
law
number | null
pii
number | null
selfharm
number | null
sexual
number | null
violence_and_threats
number | null
ignore_other_categories
boolean

If true, only evaluate categories in custom_category_thresholds; others are ignored.

Default Value: false

model_name
string

Override model name. Should be omitted in general.

Default Value: "mistral-moderation-2411"

moderation_llm_v2
ModerationLLMV2Config | null
ModerationLLMV2Config
action
"none" | "block"
custom_category_thresholds
ModerationLLMV2CategoryThresholds | null
ModerationLLMV2CategoryThresholds
criminal
number | null
dangerous
number | null
financial
number | null
hate_and_discrimination
number | null
health
number | null
jailbreaking
number | null
law
number | null
pii
number | null
selfharm
number | null
sexual
number | null
violence_and_threats
number | null
ignore_other_categories
boolean

If true, only evaluate categories in custom_category_thresholds; others are ignored.

Default Value: false

model_name
string

Override model name. Should be omitted in general.

Default Value: "mistral-moderation-2603"

logprobs
boolean | null
max_tokens
integer | 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.

messages
array<SystemMessage | UserMessage | AssistantMessage | ToolMessage>* required

The prompt(s) to generate completions for, encoded as a list of dict with role and content.

SystemMessage
content
string | array<TextChunk | ThinkChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ThinkChunk
closed
boolean

Whether the thinking chunk is closed or not. Currently only used for prefixing.

Default Value: true

signature
string | null

Signature to replay some reasoning blocks across turns.

thinking
array<TextChunk | ToolReferenceChunk | ReferenceChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ToolReferenceChunk
description
string | null
favicon
string | null
title
string* required
tool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* required
type
string

Default Value: "tool_reference"

url
string | null
ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

type
string

Default Value: "thinking"

role
string

Default Value: "system"

UserMessage
TextChunk
text
string* required
type
string

Default Value: "text"

ImageURLChunk

{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}

image_url
ImageURL | string* required
ImageURL
detail
"low" | "auto" | "high"
url
string* required
type
string

Default Value: "image_url"

DocumentURLChunk
document_name
string | null

The filename of the document

document_url
string* required
type
string

Default Value: "document_url"

ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

FileChunk
file_id
string* required
type
string

Default Value: "file"

ThinkChunk
closed
boolean

Whether the thinking chunk is closed or not. Currently only used for prefixing.

Default Value: true

signature
string | null

Signature to replay some reasoning blocks across turns.

thinking
array<TextChunk | ToolReferenceChunk | ReferenceChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ToolReferenceChunk
description
string | null
favicon
string | null
title
string* required
tool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* required
type
string

Default Value: "tool_reference"

url
string | null
ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

type
string

Default Value: "thinking"

AudioChunk
input_audio
string* required
type
string

Default Value: "input_audio"

ResourceChunk
type
string

Default Value: "resource"

uri
string* required
ResourceLinkChunk
metadata
map<string | integer | number | boolean> | null
type
string

Default Value: "resource_link"

uri
string* required
role
string

Default Value: "user"

AssistantMessage
TextChunk
text
string* required
type
string

Default Value: "text"

ImageURLChunk

{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}

image_url
ImageURL | string* required
ImageURL
detail
"low" | "auto" | "high"
url
string* required
type
string

Default Value: "image_url"

DocumentURLChunk
document_name
string | null

The filename of the document

document_url
string* required
type
string

Default Value: "document_url"

ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

FileChunk
file_id
string* required
type
string

Default Value: "file"

ThinkChunk
closed
boolean

Whether the thinking chunk is closed or not. Currently only used for prefixing.

Default Value: true

signature
string | null

Signature to replay some reasoning blocks across turns.

thinking
array<TextChunk | ToolReferenceChunk | ReferenceChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ToolReferenceChunk
description
string | null
favicon
string | null
title
string* required
tool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* required
type
string

Default Value: "tool_reference"

url
string | null
ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

type
string

Default Value: "thinking"

AudioChunk
input_audio
string* required
type
string

Default Value: "input_audio"

ResourceChunk
type
string

Default Value: "resource"

uri
string* required
ResourceLinkChunk
metadata
map<string | integer | number | boolean> | null
type
string

Default Value: "resource_link"

uri
string* required
prefix
boolean

Set this to true when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message.

Default Value: false

role
string

Default Value: "assistant"

tool_calls
array<ToolCall> | null
ToolCall
function
FunctionCall* required
FunctionCall
arguments
map<any> | string* required
name
string* required
id
string
index
integer

Default Value: 0

type
"function"
ToolMessage
TextChunk
text
string* required
type
string

Default Value: "text"

ImageURLChunk

{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}

image_url
ImageURL | string* required
ImageURL
detail
"low" | "auto" | "high"
url
string* required
type
string

Default Value: "image_url"

DocumentURLChunk
document_name
string | null

The filename of the document

document_url
string* required
type
string

Default Value: "document_url"

ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

FileChunk
file_id
string* required
type
string

Default Value: "file"

ThinkChunk
closed
boolean

Whether the thinking chunk is closed or not. Currently only used for prefixing.

Default Value: true

signature
string | null

Signature to replay some reasoning blocks across turns.

thinking
array<TextChunk | ToolReferenceChunk | ReferenceChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ToolReferenceChunk
description
string | null
favicon
string | null
title
string* required
tool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* required
type
string

Default Value: "tool_reference"

url
string | null
ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

type
string

Default Value: "thinking"

AudioChunk
input_audio
string* required
type
string

Default Value: "input_audio"

ResourceChunk
type
string

Default Value: "resource"

uri
string* required
ResourceLinkChunk
metadata
map<string | integer | number | boolean> | null
type
string

Default Value: "resource_link"

uri
string* required
name
string | null
role
string

Default Value: "tool"

tool_call_id
string | null
metadata
map<any> | null
min_tokens
integer | null
n
integer | null

Number of completions to return for each request, input tokens are only billed once.

parallel_tool_calls
boolean

Default Value: true

prediction
Prediction | null

Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.

Prediction

Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content.

content
string

Default Value: ""

type
string

Default Value: "content"

presence_penalty
number | null

The presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.

prompt_cache_key
string | null
prompt_logprobs
boolean | null
prompt_mode
"reasoning"

Available options to the prompt_mode argument on the chat completion endpoint. Values represent high-level intent. Assignment to actual SPs is handled internally. System prompt may include knowledge cutoff date, model capabilities, tone to use, safety guidelines, etc.

random_seed
integer | null

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

reasoning_effort
"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"
repetition_penalty
number | null
response_format
ResponseFormat | null

Specify the format that the model must output. By default it will use \{ "type": "text" \}. Setting to \{ "type": "json_object" \} enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to \{ "type": "json_schema" \} enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide. Note: on third-party models (for example GLM), the schema is still enforced, but field descriptions may not influence the output; put field-level requirements in the prompt.

ResponseFormat

Specify the format that the model must output. By default it will use \{ "type": "text" \}. Setting to \{ "type": "json_object" \} enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message. Setting to \{ "type": "json_schema" \} enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide. Note: on third-party models (for example GLM), the schema is still enforced, but field descriptions may not influence the output; put field-level requirements in the prompt.

json_schema
JsonSchema | null
JsonSchema
description
string | null
name
string* required
schema_definition
map<any>* required
strict
boolean

Default Value: false

type
"text" | "json_object" | "json_schema"
service_tier
"auto" | "priority" | "fast" | "standard_only"

Use auto to request priority capacity with standard fallback. Use priority or fast to require priority capacity. No entitlement returns 403, exhausted priority limits return 429, and unavailable priority service returns 503. Priority requires an enabled model and an available allocation. Use standard_only to request standard capacity. An omitted field selects standard capacity, unless the customer is configured to default to auto.

stop
string | array<string> | null

Stop generation if this token is detected. Or if one of these tokens is detected when providing an array

stream
boolean

Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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.

Default Value: false

tool_choice
"auto" | "none" | "any" | "required" | NamedToolChoice
NamedToolChoice
function
FunctionName* required

this restriction of Function is used to select a specific function to call

FunctionName

this restriction of Function is used to select a specific function to call

name
string* required
type
"function"
Tool
function
Function* required
Function
description
string

Default Value: ""

name
string* required
parameters
map<any>* required
strict
boolean

Default Value: false

type
"function"
ImageGenerationTool
tool_configuration
ToolConfiguration | null
ToolConfiguration
exclude
array<string> | null
include
array<string> | null
requires_confirmation
array<string> | null
type
"image_generation"

Default Value: "image_generation"

DocumentLibraryTool
library_ids
array<string>Min Items: 1* required

Ids of the library in which to search.

tool_configuration
ToolConfiguration | null
ToolConfiguration
exclude
array<string> | null
include
array<string> | null
requires_confirmation
array<string> | null
type
"document_library"

Default Value: "document_library"

CustomConnector
authorization
OAuth2TokenAuth | APIKeyAuth | null
exclamationMark

Deprecated: per-request connector credentials will be removed. Authenticate the connector through the Connectors API instead.

OAuth2TokenAuth
type
"oauth2-token"

Default Value: "oauth2-token"

value
string* required
APIKeyAuth
type
"api-key"

Default Value: "api-key"

value
string* required
connector_id
string* required
tool_configuration
ToolConfiguration | null
ToolConfiguration
exclude
array<string> | null
include
array<string> | null
requires_confirmation
array<string> | null
type
"connector"

Default Value: "connector"

top_k
integer | null
top_logprobs
integer | null
top_prompt_logprobs
integer | null

Responses

Successful Response

choices
array<ChatCompletionChoice>* required
ChatCompletionChoice
finish_reason
"stop" | "length" | "model_length" | "error" | "tool_calls"* required

Example:

stop
index
integer* required

Example:

0
ChatCompletionResponseChoiceLogprobs
ChatCompletionResponseTokenLogprobsTopK
bytes
array<integer>* required
logprob
number* required
token
string* required
token_id
integer* required
top_logprobs
array<ChatCompletionResponseTokenLogprobs> | null
ChatCompletionResponseTokenLogprobs
bytes
array<integer>* required
logprob
number* required
token
string* required
token_id
integer* required
AssistantMessage
TextChunk
text
string* required
type
string

Default Value: "text"

ImageURLChunk

{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}

image_url
ImageURL | string* required
ImageURL
detail
"low" | "auto" | "high"
url
string* required
type
string

Default Value: "image_url"

DocumentURLChunk
document_name
string | null

The filename of the document

document_url
string* required
type
string

Default Value: "document_url"

ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

FileChunk
file_id
string* required
type
string

Default Value: "file"

ThinkChunk
closed
boolean

Whether the thinking chunk is closed or not. Currently only used for prefixing.

Default Value: true

signature
string | null

Signature to replay some reasoning blocks across turns.

thinking
array<TextChunk | ToolReferenceChunk | ReferenceChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ToolReferenceChunk
description
string | null
favicon
string | null
title
string* required
tool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* required
type
string

Default Value: "tool_reference"

url
string | null
ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

type
string

Default Value: "thinking"

AudioChunk
input_audio
string* required
type
string

Default Value: "input_audio"

ResourceChunk
type
string

Default Value: "resource"

uri
string* required
ResourceLinkChunk
metadata
map<string | integer | number | boolean> | null
type
string

Default Value: "resource_link"

uri
string* required
prefix
boolean

Set this to true when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message.

Default Value: false

role
string

Default Value: "assistant"

tool_calls
array<ToolCall> | null
ToolCall
function
FunctionCall* required
FunctionCall
arguments
map<any> | string* required
name
string* required
id
string
index
integer

Default Value: 0

type
"function"
messages
array<DeltaMessage>
DeltaMessage
TextChunk
text
string* required
type
string

Default Value: "text"

ImageURLChunk

{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}

image_url
ImageURL | string* required
ImageURL
detail
"low" | "auto" | "high"
url
string* required
type
string

Default Value: "image_url"

DocumentURLChunk
document_name
string | null

The filename of the document

document_url
string* required
type
string

Default Value: "document_url"

ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

FileChunk
file_id
string* required
type
string

Default Value: "file"

ThinkChunk
closed
boolean

Whether the thinking chunk is closed or not. Currently only used for prefixing.

Default Value: true

signature
string | null

Signature to replay some reasoning blocks across turns.

thinking
array<TextChunk | ToolReferenceChunk | ReferenceChunk>* required
TextChunk
text
string* required
type
string

Default Value: "text"

ToolReferenceChunk
description
string | null
favicon
string | null
title
string* required
tool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* required
type
string

Default Value: "tool_reference"

url
string | null
ReferenceChunk
reference_ids
array<integer | string>* required
type
string

Default Value: "reference"

type
string

Default Value: "thinking"

AudioChunk
input_audio
string* required
type
string

Default Value: "input_audio"

ResourceChunk
type
string

Default Value: "resource"

uri
string* required
ResourceLinkChunk
metadata
map<string | integer | number | boolean> | null
type
string

Default Value: "resource_link"

uri
string* required
index
integer | null

If the completion returns multiple messages, this is to specify which message this delta is for.

metadata
map<any> | null
role
string | null
tool_call_id
string | null
tool_calls
array<ToolCall> | null
ToolCall
function
FunctionCall* required
FunctionCall
arguments
map<any> | string* required
name
string* required
id
string
index
integer

Default Value: 0

type
"function"
ChatCompletionResponseChoiceLogprobs
ChatCompletionResponseTokenLogprobsTopK
bytes
array<integer>* required
logprob
number* required
token
string* required
token_id
integer* required
top_logprobs
array<ChatCompletionResponseTokenLogprobs> | null
ChatCompletionResponseTokenLogprobs
bytes
array<integer>* required
logprob
number* required
token
string* required
token_id
integer* required
created
integer* required

Example:

1702256327
id
string* required

Example:

cmpl-e5cc70bb28c444948073e77776eb30ef
model
string* required

Example:

mistral-small-latest
object
string* required

Example:

chat.completion
usage
UsageInfo* required
UsageInfo
completion_tokens
integer

Default Value: 0

prompt_audio_seconds
integer | null
prompt_tokens
integer

Default Value: 0

prompt_tokens_details
PromptTokensDetails | null

Token usage details for the prompt.

PromptTokensDetails

Token usage details for the prompt.

audio_tokens
integer

Default Value: 0

cached_tokens
integer

Default Value: 0

service_tier
string | null

The service tier at which the request was processed: standard or priority.

total_tokens
integer

Default Value: 0