Integrations / Mistral AI
Mistral AI
Mistral AI models through the Mistral API: chat completions, agent completions, embeddings, text moderation, OCR of documents and images, and model listings. Calls use your Mistral API credits.
9 actions
API key
9 read0 write
Calls api.mistral.ai
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "mistralai" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
This toolkit uses a single credential and requests no scopes.
Actions
Agent completionreadmistralai.agent_completionGet a reply from a Mistral agent you created in AI Studio (agents completions): the agent's own model, instructions and tools are applied to your messages. Uses paid API tokens.
| Input | Type | Description | |
|---|---|---|---|
agent_id | string | Required | ID of the agent, from list_agents |
messages | array of object | Required | The conversation: objects with role (system, user, assistant) and content (text) |
max_tokens | integer | Optional | Maximum tokens to generate |
random_seed | integer | Optional | Seed for repeatable output |
await setu.execute({
userId: "user_1",
action: "mistralai.agent_completion",
input: {
"agent_id": "<agent_id>",
"messages": []
},
});Chat completionreadmistralai.chatSend a conversation to a Mistral model and get the reply (chat completions). Uses paid API tokens but changes no stored data. Set response_format to {"type":"json_object"} for JSON output.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Model id, e.g. mistral-large-latest, mistral-small-latest; list_models shows all |
messages | array of object | Required | The conversation: objects with role (system, user, assistant) and content (text) |
temperature | number | Optional | Randomness (0.0 to 1.5 recommended) |
top_p | number | Optional | Nucleus sampling, 0 to 1 |
max_tokens | integer | Optional | Maximum tokens to generate |
random_seed | integer | Optional | Seed for repeatable output |
response_format | object | Optional | Output format, e.g. {"type":"json_object"} |
safe_prompt | boolean | Optional | Add Mistral's safety prompt before the conversation |
await setu.execute({
userId: "user_1",
action: "mistralai.chat",
input: {
"model": "<model>",
"messages": []
},
});Create embeddingsreadmistralai.create_embeddingsTurn one or more texts into embedding vectors (numbers) for search, clustering or similarity, with mistral-embed or codestral-embed. Returns one vector per input text, in order. Uses paid API tokens.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Embedding model, e.g. mistral-embed |
input | array of string | Required | The texts to embed |
await setu.execute({
userId: "user_1",
action: "mistralai.create_embeddings",
input: {
"model": "<model>",
"input": []
},
});Get modelreadmistralai.get_modelGet one model's details: context length, capabilities, aliases and deprecation date.
| Input | Type | Description | |
|---|---|---|---|
model_id | string | Required | Model id, e.g. mistral-small-latest |
await setu.execute({
userId: "user_1",
action: "mistralai.get_model",
input: {
"model_id": "<model_id>"
},
});List agentsreadmistralai.list_agentsList the agents created in the Mistral workspace (name, model, instructions, version), so an agent_id can be used with agent_completion.
| Input | Type | Description | |
|---|---|---|---|
page | integer | Optional | Page number, starting at 0 |
page_size | integer | Optional | Agents per page (1-1000) |
search | string | Optional | Only agents whose name matches |
await setu.execute({
userId: "user_1",
action: "mistralai.list_agents",
input: {},
});List modelsreadmistralai.list_modelsList the models the API key can use, with context length and capabilities (chat, vision, function calling, fine-tuning).
No input.
await setu.execute({
userId: "user_1",
action: "mistralai.list_models",
input: {},
});Moderate textreadmistralai.moderate_textCheck texts for harmful or sensitive content with Mistral's moderation model: per text, which categories apply (sexual, hate and discrimination, violence and threats, dangerous and criminal content, self-harm, health, financial, law, pii) and a score for each. Uses paid API tokens.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Moderation model, e.g. mistral-moderation-latest |
input | array of string | Required | The texts to check |
await setu.execute({
userId: "user_1",
action: "mistralai.moderate_text",
input: {
"model": "<model>",
"input": []
},
});OCR a documentreadmistralai.ocr_documentExtract the text of a PDF or other document at a public https address as markdown, one entry per page, keeping headings and tables (Mistral OCR). Uses paid API tokens; the file is fetched by Mistral from the address.
| Input | Type | Description | |
|---|---|---|---|
document_url | string | Required | Public https address of the PDF or document |
model | string | Required | OCR model, e.g. mistral-ocr-latest |
pages | array of integer | Optional | Only these page numbers, starting at 0 (documents only) |
table_format | string | Optional | Return tables as markdown or html |
await setu.execute({
userId: "user_1",
action: "mistralai.ocr_document",
input: {
"document_url": "<document_url>",
"model": "<model>"
},
});OCR an imagereadmistralai.ocr_imageExtract the text of an image at a public https address (a scan, screenshot or photo of a page) as markdown (Mistral OCR). Uses paid API tokens; the image is fetched by Mistral from the address.
| Input | Type | Description | |
|---|---|---|---|
image_url | string | Required | Public https address of the image (png, jpg...) |
model | string | Required | OCR model, e.g. mistral-ocr-latest |
pages | array of integer | Optional | Only these page numbers, starting at 0 (documents only) |
table_format | string | Optional | Return tables as markdown or html |
await setu.execute({
userId: "user_1",
action: "mistralai.ocr_image",
input: {
"image_url": "<image_url>",
"model": "<model>"
},
});