Mistral Codestral
Mistral Codestral is Mistral AI's first dedicated code generation model, trained on 80+ programming languages with a context window of 128K tokens and fill-in-the-middle (FIM) support for in-context code completion.
import { streamText } from 'ai'
const result = streamText({ model: 'mistral/codestral', prompt: 'Why is the sky blue?'})Frequently Asked Questions
What is fill-in-the-middle (FIM) and how does Mistral Codestral use it?
FIM allows Mistral Codestral to complete code given both a prefix (code before the cursor) and a suffix (code after the cursor). Mistral Codestral uses this to insert completions inside partial functions or expressions, which is the dominant pattern in IDE plugins.
How many programming languages does Mistral Codestral support?
Mistral Codestral was trained on over 80 programming languages. Benchmarked languages include Python, C++, Bash, Java, PHP, TypeScript, C#, SQL, Swift, and Fortran.
What is Mistral Codestral's context window?
128K tokens. At launch this was over four times larger than the 4K to 16K windows typical of competing code models.
Can Mistral Codestral write unit tests?
Yes. Test generation is an explicit use case in Mistral AI's documentation for Mistral Codestral alongside code completion and documentation authoring.
Is Mistral Codestral available as an open-weight model?
Yes. Weights are available on HuggingFace under the Mistral AI Non-Production License (MNPL). Commercial API access is available through La Plateforme and AI Gateway.
How does Mistral Codestral integrate with IDEs?
Mistral Codestral integrates with Continue.dev and Tabnine plugins for VS Code and JetBrains, using the FIM API for in-editor completions.
How is Mistral Codestral different from Devstral?
Mistral Codestral is a code generation and completion model focused on individual file-level tasks. Devstral is an agentic model designed to navigate entire codebases, resolve GitHub issues, and orchestrate multi-file changes autonomously.