Mistral AI Introduction
Mistral AI is a French AI company offering high-performance, competitively priced large language models. Their API is OpenAI-compatible, making integration with OpenClaw straightforward.
Get an API Key
- Visit console.mistral.ai and register
- Go to the API Keys page
- Click "Create new key"
Basic Configuration
{
"providers": {
"mistral": {
"type": "openai",
"baseUrl": "https://api.mistral.ai/v1",
"apiKey": "{{MISTRAL_API_KEY}}",
"models": ["mistral-large-latest", "mistral-medium-latest", "mistral-small-latest", "open-mistral-nemo"]
}
}
}
openclaw secrets set MISTRAL_API_KEY "your-mistral-api-key"
Model Selection Guide
| Model | Features | Use Case | Price |
|---|---|---|---|
| mistral-large-latest | Strongest performance | Complex reasoning, long text | Higher |
| mistral-medium-latest | Balanced | General conversation | Medium |
| mistral-small-latest | Fast response | Simple Q&A | Lower |
| open-mistral-nemo | Open source | Basic conversation | Lowest |
| codestral-latest | Code-focused | Programming assistance | Medium |
Using Codestral for Code Generation
Codestral supports 80+ programming languages:
{
"models": {
"mistral-code": {
"provider": "mistral",
"model": "codestral-latest",
"temperature": 0.2,
"maxTokens": 8192
}
}
}
JSON Mode and Function Calling
Mistral supports JSON output mode and function calling, both compatible with OpenClaw's tool system:
{
"models": {
"mistral-tools": {
"provider": "mistral",
"model": "mistral-large-latest",
"supportsFunctionCalling": true
}
}
}
Connection Verification
openclaw doctor --provider mistral
Summary
Mistral AI offers excellent value models, with Codestral particularly excelling in code scenarios. By combining different model tiers, you can achieve the optimal balance of performance and cost in OpenClaw.