Apply your own routing policies, reduce token costs automatically, and see every routing decision in real time with Merge Gateway.

What Mistral Medium 3.1 costs to run
Test Mistral Medium 3.1
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with Mistral Medium 3.1.
Route requests to Mistral Medium 3.1 in minutes
1$ pip install merge-gateway-sdk1from merge_gateway import MergeGateway
2
3client = MergeGateway(api_key="YOUR_API_KEY")
4
5response = client.responses.create(
6 model="openai/gpt-5.2",
7 input=[
8 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
9 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
10 ],
11)
12
13print(response.output[0].content[0].text)1response = client.responses.create(
2 model="anthropic/claude-sonnet-4-20250514",
3 input=[
4 {"type": "message", "role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"type": "message", "role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/openai",
6)1response = client.chat.completions.create(
2 model="gpt-5.2",
3 messages=[
4 {"role": "system", "content": "You are a helpful programming tutor. Explain the concepts clearly with practical examples."},
5 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
6 ],
7)
8
9print(response.choices[0].message.content)1npm install merge-gateway-ai-sdk-provider ai1import { createMergeGateway } from "merge-gateway-ai-sdk-provider";
2
3const gateway = createMergeGateway({
4 apiKey: "YOUR_API_KEY",
5});1import { generateText } from "ai";
2
3const { text } = await generateText({
4 model: gateway("openai/gpt-4o"),
5 prompt: "Explain the concept of recursion in programming with a simple set of examples.",
6});
7
8console.log(text);1import { createOpenAI } from "@ai-sdk/openai";
2
3const gateway = createOpenAI({
4 apiKey: "YOUR_API_KEY",
5 baseURL: "https://api-gateway.merge.dev/v1/ai-sdk",
6});
7
8// All generateText/streamText calls work unchanged1from anthropic import Anthropic
2
3client = Anthropic(
4 api_key="YOUR_API_KEY",
5 base_url="https://api-gateway.merge.dev/v1/anthropic",
6)
7
8message = client.messages.create(
9 model="claude-sonnet-4-20250514",
10 max_tokens=1024,
11 messages=[
12 {"role": "user", "content": "Explain the concept of recursion in programming with a simple set of examples."},
13 ],
14)
15
16print(message.content[0].text)Explore other models available in Merge Gateway
Mistral Medium 3.1 FAQ
Heading
What other models does Mistral AI offer?
Mistral AI offers general-purpose models across cost tiers, plus small open-weight and coding-specialized models. Here are some other models Mistral AI supports:
- Mistral Large: the high-end general-purpose model for the most demanding reasoning and generation
- Mistral Small: a compact, cheaper general model for high-volume tasks
- Mistral Nemo: a small, open-weight 12B model for affordable, self-hostable inference
How does Mistral Medium 3.1 differ from Mistral AI's other models?
Mistral Medium 3.1 is the mid-tier general-purpose model, aimed at frontier-class quality at a lower cost than the largest models.
- Modality: accepts text and image input and returns text, so it covers multimodal tasks the smaller models don't
- Context window: 128K tokens, suited to most document and chat workloads
- Pricing: around $0.40 per 1M input and $2.00 per 1M output, positioned below Mistral Large and above Mistral Small
- Use case fit: a balance of quality and cost for general assistant, reasoning, and multimodal tasks
Reach for Mistral Medium 3.1 when you want strong general-purpose quality with image support without paying top-tier rates.
What models should I consider using alongside Mistral Medium 3.1?
No single model is optimal for every task. Here are models worth pairing with Mistral Medium 3.1 depending on what your product needs:
- Mistral Large as the step up for the most demanding reasoning while staying in the Mistral family
- Claude Opus 4.8 for the hardest reasoning or coding tasks that need frontier quality
- Mistral Small for high-volume, low-complexity tasks where Medium is more than you need
- Gemini 3.1 Pro for long-context or heavier multimodal reasoning
- Devstral when the workload shifts to agentic coding rather than general text
What are the challenges of using Mistral Medium 3.1 in my product?
Like any production LLM, Mistral Medium 3.1 comes with tradeoffs worth planning for:
- Mid-tier ceiling: it trails frontier models on the hardest reasoning and coding, so plan to escalate those tasks
- Provider dependency: relying only on Mistral is fragile during outages or model retirements
- Cost at scale: at mid-tier output pricing, high-volume workloads still compound without active budgeting
- Image quality varies: multimodal accuracy depends on image type, so evaluate on your real inputs before relying on it
- Context ceiling: the 128K-token window is smaller than the long-context frontier models for very large inputs
Why should I use Merge Gateway to route LLM requests with Mistral Medium 3.1 and every other model?
Routing Mistral Medium 3.1 through Merge Gateway pairs the model with the infrastructure you'd otherwise build yourself:
- One API, every provider: Call Mistral Medium 3.1 and every other major model from a single endpoint and key, switching models with a string change rather than a code change
- Intelligent routing and automatic failover: Merge fails over around Mistral outages on its own, and routing on cost, latency, or quality can lower spend by 40 to 60% with no code edits
- Cost governance: Cap Mistral Medium 3.1 spend with project budgets, and see every request attributed by model, project, and tag in one cross-provider dashboard
- Build Your Own Router: Define "best" for your traffic with curated benchmarks or your own evals, and let the router choose per request and explain why
- Security and compliance controls: Run DLP and prompt injection checks before requests reach Mistral, and enforce per-project model and region rules centrally
How can I start routing requests to Mistral Medium 3.1 via Merge Gateway?
Getting Mistral Medium 3.1 running through Merge Gateway takes a few minutes:
1. Create an account and get your API key from the dashboard.
2. Install the Merge Gateway SDK: run pip install merge-gateway-sdk (Python) or npm install merge-gateway-sdk (Node). Alternatively, if you're already using the OpenAI SDK, set base_url = "https://api-gateway.merge.dev/v1/openai" and your existing code works as-is.
3. Make your first request using the provider/model format. For Mistral Medium 3.1, the model string is mistral/mistral-medium-3.1 (confirm the exact slug in the dashboard). Swap the model string to route to any other provider without changing anything else.
4. Configure a routing policy in the dashboard to set failover behavior, cost limits, and optimization strategy. Your first policy can be as simple as naming Mistral Medium 3.1 as primary with one fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try Mistral Medium 3.1 through Merge Gateway
Route, observe, and control AI requests across providers from one API.





