# Codestral 22B (24.05)

> Mistral's first code model: a 22B open-weight specialist with 32K context, fill-in-the-middle, and 80+ languages.

- Maker: Mistral AI
- Line: Codestral
- Canonical page: https://ai-tldr.dev/models/codestral-2405/
- Updated: 2026-06-18

## In short

Codestral 22B (24.05) is Mistral's first code model: a 22B open-weight specialist with 32K context, fill-in-the-middle, and 80+ languages. Mistral AI released it on 29 May 2024. It has a 32K-token context window. You can use it through Mistral AI (dedicated endpoint) and Hugging Face (open weights).

## Facts

| Fact | Value | Source |
| --- | --- | --- |
| Context window | 32K tokens (max output Not separately published by Mistral; output is bounded by the 32K context window) | [1] |
| Licence | Mistral AI Non-Production License (MNPL-0.1) — research and testing only, no commercial/production use · open weights | [1] |
| Released | 29 May 2024 | [2] |
| Parameters | 22B (≈22.2B), dense | [1] |
| Knowledge cutoff | Not published by Mistral | [1] |

## Sources

1. [Codestral-22B-v0.1 model card (Hugging Face)](https://huggingface.co/mistralai/Codestral-22B-v0.1)
2. [Codestral announcement (Mistral AI)](https://mistral.ai/news/codestral/)

## 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.

## Benchmarks

- HumanEval (Python, pass@1): 81.1% ([source](https://mistral.ai/news/codestral/))
- MBPP (sanitized, pass@1): 78.2% ([source](https://mistral.ai/news/codestral/))
- CruxEval-O (Python output prediction): 51.3% ([source](https://www.analyticsvidhya.com/blog/2024/06/codestral-22b/))
- RepoBench EM (repo-level completion): 34% ([source](https://www.analyticsvidhya.com/blog/2024/06/codestral-22b/))
- Spider (text-to-SQL): 63.5% ([source](https://www.analyticsvidhya.com/blog/2024/06/codestral-22b/))
- HumanEval multilingual (avg across C++, Bash, Java, PHP, TypeScript, C#): 71.4% ([source](https://mistral.ai/news/codestral/))

## 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

- [Mistral AI (dedicated endpoint)](https://mistral.ai/news/codestral/) — model id `codestral-2405`
- [Hugging Face (open weights)](https://huggingface.co/mistralai/Codestral-22B-v0.1) — model id `mistralai/Codestral-22B-v0.1`

## Codestral versions

- [Codestral (25.08)](https://ai-tldr.dev/models/codestral-2508/) (30 July 2025)
- [Codestral 25.01](https://ai-tldr.dev/models/codestral-2501/) (January 2025)
- Codestral 22B (24.05) (29 May 2024) — this page

## 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.

## Links

- [Codestral announcement (Mistral AI)](https://mistral.ai/news/codestral/)
- [Codestral-22B-v0.1 model card (Hugging Face)](https://huggingface.co/mistralai/Codestral-22B-v0.1)
- [Codestral model lifecycle / retirement status (Mistral legal)](https://legal.mistral.ai/ai-governance/models/codestral)
- [Codestral 22B benchmark breakdown (Analytics Vidhya)](https://www.analyticsvidhya.com/blog/2024/06/codestral-22b/)
- [Mistral announces Codestral (VentureBeat)](https://venturebeat.com/ai/mistral-announces-codestral-its-first-programming-focused-ai-model)

Source: AI/TLDR LLM registry, https://ai-tldr.dev/models/codestral-2405/
