How this workload behaves
In retrieval-augmented generation (RAG) workloads, the dominant cost driver is typically the input tokens consumed by the model to process retrieved context. These systems often fetch large chunks of documents, codebases, or knowledge bases, which are then passed as context to the LLM for reasoning or generation. Output tokens, while still significant, are usually smaller in volume compared to the input, especially when the model is used for summarization, extraction, or structured responses rather than free-form generation. Codestral’s pricing structure—$0.20 per million input tokens and $0.60 per million output tokens—reflects this asymmetry, making it well-suited for RAG pipelines where input-heavy processing is the norm.
Compare against 5 alternatives
| Model | Vendor | Monthly cost | vs primary | Δ |
|---|---|---|---|---|
| Mistral Large | Mistral | $32.00 | 10.00× | +$28.80 |
| Mistral Small | Mistral | $3.20 | 1.00× | +$0.0000 |
| GPT-4o mini | OpenAI | $2.70 | 0.84× | $0.50 |
| Claude Haiku 4.5 | Anthropic | $20.00 | 6.25× | +$16.80 |
| Gemini 1.5 Flash | $1.35 | 0.42× | $1.85 |
Recommendation
For this RAG workload, **Gemini 1.5 Flash** is the clear cost leader, delivering the lowest total cost at $1.35/month while maintaining strong performance for retrieval-heavy tasks. It outperforms Codestral by $1.85/month (42% cheaper) and offers a 32,000-token context window, which is ideal for RAG applications. While GPT-4o mini is slightly cheaper at $2.70/month, the savings are marginal compared to Codestral, and its smaller context window (128k vs. 32k) may limit flexibility. Mistral Small matches Codestral’s cost but lacks the performance benefits of newer models. Stick with Codestral only if you require Mistral-specific features or have strict vendor constraints.
Cost-saving tactics for this workload
- Enable prompt caching for repeated RAG queries—store retrieved context in a cache and reuse it across sessions to reduce input token costs.
- Use a two-stage retrieval approach: first fetch a small set of relevant documents with a lightweight model (e.g., Mistral Small), then pass only the top results to Codestral or Gemini 1.5 Flash for reasoning.
- Compress retrieved context by truncating or summarizing documents before passing them to the LLM, reducing input token volume without sacrificing critical information.
- Batch API calls for RAG pipelines where multiple queries share the same context (e.g., processing a codebase or document set in bulk).
- Monitor and optimize your retrieval strategy—fewer, higher-quality documents retrieved per query directly reduce input token costs.