Codestral: Pricing, Context, and Benchmarks
Codestral is Mistral AI's Codestral model released on 2024-05-29. It runs on a 32K-token context window, priced at $0.20/M input and $0.60/M output. Code-specialized Mistral model. Cheap per token; popular for inline IDE assistance.
Specifications
| Provider | Mistral AI |
|---|---|
| Family | Codestral |
| Released | 2024-05-29 |
| Status | active |
| Context window | 32K tokens |
| Max output | 4K tokens |
| Modalities | text |
| Capabilities | function calling json mode streaming code |
| Tokenizer | mistral |
| API endpoint | https://api.mistral.ai/v1/chat/completions |
| Documentation | Official docs ↗ |
| Last updated | 2026-05-29 |
Cost calculator
For 1,000 tokens of input and 1,000 tokens of output per call, this model costs $0.0008 per call. For typical usage:
| Workload | Tokens / call (in/out) | $/call | $/1K calls | $/1M calls |
|---|---|---|---|---|
| Short Q&A | 200 / 100 | $0.000100 | $0.10 | $100 |
| Standard chat | 1K / 500 | $0.000500 | $0.50 | $500 |
| RAG with retrieval | 4K / 500 | $0.001100 | $1.10 | $1,100 |
| Long doc summary | 20K / 1K | $0.004600 | $4.60 | $4,600 |
| Long context (100K input) | 100K / 2K | $0.020900 | $20.90 | $20,900 |
For more precise estimates including caching discounts, use the LLM API Cost Calculator.
Other Mistral AI models
Common comparisons
- Codestral vs GPT-5 Mini Side-by-side specs, pricing, and benchmarks
- Codestral vs GPT-4o Mini Side-by-side specs, pricing, and benchmarks
- Codestral vs DeepSeek-V3 Side-by-side specs, pricing, and benchmarks
- Codestral vs Gemini 2.5 Flash Side-by-side specs, pricing, and benchmarks
API setup
curl https://api.mistral.ai/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "codestral", "messages": [{"role": "user", "content": "Hello"}]}'
See the official documentation for the full request/response schema. For pre-flight token counting before paying, use the appropriate token counter.