Overview
Codestral is Mistral AI’s first model built specifically for code. Mistral released it on May 29, 2024 as a 22-billion-parameter open-weight model trained on more than 80 programming languages, from Python, Java, C, C++, JavaScript and Bash to less common ones such as Swift and Fortran. It was designed for two jobs: following instructions about code, and filling in missing code between existing lines (fill-in-the-middle, or FIM), which is what editor autocomplete needs.
Specifications
- Size: 22 billion parameters, small enough to run on a single high-end GPU or, quantized, on a well-equipped desktop.
- Context window: 32,000 tokens, which Mistral highlighted at launch as larger than the 4K to 16K windows of the competing code models it compared against.
- Modes: instruction (chat about code) and fill-in-the-middle completion, served through one API.
- Local use: Ollama offers
codestral:22bas a 13GB download; weights are on Hugging Face asCodestral-22B-v0.1.
Licence and access
The weights were published under the Mistral AI Non-Production License, which allows research and testing but not commercial use; companies that want to self-host commercially must obtain a licence from Mistral. Commercial use is otherwise through Mistral’s API. At launch Mistral offered two routes: api.mistral.ai, billed per token, and a dedicated codestral.mistral.ai endpoint for IDE plugins where users bring their own keys, which was free during an eight-week beta behind a waitlist. Mistral also offers the model in its self-deployment program for enterprises.
Performance
Mistral evaluated Codestral on HumanEval and MBPP for Python generation, CruxEval for predicting Python output, RepoBench for long-range repository-level completion, Spider for SQL, and HumanEval in six other languages (C++, Bash, Java, PHP, TypeScript and C#). It compared FIM performance against DeepSeek Coder 33B. Mistral said Codestral outperformed the other models it tested on RepoBench, which it attributed to the longer context. JetBrains reported in the launch post that Codestral scored 73.75 on its Kotlin-HumanEval benchmark at temperature 0.2, ahead of GPT-4-Turbo’s 72.05. These are 2024 results; newer code models score far higher on today’s harder agentic benchmarks.
Tools and integrations
At launch Codestral was integrated with LlamaIndex and LangChain, and with the Continue.dev and Tabnine plugins for VS Code and JetBrains IDEs. Sourcegraph said it reduced autocomplete latency in its Cody assistant. These integrations made it one of the first open-weight models widely used for in-editor completion.
Strengths and limits
- Fast, compact model with strong fill-in-the-middle completion for its size.
- Broad language coverage and easy local use through Ollama and llama.cpp.
- The non-production licence rules out free commercial self-hosting.
- The 32K context is small next to current models with context windows of hundreds of thousands of tokens.
- Built for completion and short tasks, not for long autonomous coding agents.
Alternatives
Mistral’s own Devstral and Devstral Small 2 target agentic coding, and Qwen3-Coder and StarCoder2 are open alternatives with more permissive licences. Our explainer on AI coding assistants shows where autocomplete models like Codestral fit next to chat and agent tools, and our Ollama guide covers running it locally.
Specifications are taken from the provider’s official announcement, documentation or model card. Benchmark results depend on evaluation settings; see how AI benchmarks work.