Mistral API Guide: Models, Pricing, Authentication and Examples

Guides
by David Porter
Saturday, 29 August 2026 at 14:14
thumbnail_mistral-api-guide-models-prici
The Mistral API gives developers hosted access to Mistral's general-purpose, reasoning, coding, vision, document and audio models. Its main chat endpoint follows a familiar messages-based structure, while dedicated endpoints handle fill-in-the-middle code completion, embeddings, OCR, audio and batch work.
This guide reflects Mistral's public catalog and prices on 21 August 2026. Model names and rates can change, so check the official model catalog before committing a production workload.
For company background, start with What Is Mistral AI?. Our Mistral models guide explains the architectures in more detail.

Mistral API at a glance

The standard base URL is:
https://api.mistral.ai
Frequently used endpoints include:
TaskEndpoint
Chat, reasoning and tool usePOST /v1/chat/completions
Codestral fill-in-the-middlePOST /v1/fim/completions
Text or code embeddingsPOST /v1/embeddings
List accessible modelsGET /v1/models
OCRPOST /v1/ocr
Speech transcriptionPOST /v1/audio/transcriptions
Asynchronous batch jobsPOST /v1/batch/jobs
The API uses bearer-token authentication. Keep the token on a server or in a secret manager; never place it in public JavaScript, a mobile application bundle or a source repository.
Mistral's API billing is separate from the consumer and team subscriptions covered in our Mistral AI pricing guide. Likewise, Mistral Vibe is an end-user product rather than a replacement name for the API.

Which Mistral API model should you use?

These are the principal current text-generation choices:
ModelFixed IDContextInput / output per 1M tokens
Mistral Medium 3.5mistral-medium-3-5256k$1.50 / $7.50
Mistral Small 4mistral-small-2603256k$0.15 / $0.60
Mistral Large 3mistral-large-2512256k$0.50 / $1.50
Ministral 3 3Bministral-3b-2512256k$0.10 / $0.10
Ministral 3 8Bministral-8b-2512256k$0.15 / $0.15
Ministral 3 14Bministral-14b-2512256k$0.20 / $0.20
Codestral 25.08codestral-2508128k$0.30 / $0.90
Mistral Small 4 is a sensible first test for general chat, extraction, coding and multimodal work because it combines a low hosted price with structured output, function calling and reasoning support. Medium 3.5 targets more demanding agentic and coding tasks. Large 3 is a large open-weight MoE available through the API, while Ministral models provide compact options for high-volume or edge-oriented applications.
Codestral serves a narrower purpose: low-latency code generation and fill-in-the-middle completion. For a broader comparison with other coding ecosystems, see AI World Today's coding coverage.
Developers comparing provider routes can continue with the DeepSeek API guide and Llama API guide. The Llama route requires extra care because “Llama API” can refer to Meta, a cloud host or a self-hosted server rather than one universal endpoint.

How Mistral API pricing works

Mistral charges separately for tokens sent to the model and tokens generated by it. One million tokens is the billing unit, but charges accrue proportionally.
Suppose one Small 4 request uses 100,000 input tokens and produces 20,000 output tokens:
Input: 0.1 × $0.15 = $0.015 Output: 0.02 × $0.60 = $0.012 Total: $0.027
The same token volumes would cost $0.08 on Large 3 and $0.30 on Medium 3.5 at the rates above. Price alone does not establish which model is best: the cheaper model may need a stronger prompt, more retries or a fallback model.
Mistral also documents several pricing modifiers:
  • Batch inference receives a 50% discount.
  • Cached input tokens cost 10% of the ordinary input rate.
  • EU or US regional inference carries a 10% premium.
  • Priority Tier costs 1.75 times standard inference and requires entitlement.
Studio starts in Free mode without requiring a credit card, but rate and usage limits depend on the account. The current allowance is shown in the account's Limits page; there is no dependable universal free-token figure.

Create and protect a Mistral API key

Open Mistral Studio, go to API keys, create a named key and copy it immediately. Mistral displays the secret once.
On macOS or Linux, store it for the current shell:
export MISTRAL_API_KEY="your_api_key_here"
Production systems should inject the key through a managed secret store. Rotate any key that appears in logs, screenshots, browser code or version control.
Authentication is sent as:
Authorization: Bearer YOUR_API_KEY
Our Mistral safety and privacy guide covers retention, residency and security questions. More general guidance is available in the AI security and privacy and AI hubs.

Make a chat request with curl

This request uses the moving Small alias, which is convenient for a tutorial:
curl https://api.mistral.ai/v1/chat/completions \ -H "Authorization: Bearer $MISTRAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "mistral-small-latest", "messages": [ { "role": "user", "content": "Explain mixture-of-experts in two sentences." } ] }'
The generated text appears under choices[0].message.content. The response also contains token-usage data that should be captured for cost monitoring.
For a production service tested against the March 2026 Small release, replace the alias with mistral-small-2603.

Use the official Python SDK

Install the current package:
pip install mistralai
Then create a client and send a reques
import os from mistralai.client import Mistral client = Mistral(api_key=os.environ["MISTRAL_API_KEY"]) response = client.chat.complete( model="mistral-small-latest", messages=[ { "role": "user", "content": "Return three practical uses for a compact vision model." } ], ) print(response.choices[0].message.content)
Developers can inspect the models available to their workspace rather than hard-coding assumptions:
for model in client.models.list().data: print(model.id)
This is particularly useful with regional endpoints, where the supported model set can differ.

Use Codestral for fill-in-the-middle completion

A normal chat request asks for a response after a prompt. Fill-in-the-middle, or FIM, supplies code before and after a missing section so Codestral can generate what belongs between them.
import os from mistralai.client import Mistral client = Mistral(api_key=os.environ["MISTRAL_API_KEY"]) response = client.fim.complete( model="codestral-latest", prompt="def add(a, b):\n ", suffix="\n return result", stream=False, ) print(response.choices[0].message.content)
The dedicated endpoint is POST https://api.mistral.ai/v1/fim/completions. Codestral 25.08 also supports chat completions, but FIM is the clearer fit for editor autocomplete.
Do not describe current Codestral as an Apache-licensed downloadable model. The current release is a Premier API model. The original downloadable Codestral 22B from 2024 had a separate non-production license.

Latest aliases versus fixed IDs

Mistral's -latest aliases follow the newest generally available generation. They reduce maintenance in prototypes, but an alias can produce a different answer or carry a different price after it moves.
Use:
  • a -latest alias in short-lived examples and exploratory applications;
  • a fixed ID such as mistral-small-2603 for reproducible tests;
  • automated model-catalog and retirement checks in long-lived systems.
Mistral's lifecycle includes Labs, Public Preview, General Availability, Deprecated and Retired stages. Labs models can change silently and do not carry the same production expectations. Calls to a retired model return 404.
The distinction matters because older names such as Mistral 7B, Mistral Small 3.x, Magistral, Devstral 2 and Codestral 25.01 still appear in tutorials. Check the current catalog before copying old code.

EU and US regional endpoints

Mistral provides regional base URLs:
https://api.eu.mistral.ai https://api.us.mistral.ai
Regional inference is relevant to data-residency architecture, but its scope is narrower than "everything stays in the region." Mistral states that it covers eligible inference processing. Stateful Agents, Batch and Files are unavailable on regional endpoints, model availability varies, and only the function-calling tool is supported there.
Review these limits alongside the EU AI Act, security controls and contractual requirements. Regional routing does not replace a data-protection assessment.

Production checklist

Before launch:
  1. Pin the tested fixed model ID.
  2. Set request timeouts and retry 429 responses with exponential backoff.
  3. Monitor input tokens, output tokens, latency and failure rate.
  4. Validate structured output before sending it to another system.
  5. Restrict tool calls with allowlists and server-side authorization.
  6. Remove secrets and personal data from logs.
  7. Create a fallback for model retirement or regional unavailability.
  8. Recheck model pricing and lifecycle during every release cycle.
A 401 generally indicates a missing or invalid key, a 402 indicates a billing requirement, and a 429 indicates that the current rate limit has been reached.

Frequently asked questions

Is the Mistral API free?

Studio enables Free mode by default and does not require a credit card, but account-specific limits apply. Production usage generally needs pay-as-you-go billing or a contract.

Is the Mistral API OpenAI-compatible?

The chat format and endpoint design will feel familiar, but complete drop-in compatibility should not be assumed. Use Mistral's documentation or SDK and test model-specific features.

What is the cheapest current Mistral text model?

Ministral 3 3B is listed at $0.10 per million input tokens and $0.10 per million output tokens as of 21 August 2026. Suitability depends on the task, not price alone.

Can I run the same models without the API?

Some have downloadable weights, while Premier models do not. Start with our local Mistral deployment guide and verify the model card's license.
loading

Loading