How to Use Mistral Medium 3.5 with Aider, OpenCode, and Continue.dev (2026)
Mistral Medium 3.5 scores 77.6% on SWE-bench Verified, has a 256K token context window, and costs $1.50/$7.50 per million input/output tokens. That makes it a compelling alternative to Claude 3.5 Sonnet ($3/$15) and GPT-4o ($2.50/$10) for AI-assisted coding — especially if you want open weights and EU data residency.
The model works with any tool that supports OpenAI-compatible APIs. This guide covers setup for the four most popular coding assistants: Aider, OpenCode, Continue.dev, and Cursor. Each section includes the exact configuration, recommended settings, and tips for getting the best results.
For model capabilities and benchmarks, see the Mistral Medium 3.5 complete guide. For API details, see the Mistral Medium 3.5 API guide.
Prerequisites
Before configuring any tool, you need:
- Mistral API key: Sign up at console.mistral.ai and generate an API key
- Set the environment variable:
export MISTRAL_API_KEY="your-api-key-here"
Add this to your .bashrc, .zshrc, or .env file for persistence.
The model identifier across all tools is mistral-medium-3.5 (or mistral/mistral-medium-3.5 when using provider prefixes).
Aider setup
Aider is a terminal-based AI pair programming tool that edits files directly in your repository. It supports Mistral models through the OpenAI-compatible API.
For a full Aider walkthrough, see the Aider complete guide.
Basic command-line usage
aider --model mistral/mistral-medium-3.5 --api-key mistral=$MISTRAL_API_KEY
Configuration file (.aider.conf.yml)
For persistent configuration, create .aider.conf.yml in your project root or home directory:
# .aider.conf.yml
model: mistral/mistral-medium-3.5
api-key:
- mistral=$MISTRAL_API_KEY
# Recommended settings for Mistral Medium 3.5
edit-format: diff
auto-commits: true
stream: true
# Context management
map-tokens: 2048
map-refresh: auto
# Cost tracking
show-cost: true
Recommended Aider settings for Mistral Medium 3.5
Edit format: Use diff format. Mistral Medium 3.5 handles diff-based editing well, and it uses fewer output tokens than whole format (which rewrites entire files). This directly reduces costs since output tokens are 5x more expensive than input tokens.
Map tokens: Set to 2048. This controls how many tokens Aider uses for the repository map. With Medium 3.5’s 256K context window, you have plenty of room, but keeping the map concise helps the model focus on relevant code.
Auto-commits: Enable this. Aider creates a git commit for each change, making it easy to review and revert individual edits.
Temperature: Aider uses the model’s default temperature. For Mistral Medium 3.5, the default (0.7) works well for coding tasks. If you want more deterministic output, you can override:
model-settings:
- mistral/mistral-medium-3.5:
extra-params:
temperature: 0.3
Using Mistral as architect + editor
Aider supports a two-model setup where one model plans changes (architect) and another implements them (editor). You can use Medium 3.5 as the architect and a cheaper model as the editor:
model: mistral/mistral-medium-3.5
editor-model: mistral/mistral-small-latest
This reduces costs because the architect generates high-level plans (fewer output tokens) while the cheaper model handles the verbose file editing. The quality tradeoff is minimal for straightforward changes.
OpenCode setup
OpenCode is a terminal-based coding assistant similar to Aider but with a TUI (terminal user interface). It supports custom model providers through its configuration file.
For a full walkthrough, see the OpenCode complete guide.
Configuration (opencode.jsonc)
Create or edit opencode.jsonc in your project root:
{
// opencode.jsonc
"providers": {
"mistral": {
"apiKey": "env:MISTRAL_API_KEY",
"baseUrl": "https://api.mistral.ai/v1"
}
},
"models": {
"mistral-medium": {
"provider": "mistral",
"model": "mistral-medium-3.5",
"maxTokens": 8192,
"temperature": 0.3,
"contextWindow": 256000
},
"mistral-small": {
"provider": "mistral",
"model": "mistral-small-latest",
"maxTokens": 4096,
"temperature": 0.3,
"contextWindow": 128000
}
},
"defaultModel": "mistral-medium",
"agents": {
"coder": {
"model": "mistral-medium"
},
"task": {
"model": "mistral-medium"
},
"title": {
"model": "mistral-small"
},
"summarizer": {
"model": "mistral-small"
}
}
}
Key configuration notes
baseUrl: Mistral’s API is OpenAI-compatible at https://api.mistral.ai/v1. This is the standard endpoint for all Mistral models.
maxTokens: Set to 8192 for coding tasks. This is enough for most file edits. Increase to 16384 if you regularly work with large files.
Agent roles: OpenCode uses different agents for different tasks. Assign Medium 3.5 to the primary coding agents (coder, task) and use Mistral Small for lightweight tasks (title, summarizer) to reduce costs.
contextWindow: Set to 256000 to match Medium 3.5’s actual context window. This tells OpenCode how much context it can include in requests.
Continue.dev setup
Continue.dev is a VS Code and JetBrains extension that provides AI-assisted coding directly in your IDE. It supports custom model providers through its configuration.
For a full walkthrough, see the Continue.dev complete guide.
Configuration (config.json)
Edit your Continue configuration file (typically at ~/.continue/config.json):
{
"models": [
{
"title": "Mistral Medium 3.5",
"provider": "mistral",
"model": "mistral-medium-3.5",
"apiKey": "env:MISTRAL_API_KEY",
"contextLength": 256000,
"completionOptions": {
"temperature": 0.3,
"maxTokens": 4096
}
}
],
"tabAutocompleteModel": {
"title": "Mistral Small",
"provider": "mistral",
"model": "mistral-small-latest",
"apiKey": "env:MISTRAL_API_KEY"
},
"embeddingsProvider": {
"provider": "mistral",
"model": "mistral-embed",
"apiKey": "env:MISTRAL_API_KEY"
}
}
Configuration breakdown
Chat model: Mistral Medium 3.5 handles the primary chat and code editing interactions. Set temperature to 0.3 for more deterministic code generation.
Tab autocomplete: Use Mistral Small for tab autocomplete. It is faster and cheaper, and autocomplete does not need frontier-level reasoning. This keeps the typing experience responsive while reserving Medium 3.5 for complex tasks.
Embeddings: Mistral Embed provides embeddings for Continue’s codebase indexing feature. This enables semantic code search within your IDE.
VS Code settings
Add to your VS Code settings.json for optimal Continue + Mistral experience:
{
"continue.enableTabAutocomplete": true,
"continue.showInlineTip": false
}
Cursor and Windsurf setup
Cursor and Windsurf support custom model endpoints. You can point them at Mistral’s API to use Medium 3.5 as your coding model.
Cursor configuration
In Cursor, go to Settings → Models → Add Model:
- Model name:
mistral-medium-3.5 - API endpoint:
https://api.mistral.ai/v1 - API key: Your Mistral API key
- Context window: 256000
Cursor will use this model for chat, inline edits, and code generation. You can set it as the default or switch between models per conversation.
Windsurf configuration
Windsurf supports custom OpenAI-compatible endpoints. In settings:
- Provider: Custom OpenAI
- Base URL:
https://api.mistral.ai/v1 - Model:
mistral-medium-3.5 - API key: Your Mistral API key
Note that Cursor and Windsurf add their own system prompts and context management on top of the model. The effective context available for your code is less than the full 256K window. Both tools handle this automatically, but be aware that very large codebases may still hit context limits.
Cost comparison across tools
How much does Mistral Medium 3.5 cost compared to Claude and GPT-4o in each tool?
Estimated monthly costs by tool and model
Assumptions: Individual developer, 4 hours/day of active AI-assisted coding, ~200 requests/day.
| Tool | Mistral Medium 3.5 | Claude 3.5 Sonnet | GPT-4o |
|---|---|---|---|
| Aider | $25-40/mo | $60-90/mo | $45-70/mo |
| OpenCode | $20-35/mo | $50-80/mo | $40-60/mo |
| Continue.dev | $15-30/mo | $40-65/mo | $30-50/mo |
| Cursor | $20 (Pro plan) + $10-20 API | $20 + $25-40 API | $20 + $18-30 API |
Continue.dev costs less because tab autocomplete uses the cheaper Mistral Small model, and IDE-based interactions tend to be shorter than terminal-based sessions.
Cursor’s Pro plan includes some model usage, so the API cost is only for usage beyond the included quota.
Cost optimization tips
-
Use reasoning effort
nonefor simple completions. Tab autocomplete, docstring generation, and simple refactors do not need chain-of-thought reasoning. -
Use Mistral Small for lightweight tasks. Autocomplete, commit messages, PR descriptions — these do not need a 128B model.
-
Enable prompt caching. Tools that send the same system prompt repeatedly (which is all of them) benefit from Mistral’s 90% caching discount.
-
Set appropriate max_tokens. A function rename does not need 8192 output tokens. Configure per-task limits where your tool supports it.
Performance tips
Reasoning effort by task type
| Task | Recommended reasoning effort | Why |
|---|---|---|
| Tab autocomplete | none | Speed is critical, completions are short |
| Inline edits | low | Simple transformations, fast feedback |
| Code review | medium | Needs some analysis but not deep reasoning |
| Bug fixing | high | Complex reasoning about program behavior |
| Architecture decisions | high | Multi-step analysis of tradeoffs |
| Refactoring | medium | Pattern-based, moderate complexity |
Not all tools expose the reasoning effort parameter. Aider and OpenCode support it through extra model parameters. Continue.dev and Cursor may not expose it directly — check their latest documentation.
Temperature settings
For coding tasks, lower temperature produces more deterministic and reliable output:
- 0.0-0.2: Best for code generation, refactoring, and bug fixes. Minimal variation between runs.
- 0.3-0.5: Good balance for general coding assistance. Slight variation allows creative solutions.
- 0.7+: Too high for most coding tasks. Use only for brainstorming or generating multiple alternative approaches.
Set temperature to 0.3 as your default for coding tools. Adjust down to 0.1 for critical production code, up to 0.5 for exploratory work.
Context window management
Medium 3.5’s 256K context window is large but not infinite. Tips for managing it:
- Aider: Use
map-tokens: 2048to keep the repo map concise. Let Aider’s automatic context management handle file selection. - OpenCode: Set
contextWindow: 256000so the tool knows the full capacity. It will manage context automatically. - Continue.dev: The extension indexes your codebase and retrieves relevant files. Keep your workspace focused — do not open a monorepo root if you are only working in one service.
- Cursor: Use
.cursorignoreto exclude irrelevant directories (node_modules, build artifacts, test fixtures) from context.
Troubleshooting common issues
”Model not found” error
The model identifier must be exactly mistral-medium-3.5. Common mistakes:
mistral-medium-3(wrong version)medium-3.5(missing prefix)mistral-medium-latest(this resolves to a different model)
Slow responses
Mistral’s API latency depends on load and your geographic location. If responses are consistently slow:
- Check status.mistral.ai for service issues
- Try reducing
max_tokens— the model generates faster when it knows the output limit - Set
reasoning_efforttolowornonefor simple tasks - Consider using a regional endpoint if available
Context window exceeded
If you get context length errors, your tool is sending too much context. Solutions:
- Reduce the number of files included in context
- Use
.aiderignoreor equivalent to exclude large files - Split large tasks into smaller, focused requests
- Check if your tool is including conversation history that exceeds the window
Authentication errors
Verify your API key:
curl -H "Authorization: Bearer $MISTRAL_API_KEY" \
https://api.mistral.ai/v1/models
If this returns a model list, your key is valid. If not, regenerate it at console.mistral.ai.
Rate limiting
Mistral’s API has rate limits that vary by plan. If you hit rate limits during heavy coding sessions:
- Upgrade your API plan for higher limits
- Add retry logic with exponential backoff (most tools handle this automatically)
- Reduce request frequency by batching related questions into single prompts
FAQ
Which coding tool works best with Mistral Medium 3.5?
Aider has the most mature Mistral integration and gives you the most control over model parameters. OpenCode is a close second with a better visual interface. Continue.dev is best if you prefer staying in your IDE. There is no single “best” — it depends on your workflow preference. Try Aider first if you are comfortable in the terminal, Continue.dev if you prefer VS Code integration.
Is Mistral Medium 3.5 as good as Claude 3.5 Sonnet for coding?
On benchmarks, they are close. Mistral scores 77.6% on SWE-bench Verified; Claude 3.5 Sonnet scores around 79%. In practice, both handle most coding tasks well. Mistral is noticeably cheaper ($1.50/$7.50 vs $3/$15 per million tokens) and offers EU data residency. If you do not need Claude’s specific strengths (very long document analysis, nuanced writing), Mistral is the better value.
Can I use Mistral Medium 3.5 with GitHub Copilot?
Not directly. GitHub Copilot uses its own model infrastructure and does not support custom model endpoints. You can use Continue.dev as a Copilot alternative with Mistral Medium 3.5 — it provides similar inline completions and chat features within VS Code.
How do I switch between Mistral models in Aider?
Use the --model flag: aider --model mistral/mistral-small-latest for quick tasks, aider --model mistral/mistral-medium-3.5 for complex work. You can also set up aliases in your shell configuration for quick switching.
Does the 256K context window actually work in practice?
Yes, but with caveats. The model can process 256K tokens of input, but quality degrades on very long contexts — this is true for all current models. For coding tasks, you rarely need more than 50-100K tokens of context. The large window is useful for including multiple related files simultaneously, not for dumping your entire codebase into a single prompt.
Can I use a self-hosted Mistral Medium 3.5 with these tools?
Yes. If you self-host with vLLM or TGI, you get an OpenAI-compatible endpoint. Point any of these tools at your self-hosted URL instead of https://api.mistral.ai/v1. The configuration is identical except for the base URL and API key (which you define in your self-hosted setup). This gives you full data privacy — no data leaves your infrastructure.