#16258: feat(models): add Mistral AI provider support
docs
agents
size: S
Cluster:
Voice Transcription Enhancements
## Pull Request Description
### Summary
Adds native support for **Mistral AI** as a model provider. Users can now use Mistral models directly by setting the `MISTRAL_API_KEY` environment variable or configuring the provider in their OpenClaw config.
### Models Added
| Model ID | Name | Context Window | Input Types | Pricing (per 1M tokens) |
|----------|------|----------------|-------------|------------------------|
| `mistral-large-latest` | Mistral Large | 128K | text, image | $2.00 input / $6.00 output |
| `mistral-medium-latest` | Mistral Medium | 128K | text | $0.40 input / $1.20 output |
| `mistral-small-latest` | Mistral Small | 128K | text | $0.10 input / $0.30 output |
| `codestral-latest` | Codestral | 256K | text | $0.30 input / $0.90 output |
| `ministral-8b-latest` | Ministral 8B | 128K | text | $0.10 input / $0.30 output |
### Usage
**Option 1: Environment Variable**
```bash
export MISTRAL_API_KEY="your-api-key"
openclaw agent --model mistral/mistral-large-latest
```
**Option 2: Configuration**
```json
{
"models": {
"providers": {
"mistral": {
"apiKey": "your-api-key"
}
}
},
"agents": {
"defaults": {
"model": { "primary": "mistral/mistral-large-latest" }
}
}
}
```
### Changes
- **`src/agents/models-config.providers.ts`**:
- Added Mistral base URL and pricing constants
- Added `buildMistralProvider()` function with 5 models
- Added Mistral to `resolveImplicitProviders()` for auto-discovery
### Related
- Mistral tool call ID sanitization (`strict9` mode) was already supported in `transcript-policy.ts`
- `MISTRAL_API_KEY` environment variable mapping was already in `model-auth.ts`
### Testing
- [x] Verify `MISTRAL_API_KEY` environment variable is detected
- [x] Verify models appear in `openclaw models list`
- [x] Test model selection with `mistral/mistral-large-latest`
- [x] Verify tool call ID sanitization works correctly
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds native Mistral AI provider support with 5 models (`mistral-large-latest`, `mistral-medium-latest`, `mistral-small-latest`, `codestral-latest`, `ministral-8b-latest`). The implementation follows established provider patterns in the codebase and integrates with existing Mistral infrastructure (env var mapping in `model-auth.ts`, tool call ID sanitization in `transcript-policy.ts`).
- Defines `buildMistralProvider()` with OpenAI-compatible API, pricing tiers, and correct context windows (128K default, 256K for Codestral)
- Registers Mistral in `resolveImplicitProviders()` for auto-discovery via `MISTRAL_API_KEY` env var or auth profiles
- Includes an unrelated change in `src/browser/csrf.ts` that adds an explicit return type annotation to `browserMutationGuardMiddleware()`
- Minor typo in the pricing URL comment (`la-plateprise` → `la-plateforme`)
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge — it adds a new provider following well-established patterns with no impact on existing functionality.
- The Mistral provider implementation closely mirrors existing providers (NVIDIA, Together, etc.) in both structure and registration flow. The codebase already had Mistral support infrastructure (env var mapping, tool call ID sanitization) in place. The only notable issue is a typo in a comment URL. The unrelated csrf.ts change is a safe type annotation addition.
- No files require special attention. The `src/browser/csrf.ts` change is unrelated to the PR scope but is harmless.
<sub>Last reviewed commit: bc1713a</sub>
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#14730: Add Mistral AI as a model provider
by jaimegh-es · 2026-02-12
87.4%
#11334: feat: add Mistral/Voxtral audio transcription provider
by JamesEBall · 2026-02-07
84.8%
#12059: feat(agents): Add Azure AI Foundry credential support
by lisanyambere · 2026-02-08
77.0%
#20530: feat: add Astrai as implicit provider (intelligent inference router)
by beee003 · 2026-02-19
76.6%
#15991: feat: add Novita AI provider support with dynamic model discovery
by Alex-wuhu · 2026-02-14
76.0%
#20965: feat: Add comprehensive model configuration and discovery for various…
by rodeok · 2026-02-19
75.5%
#14934: fix: add mistral to MemorySearchSchema provider/fallback unions
by ThomsenDrake · 2026-02-12
75.1%
#16766: fix(model): apply provider baseUrl/headers override to registry-fou...
by dzianisv · 2026-02-15
75.0%
#20587: feat: add Tetrate Agent Router Service provider
by RicHincapie · 2026-02-19
74.9%
#15756: [Security]: strip provider apiKey from models.json before prompt se...
by SecBear · 2026-02-13
74.7%