KosmoKrator

other

Mistralai CLI for AI Agents

Use the Mistralai CLI from KosmoKrator to call Mistralai tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 3 read 4 write API key auth

Mistralai CLI Setup

Mistralai can be configured headlessly with `kosmokrator integrations:configure mistralai`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure mistralai --set api_key="$MISTRALAI_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor mistralai --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key MISTRALAI_API_KEY Secret secret yes API Key
url MISTRALAI_URL URL url no API Base URL

Call Mistralai Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call mistralai.mistralai_chat '{
  "model": "example_model",
  "messages": "example_messages",
  "temperature": 1,
  "max_tokens": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:mistralai mistralai_chat '{
  "model": "example_model",
  "messages": "example_messages",
  "temperature": 1,
  "max_tokens": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs mistralai --json
kosmo integrations:docs mistralai.mistralai_chat --json
kosmo integrations:schema mistralai.mistralai_chat --json
kosmo integrations:search "Mistralai" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Mistralai.

mistralai.mistralai_chat

Write write

Generate a chat completion using a MistralAI model. Send a list of messages (with roles "system", "user", or "assistant") and receive a model-generated response. Use temperature to control creativity (0 = deterministic, 1 = creative).

Parameters
model, messages, temperature, max_tokens

Generic CLI call

kosmo integrations:call mistralai.mistralai_chat '{"model":"example_model","messages":"example_messages","temperature":1,"max_tokens":1}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_chat '{"model":"example_model","messages":"example_messages","temperature":1,"max_tokens":1}' --json

mistralai.mistralai_create_embedding

Write write

Generate text embeddings using a MistralAI embedding model. Converts text into numerical vectors for semantic search, similarity comparison, or clustering. Supports single strings or arrays of strings.

Parameters
model, input

Generic CLI call

kosmo integrations:call mistralai.mistralai_create_embedding '{"model":"example_model","input":"example_input"}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_create_embedding '{"model":"example_model","input":"example_input"}' --json

mistralai.mistralai_list_models

Read read

List all models available in your MistralAI account. Returns model IDs, creation timestamps, and capabilities. Use this to discover which models you can use for chat completions or embeddings.

Parameters
none

Generic CLI call

kosmo integrations:call mistralai.mistralai_list_models '{}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_list_models '{}' --json

mistralai.mistralai_finetune

Write write

Create a fine-tuning job on MistralAI. Upload training data and select a base model to create a custom fine-tuned model. The job runs asynchronously — check the returned job ID for status updates.

Parameters
model, training_files, hyperparameters, suffix

Generic CLI call

kosmo integrations:call mistralai.mistralai_finetune '{"model":"example_model","training_files":"example_training_files","hyperparameters":"example_hyperparameters","suffix":"example_suffix"}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_finetune '{"model":"example_model","training_files":"example_training_files","hyperparameters":"example_hyperparameters","suffix":"example_suffix"}' --json

mistralai.mistralai_list_agents

Read read

List all MistralAI agents in your account. Returns agent IDs, names, models, and descriptions. Agents are AI assistants with custom instructions and tools.

Parameters
none

Generic CLI call

kosmo integrations:call mistralai.mistralai_list_agents '{}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_list_agents '{}' --json

mistralai.mistralai_create_agent

Write write

Create a new MistralAI agent. Specify a name, model, and instructions to define how the agent should behave. Agents are persistent AI assistants that can be used for conversations with custom personalities and capabilities.

Parameters
name, model, instructions, description

Generic CLI call

kosmo integrations:call mistralai.mistralai_create_agent '{"name":"example_name","model":"example_model","instructions":"example_instructions","description":"example_description"}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_create_agent '{"name":"example_name","model":"example_model","instructions":"example_instructions","description":"example_description"}' --json

mistralai.mistralai_get_current_user

Read read

Get information about the currently authenticated MistralAI user. Returns account details, subscription tier, and usage information.

Parameters
none

Generic CLI call

kosmo integrations:call mistralai.mistralai_get_current_user '{}' --json

Provider shortcut

kosmo integrations:mistralai mistralai_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

mistralai.mistralai_chat

Generate a chat completion using a MistralAI model. Send a list of messages (with roles "system", "user", or "assistant") and receive a model-generated response. Use temperature to control creativity (0 = deterministic, 1 = creative).

Operation
Write write
Schema command
kosmo integrations:schema mistralai.mistralai_chat --json
ParameterTypeRequiredDescription
model string yes The model to use (e.g., "mistral-large-latest", "mistral-small-latest", "open-mistral-nemo").
messages array yes Array of message objects with "role" (system, user, assistant) and "content" fields. Example: [{"role": "user", "content": "Hello"}]
temperature number no Sampling temperature between 0.0 and 1.0. Lower values are more deterministic, higher values more creative. Default: 0.7.
max_tokens integer no Maximum number of tokens to generate in the response.

mistralai.mistralai_create_embedding

Generate text embeddings using a MistralAI embedding model. Converts text into numerical vectors for semantic search, similarity comparison, or clustering. Supports single strings or arrays of strings.

Operation
Write write
Schema command
kosmo integrations:schema mistralai.mistralai_create_embedding --json
ParameterTypeRequiredDescription
model string yes The embedding model to use (e.g., "mistral-embed").
input string yes The text to embed. Can be a single string or JSON array of strings for batch embedding.

mistralai.mistralai_list_models

List all models available in your MistralAI account. Returns model IDs, creation timestamps, and capabilities. Use this to discover which models you can use for chat completions or embeddings.

Operation
Read read
Schema command
kosmo integrations:schema mistralai.mistralai_list_models --json
ParameterTypeRequiredDescription
No parameters.

mistralai.mistralai_finetune

Create a fine-tuning job on MistralAI. Upload training data and select a base model to create a custom fine-tuned model. The job runs asynchronously — check the returned job ID for status updates.

Operation
Write write
Schema command
kosmo integrations:schema mistralai.mistralai_finetune --json
ParameterTypeRequiredDescription
model string yes The base model to fine-tune (e.g., "open-mistral-7b", "open-mixtral-8x7b").
training_files array yes Array of training file IDs (previously uploaded to MistralAI).
hyperparameters string no JSON-encoded hyperparameters object (e.g., {"n_epochs": 3, "learning_rate": 0.0001}).
suffix string no Suffix for the fine-tuned model name.

mistralai.mistralai_list_agents

List all MistralAI agents in your account. Returns agent IDs, names, models, and descriptions. Agents are AI assistants with custom instructions and tools.

Operation
Read read
Schema command
kosmo integrations:schema mistralai.mistralai_list_agents --json
ParameterTypeRequiredDescription
No parameters.

mistralai.mistralai_create_agent

Create a new MistralAI agent. Specify a name, model, and instructions to define how the agent should behave. Agents are persistent AI assistants that can be used for conversations with custom personalities and capabilities.

Operation
Write write
Schema command
kosmo integrations:schema mistralai.mistralai_create_agent --json
ParameterTypeRequiredDescription
name string yes The agent name (e.g., "Support Bot", "Code Assistant").
model string yes The model to use for the agent (e.g., "mistral-large-latest", "mistral-small-latest").
instructions string yes System instructions that define the agent's behavior, personality, and constraints.
description string no A short description of what the agent does.

mistralai.mistralai_get_current_user

Get information about the currently authenticated MistralAI user. Returns account details, subscription tier, and usage information.

Operation
Read read
Schema command
kosmo integrations:schema mistralai.mistralai_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.