Setup guide - Documented by OpenCode
Use Mistral in OpenCode
OpenCode's providers page has no dedicated Mistral section, but it documents a Custom provider for APIs not already in its catalog, using the @opencode/ai/providers/openai-compatible package. Mistral documents its OpenAI-compatible base URL, https://api.mistral.ai/v1. Combine the two: declare the provider, MISTRAL_API_KEY and Mistral model ids in opencode.jsonc, then pick the model with /models.
Last verified 3 steps6 official sources
Steps
- Step 1.
Create or update opencode.jsonc. This is the docs' OpenAI-compatible Custom example with Mistral's documented base URL and model ids filled in. The env field lists the environment variables that can provide the credential.
JSON{ "$schema": "https://opencode.ai/config.json", "providers": { "mistral-api": { "name": "Mistral", "env": ["MISTRAL_API_KEY"], "package": "@opencode/ai/providers/openai-compatible", "settings": { "baseURL": "https://api.mistral.ai/v1", }, "models": { "mistral-large-4": { "name": "Mistral Large 4", }, "codestral-latest": { "name": "Codestral", }, }, }, }, } - Step 2.
Make MISTRAL_API_KEY available to the OpenCode server process, since the env field names it as the credential source.
- Step 3.
Run /models and select the model. The provider ID is the prefix in model references, for example mistral-api/mistral-large-4.
Snippet/models
Caveats
- This combines OpenCode's documented Custom provider example with the base URL from Mistral's migration guide and model ids from Mistral's Models Overview. OpenCode's docs do not show Mistral specifically.
- The provider id mistral-api is an example name chosen here. OpenCode's docs say the providers object is keyed by the provider ID used in model references.
- OpenCode's providers page says its catalog comes from models.dev and that a Custom provider is for APIs not already in the catalog. The page has no Mistral section, so check /connect for a built-in Mistral entry first.
- OpenCode's docs say to use the compatible runtime for APIs that implement the OpenAI request format. Mistral documents POST /v1/chat/completions.
- Mistral Large 4 has a 1M context window per Mistral's docs. OpenCode's model entries accept a limit field for context, input and output token limits if you want OpenCode to track context.
- Devstral 2 (devstral-2512, devstral-latest) was retired 2026-07-31. Mistral lists Mistral Medium 3.5 as its alternative, and Medium 3.5 is itself now deprecated in favour of Mistral Large 4.
- Mistral Medium 3.5 (mistral-medium-3-5, mistral-medium-latest) is deprecated (deprecation date 10/31/2026 on its model page). Mistral says to use Mistral Large 4 (mistral-large-4) for new integrations.
More setup guides
Same tool, other providers
Related reading
- Mistral Large 4 on Hugging Face: Weights, License, vLLM SetupMistral Large 4 weights are on Hugging Face under a modified MIT license. What the license blocks, the vLLM command, and when self-hosting beats the API.
- Mistral Large 4: Specs, Pricing, Benchmarks and Weights DateMistral Large 4 is a 1T-parameter multimodal MoE with 52B active, in public preview at $0.68/$2.09 per million tokens, with open weights due end of October.
- Mistral Shieldstral: A 3B Open-Weight Policy-Adaptive Moderation Model That Beats Models 7x Its SizeMistral Shieldstral is a 3B Apache 2.0 multimodal moderation model that takes your policy as a plain-language question at inference and runs on one 16GB GPU.
- Mistral Releases Robostral Navigate: An 8B Robotics Navigation ModelMistral Robostral Navigate is an 8B robotics model that navigates with only a camera and natural language commands. How it works and what the benchmarks mean.
- Leanstral 1.5: Mistral's Open Theorem-Proving Model Hits 100% on miniF2FLeanstral 1.5 is Mistral's open Apache-2.0 model for Lean 4 theorem proving. The benchmark claims, the HN pushback on its bug-finding pitch, and how to use it.
- Mistral OCR 4 and Unlimited OCR Make Document Parsing an Agent Runtime ChoiceMistral OCR 4 and Baidu's Unlimited OCR turn document parsing into a runtime choice for agents - cost per page, layout, confidence scores and self-hosting.
FAQ
How do I use Mistral in OpenCode?
OpenCode's providers page has no dedicated Mistral section, but it documents a Custom provider for APIs not already in its catalog, using the @opencode/ai/providers/openai-compatible package. Mistral documents its OpenAI-compatible base URL, https://api.mistral.ai/v1. Combine the two: declare the provider, MISTRAL_API_KEY and Mistral model ids in opencode.jsonc, then pick the model with /models.
Which Mistral model ids work in OpenCode?
The official docs read for this guide list mistral-large-4, mistral-large-4-0, mistral-small-2603, mistral-small-latest, codestral-2508 and codestral-latest. Requests go to https://api.mistral.ai/v1.
Is this an official Mistral and OpenCode setup?
OpenCode documents this setup in its own docs. It was last checked against 6 official pages on November 8, 2026.
Sources
Last verified against 6 official pages.
- opencode.aihttps://opencode.ai/docs/providers/
- docs.mistral.aihttps://docs.mistral.ai/resources/migration-guides
- docs.mistral.aihttps://docs.mistral.ai/api
- docs.mistral.aihttps://docs.mistral.ai/models
- docs.mistral.aihttps://docs.mistral.ai/models/mistral-large-4-0
- docs.mistral.aihttps://docs.mistral.ai/models/mistral-medium-3-5-26-04
Newsletter
New models, set up the day they ship
One email per week. New model releases, the coding tools that support them and how to wire them up.