Overview
Codestral 22B (codestral-2405) was Mistral AI's first code-specialized model, released on May 29, 2024. The dense 22-billion-parameter model was trained on more than 80 programming languages — including Python, Java, C, C++, JavaScript, TypeScript, PHP, Bash, Swift and Fortran — and shipped with a then-large 32K-token context window aimed at repository-level code completion.
Unlike a chat-only model, Codestral 22B supports both instruction-following and native fill-in-the-middle (FIM) completion: given a prefix and a suffix, it generates the code in between, which made it well suited to IDE autocomplete and test/docstring generation. Mistral released it as an open-weight model under the new Mistral AI Non-Production License (MNPL-0.1), which permitted research and testing but not commercial production use. For API access, Mistral offered a dedicated endpoint at codestral.mistral.ai (free during an 8-week beta) alongside the standard api.mistral.ai endpoint.
Codestral 22B has since been retired: Mistral's model registry lists codestral-2405 with a retirement date of June 16, 2025, after the line moved on to Codestral 25.01 (2501) and Codestral 2508. The original open weights remain available on Hugging Face as Codestral-22B-v0.1 for anyone who wants to study or run the historical model locally.
| Released | 2024-05-29 |
|---|---|
| License | Mistral AI Non-Production License (MNPL-0.1) — research and testing only, no commercial/production use |
| Weights | Open weights |
| Parameters | 22B (≈22.2B), dense |
| Context | 32K tokens |
| Max output | Not separately published by Mistral; output is bounded by the 32K context window |
| Architecture | Dense decoder-only transformer using the Mistral v3 tokenizer. Trained for both instruction-following and native fill-in-the-middle (FIM) code completion via prefix/suffix tokens. No mixture-of-experts (the separate Codestral Mamba 7B used a different architecture). |
| Knowledge cutoff | Not published by Mistral |
| Modalities | text, code |
| Status | Retired. Mistral lists codestral-2405 with a retirement date of 2025-06-16; the legacy API alias was superseded by newer Codestral versions (2501 / 2508). The open weights remain downloadable on Hugging Face. |
Benchmarks
- HumanEval (Python, pass@1)81.1%
- MBPP (sanitized, pass@1)78.2%
- CruxEval-O (Python output prediction)51.3%
- RepoBench EM (repo-level completion)34%
- Spider (text-to-SQL)63.5%
- HumanEval multilingual (avg across C++, Bash, Java, PHP, TypeScript, C#)71.4%
Scores on a 0–100 scale (25-point gridlines); higher is better. Each benchmark links to its published source.
Strengths
- Native fill-in-the-middle (FIM) completion for prefix/suffix code infilling, beyond plain chat generation
- Broad language coverage — trained on 80+ programming languages
- 32K-token context window, large for a code model at its mid-2024 launch, strengthening long-range / repo-level completion
- Open weights downloadable on Hugging Face for local and offline use
- Strong HumanEval (81.1%) relative to its size, beating much larger code models of the era like Code Llama 70B
- Compact 22B footprint runnable on a single high-memory GPU
Best for
- IDE code autocomplete and inline fill-in-the-middle suggestions
- Generating functions, tests, and docstrings from natural-language prompts
- Repository-level code completion using the 32K context
- Multi-language code generation across 80+ languages
- Local/offline coding assistants where open weights are required
- Research and benchmarking of code LLMs (non-production, per the MNPL license)
How to access
| Provider | Model ID |
|---|---|
| Mistral AI (dedicated endpoint) ↗ | codestral-2405 |
| Hugging Face (open weights) ↗ | mistralai/Codestral-22B-v0.1 |
Codestral — every version
The full lineage of the Codestral line, newest first. Every version has its own page — click any to compare specs, benchmarks and pricing.
| Version | Released | Context | License |
|---|---|---|---|
| Codestral (25.08)current | 2025-07-30 | — | Open weights |
| Codestral 25.01 | 2025-01 | — | Open weights |
| Codestral 22B (24.05) | 2024-05-29 | — | Open weights |
FAQ
Is Codestral 22B (24.05) still available?
The codestral-2405 API model is retired — Mistral's model registry lists a retirement date of June 16, 2025, and the line was succeeded by Codestral 25.01 (2501) and Codestral 2508. However, the original open weights remain downloadable on Hugging Face as Codestral-22B-v0.1, so you can still run the historical model locally.
Can I use Codestral 22B commercially?
No. The May 2024 release was published under the Mistral AI Non-Production License (MNPL-0.1), which allows research and testing only — not commercial or production use. (Mistral later relicensed newer Codestral versions; check each version's own license.)
What is fill-in-the-middle (FIM) in Codestral?
FIM lets the model complete code between a given prefix and suffix rather than only continuing from the end. Codestral 22B was trained natively for FIM, which is what powers IDE-style inline autocomplete and inserting code into the middle of an existing file.
How big is Codestral 22B and what context length does it support?
It is a dense ~22-billion-parameter (22.2B) transformer with a 32K-token context window, trained on 80+ programming languages. The 32K context was relatively large for a code model at its mid-2024 launch and helped on repository-level completion benchmarks like RepoBench.