LLM·Dex
Open weightsMistralmidtext

Codestral 2

Mistral's code-specialized model, fast inline completion and strong fill-in-the-middle support.

Updated


Quick facts

Released
Jan 2025
Context
256K tokens
Output / 1M
$0.90 / 1M tokens
License
Mistral Non-Production License

About Codestral 2

Codestral 2 is Mistral's coding-specialist model, trained on 80+ programming languages with strong fill-in-the-middle support. It's the model many self-hosted Continue.dev and Cody setups use under the hood for inline completion.

The non-production license is the catch, commercial deployments require a paid agreement with Mistral. For research and inline editor use, it remains one of the best open coder options in its size class.

Benchmarks

Published scores from Mistral's model card or independent leaderboards. We do not publish numbers we cannot source, see methodology.

HumanEval
92.0
Python coding pass@1
MMLU
,
Broad academic knowledge
GPQA
,
Graduate-level reasoning
SWE-bench
,
Real software-engineering tasks
  • HumanEval92.0

Capabilities

Strengths

  • Fast inline completion
  • FIM support
  • Self-hostable for IP-sensitive teams

Tracked weaknesses

  • Non-production license restricts commercial deployment
  • Coding-only, not a general chat model

Pricing

Per-million-token rates as published by Mistral.

TierPriceNotes
Input$0.30 / 1M tokensTokens you send to the model
Output$0.90 / 1M tokensTokens the model generates
Context256K tokensMax combined input + output

Call Codestral 2 from your code

Drop-in snippet for the Mistral SDK. Set your API key in the environment and run.

typescript
import OpenAI from "openai";

const client = new OpenAI({
  // Use OPENAI_API_KEY for OpenAI, or your provider's key + baseURL.
  apiKey: process.env.OPENAI_API_KEY,
});

const completion = await client.chat.completions.create({
  model: "codestral-2",
  messages: [
    { role: "user", content: "What's the time complexity of quicksort?" },
  ],
});

console.log(completion.choices[0].message.content);

Best for

Tasks where Codestral 2 ranks among LLMDex's top picks.

Compare Codestral 2 with…

Frequently asked

  • How much does Codestral 2 cost per million tokens?
    Codestral 2 is priced at $0.30 / 1M tokens for input tokens and $0.90 / 1M tokens for output tokens via the official Mistral API at the time of writing.
  • What is Codestral 2's context window?
    Codestral 2 supports a context window of 256K tokens.
  • Is Codestral 2 open source?
    Codestral 2 ships with open weights under the Mistral Non-Production License license. You can self-host it, fine-tune it, and (subject to the license terms) deploy it commercially.
  • When was Codestral 2 released?
    Codestral 2 was released on Jan 14, 2025 by Mistral.
Friday digest

Intelligence, distilled weekly.

One short email every Friday, new model launches, leaderboard moves, and pricing drops. Curated by hand. Free, no spam.