← Back to API models

Codestral

by Mistral AI · code specialist

Mistral's code specialist: fill-in-the-middle completion at a fraction of frontier rates, popular as an IDE backend.

Input $0.30 / 1M
Output $0.90 / 1M
Context 256K tokens
Specialty Code
La Plateforme ↗ Updated June 10, 2026
§ API pricing

Per-token rates.

Input
$0.30/1M tokens
Prompt tokens
  • ~8× cheaper than Sonnet 4.6
  • 256K window for repo context
  • Optimized for code tokens
Output
$0.90/1M tokens
Completion tokens
  • ~17× cheaper than Sonnet 4.6
  • Completion-speed latency
  • Cheap enough for keystroke-level use
Context
256Ktokens
Window
  • Larger than Claude's 200K standard
  • Fits sizable repos
  • Same window as Mistral Large 3
FIM
Yesfill-in-the-middle
Completion mode
  • Completes code mid-file
  • Built for editor integration
  • Not just chat-style generation

Why Codestral exists

Codestral is a specialist: a model trained for code that supports fill-in-the-middle — completing code where your cursor is, with file context on both sides — which chat-tuned frontier models handle awkwardly. At $0.30 input and $0.90 output per 1M tokens, it's priced for keystroke-frequency calls: an IDE firing dozens of completions per minute stays affordable.

That's a different job than agentic coding. Claude and GPT models plan, refactor, and run tools; Codestral completes and generates. Plenty of teams run both — a frontier model for the hard work, Codestral as the always-on completion layer.

Capabilities

Strong code generation and completion across mainstream languages, a 256K window that fits real repository context, and latency suited to interactive use. The open-weights heritage matters here too: self-hostable variants exist for teams that can't send code to any external API.

The honest weakness: it's not a reasoner. Architecture decisions, subtle multi-file refactors, and debugging-by-deduction belong to Opus-class models or agent loops built on bigger brains.

Typical use cases

  • IDE autocomplete and fill-in-the-middle completion
  • Code generation from well-specified prompts
  • Boilerplate, test, and docstring generation at volume
  • Self-hosted completion backends (code never leaves your infra)
  • Cheap first-pass code review summaries

Sibling and rival comparison

ModelInput / 1MOutput / 1MContext
Codestral$0.30$0.90256K
Grok Code Fast 1$0.20$1.50256K
Claude Sonnet 4.6$3$15200K (1M β)
GPT-5.4$2.50$15272K
Mistral Large 3$2$6256K

The direct rival is Grok Code Fast 1 — cheaper input, pricier output, no FIM pedigree. The frontier coding models (Sonnet, GPT-5.4) cost 8–17× more and earn it on hard tasks. The split that works: Codestral for completion volume, a frontier model for thinking.

← See the full Mistral lineup