Use the Mistralai CLI from KosmoKrator to call Mistralai tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
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 --jsonkosmokrator integrations:doctor mistralai --jsonkosmokrator integrations:status --json
Credentials
Authentication type: API keyapi_key. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
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.
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).
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.
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.
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.
List all MistralAI agents in your account. Returns agent IDs, names, models, and descriptions. Agents are AI assistants with custom instructions and tools.
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.
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).
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.
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.
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.
List all MistralAI agents in your account. Returns agent IDs, names, models, and descriptions. Agents are AI assistants with custom instructions and tools.
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.
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.