- API Reference
- endpoint
Agents
Agents
POST /v1/agents/completions
Agents Completion
Agents Completion
Request Example
{
"agent_id": "ipsum eiusmod",
"messages": [
{
"content": "consequat do"
}
]
}
Request Body
agent_id
string* requiredThe ID of the agent to use for this completion.
frequency_penalty
number | nullThe 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> | nullGuardrailConfig
block_on_error
booleanIf true, return HTTP 403 and block request in the event of a server-side error
Default Value: false
moderation_llm_v1
ModerationLLMV1Config | nullModerationLLMV1Config
action
"none" | "block"custom_category_thresholds
ModerationLLMV1CategoryThresholds | nullModerationLLMV1CategoryThresholds
dangerous_and_criminal_content
number | nullfinancial
number | nullhate_and_discrimination
number | nullhealth
number | nulllaw
number | nullpii
number | nullselfharm
number | nullsexual
number | nullviolence_and_threats
number | nullignore_other_categories
booleanIf true, only evaluate categories in custom_category_thresholds; others are ignored.
Default Value: false
model_name
stringOverride model name. Should be omitted in general.
Default Value: "mistral-moderation-2411"
moderation_llm_v2
ModerationLLMV2Config | nullModerationLLMV2Config
action
"none" | "block"custom_category_thresholds
ModerationLLMV2CategoryThresholds | nullModerationLLMV2CategoryThresholds
criminal
number | nulldangerous
number | nullfinancial
number | nullhate_and_discrimination
number | nullhealth
number | nulljailbreaking
number | nulllaw
number | nullpii
number | nullselfharm
number | nullsexual
number | nullviolence_and_threats
number | nullignore_other_categories
booleanIf true, only evaluate categories in custom_category_thresholds; others are ignored.
Default Value: false
model_name
stringOverride model name. Should be omitted in general.
Default Value: "mistral-moderation-2603"
logprobs
boolean | nullmax_tokens
integer | nullThe 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.
The prompt(s) to generate completions for, encoded as a list of dict with role and content.
SystemMessage
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ThinkChunk
closed
booleanWhether the thinking chunk is closed or not. Currently only used for prefixing.
Default Value: true
signature
string | nullSignature to replay some reasoning blocks across turns.
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ToolReferenceChunk
description
string | nullfavicon
string | nulltitle
string* requiredtool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* requiredtype
stringDefault Value: "tool_reference"
url
string | nullReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
type
stringDefault Value: "thinking"
role
stringDefault Value: "system"
UserMessage
content
string | array<TextChunk | ImageURLChunk | DocumentURLChunk | ReferenceChunk | FileChunk | ThinkChunk | AudioChunk | ResourceChunk | ResourceLinkChunk> | null* requiredTextChunk
text
string* requiredtype
stringDefault Value: "text"
ImageURLChunk
{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}
ImageURL
detail
"low" | "auto" | "high"url
string* requiredtype
stringDefault Value: "image_url"
DocumentURLChunk
document_name
string | nullThe filename of the document
document_url
string* requiredtype
stringDefault Value: "document_url"
ReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
FileChunk
file_id
string* requiredtype
stringDefault Value: "file"
ThinkChunk
closed
booleanWhether the thinking chunk is closed or not. Currently only used for prefixing.
Default Value: true
signature
string | nullSignature to replay some reasoning blocks across turns.
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ToolReferenceChunk
description
string | nullfavicon
string | nulltitle
string* requiredtool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* requiredtype
stringDefault Value: "tool_reference"
url
string | nullReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
type
stringDefault Value: "thinking"
AudioChunk
input_audio
string* requiredtype
stringDefault Value: "input_audio"
ResourceChunk
type
stringDefault Value: "resource"
uri
string* requiredResourceLinkChunk
metadata
map<string | integer | number | boolean> | nulltype
stringDefault Value: "resource_link"
uri
string* requiredrole
stringDefault Value: "user"
AssistantMessage
content
string | array<TextChunk | ImageURLChunk | DocumentURLChunk | ReferenceChunk | FileChunk | ThinkChunk | AudioChunk | ResourceChunk | ResourceLinkChunk> | nullTextChunk
text
string* requiredtype
stringDefault Value: "text"
ImageURLChunk
{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}
ImageURL
detail
"low" | "auto" | "high"url
string* requiredtype
stringDefault Value: "image_url"
DocumentURLChunk
document_name
string | nullThe filename of the document
document_url
string* requiredtype
stringDefault Value: "document_url"
ReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
FileChunk
file_id
string* requiredtype
stringDefault Value: "file"
ThinkChunk
closed
booleanWhether the thinking chunk is closed or not. Currently only used for prefixing.
Default Value: true
signature
string | nullSignature to replay some reasoning blocks across turns.
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ToolReferenceChunk
description
string | nullfavicon
string | nulltitle
string* requiredtool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* requiredtype
stringDefault Value: "tool_reference"
url
string | nullReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
type
stringDefault Value: "thinking"
AudioChunk
input_audio
string* requiredtype
stringDefault Value: "input_audio"
ResourceChunk
type
stringDefault Value: "resource"
uri
string* requiredResourceLinkChunk
metadata
map<string | integer | number | boolean> | nulltype
stringDefault Value: "resource_link"
uri
string* requiredprefix
booleanSet 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
stringDefault Value: "assistant"
tool_calls
array<ToolCall> | nullToolCall
FunctionCall
arguments
map<any> | string* requiredname
string* requiredid
stringindex
integerDefault Value: 0
type
"function"ToolMessage
content
string | array<TextChunk | ImageURLChunk | DocumentURLChunk | ReferenceChunk | FileChunk | ThinkChunk | AudioChunk | ResourceChunk | ResourceLinkChunk> | null* requiredTextChunk
text
string* requiredtype
stringDefault Value: "text"
ImageURLChunk
{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}
ImageURL
detail
"low" | "auto" | "high"url
string* requiredtype
stringDefault Value: "image_url"
DocumentURLChunk
document_name
string | nullThe filename of the document
document_url
string* requiredtype
stringDefault Value: "document_url"
ReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
FileChunk
file_id
string* requiredtype
stringDefault Value: "file"
ThinkChunk
closed
booleanWhether the thinking chunk is closed or not. Currently only used for prefixing.
Default Value: true
signature
string | nullSignature to replay some reasoning blocks across turns.
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ToolReferenceChunk
description
string | nullfavicon
string | nulltitle
string* requiredtool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* requiredtype
stringDefault Value: "tool_reference"
url
string | nullReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
type
stringDefault Value: "thinking"
AudioChunk
input_audio
string* requiredtype
stringDefault Value: "input_audio"
ResourceChunk
type
stringDefault Value: "resource"
uri
string* requiredResourceLinkChunk
metadata
map<string | integer | number | boolean> | nulltype
stringDefault Value: "resource_link"
uri
string* requiredname
string | nullrole
stringDefault Value: "tool"
tool_call_id
string | nullmetadata
map<any> | nullmin_tokens
integer | nulln
integer | nullNumber of completions to return for each request, input tokens are only billed once.
parallel_tool_calls
booleanDefault Value: true
prediction
Prediction | nullEnable 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
stringDefault Value: ""
type
stringDefault Value: "content"
presence_penalty
number | nullThe 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 | nullprompt_logprobs
boolean | nullprompt_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 | nullThe 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 | nullresponse_format
ResponseFormat | nullSpecify 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 | nullJsonSchema
description
string | nullname
string* requiredschema_definition
map<any>* requiredstrict
booleanDefault 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> | nullStop generation if this token is detected. Or if one of these tokens is detected when providing an array
stream
booleanWhether 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" | NamedToolChoiceNamedToolChoice
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* requiredtype
"function"tools
array<Tool | ImageGenerationTool | DocumentLibraryTool | CustomConnector> | nullTool
Function
description
stringDefault Value: ""
name
string* requiredparameters
map<any>* requiredstrict
booleanDefault Value: false
type
"function"ImageGenerationTool
tool_configuration
ToolConfiguration | nullToolConfiguration
exclude
array<string> | nullinclude
array<string> | nullrequires_confirmation
array<string> | nulltype
"image_generation"Default Value: "image_generation"
DocumentLibraryTool
library_ids
array<string>Min Items: 1* requiredIds of the library in which to search.
tool_configuration
ToolConfiguration | nullToolConfiguration
exclude
array<string> | nullinclude
array<string> | nullrequires_confirmation
array<string> | nulltype
"document_library"Default Value: "document_library"
CustomConnector
authorization
OAuth2TokenAuth | APIKeyAuth | nullDeprecated: 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* requiredAPIKeyAuth
type
"api-key"Default Value: "api-key"
value
string* requiredconnector_id
string* requiredtool_configuration
ToolConfiguration | nullToolConfiguration
exclude
array<string> | nullinclude
array<string> | nullrequires_confirmation
array<string> | nulltype
"connector"Default Value: "connector"
top_k
integer | nulltop_logprobs
integer | nulltop_prompt_logprobs
integer | nullResponses
Successful Response
ChatCompletionChoice
finish_reason
"stop" | "length" | "model_length" | "error" | "tool_calls"* requiredExample:
stop
index
integer* requiredExample:
0
logprobs
ChatCompletionResponseChoiceLogprobs | nullChatCompletionResponseChoiceLogprobs
ChatCompletionResponseTokenLogprobsTopK
bytes
array<integer>* requiredlogprob
number* requiredtoken
string* requiredtoken_id
integer* requiredtop_logprobs
array<ChatCompletionResponseTokenLogprobs> | nullChatCompletionResponseTokenLogprobs
bytes
array<integer>* requiredlogprob
number* requiredtoken
string* requiredtoken_id
integer* requiredmessage
AssistantMessageAssistantMessage
content
string | array<TextChunk | ImageURLChunk | DocumentURLChunk | ReferenceChunk | FileChunk | ThinkChunk | AudioChunk | ResourceChunk | ResourceLinkChunk> | nullTextChunk
text
string* requiredtype
stringDefault Value: "text"
ImageURLChunk
{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}
ImageURL
detail
"low" | "auto" | "high"url
string* requiredtype
stringDefault Value: "image_url"
DocumentURLChunk
document_name
string | nullThe filename of the document
document_url
string* requiredtype
stringDefault Value: "document_url"
ReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
FileChunk
file_id
string* requiredtype
stringDefault Value: "file"
ThinkChunk
closed
booleanWhether the thinking chunk is closed or not. Currently only used for prefixing.
Default Value: true
signature
string | nullSignature to replay some reasoning blocks across turns.
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ToolReferenceChunk
description
string | nullfavicon
string | nulltitle
string* requiredtool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* requiredtype
stringDefault Value: "tool_reference"
url
string | nullReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
type
stringDefault Value: "thinking"
AudioChunk
input_audio
string* requiredtype
stringDefault Value: "input_audio"
ResourceChunk
type
stringDefault Value: "resource"
uri
string* requiredResourceLinkChunk
metadata
map<string | integer | number | boolean> | nulltype
stringDefault Value: "resource_link"
uri
string* requiredprefix
booleanSet 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
stringDefault Value: "assistant"
tool_calls
array<ToolCall> | nullToolCall
FunctionCall
arguments
map<any> | string* requiredname
string* requiredid
stringindex
integerDefault Value: 0
type
"function"messages
array<DeltaMessage>DeltaMessage
content
string | array<TextChunk | ImageURLChunk | DocumentURLChunk | ReferenceChunk | FileChunk | ThinkChunk | AudioChunk | ResourceChunk | ResourceLinkChunk> | nullTextChunk
text
string* requiredtype
stringDefault Value: "text"
ImageURLChunk
{"type":"image_url","image_url":"data:image/png;base64,iVBORw0"}
ImageURL
detail
"low" | "auto" | "high"url
string* requiredtype
stringDefault Value: "image_url"
DocumentURLChunk
document_name
string | nullThe filename of the document
document_url
string* requiredtype
stringDefault Value: "document_url"
ReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
FileChunk
file_id
string* requiredtype
stringDefault Value: "file"
ThinkChunk
closed
booleanWhether the thinking chunk is closed or not. Currently only used for prefixing.
Default Value: true
signature
string | nullSignature to replay some reasoning blocks across turns.
TextChunk
text
string* requiredtype
stringDefault Value: "text"
ToolReferenceChunk
description
string | nullfavicon
string | nulltitle
string* requiredtool
"web_search" | "web_search_premium" | "code_interpreter" | "image_generation" | "document_library" | "mistral_mcp" | string* requiredtype
stringDefault Value: "tool_reference"
url
string | nullReferenceChunk
reference_ids
array<integer | string>* requiredtype
stringDefault Value: "reference"
type
stringDefault Value: "thinking"
AudioChunk
input_audio
string* requiredtype
stringDefault Value: "input_audio"
ResourceChunk
type
stringDefault Value: "resource"
uri
string* requiredResourceLinkChunk
metadata
map<string | integer | number | boolean> | nulltype
stringDefault Value: "resource_link"
uri
string* requiredindex
integer | nullIf the completion returns multiple messages, this is to specify which message this delta is for.
metadata
map<any> | nullrole
string | nulltool_call_id
string | nulltool_calls
array<ToolCall> | nullToolCall
FunctionCall
arguments
map<any> | string* requiredname
string* requiredid
stringindex
integerDefault Value: 0
type
"function"prompt_logprobs
ChatCompletionResponseChoiceLogprobs | nullChatCompletionResponseChoiceLogprobs
ChatCompletionResponseTokenLogprobsTopK
bytes
array<integer>* requiredlogprob
number* requiredtoken
string* requiredtoken_id
integer* requiredtop_logprobs
array<ChatCompletionResponseTokenLogprobs> | nullChatCompletionResponseTokenLogprobs
bytes
array<integer>* requiredlogprob
number* requiredtoken
string* requiredtoken_id
integer* requiredcreated
integer* requiredExample:
1702256327
id
string* requiredExample:
cmpl-e5cc70bb28c444948073e77776eb30ef
model
string* requiredExample:
mistral-small-latest
object
string* requiredExample:
chat.completion
UsageInfo
completion_tokens
integerDefault Value: 0
prompt_audio_seconds
integer | nullprompt_tokens
integerDefault Value: 0
prompt_tokens_details
PromptTokensDetails | nullToken usage details for the prompt.
PromptTokensDetails
Token usage details for the prompt.
audio_tokens
integerDefault Value: 0
cached_tokens
integerDefault Value: 0
service_tier
string | nullThe service tier at which the request was processed: standard or priority.
total_tokens
integerDefault Value: 0