Mistral AI API: endpoints, authentication, models and limits
Connection details
| Base URL | https://api.mistral.ai/v1 |
| Auth | Bearer token via MISTRAL_API_KEY |
| OpenAI SDK compatible | Yes |
| SDKs | Mistral SDK (Python, TypeScript), OpenAI SDK, raw HTTP |
Models and token pricing
| Model | Model ID | Context | In / 1M | Out / 1M |
|---|---|---|---|---|
| Mistral Large 2 | mistral-large-2411 | 128K | $2.00 | $6.00 |
| Codestral | codestral-2501 | 256K | $0.300 | $0.900 |
What is distinctive about this API
- European provider with EU data residency, which is frequently the deciding factor rather than any model capability.
- Dedicated code models and an embeddings endpoint sit alongside the chat models.
- Several models ship under Apache 2.0, so the hosted API and a self-hosted deployment can run the same weights.
Constraints worth knowing first
- Open-weight and commercial models carry different licences — check before assuming a model can be self-hosted.
- Function-calling support varies across the family; the smaller models are more limited than the flagships.
Frequently asked
- What is the Mistral AI API base URL?
- https://api.mistral.ai/v1. Authenticate with a bearer token, conventionally read from the MISTRAL_API_KEY environment variable.
- Is the Mistral AI API compatible with the OpenAI SDK?
- Yes. The chat completions surface is wire-compatible, so the official OpenAI client libraries work by pointing base_url at https://api.mistral.ai/v1 and supplying a MISTRAL_API_KEY. No client library change is needed.
- How do I get a Mistral AI API key?
- Create an account with the provider and generate a key from the developer console, then expose it to your application as MISTRAL_API_KEY. Keys are secrets: keep them server-side, never in client bundles or committed config.
- Which models does the Mistral AI API expose?
- Mistral Large 2, Codestral. Context windows run to 256K tokens.
Other provider APIs
Mistral AI publishes official documentation at https://docs.mistral.ai. Pricing and limits change; verify against the provider before committing to a budget.