πŸ€– AI Tools
Β· 4 min read
Last updated on

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

SpecDevstral 2Devstral Small 2
Parameters123B (dense)24B (dense)
Context window256K256K
SWE-bench Verified72.2%~58%
ArchitectureDense transformerDense transformer
LicenseModified MITModified 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

ModelSWE-benchContextParamsLicenseLocal?
Devstral 272.2%256K123BMod. MIT1x H100
GLM-5.158.4 (Pro)200K754B MoEMIT4x A100
Claude Opus 4.672.1%200KUnknownProprietaryNo
Kimi K2.565.8%256K1T MoEMIT4x A100
Mistral Large 2~68%128K123BResearch1x 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:

SetupSpeedUsable?
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 2Codestral
PurposeAgentic coding (agent)Autocomplete (FIM)
Size123B22B
Context256K256K
Best atMulti-file refactors, bug fixesInline completions, tab suggestions
Use withAider, Vibe CLIContinue.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