Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Responses Endpoints

Responses API, currently in public preview.

Create a response

POST /v1/responses#

200 (application/json)

200 (text/event-stream)

Successful Response

AdditionalProperties#
map<any>
background#
boolean|null
completed_at#
number|null
created_at#
*number
error#
ResponsesError|null

Error details when generation fails.

id#
*string
incomplete_details#
ResponsesIncompleteDetails|null

Details when generation stops before the response is complete.

instructions#
string|null
max_output_tokens#
integer|null
max_tool_calls#
integer|null
metadata#
map<string>|null
model#
*string
object#
*string

The generated messages, reasoning items, and function calls. To continue the conversation, append these items to your next request's input.

parallel_tool_calls#
*boolean
previous_response_id#
string|null
prompt_cache_key#
string|null
prompt_cache_retention#
"in_memory"|"24h"
safety_identifier#
string|null
service_tier#
"auto"|"default"|"flex"|"scale"|"priority"
status#
"completed"|"failed"|"in_progress"|"cancelled"|"queued"|"incomplete"

The response status. Check this field to see whether generation completed.

temperature#
number|null
tool_choice#
*"none"|"auto"|"required"|ResponsesToolChoiceFunction
top_logprobs#
integer|null
top_p#
number|null
truncation#
"auto"|"disabled"
usage#
ResponsesUsage|null

Token usage for this response.

user#
string|null
curl https://api.mistral.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MISTRAL_API_KEY" \
  -d '{
  "model": "mistral-large-4",
  "input": "Write a one-sentence greeting.",
  "reasoning": {
    "effort": "high"
  },
  "max_output_tokens": 4096
}'
import os
from mistralai.client import Mistral

with Mistral(api_key=os.environ["MISTRAL_API_KEY"]) as client:
    response = client.responses.create(
        model="mistral-large-4",
        input="Write a one-sentence greeting.",
        reasoning={"effort": "high"},
        max_output_tokens=4096,
    )

    for item in response.output:
        if item.type == "message":
            for part in item.content:
                if part.type == "output_text":
                    print(part.text)
import { Mistral } from "@mistralai/mistralai";

const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });

const response = await client.responses.create({
  model: "mistral-large-4",
  input: "Write a one-sentence greeting.",
  reasoning: { effort: "high" },
  maxOutputTokens: 4096,
});

for (const item of response.output) {
  if (item.type === "message") {
    for (const part of item.content) {
      if (part.type === "output_text") console.log(part.text);
    }
  }
}

200 (application/json)

200 (text/event-stream)

{
  "id": "resp_example",
  "object": "response",
  "created_at": 1792584000,
  "model": "mistral-large-4",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "id": "msg_example",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "Hello! How can I help you today?",
          "annotations": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "tool_choice": "auto",
  "tools": [],
  "store": false,
  "error": null,
  "incomplete_details": null,
  "usage": {
    "input_tokens": 12,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 10,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 22
  }
}

Count input tokens

POST /v1/responses/input_tokens#

Count response input tokens.

Count the input tokens for a Responses request without generating a response. The count includes the supplied conversation, instructions, and tool definitions.

Use the same input, instructions, and tools that you plan to send when creating a response. For multi-turn conversations, include prior output items and function results in input.

200

Successful Response

AdditionalProperties#
map<any>
input_tokens#
*integer

The number of input tokens, including conversation history, instructions, and tool definitions.

object#
*string
curl https://api.mistral.ai/v1/responses/input_tokens \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MISTRAL_API_KEY" \
  -d '{
  "model": "mistral-large-4",
  "input": "Write a one-sentence greeting."
}'
import os
from mistralai.client import Mistral

with Mistral(api_key=os.environ["MISTRAL_API_KEY"]) as client:
    response = client.responses.count_input_tokens(
        model="mistral-large-4",
        input="Write a one-sentence greeting.",
    )

    print(response.input_tokens)
import { Mistral } from "@mistralai/mistralai";

const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });

const response = await client.responses.countInputTokens({
  model: "mistral-large-4",
  input: "Write a one-sentence greeting.",
});

console.log(response.inputTokens);

200

{
  "object": "response.input_tokens",
  "input_tokens": 12
}