Skip to main content
Lesson 4 of 14 · Mistral Models: The Complete Guide

Codestral and Devstral — Models for Code

Lesson 4 of 14 Updated July 28, 2026 Beginner
On this page
  1. Code, a Domain Apart
  2. Codestral — The Code Completion Model
  3. Devstral 2 — The Frontier Code Agent
  4. Codestral Embed — Code Embeddings
  5. Key Takeaways

Code, a Domain Apart

Code generation is where specialization pays off most. A generalist model writes correct Python; but a model trained specifically on millions of repositories, with optimization objectives tailored to this domain, reaches a different order of reliability. The difference doesn’t show in a ten-line function written from scratch—it shows in the thousands of suggestions a developer accepts or rejects in a day. That’s the role of the Codestral family at Mistral.

Codestral — The Code Completion Model

Codestral, in its August 2025 version, is the specialist for code completion and generation. It sits in the Premier tier: accessible only via the Mistral API, with no option to download the weights.

Its most defining capability is called Fill-in-the-Middle, or FIM. An ordinary generation model can only continue text from the end; Codestral, however, also completes the middle of an existing file, taking into account what follows the cursor as much as what precedes it. This is exactly the situation of a developer returning to a function already written to insert three lines, which is why FIM dictates any serious integration into an IDE. Add to that support for more than eighty languages—Python, JavaScript, TypeScript, Java, C++, Rust, Go and many others—, an understanding of project context that makes it respect existing imports and your naming conventions, and an optimization focused on speed: in an editor, a suggestion that arrives after two seconds won’t get used.

Integration works natively in modern editors: on VS Code via the Continue extension or the Mistral extension, on JetBrains environments—IntelliJ, PyCharm, WebStorm—via dedicated plugins, on Neovim via compatible LSP clients. The experience mirrors GitHub Copilot: suggestions appear as you type, and you accept or ignore them with a keystroke.

One legitimate question remains, since Mistral Small 4 also has a coding mode: why maintain both? Because they aren’t optimized for the same task. Codestral targets fast completion in IDE, with FIM, low latency and short suggestions. Small 4 performs better on complex code tasks—large-scale refactoring, explaining a legacy module, debugging via conversation. Most developers end up using both: Codestral in the editor for the coding flow, Small 4 in a chat for moments when you need to think rather than type.

Devstral 2 — The Frontier Code Agent

Devstral 2, launched in December 2025, is in a different category. Where Codestral completes code, Devstral is a code agent: it handles a development task from end to end.

The distinction deserves clarification, because the word “agent” is thrown around loosely. A code agent starts from a problem described in natural language, explores the existing codebase to understand its structure, plans a solution in several steps, writes the code in the relevant files, then tests and iterates until obtaining a functional result. It doesn’t produce an answer; it produces a change in a repository—which also requires governing it with the same safeguards as a human contributor: dedicated branch, tests, and review before merging.

In practice, this opens up four use cases found in most teams. The first is automatic ticket resolution: you give it a bug report, it proposes a fix. The second is implementing features described in plain language. The third is code migration, typically moving from one framework version to the next, a repetitive and costly task if any. The fourth is augmented code review, where analysis goes beyond syntax checking to focus on the meaning of what was written. Devstral 2 belongs to the Open tier: its weights are on Hugging Face, and nothing stops you from hosting it internally—a condition often non-negotiable when the agent must read proprietary code.

Codestral Embed — Code Embeddings

Codestral Embed (May 2025, Premier tier) rounds out the family without ever writing a line of code. Its role is to produce vector representations—embeddings—optimized for source code, to make semantic search in a repository possible.

The value becomes clear as soon as a codebase exceeds the size a person can hold in memory. You index the entire source code, then search by intention rather than by string: “the function that validates an email address” finds the right fragment even if it’s called checkUserContact, where a grep "email" would have come up empty. The same index then feeds a specialized code RAG pipeline.

Key Takeaways

  • Codestral is the specialist for code completion in IDE (FIM, 80+ languages, low latency)
  • Devstral 2 is a frontier code agent capable of solving complex tasks end to end
  • Codestral Embed generates embeddings optimized for semantic search in code
  • Codestral and Small 4 are complementary: fast completion vs reasoning on code
  • Devstral 2 is open source, Codestral and Codestral Embed are Premier tier