contenox

Mistral coding agent: API key, models and setup

Updated

MODEL PROVIDERSMistral

To set up a Mistral coding agent, create an API key in the Mistral console and give it to your agent. Mistral’s own agent, Vibe, signs in with your Mistral account or a key. OpenCode has Mistral built in, Codex CLI takes it as a custom provider, and Contenox takes the key too. Claude Code can’t use Mistral models.

Use Mistral with your agent

Agent Supported? How Note
Claude Code No Claude Code runs Claude models only, through Anthropic, Amazon Bedrock, Google Cloud’s Agent Platform (Vertex AI) or Microsoft Foundry. Anthropic doesn’t support routing it to other models.
Codex CLI Yes [model_providers.mistral] in ~/.codex/config.toml Codex uses Mistral’s Responses API, which is in public preview.
OpenCode Yes /connect → Mistral → paste the key Also reads MISTRAL_API_KEY.
Mistral Vibe Yes vibe, then sign in in the browser or paste a key Mistral’s own agent, in the terminal and VS Code.
Contenox Yes Backends → Providers → More providers → Mistral

Which plan or key do I need?

Two things are easy to mix up:

  • The API. You create keys in the Mistral console.
  • Mistral’s plans (Free, Pro, Team, Enterprise and others). Each plan’s monthly usage is shared across Studio, the API and Vibe; pay-as-you-go can extend it. Mistral’s pricing page says Pro includes Vibe coding and a monthly amount of API credit.

Your organization’s current limits are in the console under Admin Panel → API → Limits. An organization can also set a monthly spending limit; when it is reached, API access stops until the next month or until an admin raises it.

Mistral Vibe

On macOS or Linux:

curl -LsSf https://mistral.ai/vibe/install.sh | bash
vibe --version

For Windows, follow the Windows tab in Mistral’s install guide.

Run vibe in your project. The first-run wizard offers Launch browser, which signs you in with your Mistral account and plan, or an API key, which it stores in your system keyring or ~/.vibe/.env. vibe --setup runs the wizard again.

OpenCode

Install it. On Windows, OpenCode recommends WSL; natively, use npm:

npm install -g opencode-ai

macOS or Linux:

curl -fsSL https://opencode.ai/install | bash

Start opencode in your project, type /connect, choose Mistral and paste the key. Pick a model with /models. The key is saved in ~/.local/share/opencode/auth.json.

Codex CLI

Add the provider to ~/.codex/config.toml in your user folder. Replace the model with an API model ID from Mistral’s models list:

model = "YOUR_MISTRAL_MODEL_ID"
model_provider = "mistral"

[model_providers.mistral]
name = "Mistral"
base_url = "https://api.mistral.ai/v1"
env_key = "MISTRAL_API_KEY"

Set the key, then open a new terminal and run codex. Windows PowerShell:

setx MISTRAL_API_KEY "your-key-here"

macOS or Linux:

export MISTRAL_API_KEY=your-key-here

The preview gotcha: Codex only speaks the OpenAI Responses API to custom providers, and Mistral’s Responses API is still in public preview. If a feature breaks, that is the first place to look.

Which Mistral model should I pick?

An agent needs a chat model that calls tools reliably. From Mistral’s current models list:

  • Mistral Large 4: the general-purpose flagship. Start here for changes across several files.
  • Mistral Small 4: combines instruction following, reasoning and coding in a smaller, cheaper model. Good for routine edits.
  • Codestral: built for code completion as you type, not for running an agent. Skip it.

Mistral’s API also serves some third-party open-weight models, such as GLM and DeepSeek models. Try any model on a small task in your project before you trust it with a large one.

Common errors

  • Key rejected or 401: the key is wrong or was deleted. Create a new one in the console.
  • 429 Too Many Requests: you hit a rate limit. Wait and try again, and check your limits under Admin Panel → API → Limits.
  • Requests stop until next month: your organization reached its monthly spending limit. An admin can raise it.

Other ways to run Mistral models

  • Open weights: Mistral publishes models such as Mistral Small 4 and Ministral 3 under open licenses. You can run open-weight models on your own machine with Ollama if your hardware allows; check the Ollama library for the exact model first.
  • AWS Bedrock offers some Mistral models, billed to your AWS account. See AWS Bedrock.

Contenox

Contenox takes the same key and lets you switch between Mistral and other providers per session.

  1. Open Backends → Providers, then More providers, and choose Mistral.
  2. Select Create key, create a key in the Mistral console and copy it.
  3. Paste it into API Key, select Connect and wait for Connected.
  4. Pick a model in the Model chip on the message box.

To keep the key out of the app, enter MISTRAL_API_KEY under Advanced in Environment variable name, set it with setx MISTRAL_API_KEY "your-key-here", and reopen Contenox. If the status shows Key rejected, use Replace to paste a new key.

Related

Esc to close