Codestral
Codestral

Codestral

Codestral is Mistral AI's low-latency coding model optimized for fill-in-the-middle completion and code generation. This guide distinguishes Codestral 25.08 from Mistral Code, Vibe, Devstral and Codestral Embed and covers API cost, privacy, FIM integration, evaluation, security and deployment.

252

Views

0

Likes

Jan 2026

Added

chat.mistral.ai

Website

Tags

ai-codingfree

Editorial Review

About Codestral

Codestral is Mistral AI’s specialized model family for fast, high-frequency code completion, especially fill-in-the-middle (FIM). The current production alias codestral-latest points to the supported generation selected by Mistral; the current documented version is Codestral 25.08 (codestral-2508) with a 128K context window. It can also perform code generation and chat-style tasks.

Codestral is not the whole Mistral developer product line. Vibe Code is the current CLI, IDE and web coding agent; Devstral is optimized for multi-step agentic software engineering; Codestral Embed creates vectors for code search; and the earlier Mistral Code product announcement described an enterprise IDE stack. Choosing the right layer prevents an autocomplete model from being evaluated as if it were an autonomous agent.

Codestral directory placeholder visual
This directory entry currently lacks official Codestral artwork. The authoritative capability, price and lifecycle information is in Mistral’s live model card and pricing documentation.

Map the task to the correct Mistral coding component

ComponentPrimary jobTypical input/outputDo not confuse it with
Codestral 25.08Low-latency FIM and code generationPrefix + suffix → missing codeA full repository agent
DevstralAgentic coding and software-engineering tasksIssue + tools/repository → multi-step changeInline completion
Codestral EmbedCode/search vector representationCode/query → embeddingText generation
Vibe CodeUser-facing CLI/IDE/web agent experienceDeveloper task → edits, commands, PROne model endpoint
StudioAPI keys, playground, evaluation and monitoringDeveloper control planeEnd-user coding assistant
Le Chat legacy URLEarlier chat entry pointConversationThe official Codestral model page

The listing’s stored URL points to chat.mistral.ai/chat, but the current Mistral platform describes Vibe, Studio and Admin. For API evaluation, use the model card and Studio rather than treating a consumer chat page as Codestral’s canonical product surface.

How FIM works

 file before cursor          file after cursor
       |                            |
       v                            v
    [prefix] + FIM markers + [suffix]
                 |
                 v
            Codestral
                 |
                 v
        proposed middle span
                 |
      syntax/type/test/security gate
                 |
            developer accepts

Ordinary next-token completion sees only what precedes the cursor. FIM also supplies the suffix, allowing the model to close a function, respect following calls and insert code without rewriting the rest. An IDE integration should send only the context required for the completion, preserve exact prefix/suffix boundaries and stop generation before duplicated suffix content.

Current version, context and price

As reviewed July 26, 2026, the Codestral 25.08 model card lists a 128K context and API pricing of $0.30 per million input tokens and $0.90 per million output tokens. Mistral’s pricing page shows the same rates for codestral-latest, with batch processing advertised at 50% off and cached input at a large discount where applicable. Confirm the live invoice currency, region and endpoint.

Example API workloadInputOutputApproximate model cost
1,000 small completions4M tokens0.5M tokens$1.20 + $0.45 = $1.65
1,000 broad-context completions20M1M$6.00 + $0.90 = $6.90
Batch offline generation20M2MAbout half standard token charge if eligible
Waste from low acceptanceSame tokensSame tokensCost unchanged even when developers reject suggestions

These arithmetic examples exclude IDE/plugin fees, gateways, retrieval, network, self-hosted infrastructure and engineering. Track cost per accepted completion and retained code, not calls alone. Aggressively sending 128K on every keystroke is slow, costly and unnecessary.

Model lifecycle: aliases versus pinned IDs

codestral-latest simplifies upgrades but can change behavior. A pinned ID such as codestral-2508 improves reproducibility until retirement. Mistral’s model catalog places Codestral 25.01, Codestral 24.05 and Codestral Mamba among legacy/deprecated models; the 25.01 card recorded a retirement date in 2025.

StrategyBenefitRiskRecommended control
Use latestAutomatic supported upgradeSilent quality/latency changeCanary traffic and continuous benchmark
Pin versionReproducible behaviorRetirement outageLifecycle alert and migration window
Self/VPC deployResidency and controlLicense, hardware and operationsContract plus capacity/security testing
Fallback modelAvailabilityDifferent FIM markers/quality/data termsExplicit compatible adapter and user signal

License and “open weight” history

The original Codestral 22B weights were released under the Mistral AI Non-Production License for research/testing, with commercial licenses offered separately. Do not generalize that license to every Codestral version, API use or enterprise deployment. Codestral 25.08 is documented as a Premier model and enterprise self-deployment is a commercial offering.

Record the exact artifact/API terms, permitted use, derivative/fine-tuning rights, geographic restrictions and support. “Downloadable” and “open source” are not synonyms. Downstream generated code also needs normal license, dependency and provenance review.

Code privacy and context minimization

Autocomplete may send code around the cursor, imports, symbols, open tabs, repository maps, filenames and developer prompts. This can include secrets, customer data and proprietary algorithms. Inspect the IDE extension or integration’s actual context builder, not only the model provider’s policy.

Context sourceValueRiskMinimization
Current file prefix/suffixEssential FIM structureSecrets and unrelated regionsBound window; redact secret patterns
Imported definitionsType/API accuracyBroad proprietary codeSend signatures/docs before implementations
Repository retrievalConventions and cross-file callsLarger disclosure/index retentionPath allowlist and local retrieval
Terminal/test outputFailure contextTokens, environment paths and user dataScrub logs and select relevant lines
Git diff/issueIntent and recent changeUntrusted prompt injectionLabel as data; never grant tool authority

Use separate API keys per environment, least-privilege workspaces, spending limits and rotation. Do not embed keys in editor settings committed to Git. Confirm Mistral’s current data-processing, retention and training controls for Free, paid API, Team and Enterprise because product plans differ.

A completion benchmark that reflects developer value

Create 200–1,000 cursor positions sampled from repositories and languages your team actually uses. Freeze the prefix, suffix, relevant context and hidden ground truth. Include boilerplate, API use, error handling, tests, SQL, shell, security-sensitive code and incomplete refactors. Remove cases already present in public benchmark corpora where leakage is plausible.

MetricDefinitionWhy it matters
Exact/semantic matchMatches target or passes behavior testsAcademic comparability
Acceptance rateSuggestions accepted / shownImmediate usefulness
RetentionAccepted code remaining after 1–7 daysFilters quick accept/rewrite behavior
Keystrokes/time savedControlled task comparisonActual productivity
Defect/security rateAccepted suggestions causing findingsQuality guardrail
LatencyP50/P95 cursor-to-renderAutocomplete must stay in flow
Cost/retained completionAll token/tool cost / retained acceptsEconomic decision

Mistral reported improved accepted and retained completions for 25.08 in its enterprise announcement. Treat vendor figures as a hypothesis and reproduce them using your extension, network and repositories.

Latency engineering

Debounce keystrokes, cancel stale requests and cache stable prefixes. Keep output length short for autocomplete. Use streaming only if partial candidates improve experience without encouraging premature acceptance. Separate interactive FIM traffic from batch test generation so long jobs do not saturate rate limits.

Measure end-to-end latency: editor context collection, retrieval, network, queue, first token, generation and rendering. A model benchmark that excludes extension overhead cannot predict developer experience.

Security and correctness gates

Never execute generated code merely because it compiles. Run formatter, parser/typechecker, unit tests, secret scan, dependency policy and language-specific security checks in a sandbox. For SQL and shell completions, require stricter confirmation and a non-production environment.

  • Reject suggestions that introduce hard-coded credentials, disabled TLS or unsafe deserialization.
  • Resolve package names against an approved registry to reduce hallucinated dependency attacks.
  • Require human review for authentication, cryptography, payments, migrations and access control.
  • Show the whole suggested span and affected suffix before acceptance.
  • Attribute accepted AI code in internal telemetry only as permitted by employee/privacy policy.

FIM integration checklist

Integration concernTestFailure symptom
Markers/tokenizerOfficial FIM endpoint/SDK fixtureMarkers leak into code or suffix repeats
Stop logicBraces, indentation and following statementRunaway generation
UnicodeNon-ASCII identifiers/commentsCorruption or offset mismatch
Context truncationVery large file/repoCritical suffix/import disappears
CancellationRapid typing and file switchStale completion inserted
TelemetryInspect request/log payloadCode or secrets stored unexpectedly

When Codestral is not the right choice

Use Devstral/Vibe Code or another agentic system when the job requires exploring a repository, planning, editing multiple files, running commands and opening a PR. Use Codestral Embed for semantic code retrieval. Use deterministic refactoring/linters when the transformation is known. Use a general reasoning model for architecture discussions that are not latency-sensitive completions.

Alternatives

OptionBest fitTradeoff versus Codestral
CodestralLow-latency multi-language FIM through MistralPremier model lifecycle and provider dependency
GitHub CopilotManaged IDE/GitHub experienceProduct subscription and less model-level control
TabnineEnterprise completion and deployment choicesDifferent ecosystem and pricing
Continue + selected modelOpen-source IDE orchestrationYou own context, providers and evaluation
Local open code modelOffline/residency and predictable controlGPU, latency, licensing and maintenance
Language server/snippetKnown symbols and deterministic boilerplateLess generative flexibility, higher factual reliability

Frequently asked questions

What is the current Codestral model?

The current model card lists Codestral 25.08 (codestral-2508) and the API alias codestral-latest.

How much does the API cost?

At review time, $0.30 per million input tokens and $0.90 per million output tokens. Confirm the live pricing page.

Is Codestral open source?

Do not use that blanket label. Original weights had a non-production license; the current Premier model and self-deployment use current Mistral terms/contracts.

Is it the same as Devstral?

No. Codestral targets completion/FIM; Devstral targets agentic software-engineering tasks.

Is it the same as Vibe Code?

No. Vibe Code is a user-facing coding agent across terminal, IDE and web that can use coding models.

Does a 128K window mean I should send the full repository?

No. Retrieve and minimize relevant context for latency, cost and privacy.

Can generated code be trusted?

No. Run independent tests, static/security checks and human review proportional to risk.

Primary sources

Last reviewed July 26, 2026. Model aliases, prices, product naming and retirement dates change. Pin versions for production and monitor the live catalog and changelog.

Ready to try Codestral?

Visit the official website to get started

Visit Codestral

Quick Info

Added
1/21/2026
Published
1/21/2026
Updated
9/7/2026

Share This Tool

Have an AI tool to share?

Submit it to AI Dreamhub

Get your product in front of people actively exploring AI tools.

Submit Your Tool
Cursor

Cursor

Built to make you extraordinarily productive, Cursor is the best way to code with AI.

ai-codingfree
2970
GitHub Copilot

GitHub Copilot

GitHub Copilot is GitHub’s AI coding assistant across IDEs, GitHub.com, pull requests, CLI workflows, code review, and agentic development. It is best for developers and teams that want AI help inside existing repositories while keeping review, tests, and governance in the workflow.

GitHub CopilotAI coding assistantCopilot Chat
3220
Trae

Trae

Trae is your helpful coding partner. It offers features like AI Q&A, code auto-completion, and agent-based AI programming capabilities.

ai-codingfree
3950
MarsCode

MarsCode

MarsCode is an AI coding assistant and IDE-style development tool for code completion, explanation, debugging, and code generation. Current official metadata also points to Trae AI IDE, so the page should explain the product carefully instead of treating it as a static legacy listing.

MarsCodeTrae AI IDEAI coding assistant
7240