Devstral 2 Complete Guide β Mistral's Open-Source Coding Agent Model (2026)
π’ Update: Mistral Medium 3.5 has replaced Devstral 2 as the default model in Vibe CLI. See the Medium 3.5 complete guide and Vibe 2.0 remote agents guide.
Devstral 2 is Mistral AIβs dedicated coding agent model β a 123B dense transformer with a 256K context window that scores 72.2% on SWE-bench Verified. That puts it among the best open-weight coding models available, competing directly with Claude Code and GLM-5.1.
Unlike Codestral (optimized for autocomplete), Devstral 2 is built for agentic coding β planning, executing, debugging, and iterating across entire repositories.
Specs
| Spec | Devstral 2 | Devstral Small 2 |
|---|---|---|
| Parameters | 123B (dense) | 24B (dense) |
| Context window | 256K | 256K |
| SWE-bench Verified | 72.2% | ~58% |
| Architecture | Dense transformer | Dense transformer |
| License | Modified MIT | Modified MIT |
| Quantized size | ~65GB (Q4) | ~14GB (Q4) |
The 256K context window is the standout feature β it can reason across entire codebases in a single pass. Most competing models top out at 128-200K.
Devstral 2 vs the competition
| Model | SWE-bench | Context | Params | License | Local? |
|---|---|---|---|---|---|
| Devstral 2 | 72.2% | 256K | 123B | Mod. MIT | 1x H100 |
| GLM-5.1 | 58.4 (Pro) | 200K | 754B MoE | MIT | 4x A100 |
| Claude Opus 4.6 | 72.1% | 200K | Unknown | Proprietary | No |
| Kimi K2.5 | 65.8% | 256K | 1T MoE | MIT | 4x A100 |
| Mistral Large 2 | ~68% | 128K | 123B | Research | 1x H100 |
Devstral 2 essentially matches Claude Opus on SWE-bench while being open-weight and runnable on a single server node. Thatβs remarkable.
How to use Devstral 2
Via Mistral API
from mistralai import Mistral
client = Mistral(api_key="your-key")
response = client.chat.complete(
model="devstral-2-latest",
messages=[{"role": "user", "content": "Refactor this module to use dependency injection"}]
)
Via OpenRouter
from openai import OpenAI
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key="your-key")
response = client.chat.completions.create(
model="mistralai/devstral-2",
messages=[{"role": "user", "content": "Fix the race condition in this handler"}]
)
See our OpenRouter guide for full setup.
With Aider
aider --model mistralai/devstral-2 --openai-api-base https://api.mistral.ai/v1
See our Aider guide for configuration details.
With Mistral Vibe CLI
Mistral released their own terminal coding tool alongside Devstral 2:
npm install -g @mistralai/vibe-cli
vibe
Vibe CLI is purpose-built for Devstral and includes project-aware context management.
Running locally
Devstral 2 at 123B is the same size as Mistral Large 2 β it fits on a single high-end GPU:
| Setup | Speed | Usable? |
|---|---|---|
| 1x H100 (80GB) | ~30 tok/s | β Excellent |
| 2x A100 (160GB) | ~25 tok/s | β Good |
| Mac Studio Ultra 192GB | ~5-8 tok/s (Q4) | β οΈ Slow but works |
For consumer hardware, use Devstral Small 2 (24B) instead β it runs on a single RTX 4090 or a Mac with 32GB RAM:
ollama pull devstral-small:24b
aider --model ollama/devstral-small:24b
Devstral 2 vs Codestral β whatβs the difference?
Both are from Mistral, but they serve different purposes:
| Devstral 2 | Codestral | |
|---|---|---|
| Purpose | Agentic coding (agent) | Autocomplete (FIM) |
| Size | 123B | 22B |
| Context | 256K | 256K |
| Best at | Multi-file refactors, bug fixes | Inline completions, tab suggestions |
| Use with | Aider, Vibe CLI | Continue.dev, IDE |
The ideal Mistral setup: Devstral 2 for complex agent tasks + Codestral for fast autocomplete.
Bottom line
Devstral 2 is the best open-weight coding agent model in 2026. It matches Claude Opus on SWE-bench, has the largest context window (256K), and runs on a single server. The modified MIT license allows commercial use. If youβre building AI coding tools or need a self-hosted coding agent, Devstral 2 should be your first choice.
FAQ
Is Devstral 2 free?
Yes, Devstral 2 is released under a modified MIT license that allows free commercial use. You can download the weights and self-host without any licensing fees.
Can I run Devstral locally?
Yes, Devstral 2 is designed to run on a single server with high-end GPUs. Itβs one of the most practical frontier coding models for local deployment, requiring approximately 2x A100 80GB GPUs for full precision.
How does Devstral compare to Codestral?
Devstral 2 is optimized for agentic coding workflows (multi-file edits, tool use, autonomous problem-solving), while Codestral focuses on fast code completion and generation. Devstral 2 significantly outperforms Codestral on SWE-bench and complex coding tasks.
Is Devstral good for coding?
Devstral 2 is specifically built for coding and matches Claude Opus on SWE-bench verified. It excels at autonomous code editing, debugging, and multi-step development tasks with its 256K context window.
Related: Codestral Complete Guide Β· Mistral Large 2 Complete Guide Β· Best Open-Source Coding Models 2026