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

What Gemini 3.1 Pro Preview costs to run
Test Gemini 3.1 Pro Preview
with Gateway’s Simulator
See a prompt's output, token spend, latency, and more with Gemini 3.1 Pro Preview.
Route requests to Gemini 3.1 Pro Preview 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
Gemini 3.1 Pro Preview FAQ
Heading
What other models does Google offer?
Google's model lineup spans reasoning flagships, cost-efficient flash tiers, and open-weight alternatives built for self-hosting. Here are some other models Google supports:
- Gemini 3.5 Flash: Gemini 3.5 Flash is Google's most capable stable model, priced at $1.50 per million input tokens and $9.00 per million output tokens, supporting text, image, speech, and video inputs with a 1M token context window and an Intelligence Index score of 55, placing it at the frontier tier while offering faster throughput than Gemini 3.1 Pro
- Gemini 2.5 Pro: Gemini 2.5 Pro is Google's previous-generation flagship, offering extended reasoning and a 1M token context window at a lower price point than Gemini 3.1 Pro, suited for complex analytical tasks where the latest model generation is not required
- Gemini 2.5 Flash: Gemini 2.5 Flash is a stable mid-tier model priced at $0.30 per million input tokens, delivering high output throughput and a competitive Intelligence Index score for general-purpose workloads that don't require frontier reasoning depth
- Gemini 2.5 Flash Lite: Gemini 2.5 Flash Lite is the most affordable model in Google's current lineup, priced at $0.10 per million input tokens and $0.40 per million output tokens, optimized for high-volume, latency-sensitive workloads where cost is the primary constraint
- Gemma 4 31B: Gemma 4 31B is an open-weight model released under the Apache 2.0 license, available via Hugging Face at google/gemma-4-31b-it, offering a 256K token context window and multimodal input support for teams that need to self-host or run inference on their own infrastructure
How does Gemini 3.1 Pro differ from Google's other models?
Gemini 3.1 Pro is Google's most advanced reasoning model in the Gemini 3 series, positioned above Gemini 3.5 Flash on the Intelligence Index and priced accordingly for workloads that require maximum reasoning depth.
- Intelligence Index: Gemini 3.1 Pro scores 57 on the Artificial Analysis Intelligence Index, ranking #5 of 150 evaluated models. Gemini 3.5 Flash scores 55 at #9, and Gemini 2.5 Pro scores below both, making Gemini 3.1 Pro the highest-ranked Google model on this benchmark
- Pricing: Input costs $2.00 per million tokens and output costs $12.00 per million tokens. Gemini 3.5 Flash costs $1.50 input and $9.00 output, while Gemini 2.5 Flash Lite costs $0.10 input and $0.40 output. Gemini 3.1 Pro carries the highest price in Google's lineup
- Speed: Gemini 3.1 Pro outputs 133.7 tokens per second, compared to 163.1 tokens per second for Gemini 3.5 Flash. The lower throughput reflects the additional reasoning compute the model performs before generating a final answer
- Capabilities: Gemini 3.1 Pro is a reasoning model that uses extended chain-of-thought, accepting text, image, speech, and video inputs. It shares multimodal input support with Gemini 3.5 Flash but applies deeper reasoning passes per request
- Context window: Supports a 1M token context window, the same as Gemini 3.5 Flash and Gemini 2.5 Pro, which is more than sufficient for long-document analysis, large codebase review, and extended multi-turn conversations
Gemini 3.1 Pro is the right choice when benchmark accuracy and reasoning quality take priority over throughput or cost, such as in scientific analysis, complex agentic pipelines, or multi-step code reasoning tasks.
What models should I consider using alongside Gemini 3.1 Pro?
No single model is optimal for every task. Here are models worth pairing with Gemini 3.1 Pro depending on what your product needs:
- Gemini 3.5 Flash: For requests that need the current generation's capability but not full reasoning depth, route to Gemini 3.5 Flash at $1.50 per million input tokens to capture near-frontier quality at roughly 75% of the cost, reserving Gemini 3.1 Pro for the hardest tasks in your pipeline
- Gemini 2.5 Flash Lite: For high-volume preprocessing, classification, or summarization steps that feed into a Gemini 3.1 Pro reasoning call, Gemini 2.5 Flash Lite at $0.10 per million input tokens handles the groundwork so Gemini 3.1 Pro processes only what demands deep analysis
- Claude Opus 4 (Anthropic): For creative long-form generation or nuanced instruction-following evaluations, Claude Opus 4 serves as a cross-provider reasoning model comparison to validate which model performs better on your specific workload before committing to Gemini 3.1 Pro at scale
- o3 (OpenAI): For mathematical reasoning, formal proofs, and competitive programming tasks where a second top-tier reasoning model adds redundancy, o3 from OpenAI serves as a high-quality fallback or A/B comparison partner alongside Gemini 3.1 Pro
- Gemma 4 31B: For teams with data residency or on-premises requirements, Gemma 4 31B provides an open-weight alternative for instruction-following and multimodal tasks where routing all traffic to a cloud API is not acceptable
What are the challenges of using Gemini 3.1 Pro in my product?
Like any production LLM, Gemini 3.1 Pro comes with tradeoffs worth planning for:
- Cost at scale: At $2.00 per million input tokens and $12.00 per million output tokens, Gemini 3.1 Pro is among the most expensive models available. Token costs compound quickly at production volumes, and routing all traffic through Gemini 3.1 Pro without cost controls can push monthly spend well beyond budget forecasts
- Provider dependency: Concentrating all requests on Google's API means any quota restriction, regional outage, or model deprecation directly disrupts every workload that depends on Gemini 3.1 Pro. Preview-stage models in particular carry deprecation risk as newer versions are released
- Latency for real-time applications: As a reasoning model, Gemini 3.1 Pro generates extended chain-of-thought before producing a final answer, with a time to first token of approximately 25 seconds under typical load. Interactive applications like chatbots or autocomplete are poor fits without controls to limit thinking depth
- Output verbosity and cost interaction: Gemini 3.1 Pro generated 57M output tokens during the Artificial Analysis Intelligence Index evaluation, indicating it produces lengthy responses by default. At $12.00 per million output tokens, verbose completions raise the effective cost per task above what headline pricing suggests
- Preview-stage availability: Gemini 3.1 Pro is designated as a preview model, which means rate limits, uptime guarantees, and API behavior may differ from stable production models. Teams building latency-critical or reliability-sensitive features should plan for this variability
Why should I use Merge Gateway to route LLM requests with Gemini 3.1 Pro and every other model?
Using Gemini 3.1 Pro through Merge Gateway gives you access to the model itself and the infrastructure layer around it:
- One API, every provider: Access Gemini 3.1 Pro and every other major LLM through a single endpoint and API key. Change providers by swapping the model string, with no application code changes required
- Intelligent routing and automatic failover: Merge routes around Google outages automatically. Routing policies based on cost, latency, or quality can reduce spend by 40-60% without touching your application code, which matters especially given Gemini 3.1 Pro's output pricing
- Cost governance: Set hard or soft project budgets so Gemini 3.1 Pro spend stays within plan. Every request is attributed to a model, project, and tag in a unified billing dashboard across all providers
- Build Your Own Router: Define what "best" means for your traffic by selecting from curated ML benchmarks or adding your own eval scores. The router scores each available model against your weights and picks the winner per request, with a plain-language explanation of every decision
- Security and compliance controls: Apply DLP rules and prompt injection protection before every request reaches Google. Enforce per-project model and region policies without adding that logic to your application
How can I start routing requests to Gemini 3.1 Pro via Merge Gateway?
Getting Gemini 3.1 Pro 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 Gemini 3.1 Pro, the model string is google/gemini-3.1-pro. 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 Gemini 3.1 Pro as primary with one fallback.
Full setup instructions and SDK references are in the Merge Gateway docs.
Try Gemini 3.1 Pro Preview through Merge Gateway
Route, observe, and control AI requests across providers from one API.





