AI/TLDR

Codestral 22B (24.05)

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

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.

Released2024-05-29
LicenseMistral AI Non-Production License (MNPL-0.1) — research and testing only, no commercial/production use
WeightsOpen weights
Parameters22B (≈22.2B), dense
Context32K tokens
Max outputNot separately published by Mistral; output is bounded by the 32K context window
ArchitectureDense 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 cutoffNot published by Mistral
Modalitiestext, code
StatusRetired. 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

  1. HumanEval (Python, pass@1)81.1%
  2. MBPP (sanitized, pass@1)78.2%
  3. CruxEval-O (Python output prediction)51.3%
  4. RepoBench EM (repo-level completion)34%
  5. Spider (text-to-SQL)63.5%
  6. 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

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

VersionReleasedContextLicense
Codestral (25.08)current2025-07-30Open weights
Codestral 25.012025-01Open weights
Codestral 22B (24.05)2024-05-29Open 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.