Mistral — quickstart
European-data-residency friendly; competitive on code tasks via Codestral/Devstral; strong multilingual. Pick when you need EU hosting, code-specialist models, or want a non-US alternative in a portfolio.
mistral-large-latest Get a key
- Create an API key at console.mistral.ai
- Set it as `MISTRAL_API_KEY` env var
Make a request
Three equivalent ways to call the recommended model. Pick the one that matches your stack.
curl
curl https://api.mistral.ai/v1/chat/completions \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-large-latest",
"messages": [
{"role": "user", "content": "Summarize the last week of AI model releases."}
]
}' python
pip install mistralai from mistralai import Mistral
client = Mistral(api_key=__import__("os").environ["MISTRAL_API_KEY"])
res = client.chat.complete(
model="mistral-large-latest",
messages=[{"role": "user", "content": "Summarize the last week of AI model releases."}],
)
print(res.choices[0].message.content) node
npm install @mistralai/mistralai import { Mistral } from "@mistralai/mistralai";
const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });
const res = await client.chat.complete({
model: "mistral-large-latest",
messages: [{ role: "user", content: "Summarize the last week of AI model releases." }],
});
console.log(res.choices[0].message.content); Pricing
Mistral pricing sits between Anthropic and the Llama-via-Together tier. Codestral undercuts most code-specialized closed models.
Alternatives in this lineup
- Mistral Medium 3.1 — Mid-tier; balances cost and capability.
- Codestral 2508 — Code-specialized model; competitive with general-purpose models on code tasks at lower cost.
- Devstral 2512 — Agentic-coding specialized; good fit for autonomous code-edit loops.
Gotchas
- Chat-completions shape (OpenAI-compatible). Mistral's chat API mirrors OpenAI's, so OpenAI-compatible tools mostly Just Work. The cost is missing the agent-specific affordances of Anthropic Messages API or OpenAI Responses.
- Latest-tag drift. `mistral-large-latest` rolls to the newest version automatically. For reproducibility, pin to a dated id (e.g., `mistral-large-2512`).
- Lower JSON-mode reliability. JSON-mode + tool-use are present but historically less reliable than Anthropic/OpenAI. Validate outputs strictly.
Official docs: https://docs.mistral.ai