[Mistral](/ai-gateway/models/labs/mistral)

# Mistral Codestral

Mistral Codestral is Mistral's first dedicated code generation model, trained on 80+ programming languages with a context window of 128K tokens and fill-in-the-middle (FIM) support for in-context code completion. Your use is subject to Mistral's [Terms](https://mistral.ai/terms) & [Privacy](https://mistral.ai/terms#privacy-policy) Policies.

Tool Use

[Use with AI Gateway](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Futm_source%3Dgateway-model-page%26utm_campaign%3Dai-gateway-models&title=Get+Started+with+Vercel+AI+Gateway) [View docs](https://vercel.com/docs/ai-gateway)

AI SDKChat CompletionsMessagesResponses

```
1import { streamText } from 'ai'
2

3const result = streamText({
4  model: 'mistral/codestral',
5  prompt: 'Why is the sky blue?'
6})
```

[Read docs](https://vercel.com/docs/ai-gateway/sdks-and-apis/ai-sdk)

[Overview](/ai-gateway/models/codestral) [API](/ai-gateway/models/codestral/api) [About](/ai-gateway/models/codestral/about) [Providers](/ai-gateway/models/codestral/providers) [Throughput](/ai-gateway/models/codestral/throughput) [Latency](/ai-gateway/models/codestral/latency) [Uptime](/ai-gateway/models/codestral/uptime) [Status](/ai-gateway/models/codestral/status) [Similar](/ai-gateway/models/codestral/similar) [FAQ](/ai-gateway/models/codestral/faq)

## [Copy link to heading](#playground)Playground

Try out Mistral Codestral by Mistral. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.

![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75)Mistral Codestral

![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=96&q=75)

Mistral Codestral

## [Copy link to heading](#providers)Providers

Route requests across multiple providers. Copy a provider slug to set your preference. Visit the [docs](/docs/ai-gateway/provider-options) for more info. Using a provider means you agree to their terms, listed under Legal.

| Provider |
| --- |

| Context | Max Output | Latency | Throughput | Input | Output | Cache | Web Search | Capabilities | ZDR | No Training | Free Tier | Release Date |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |

| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [Mistral](/ai-gateway/models/providers/mistral) Legal:[Terms](https://mistral.ai/terms)•[Privacy](https://mistral.ai/terms#privacy-policy) | 128K | 4K | 0.4 s | 94 tps | $0.30/M | $0.90/M |  | — |  |  |  |  | 05/29/2024 |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |

## [Copy link to heading](#throughput)Throughput24 hours

1W

1D

P50 throughput on live AI Gateway traffic, in tokens per second (TPS). Visit the [docs](https://vercel.com/docs/ai-gateway/models-and-providers/metrics) for more info.

## [Copy link to heading](#latency)Latency24 hours

1W

1D

P50 time to first token (TTFT) on live AI Gateway traffic, in milliseconds. View the [docs](https://vercel.com/docs/ai-gateway/models-and-providers/metrics) for more info.

## [Copy link to heading](#uptime)Uptime24 hours

1W

1D

1H

Direct request success rate on AI Gateway and per-provider. Visit the [docs](https://vercel.com/docs/ai-gateway/models-and-providers/uptime) for more info.

1W

1D

1H

## [Copy link to heading](#more-models-by-mistral)More models by Mistral

All

Text

Code

Embed

| Model |
| --- |

| Context | Latency | Throughput | Input | Output | Cache | Web Search | Capabilities | Providers | ZDR | No Training | Free Tier | Release Date |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |

| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [mistral/devstral\-small-2](/ai-gateway/models/devstral-small-2) | 256K | 0.4 s |  | $0.10/M | $0.30/M |  | — |  | ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) |  |  |  | 12/09/2025 |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [mistral/mistral\-large-3](/ai-gateway/models/mistral-large-3) | 256K | 5.1 s | 60 tps | $0.50/M | $1.50/M |  | — |  | ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) |  |  |  | 12/02/2025 |  |
| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [mistral/ministral-14b](/ai-gateway/models/ministral-14b) | 256K | 0.4 s | 83 tps | $0.20/M | $0.20/M |  | — |  | ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) |  |  |  | 12/02/2025 |  |
| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [mistral/ministral-3b](/ai-gateway/models/ministral-3b) | 128K | 0.3 s | 144 tps | $0.10/M | $0.10/M |  | — |  | ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) |  |  |  | 10/16/2024 |  |
| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [mistral/mistral-small](/ai-gateway/models/mistral-small) | 32K | 1.0 s | 154 tps | $0.10/M | $0.30/M |  | — |  | ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) |  |  |  | 09/17/2024 |  |
| ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) [mistral/mistral-embed](/ai-gateway/models/mistral-embed) |  |  |  | $0.10/M |  |  | — |  | ![mistral logo](/vc-ap-vercel-marketing/_next/image?url=https%3A%2F%2F7nyt0uhk7sse4zvn.public.blob.vercel-storage.com%2Fdocs-assets%2Fstatic%2Fdocs%2Fai-gateway%2Flogos%2Fmistral.png&w=48&q=75) |  |  |  | 12/11/2023 |  |

## [Copy link to heading](#about-mistral-codestral)About Mistral Codestral

Announced May 29, 2024, Mistral Codestral was the first model Mistral dedicated entirely to code. With 22 billion parameters and training across more than 80 programming languages, including Python, Java, C, C++, JavaScript, Bash, Swift, and Fortran, Mistral Codestral covers the breadth of languages developers encounter in production.

Mistral Codestral's defining technical feature is fill-in-the-middle (FIM) support. Unlike instruction-only models that generate code from a prompt, FIM lets Mistral Codestral complete code within a partial snippet. Mistral Codestral can insert a function body, finish a conditional branch, or complete a class method given the surrounding context. This makes Mistral Codestral a natural fit for IDE integrations like Continue.dev and Tabnine, where code above and below the cursor is provided as context.

Beyond completion, Mistral Codestral handles test generation and documentation authoring. Its context window of 128K tokens was over four times larger than those of competing models at launch, so Mistral Codestral can process full files rather than truncated snippets.

## [Copy link to heading](#what-to-consider-when-choosing-a-provider)What To Consider When Choosing a Provider

- Configuration: Mistral Codestral's context window of 128K tokens was over four times larger than the 4K to 16K windows typical of competing code models at release. You can reason over entire files or multi-file snippets in a single request.
- Zero Data Retention: Zero Data Retention is available for this model. It is offered on a per-provider and model basis. See the [documentation](https://vercel.com/docs/ai-gateway/security-and-compliance/zdr) for details.
- Authentication: AI Gateway authenticates requests using an [API key](https://vercel.com/docs/ai-gateway/authentication-and-byok#api-key-authentication) or [OIDC token](https://vercel.com/docs/ai-gateway/authentication-and-byok#oidc-token-authentication). You do not need to manage provider credentials directly.

## [Copy link to heading](#when-to-use-mistral-codestral)When to Use Mistral Codestral

### Best for

- IDE and editor plugins: Requiring fill-in-the-middle code completion
- Automated test generation: Producing unit or integration tests from existing source code
- Documentation generation: Writing inline docs and reference material for functions, classes, and modules
- Code translation between languages: Converting source across languages, for example Python to TypeScript
- Broad language coverage: Applications that need wide support in a single model

### Consider alternatives when

- Agentic software engineering: You need multi-file orchestration (consider Devstral)
- Semantic code search: Your primary requirement is search rather than generation (consider Codestral Embed)
- Reasoning-heavy problem solving: You need deep reasoning alongside coding (consider Magistral)

## [Copy link to heading](#conclusion)Conclusion

Mistral Codestral established Mistral's footprint in developer tooling when it launched. Mistral Codestral remains relevant for teams that need broad language coverage, fill-in-the-middle completion, and a context window of 128K tokens optimized for code. Mistral's coding model family builds on this foundation.