Google just reclaimed the AI crown. On February 19, 2026, Google DeepMind released Gemini 3.1 Pro, delivering more than double the reasoning performance of its predecessor while maintaining the exact same pricing structure. This isn't an incremental update—it's a fundamental shift in what developers and businesses can expect from a mid-tier AI model - VentureBeat.
The timing matters. Just two weeks earlier, Anthropic had released Claude Opus 4.6 with a functional 1-million-token context window, and OpenAI's GPT-5.2 continued dominating mathematical reasoning benchmarks. Google needed a response, and Gemini 3.1 Pro is that response—a model that tops most major benchmarks while costing 60% less than Claude Opus 4.6 and offering features neither competitor can match.
This guide breaks down everything you need to know: the technical specifications, the real benchmark numbers, how it compares to Claude and OpenAI, where it excels, where it fails, and how to actually use it for production workloads. We'll cover API pricing down to the token, agentic capabilities for browser automation, and the practical limitations that Google's marketing materials conveniently omit.
The AI landscape moves fast. In the three months since December 2025, we've seen Google release Gemini 3, then 3 Flash, then 3.1 Pro. OpenAI dropped GPT-5.2 in December and GPT-5.2-Codex in January. Anthropic responded with Claude Opus 4.6 in early February. Understanding where each model excels requires cutting through marketing claims and examining actual benchmark data, developer experiences, and production deployment patterns.
This guide synthesizes information from over 25 primary sources including official documentation, benchmark analyses, developer forums, and enterprise deployment case studies. Every major claim includes source links so you can verify and dig deeper. The AI field changes rapidly—always check current documentation before making production decisions.
Gemini 3.1 Pro represents Google's first major point release in the Gemini 3 family, and understanding what it actually is requires understanding what it replaced. The previous model, Gemini 3 Pro, launched in late 2025 and immediately faced criticism despite strong benchmark scores. Independent community benchmarks flagged it as having one of the highest hallucination rates among frontier models. Users reported inconsistent output quality across tasks - Hacker News. The model worked brilliantly for some prompts and produced gibberish for others.
Google describes 3.1 Pro as a "natively multimodal reasoning" system, but that marketing language obscures the more significant change. The real innovation is what VentureBeat calls a "Deep Think Mini"—three levels of adjustable thinking that effectively turn Gemini 3.1 Pro into a lightweight version of Google's specialized Deep Think reasoning system. Where Gemini 3 Pro offered only two thinking modes (low and high), the new version adds a medium setting and completely overhauls what "high" means - VentureBeat.
This matters because it lets developers balance cost, latency, and quality in ways that weren't possible before. A simple classification task doesn't need the same reasoning depth as a complex multi-step coding problem. With Gemini 3.1 Pro, you can dial the thinking level down for routine tasks and crank it up only when the problem demands it.
The model is currently being released in preview across the Gemini API, Vertex AI, the Gemini app, and NotebookLM. Google is validating updates and making further advancements in agentic workflows before general availability - Google Blog. This preview status is important context: the model you test today may behave differently when it reaches GA.
The release philosophy represents a shift for Google. Rather than holding capabilities until perfect, they're shipping in preview and iterating based on developer feedback. This approach mirrors how competitors like OpenAI and Anthropic have operated, but it's relatively new for Google's AI division. The result is faster innovation cycles but also more uncertainty about long-term model behavior.
Gemini 3.1 Pro targets what Google calls "complex problem-solving" scenarios - 9to5Google. This includes legal document analysis, financial forecasting, scientific research assistance, and enterprise software development—domains where nuance and multi-step reasoning separate useful AI from expensive mistakes. The model can comprehend vast datasets and challenging problems from massively multimodal information sources, including text, audio, images, video, and entire code repositories.
The naming convention deserves brief explanation. "3.1" indicates this is a point release building on Gemini 3, not a full version increment. "Pro" positions it between Flash (faster, cheaper, less capable) and Deep Think (slower, more expensive, more capable for complex reasoning). The "Preview" suffix indicates it hasn't reached general availability and may change before stable release.
The core technical parameters of Gemini 3.1 Pro represent evolution rather than revolution from its predecessor, with one critical exception: the reasoning architecture. Understanding these specifications helps you determine whether the model fits your requirements and how to optimize usage.
The context window remains at 1 million tokens, matching what Google offered with Gemini 3 Pro. This sounds impressive until you examine how well models actually use that context. One million tokens translates to approximately 750,000 words—enough to include several novels, an entire codebase, or years of business documents in a single prompt.
However, context window size and context utilization are different things. Claude Opus 4.6 also advertises 1 million tokens, but scores 76% on the MRCR v2 long-context retrieval benchmark (8-needle, 1M context). Gemini 3 Pro scored only 26.3% on the same test at 1M tokens - AI Free API. We don't yet have MRCR scores for 3.1 Pro, which is a gap worth monitoring.
The practical implication: you can feed Gemini 3.1 Pro enormous amounts of context, but it may not reliably retrieve and use information from that context. Early observations suggest long-context reliability drops past approximately 120-150k tokens, with early answers being sharp but quality degrading on subsequent queries - GlbGPT. By the sixth query against a large context, models sometimes invent details that don't exist in the provided material.
The output limit caps at 64,000 tokens (roughly 50,000 words), which is half of Claude Opus 4.6's 128,000-token output limit. For most applications this won't matter, but if you're generating extremely long documents or code files, Claude maintains an advantage here.
The 64K output limit represents a practical ceiling on single-response generation. For applications requiring longer outputs, you'll need to implement continuation strategies—prompting the model to continue where it left off. This adds complexity and potential for context drift but is manageable for most use cases.
Gemini 3.1 Pro is engineered around a hybrid transformer-decoder backbone augmented with adaptive compute pathways that dynamically allocate reasoning depth via the thinking_level parameter (low, medium, high). When high thinking is selected, the model triggers deeper internal simulation chains for problems requiring multi-hop logic or constraint satisfaction - Constellation Research.
The architecture supports parallel tool invocation and multimodal function responses, allowing a single inference step to call Google Search, execute Python code that manipulates images, and return both JSON results and generated visuals. This reduces round-trip latency compared with external orchestration layers - Apidog.
The model accepts text, images, audio, video, and code as inputs—true multimodal capability from the ground up rather than separate vision and language models stitched together. For video understanding, Gemini 3.1 Pro has been optimized for high frame rate understanding with stronger performance at understanding fast-paced actions when sampling at more than 1 frame-per-second. The model can process video at 10 FPS—ten times the default speed—to catch rapid details vital for tasks like analyzing golf swing mechanics or monitoring industrial processes - Google AI Developers.
Gemini 3 introduces granular control over multimodal vision processing with the media_resolution parameter, which determines the maximum number of tokens allocated per input image or video frame. Higher resolutions improve the model's ability to read fine text or identify small details, but increase token usage and latency - VentureBeat.
The model's training data cutoff is not publicly documented as of the February 2026 release. Based on release patterns and developer observations, the knowledge cutoff is likely somewhere in late 2025, meaning the model has awareness of events through that period but lacks information about more recent developments.
What sets 3.1 Pro apart from its predecessor is the adjustable thinking architecture. This three-tier system gives developers and IT leaders a single model that can scale its reasoning effort dynamically, from quick responses for routine queries up to multi-minute deep reasoning sessions for complex problems - VentureBeat.
The low thinking mode minimizes latency and cost. This mode optimizes for speed, suitable for straightforward tasks like classification, simple Q&A, basic text generation, or any scenario where fast responses matter more than deep analysis.
Practical applications for low thinking include:
In low thinking mode, the model produces responses quickly with minimal reasoning overhead. The output quality is still strong for tasks that don't require extended reasoning chains, but complex problems will show degraded performance compared to higher thinking levels.
The medium thinking mode provides balanced reasoning for moderately complex tasks. This is similar to what the previous "high" setting offered on Gemini 3 Pro. Most production workloads will likely settle here—enough reasoning depth to handle nuanced problems without the latency cost of full reasoning chains.
Practical applications for medium thinking include:
Medium thinking represents the sweet spot for most enterprise applications. You get substantial reasoning capability without the latency or cost of deep reasoning mode.
The high thinking mode essentially runs a lightweight version of Google's Deep Think system, pursuing multiple reasoning paths and evaluating trade-offs before generating output. When set to high, 3.1 Pro behaves as a "mini version of Gemini Deep Think" — the company's specialized reasoning model - VentureBeat.
According to Google, the "core intelligence" of Gemini 3.1 Pro comes directly from the Deep Think model, which explains the strong reasoning benchmark performance - Let's Data Science.
Practical applications for high thinking include:
This mode excels at problems requiring careful logical analysis. The trade-off is increased latency—responses may take considerably longer as the model pursues multiple reasoning chains before settling on an answer.
In the API, you specify thinking level via the thinking_level parameter in your generation config. The parameter accepts string values: "low", "medium", or "high". If not specified, the model defaults to medium thinking - Google AI Developers.
The ability to adjust thinking levels per-request enables sophisticated cost optimization strategies. Routine document summarization can run on low thinking with fast response times, while complex analytical tasks can be elevated to high thinking for Deep Think–caliber reasoning—all without switching models or managing multiple API endpoints.
Benchmarks matter because they're the only standardized way to compare models, but they also lie. A model can be tuned specifically to perform well on popular benchmarks while failing on real-world tasks. With that caveat, here's comprehensive benchmark data for Gemini 3.1 Pro.
ARC-AGI-2 tests a model's ability to solve entirely new logic patterns it has never seen during training. Gemini 3.1 Pro achieved a verified score of 77.1%. This is more than double the reasoning performance of Gemini 3 Pro (31.1%) on the same benchmark - MarkTechPost. For context, this benchmark is specifically designed to resist training data memorization—the model must actually reason through novel problems. The 77.1% score dwarfs the next-closest competitor, Claude Opus 4.6, which scored 68.8% - VentureBeat.
Humanity's Last Exam is a notoriously difficult benchmark featuring questions designed to stump AI systems. Gemini 3.1 Pro scored 44.4% without tools. When using tools (calculators, web search, etc.), the score jumps to 51.4%. Claude Opus 4.6 edges it out slightly in the with-tools category at 53.1% - Trending Topics EU.
GPQA Diamond tests PhD-level scientific reasoning across physics, chemistry, and biology. Gemini 3.1 Pro scores 94.3%, representing one of the highest scores ever achieved on this benchmark - Interesting Engineering. This demonstrates genuine capability in complex scientific domains where questions require cross-domain synthesis and expert-level knowledge.
MMMLU (Massive Multitask Multilingual Language Understanding) tests understanding across multiple languages and task types. Gemini 3.1 Pro achieves 92.6%, one of the top scores across all frontier models - Interesting Engineering.
SWE-Bench Verified measures how well AI can solve real-world GitHub programming bugs. Gemini 3.1 Pro scores 80.6%—excellent performance that means it successfully resolves roughly 4 out of 5 real-world bugs when given adequate context. Claude Opus 4.6 leads at 80.8%—effectively tied - The New Stack.
LiveCodeBench Pro tests code generation on recent problems the model couldn't have seen during training. Gemini 3.1 Pro achieves an Elo of 2887, placing it significantly ahead of both GPT-5.2 (2393) and Gemini 3 Pro (2439) - Digital Applied. This is the best-in-class result for competitive coding.
Terminal-Bench 2.0 tests autonomous coding tasks where models must operate a computer via terminal commands. Gemini 3.1 Pro scored 68.5%, a massive improvement over Gemini 3 Pro's 56.9%. However, GPT-5.3-Codex leads this benchmark at 77.3% - Office Chai.
BrowseComp tests agentic web search capability. Gemini 3.1 Pro achieved 85.9%, surging past Gemini 3 Pro's 59.2%—a 45% relative improvement - Natural20. This represents one of Gemini 3.1 Pro's strongest showings.
APEX-Agents tests multi-step autonomous agent tasks. Gemini 3.1 Pro posted 33.5%, nearly double Gemini 3 Pro's 18.4% and well ahead of GPT-5.2's 23.0% - VentureBeat.
MCP Atlas tests multi-step computer tasks. Gemini 3.1 Pro reached 69.2%, a 15-point improvement over Gemini 3 Pro's 54.1% - Let's Data Science.
| Benchmark | Gemini 3.1 Pro | Gemini 3 Pro | Claude Opus 4.6 | GPT-5.2 |
|---|---|---|---|---|
| ARC-AGI-2 | 77.1% | 31.1% | 68.8% | 52.9% |
| GPQA Diamond | 94.3% | 91.9% | ~92% | ~90% |
| SWE-Bench Verified | 80.6% | ~75% | 80.8% | ~78% |
| LiveCodeBench Pro (Elo) | 2887 | 2439 | ~2600 | 2393 |
| Terminal-Bench 2.0 | 68.5% | 56.9% | 65.4% | ~62% |
| BrowseComp | 85.9% | 59.2% | ~82% | ~75% |
| APEX-Agents | 33.5% | 18.4% | ~28% | 23.0% |
| Humanity's Last Exam (tools) | 51.4% | ~45% | 53.1% | ~50% |
| MMMLU | 92.6% | ~90% | ~91% | ~90% |
Gemini 3.1 Pro holds the #1 position on at least 12 of 18 tracked benchmarks, with strongest leads in novel reasoning (ARC-AGI-2) and competitive coding (LiveCodeBench) - Office Chai.
Understanding what changed between Gemini 3 Pro and 3.1 Pro helps clarify whether upgrading is worth the integration effort. The short answer: if you're using Gemini 3 Pro for agentic tasks, the upgrade is mandatory. If you're using it for basic text generation, the improvements are incremental but meaningful.
The reasoning architecture is the most significant change. Gemini 3 Pro offered binary thinking modes—low or high. Gemini 3.1 Pro introduces the medium setting and fundamentally changes what "high" means. At the high thinking level, 3.1 Pro behaves as what VentureBeat describes as a "mini version of Gemini Deep Think," pursuing multiple reasoning chains before settling on an answer - VentureBeat.
This architectural change explains the dramatic improvement on ARC-AGI-2—from 31.1% to 77.1%, more than doubling performance. The model isn't just better at pattern matching; it's fundamentally better at reasoning through novel problems.
The agentic capabilities improved dramatically across the board:
These aren't incremental gains—they represent qualitative improvements in the model's ability to plan and execute multi-step tasks. Early evaluations showed up to 15% improvement over the best Gemini 3 Pro Preview runs, with the model being stronger, faster, and more efficient, requiring fewer output tokens while delivering more reliable results - The Register.
Safety improvements are modest but measurable. In automated content safety evaluations, Gemini 3.1 Pro showed improvements compared to Gemini 3 Pro in text-to-text safety (+0.10%) and multilingual safety (+0.11%) - Google DeepMind Model Card. These are small numbers, but they matter for production deployments where safety regressions can create significant liability.
The hallucination issue that plagued Gemini 3 Pro appears to be addressed, though comprehensive third-party testing is still pending. Early user reports suggest more consistent output quality across tasks, with fewer instances of the model producing confidently incorrect information.
Independent community benchmarks had flagged Gemini 3 Pro as having one of the highest hallucination rates among frontier models - GlbGPT. The 3.1 Pro release appears designed specifically to address this criticism.
Pricing remained unchanged—a significant decision by Google. When Gemini 3 Pro launched, it was positioned at $2.00 per million input tokens and $12.00 per million output tokens. Gemini 3.1 Pro maintains this exact pricing structure, effectively offering a massive performance upgrade at no additional cost to API users - MarkTechPost.
The core specifications remain the same:
The improvements come from training and fine-tuning advances, not architectural changes. This means existing integrations should work without modification—just update the model identifier.
Claude Opus 4.6 and Gemini 3.1 Pro represent the two strongest contenders for most enterprise AI applications in February 2026. Understanding their relative strengths helps you choose correctly for your use case.
Claude Opus 4.6 was released on February 5, 2026, just two weeks before Gemini 3.1 Pro - Digital Applied. Anthropic marketed it as the first model with a functional 1-million-token context that actually works—a dig at competitors whose large context windows fail to reliably retrieve information from long documents.
The long-context claim appears substantiated: Opus 4.6 scores 76% on MRCR v2 (8-needle, 1M context), while Gemini 3 Pro scored only 26.3% on the same test - AI Free API. If your application requires reliable retrieval from very long documents, this is a decisive difference.
Opus 4.6 excels at agentic coding tasks. It achieves 65.4% on Terminal-Bench 2.0—though Gemini 3.1 Pro now beats this at 68.5%. On SWE-bench Verified, Opus 4.6 scores 80.8% compared to Gemini's 80.6%—effectively tied - The New Stack.
Anthropic claims 50% to 75% reductions in both tool calling errors and build/lint errors compared to previous Claude versions. For complex, long-running autonomous coding sessions, Opus 4.6 remains strong. Work sessions with Opus 4.6 routinely stretch to 20 or 30 minutes of autonomous operation before requiring human input - Composio.
The massive 128,000-token output limit gives Opus 4.6 a significant advantage for tasks requiring long-form generation. Gemini 3.1 Pro's 64,000-token limit is half that. For generating complete codebases, book-length documents, or comprehensive analysis reports, Claude can produce twice as much output in a single call.
Opus 4.6 costs significantly more. At $5.00 per million input tokens and $25.00 per million output tokens, it's roughly 2.5x more expensive than Gemini 3.1 Pro for input and 2.1x more expensive for output - LLM Stats.
The cost difference is substantial for high-volume applications. If you're making millions of API calls, the 60% input cost savings with Gemini represents significant budget impact.
On ARC-AGI-2, Gemini 3.1 Pro leads decisively at 77.1% compared to Claude's 68.8%—an 8.3 percentage point advantage in novel reasoning capability - VentureBeat.
However, Opus 4.6 retains the top score for Humanity's Last Exam (full set) at 53.1% vs Gemini's 51.4% - Trending Topics EU.
Claude's tool orchestration remains superior. The 50-75% lower error rates in tool calling compared to previous versions give Opus 4.6 an edge for complex agentic workflows involving many tool calls. If your automation involves heavy tool use with low tolerance for errors, Claude may be worth the premium.
Claude Opus 4.6 leads on security benchmarks. Anthropic's 4.7% prompt injection success rate leads the industry—meaning attacks succeed less than 5% of the time - HumAI Blog. For enterprises with strict security requirements, this matters.
| Factor | Gemini 3.1 Pro | Claude Opus 4.6 | Winner |
|---|---|---|---|
| ARC-AGI-2 (novel reasoning) | 77.1% | 68.8% | Gemini |
| SWE-Bench (coding) | 80.6% | 80.8% | Tie |
| Long-context retrieval | ~26%* | 76% | Claude |
| Output limit | 64K | 128K | Claude |
| Input pricing | $2.00/M | $5.00/M | Gemini |
| Output pricing | $12.00/M | $25.00/M | Gemini |
| Tool error rate | Higher | 50-75% lower | Claude |
| Autonomous session length | Shorter | 20-30 min | Claude |
| BrowseComp (web automation) | 85.9% | ~82% | Gemini |
*Based on Gemini 3 Pro scores; 3.1 Pro pending verification
Bottom line: Choose Gemini 3.1 Pro for cost-sensitive, high-volume applications with straightforward tool usage. Choose Claude Opus 4.6 for mission-critical coding tasks, applications requiring long-context reliability, or complex agentic workflows where error rates matter more than cost.
GPT-5.2 was released on December 11, 2025, representing OpenAI's current flagship for professional knowledge work - OpenAI. The model comes in three variants: Instant for fast responses, Thinking for complex reasoning, and Pro for maximum capability.
GPT-5.2's dominant strength is mathematical reasoning. It achieves 100% accuracy on AIME 2025 mathematics—a perfect score. On GDPval, which measures performance on economically valuable knowledge work tasks spanning 44 occupations, GPT-5.2 Thinking outperforms the industry's next-best model by around 144 Elo points. It's the first model that performs at or above human expert level on this benchmark - OpenAI.
If your application involves complex mathematics, financial modeling, or other computation-heavy reasoning, GPT-5.2 is the clear choice.
GPT-5.2 demonstrates 65% fewer hallucinations than GPT-5.1 across general tasks - OpenAI. On a set of de-identified queries from ChatGPT, responses with errors were 30% less common with GPT-5.2 Thinking compared to GPT-5.1 Thinking. This focus on accuracy makes it reliable for professional knowledge work.
The three variants serve different needs:
This tiered approach mirrors Gemini's thinking levels but with distinct model endpoints rather than a single model with configurable reasoning depth.
GPT-5.2-Codex arrived on January 14, 2026, bringing specialized agentic coding capabilities - OpenAI. This variant includes context compaction and enhanced cybersecurity features. On Terminal-Bench 2.0, GPT-5.3-Codex (the subsequent release) leads at 77.3%, surpassing both Gemini 3.1 Pro's 68.5% and Claude Opus 4.6's 65.4% - Office Chai.
GPT-5.2's context window is 400K tokens—less than half of Gemini's 1M token capacity. However, the output limit is 128K tokens, matching Claude Opus 4.6 and doubling Gemini's 64K limit - GlbGPT.
GPT-5.2 pricing sits at $1.75 per million input tokens and $14.00 per million output tokens, with a 90% discount on cached inputs - Fello AI.
On a pure input cost basis, GPT-5.2 is actually 12.5% cheaper than Gemini 3.1 Pro ($1.75 vs $2.00). But Gemini's output costs are 14% lower ($12 vs $14), so the real cost comparison depends on your input/output ratio.
| Factor | Gemini 3.1 Pro | GPT-5.2 | Winner |
|---|---|---|---|
| ARC-AGI-2 | 77.1% | 54.2% | Gemini |
| Mathematical reasoning | Good | 100% AIME | GPT-5.2 |
| Context window | 1M | 400K | Gemini |
| Output limit | 64K | 128K | GPT-5.2 |
| Input pricing | $2.00/M | $1.75/M | GPT-5.2 |
| Output pricing | $12.00/M | $14.00/M | Gemini |
| LiveCodeBench (Elo) | 2887 | 2393 | Gemini |
| Hallucination rate | Improved | 65% reduction | GPT-5.2 |
| GDPval (knowledge work) | Good | +144 Elo lead | GPT-5.2 |
Bottom line: Choose Gemini 3.1 Pro for novel reasoning, competitive coding, and applications needing massive context windows. Choose GPT-5.2 for mathematical reasoning, professional knowledge work, and applications where hallucination rates are critical.
Understanding when to use each model—and when to route between them—is essential for optimizing both cost and quality. The practical recommendation that emerged from benchmark analyses: use model routing - LM Council.
Complex Coding and Software Engineering
Mathematical Reasoning and Computation
Novel Problem Solving and Reasoning
Long Document Analysis
Web Automation and Browser Tasks
High-Volume, Cost-Sensitive Processing
Professional Knowledge Work
Multimodal Analysis (Video, Image, Audio)
Deploying multiple models with intelligent routing can reduce costs by 70-80% compared to uniform premium model deployment. The strategy:
This multi-model approach requires additional infrastructure but delivers substantial cost savings for high-volume applications.
| Model | Input (per 1M) | Output (per 1M) | Context | Output Limit |
|---|---|---|---|---|
| Gemini 3.1 Pro | $2.00 | $12.00 | 1M | 64K |
| Gemini 3.1 Pro (>200K) | $4.00 | $18.00 | 1M | 64K |
| Claude Opus 4.6 | $5.00 | $25.00 | 200K | 128K |
| Claude Opus 4.6 (1M beta) | $10.00 | $37.50 | 1M | 128K |
| GPT-5.2 | $1.75 | $14.00 | 400K | 128K |
Pricing is where Gemini 3.1 Pro makes its strongest case against competitors. The model offers frontier-class performance at mid-tier pricing, creating genuine value for developers and businesses.
The standard pricing for Gemini 3.1 Pro is $2.00 per million input tokens and $12.00 per million output tokens for contexts under 200,000 tokens. For longer contexts exceeding 200,000 tokens, the prices scale to $4.00 input and $18.00 output per million tokens - MarkTechPost.
This tiered structure matters for applications that actually need the 1-million-token context. If you're processing documents that require 500K tokens of context, you'll pay the higher rates for the portion exceeding 200K. Plan accordingly.
Batch processing offers a 50% discount on both input and output tokens. If your workload can tolerate asynchronous processing (results delivered within hours rather than seconds), batch mode cuts costs dramatically. This is ideal for:
Context caching provides up to 90% savings on repeated context. If you're sending the same system prompts, few-shot examples, or reference documents across multiple requests, caching eliminates redundant token charges. Cache read tokens cost 10% of base input price - Google AI Developers Pricing.
Context caching is particularly valuable for:
Gemini 3.1 Pro: $2.00/$12.00 per million tokens (input/output) Claude Opus 4.6: $5.00/$25.00 per million tokens (standard), $10.00/$37.50 for 1M context beta GPT-5.2: $1.75/$14.00 per million tokens, 90% cached input discount
On a pure input cost basis, GPT-5.2 is actually 12.5% cheaper than Gemini 3.1 Pro. But Gemini's output costs are 14% lower than GPT-5.2's, so the real cost comparison depends on your input/output ratio. For workloads that generate substantial output (long documents, code generation, detailed analysis), Gemini 3.1 Pro often comes out ahead.
Compared to Claude Opus 4.6, Gemini 3.1 Pro is 60% cheaper on input and 52% cheaper on output. Unless you specifically need Opus 4.6's superior coding capabilities or long-context reliability, Gemini offers substantially better economics.
The free tier situation is complicated. There is no free tier available for gemini-3-1-pro-preview in the Gemini API, though you can try it for free in Google AI Studio. Many developers report that the actual rate limits feel stricter than documented, particularly since Google's significant cuts to free tier quotas in December 2025 - Apiyi.
On December 7, 2025, Google implemented dramatic changes to Gemini API quotas. Without prior announcement, free tier limits were slashed by 50-92% depending on the model. The free tier RPD (requests per day) dropped from 250 to just 20 for some models—a 92% reduction - AI Free API.
Stable pricing is expected to settle around $1.50/$10.00 for Pro models with additional caching and batch discounts in Q2 2026 - CostGoat. If cost is a primary concern, waiting for GA may yield additional savings.
For software engineering tasks, Gemini 3.1 Pro represents a significant step forward from its predecessor, though Claude Opus 4.6 maintains a slight edge in the most demanding scenarios.
The SWE-bench Verified benchmark is the industry standard for measuring AI capability on real software engineering tasks. Models are given GitHub issues and must produce patches that resolve them. Gemini 3.1 Pro scores 80.6%, meaning it successfully resolves roughly 4 out of 5 real-world bugs when given adequate context. Claude Opus 4.6 scores 80.8%—effectively tied - The New Stack.
Both models have crossed the threshold where they can genuinely solve most real-world bugs given adequate context. The difference between 80.6% and 80.8% is statistically insignificant for practical purposes.
On LiveCodeBench Pro, which tests code generation on recent problems the model couldn't have seen during training, Gemini 3.1 Pro achieves an Elo of 2887. This places it significantly ahead of GPT-5.2 (2393) and Gemini 3 Pro (2439), representing best-in-class performance for competitive coding challenges - Digital Applied.
Where Gemini 3.1 Pro genuinely excels is what developers call "vibe coding"—generating entire applications from high-level prompts. The model demonstrates remarkable ability to create visually compelling web apps and agentic code applications from natural language descriptions. It can produce website-ready, animated SVGs directly from text prompts and build complex dashboards that integrate with live data APIs - Google Blog.
One developer reported managing to one-shot an entire Windows 11-style web operating system in a single prompt - Simon Willison. This capability for rapid prototyping from vague descriptions sets Gemini apart.
The code execution capability is critical for coding tasks. Gemini 3.1 Pro can not only write code but also run and test it to verify correctness. This closed-loop approach catches errors that purely generative models would miss.
Early testing of Gemini 3.1 Pro in GitHub Copilot showed 35% higher accuracy in resolving software engineering challenges than Gemini 2.5 Pro - Joshua Berkowitz. The Gemini 3 Pro model shows more than a 50% improvement over Gemini 2.5 Pro in the number of solved benchmark tasks.
Developers using Gemini 3.1 Pro for coding report:
The model handles code transformation and editing particularly well, modifying existing codebases while maintaining consistency with surrounding code. This matters for real software engineering where you're rarely writing from scratch.
For multi-file projects, Gemini 3.1 Pro's 1-million-token context allows you to include substantial portions of a codebase for context. Whether the model actually uses that context effectively remains an open question based on Gemini 3 Pro's poor long-context retrieval scores.
The thinking level setting matters significantly for coding. Simple refactoring tasks work well at low thinking, but debugging complex issues or implementing new features benefits from medium or high thinking modes.
One consistent criticism: developers describe Gemini as "the most frustrating model" to use for development, despite strong benchmark scores - Hacker News. The frustration typically relates to inconsistent behavior—the model performs brilliantly on some tasks and poorly on similar ones. This variability appears reduced in 3.1 Pro compared to 3 Pro, but isn't eliminated.
The agentic capabilities of Gemini 3.1 Pro represent the most significant improvement over its predecessor. If you're building AI agents that need to browse the web, execute terminal commands, or complete multi-step tasks autonomously, this is where 3.1 Pro shines.
Terminal-Bench 2.0: Gemini 3.1 Pro scored 68.5% compared to Gemini 3 Pro's 56.9%—an 11.6-point improvement - Let's Data Science.
BrowseComp: Gemini 3.1 Pro achieved 85.9%, dramatically surpassing Gemini 3 Pro's 59.2%—a 26.7-point improvement. This means tasks that previously failed more often than they succeeded now succeed reliably - Natural20.
MCP Atlas: Gemini 3.1 Pro reached 69.2%, a 15-point improvement over Gemini 3 Pro's 54.1%.
APEX-Agents: Gemini 3.1 Pro posted 33.5%, nearly double Gemini 3 Pro's 18.4% and well ahead of GPT-5.2's 23.0%.
Google's strong showing on agentic benchmarks is particularly notable as the industry shifts focus from raw question-answering ability toward AI agents capable of executing complex, multi-step workflows in the real world - Natural20.
Gemini 3.1 Pro natively supports parallel tool invocation and multimodal function responses, allowing a single inference step to:
This reduces round-trip latency compared with external orchestration layers - Apidog.
Browser Use, an open-source library that empowers AI agents to interact with websites, works well with Gemini 3.1 Pro. The library handles the complex bridge between an LLM's reasoning and actual browser actions—clicking, typing, navigating—enabling web automation.
A form-filling AI agent powered by Gemini uses the model's multimodal capabilities to visually identify fields, map structured JSON data to complex inputs, and handle file uploads autonomously.
For enterprise browser automation, developers are applying workforce architectures to manage complex workflows. AI agents can autonomously navigate Salesforce dashboards to update records and extract data, handling the kind of repetitive work that previously required human attention.
Building complex system integrations is another strength. Gemini 3.1 Pro can utilize advanced reasoning to bridge the gap between complex APIs and user-friendly design. Example: building a live aerospace dashboard that successfully configured a public telemetry stream to visualize the International Space Station's orbit - Google Developers Blog.
Claude Opus 4.6 still maintains advantages for certain agentic tasks. Opus 4.6's autonomous work sessions routinely stretch to 20 or 30 minutes before requiring human input - Composio. When developers return, the task is often complete.
Opus 4.6 also demonstrates exceptional tool orchestration, with 50% to 75% reductions in both tool calling errors and build/lint errors compared to previous versions. If your agentic workflow involves heavy tool use, Claude may still be the safer choice despite higher costs.
The practical recommendation: start with Gemini 3.1 Pro for cost efficiency and switch to Claude Opus 4.6 for mission-critical workflows where error rates matter more than cost.
Gemini 3.1 Pro is "natively multimodal" from the ground up—it can comprehend vast datasets from massively multimodal information sources including text, audio, images, video, and entire code repositories - Google DeepMind Model Card. This isn't a language model with vision bolted on; it's a unified architecture that reasons across modalities.
The model demonstrates strong performance across image analysis tasks:
Video understanding is where Gemini's multimodal architecture truly differentiates. The model has been optimized for high frame rate understanding with stronger performance on fast-paced actions when sampling at more than 1 frame-per-second. You can process video at 10 FPS—ten times the default speed—to catch rapid details vital for tasks like:
The 1-million-token context window enables analysis of lengthy videos in a single session. Rather than processing short clips, you can feed the model substantial video content and ask complex questions about temporal relationships, character actions, or scene progressions.
Audio processing capabilities allow the model to transcribe, analyze, and reason about audio content. Combined with video, this enables comprehensive media analysis—understanding what's happening visually while also processing dialogue, music, and environmental sounds.
MMMU-Pro: Tests multimodal reasoning with complex questions requiring both visual and textual understanding. Gemini 3 Pro scores 81.0% - HumAI Blog.
Video-MMMU: Extends multimodal testing to video understanding. Gemini 3 Pro scores 87.6%.
MMMLU: Gemini 3.1 Pro achieves 92.6% on multimodal understanding.
Gemini 3 introduces granular control over multimodal vision processing with the media_resolution parameter, which determines the maximum number of tokens allocated per input image or video frame. Higher resolutions improve the model's ability to read fine text or identify small details, but increase token usage and latency - VentureBeat.
The practical applications span numerous domains:
While the model can process video at 10 FPS, this creates substantial token consumption. A 10-minute video at 10 FPS generates significant context requirements that may push into the higher pricing tiers for contexts exceeding 200K tokens. Plan your costs accordingly.
Understanding Gemini 3.1 Pro's architecture helps explain its capabilities and limitations. While Google hasn't published complete architectural details, we can piece together the key elements from documentation and model cards.
Gemini 3.1 Pro is engineered around a hybrid transformer-decoder backbone augmented with adaptive compute pathways that dynamically allocate reasoning depth via the thinking_level parameter - Constellation Research.
This architecture differs from pure decoder-only models (like GPT) by incorporating elements that allow the model to allocate different amounts of computation to different parts of the input and output.
The adaptive compute pathways are the key innovation. Rather than processing all inputs with the same computational depth, the model can:
This is controlled via the thinking_level parameter, which affects how much internal reasoning the model performs before generating output.
According to Google, the "core intelligence" of Gemini 3.1 Pro comes directly from the Deep Think model - Let's Data Science. This explains why 3.1 Pro performs so well on reasoning benchmarks—the high thinking mode essentially runs a lightweight version of Google's specialized reasoning system.
When set to high thinking, 3.1 Pro behaves as a "mini version of Gemini Deep Think," pursuing multiple reasoning paths and evaluating trade-offs before generating output.
Unlike models that add vision capabilities through separate encoders, Gemini is natively multimodal. The architecture processes text, images, audio, and video through unified representations, allowing the model to reason across modalities naturally rather than translating between them.
The architecture natively supports parallel tool invocation and multimodal function responses. A single inference step can:
This native tool support reduces the orchestration complexity required for agentic applications.
Gemini 3.1 Pro deploys multiple guardrails to reduce harmful content generation, but the implementation has received mixed feedback from developers.
According to Google's documentation, the safety framework includes:
These guardrails also fortify models against prompt injection attacks. The interventions are designed to prevent violative model responses while allowing benign responses—considering a response violative if it helps with attacks concretely, and non-violative if it is abstract, generic, or easily found in a textbook.
The Gemini API provides two harm block methods:
The API provides configurable harm block thresholds:
This allows developers to tune the sensitivity of content filtering based on their application requirements.
User feedback on safety implementation has been mixed. Some developers report safety guardrails regressing in contextual understanding, triggering false positives on harmless creative writing content - Google AI Developers Forum.
The balance between safety and capability remains challenging. Overly aggressive filtering blocks legitimate use cases; insufficient filtering allows harmful content. Google continues adjusting this balance based on feedback.
Organizations deploy Gemini 3.1 Pro through Google Cloud Vertex AI for enterprise-grade access with additional features and controls.
Vertex AI adds enterprise features including:
Developers and enterprises can access Gemini 3.1 Pro through multiple channels:
Admins enable the Gemini API, select the gemini-3-1-pro-preview endpoint, and apply IAM roles. The process integrates with existing Google Cloud security and governance frameworks.
Target enterprise scenarios include:
The model can upload lengthy contracts, reports, or research documents (up to 1M tokens) and answer detailed questions without splitting files - Tech Buzz AI.
Enterprise partners have already begun integrating the preview version. Early evaluations showed up to 15% improvement over the best Gemini 3 Pro Preview runs - The Register.
Gemini 3.1 Pro can plug directly into Google Workspace, BigQuery, and other enterprise tools millions of businesses already use daily, giving Google a structural advantage in enterprise AI deployment - VentureBeat.
This section provides a practical guide to accessing Gemini 3.1 Pro through the API.
Using the Gemini API requires an API key, which you can create for free in Google AI Studio:
The Gemini 3.1 Pro model identifier is gemini-3-1-pro-preview. As of this writing, Gemini 3.1 Pro Preview is live on the AI Studio web interface - Apiyi.
import google.generativeai as genai
# Configure with your API key
genai.configure(api_key="YOUR_API_KEY")
# Initialize the model
model = genai.GenerativeModel('gemini-3-1-pro-preview')
# Generate content
response = model.generate_content("Explain quantum computing in simple terms")
print(response.text)
from google.generativeai.types import GenerationConfig
# Configure with high thinking for complex reasoning
config = GenerationConfig(
thinking_level="high" # Options: "low", "medium", "high"
)
response = model.generate_content(
"Prove that there are infinitely many prime numbers",
generation_config=config
)
import PIL.Image
# Load an image
image = PIL.Image.open("diagram.png")
# Send both text and image
response = model.generate_content( [
"Explain what this diagram shows:",
image
])
print(response.text)
Gemini 3.1 Pro is available through:
Understanding rate limits is critical for production deployments. Google's quota system has multiple tiers with significantly different limits.
Free Tier (limited availability):
Tier 1 (Paid):
Enterprise: Custom limits based on agreement
On December 7, 2025, Google implemented dramatic changes to Gemini API quotas. Without prior announcement, free tier limits were slashed by 50-92% depending on the model. The free tier RPD dropped from 250 requests per day to just 20—a 92% reduction for some models - AI Free API.
Rate limits depend on various factors (such as your quota tier) and can be viewed in Google AI Studio - Google AI Developers.
There is no free tier available for gemini-3-1-pro-preview in the Gemini API. You can experiment for free in Google AI Studio, but API access requires payment - Google AI Developers.
For production deployments:
Fine-tuning allows you to customize model behavior for specific tasks or domains.
As of February 2026, the currently supported models for supervised fine-tuning are:
Gemini 3.1 Pro is in preview and fine-tuning support has not been announced. This is expected to become available after general availability.
Fine-tuning is supported through Vertex AI:
While waiting for fine-tuning support, customize behavior through:
No AI model is perfect, and Gemini 3.1 Pro has documented limitations that developers should understand before committing to production deployments.
Hallucination was the primary criticism of Gemini 3 Pro. Independent community benchmarks flagged it as having one of the highest hallucination rates among frontier models - Hacker News. While Gemini 3.1 Pro appears to address this issue based on early reports, comprehensive third-party testing is still pending.
Inconsistent output quality plagued Gemini 3 Pro, and while 3.1 Pro shows improvement, variability remains. The model performs brilliantly on some prompts and produces suboptimal results on similar ones. Developers describe this inconsistency as the most frustrating aspect of working with Gemini models.
The long-context retrieval question is unresolved. Gemini 3 Pro scored only 26.3% on MRCR v2 at 1M tokens, compared to Claude Opus 4.6's 76% - AI Free API. If 3.1 Pro inherits this limitation, the advertised 1-million-token context window is more theoretical than practical.
Long-context reliability reportedly drops past approximately 120-150k tokens, with early answers being sharp but quality degrading on subsequent queries. By the sixth query, models sometimes invent details that don't exist - GlbGPT.
Structured output is inconsistent under pressure. Gemini 3 occasionally slipped extra fields or reordered keys, achieving only 84% schema-valid responses without retries - GlbGPT.
The model appeared to be incredibly slow on launch day, with some tests taking 104 seconds to respond to simple queries and experiencing high demand errors - Simon Willison. This was attributed to launch day infrastructure strain and should not reflect normal performance.
Rate limiting is aggressively enforced. Many users report that actual limits feel stricter than documented. Google significantly cut free tier quotas in December 2025, and the Gemini 3.1 Pro preview inherits these restrictions - Apiyi.
Preview status means the model is not yet generally available. Google is validating updates and making advancements in agentic workflows before GA release. The model you test today may behave differently when it reaches general availability.
Output length is capped at 64,000 tokens, half of Claude Opus 4.6's 128,000-token limit. For applications requiring very long-form generation, this limitation matters.
Tool orchestration for complex agentic tasks still trails Claude Opus 4.6. While 3.1 Pro's agentic benchmarks improved dramatically, Opus 4.6 demonstrates 50-75% lower error rates in tool calling scenarios.
Multiple developers describe Gemini as "the most frustrating model" for development work - Hacker News. This subjective assessment doesn't appear in benchmarks but reflects real developer experience. The frustration typically stems from the inconsistency mentioned above—unpredictable quality makes it hard to build reliable workflows.
Understanding where Gemini 3.1 Pro performs best—and worst—helps you choose the right model for specific applications.
High-volume, cost-sensitive applications are Gemini's sweet spot. At $2/$12 per million tokens, you can process substantially more content for the same budget compared to Claude Opus 4.6 ($5/$25) or GPT-5.2 ($1.75/$14 output). For applications making thousands of API calls daily, these cost differences compound.
Multimodal analysis is a genuine strength. The native multimodal architecture handles image, video, and audio reasoning better than language models with bolted-on vision capabilities. Document intelligence, video analysis, and applications requiring cross-modal reasoning benefit from this architecture.
Agentic web automation saw massive improvements. The 85.9% BrowseComp score suggests reliable web automation for most common tasks. If you're building AI agents that need to fill forms, navigate websites, or extract data from web pages, Gemini 3.1 Pro is now a viable choice.
Complex reasoning tasks benefit from the adjustable thinking levels. For mathematical proofs, multi-step logical analysis, or problems requiring extended reasoning chains, the high thinking mode competes effectively with specialized reasoning models.
"Vibe coding" or rapid application prototyping from natural language descriptions. Gemini 3.1 Pro excels at generating complete web applications, animated visualizations, and functional prototypes from high-level descriptions.
Novel problem solving is where ARC-AGI-2's 77.1% score matters. For applications requiring reasoning through problems the model hasn't seen before, Gemini leads the field.
Mathematical reasoning at the highest level still favors GPT-5.2. OpenAI's model achieves 100% accuracy on AIME 2025 mathematics. For applications requiring flawless mathematical computation, GPT-5.2 is safer.
Mission-critical agentic tasks with zero tolerance for errors should consider Claude Opus 4.6. While Gemini 3.1 Pro's agentic benchmarks improved dramatically, Claude's 50-75% lower tool calling error rates make it more reliable for high-stakes automation.
Long-context reliability is uncertain. If your application depends on accurately retrieving information from very long documents, Claude Opus 4.6's proven 76% MRCR score at 1M tokens is significantly more reliable than Gemini's historical 26.3%.
Long-form generation exceeding 64,000 tokens requires Claude Opus 4.6's 128,000-token output limit. For generating entire books, comprehensive codebases, or very long documents, Gemini 3.1 Pro physically cannot produce the output in a single call.
Enterprise knowledge work at the highest level still favors GPT-5.2. On GDPval, GPT-5.2 outperforms the competition by 144 Elo points and is the first model performing at or above human expert level.
Consistency-critical applications may struggle with Gemini's variability. If you need predictable, consistent outputs across similar prompts, the reported inconsistency is a real concern.
Gemini 3.1 Pro is now available in public preview in GitHub Copilot, expanding model choice for developers who prefer working within their existing IDE workflows - GitHub Changelog.
Users can enable Gemini 3.1 Pro by:
There's an option to bring your own API key:
This allows developers to customize their experience and integrate it into existing workflows while potentially accessing better rate limits.
Early testing showed 35% higher accuracy in resolving software engineering challenges compared to Gemini 2.5 Pro - Joshua Berkowitz. The Gemini 3 Pro model shows more than a 50% improvement in the number of solved benchmark tasks.
GitHub Copilot CLI adds support for Gemini 3 Pro for data tasks, alongside other models like GPT-5.1 and Claude Opus 4.5 - GitHub Discussions.
Gemini 3.1 Pro's integration with the broader Google ecosystem provides significant advantages for organizations already invested in Google Cloud.
Gemini 3.1 Pro can plug directly into Google Workspace, enabling AI capabilities within familiar productivity tools:
Integration with BigQuery enables AI-powered data analysis on enterprise-scale datasets. You can combine Gemini's reasoning capabilities with BigQuery's data processing, enabling natural language queries against large datasets.
NotebookLM integrates Gemini 3.1 Pro for document analysis and research workflows. This is particularly useful for academic and research applications where you need to synthesize information across multiple sources.
For mobile developers, Android Studio integration provides Gemini-powered coding assistance within the primary Android development environment. This includes code completion, error explanation, and refactoring suggestions.
Antigravity is Google's agent-based development platform, providing a structured environment for building AI agents with Gemini as the underlying model. This represents Google's answer to growing interest in agentic AI applications.
The AI model landscape in February 2026 is more competitive than ever, with multiple vendors offering genuinely capable frontier models at increasingly aggressive price points.
Google holds the price-to-performance crown with Gemini 3.1 Pro. The model tops most benchmarks while costing less than competitors. Google's strategy appears focused on winning developer mindshare through accessibility—good enough performance at a price that makes experimentation cheap.
The Gemini 3 family now includes:
Anthropic continues to lead on coding and agentic tasks with Claude Opus 4.6. The $5/$25 pricing is premium, but the model justifies it for applications where reliability matters more than cost. Anthropic's focus on safety and security (their 4.7% prompt injection success rate leads the industry) appeals to enterprises with compliance requirements - HumAI Blog.
OpenAI dominates mathematical reasoning and professional knowledge work with GPT-5.2. The introduction of three model variants (Instant, Thinking, Pro) mirrors Google's thinking levels approach. ChatGPT Go, Plus, and Pro subscription tiers provide consumer access at various price points.
The recent GPT-5.2-Codex release demonstrates OpenAI's continued investment in specialized coding models, achieving 77.3% on Terminal-Bench 2.0—the highest score recorded.
Emerging players continue entering the market. Moonshot AI's Kimi K2.5 and xAI's Grok 4 are mentioned in comparative analyses, suggesting the competitive field extends beyond the big three - Medium.
The model routing approach is emerging as industry best practice. Rather than choosing a single model for all tasks, organizations deploy multiple models and route requests based on task characteristics. This approach can reduce costs by 70-80% compared to uniform premium deployment - LM Council.
AI agent platforms are becoming the integration layer that abstracts away model selection. Instead of building directly against specific model APIs, developers increasingly build on platforms that provide agent orchestration, tool integration, and model routing as managed services.
For organizations building AI workforces—teams of AI agents that collaborate on business processes—the choice often comes down to ecosystem rather than raw capability. Platforms like o-mega.ai let you deploy multiple specialized agents that can use different underlying models based on task requirements. The approach: humans set high-level goals and AI agents handle the grunt work, checking in for guidance when needed.
The trajectory of AI model development suggests several trends worth monitoring.
General availability of Gemini 3.1 Pro is expected soon, but Google hasn't announced a specific date. The preview period allows validation of agentic workflows, so GA may bring additional capabilities or refinements.
Pricing reductions are anticipated. Stable pricing for Pro models is expected to settle around $1.50/$10 with additional caching and batch discounts by Q2 2026 - CostGoat. Competition among vendors continues pushing prices down.
Gemini 3.1 Flash hasn't been officially announced, but if Google follows previous patterns, a Flash variant offering faster, cheaper performance with slightly reduced capability would be logical.
Context window utilization improvements are likely coming from all vendors. Claude Opus 4.6's 76% MRCR score sets the bar for functional long-context processing. If Google addresses Gemini's historical weakness in this area, the 1-million-token context becomes genuinely useful.
Agentic AI continues its trajectory toward mainstream adoption. Gartner predicts 40% of enterprise applications will integrate task-specific AI agents by end of 2026, up from less than 5% in 2025 - Gartner.
By 2028, projections suggest AI agents will outnumber human sellers 10x in B2B contexts, with $15 trillion of B2B spend flowing through AI agent exchanges.
Multi-agent architectures are becoming standard for complex enterprise applications. Rather than single agents handling entire workflows, organizations deploy multiple specialized agents that collaborate. Procurement agents, logistics agents, manufacturing agents, quality agents, and finance agents each have their own responsibilities—coordinated through orchestration platforms.
The model selection question will increasingly be answered by routing systems rather than humans. Developers will specify requirements (cost, latency, reliability, capability), and intelligent routers will select appropriate models for each request.
For Gemini 3.1 Pro specifically, the key question is whether Google can address the consistency issues that made Gemini "the most frustrating model" for developers. Strong benchmarks mean little if real-world usage remains unpredictable.
Gemini 3.1 Pro represents a significant advancement in Google's AI capabilities, delivering more than double the reasoning performance of its predecessor while maintaining the same pricing. The model excels at novel reasoning, competitive coding, web automation, and cost-sensitive high-volume applications.
The AI landscape continues evolving rapidly. Rather than betting everything on a single model, the most resilient approach is building applications that can use multiple models based on task requirements. Gemini 3.1 Pro is an excellent addition to any multi-model strategy—strong enough to handle most tasks at compelling economics, with clear upgrade paths to Claude or GPT-5.2 when specific requirements demand it.
The future belongs to AI workforces—teams of specialized agents collaborating on complex business processes. Gemini 3.1 Pro's improvements in agentic capabilities position it well for this transition. Whether you're building individual automations or orchestrated agent teams, the model offers a compelling balance of capability and cost.
Understanding how AI benchmarks work helps you interpret the numbers and understand what they actually mean for your applications. Not all benchmarks are created equal, and high scores don't always translate to real-world performance.
The ARC-AGI-2 (Abstraction and Reasoning Corpus for AGI, Version 2) benchmark is designed specifically to test reasoning on problems the model couldn't have seen during training. Created by François Chollet, it presents visual reasoning puzzles that require understanding abstract patterns and applying them to new examples.
The benchmark matters because it resists the "benchmark gaming" that plagues other evaluations. A model can't improve its ARC-AGI-2 score simply by training on more data—it must genuinely reason through novel problems.
Gemini 3.1 Pro's 77.1% score represents a significant breakthrough. For context:
This improvement suggests Gemini 3.1 Pro has genuinely better reasoning capabilities, not just better training data coverage. The gap to competitors indicates Google has made architectural advances in how the model handles abstract reasoning.
However, ARC-AGI-2 focuses specifically on visual-spatial reasoning puzzles. Strong performance here doesn't guarantee strong performance on all reasoning tasks. The benchmark is one signal among many, not a definitive measure of general intelligence.
SWE-Bench Verified uses actual GitHub issues from popular open-source projects as test cases. The model receives the issue description and repository context, then must produce a patch that resolves the issue. Success is measured by whether the patch passes the project's test suite.
The benchmark is valuable because it tests realistic software engineering tasks rather than artificial coding challenges. Issues come from real projects with real codebases, requiring the model to understand existing code, identify the root cause of problems, and implement working fixes.
Gemini 3.1 Pro's 80.6% and Claude Opus 4.6's 80.8% are effectively tied. Both models successfully resolve 4 out of 5 real-world bugs when given adequate context. This represents a significant milestone—models have crossed the threshold where they can meaningfully contribute to software development workflows.
The remaining 20% of failures typically involve:
LiveCodeBench Pro tests code generation on recent competitive programming problems from platforms like Codeforces and LeetCode. Problems are collected after model training cutoffs, ensuring the model couldn't have memorized solutions.
The Elo rating system (like chess) allows direct comparison between models. Gemini 3.1 Pro's 2887 Elo places it significantly ahead of:
Competitive coding tests algorithmic reasoning and implementation speed. Strong performance indicates the model can solve complex algorithmic problems efficiently. However, competitive coding differs from production software engineering—it emphasizes algorithms over architecture, testing, maintainability, and collaboration.
BrowseComp tests a model's ability to navigate websites, fill forms, extract information, and complete multi-step web tasks. The benchmark simulates realistic web automation scenarios that developers might want to automate.
Gemini 3.1 Pro's 85.9% represents exceptional improvement from Gemini 3 Pro's 59.2%. This 26.7-point jump indicates qualitative improvement in web automation capability—tasks that previously failed more often than succeeded now succeed reliably.
The benchmark matters for developers building:
GPQA Diamond (Graduate-level Google-Proof Q&A) tests PhD-level scientific knowledge across physics, chemistry, and biology. Questions are designed to be "Google-proof"—you can't find the answers through simple web searches. They require genuine understanding and reasoning.
Gemini 3.1 Pro's 94.3% indicates near-expert-level scientific reasoning. The model can engage meaningfully with complex scientific questions that would challenge human experts.
This capability is particularly valuable for:
All benchmarks have limitations:
Data contamination remains a concern. If benchmark questions appeared in training data (even indirectly), scores may be inflated. Model providers are generally careful about this, but perfect isolation is difficult to verify.
Benchmark gaming can occur when models are optimized specifically for benchmark performance. A model might score highly on benchmarks while performing poorly on similar real-world tasks.
Coverage gaps mean no benchmark suite tests everything important. A model might excel on all measured benchmarks while failing on unmeasured capabilities.
Snapshot nature means benchmarks capture performance at a specific point. Models change with updates, and benchmark versions evolve. Always check when scores were measured.
Aggregation problems arise when combining scores across benchmarks. A model might rank #1 on average while being suboptimal for any specific task.
The practical recommendation: use benchmarks as one input among many. Test models on your specific use cases before making production decisions. Benchmark performance indicates potential, not guaranteed performance for your application.
This section provides detailed code examples for common Gemini 3.1 Pro use cases. Each example includes context about when to use it and what to expect.
When you need to analyze a lengthy document and answer questions about it:
import google.generativeai as genai
from google.generativeai.types import GenerationConfig
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel('gemini-3-1-pro-preview')
# Read your document (contract, research paper, codebase, etc.)
with open("lengthy_contract.txt", "r") as f:
document = f.read()
# Use medium thinking for document analysis
config = GenerationConfig(thinking_level="medium")
# First, get a structured summary
summary_prompt = f"""
Analyze the following document and provide:
1. A one-paragraph executive summary
2. The 5 most important provisions or findings
3. Any areas of concern or ambiguity
4. Recommended next steps
Document:
{document}
"""
response = model.generate_content(summary_prompt, generation_config=config)
print(response.text)
# Then ask follow-up questions
follow_up = f"""
Based on the document provided earlier:
{document}
Specifically identify any clauses related to:
1. Termination conditions
2. Liability limitations
3. Intellectual property rights
"""
response2 = model.generate_content(follow_up, generation_config=config)
print(response2.text)
Key considerations:
For complex coding tasks requiring multiple steps:
import google.generativeai as genai
from google.generativeai.types import GenerationConfig
import subprocess
import tempfile
import os
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel('gemini-3-1-pro-preview')
# Use high thinking for complex code generation
config = GenerationConfig(thinking_level="high")
# Step 1: Generate code
code_prompt = """
Write a Python function that:
1. Takes a directory path as input
2. Recursively scans for all Python files
3. Extracts all function definitions with their docstrings
4. Returns a structured dictionary with file paths as keys
5. Handles edge cases (no access permissions, symlinks, empty files)
Include type hints and comprehensive error handling.
"""
response = model.generate_content(code_prompt, generation_config=config)
generated_code = response.text
# Step 2: Extract code block from response
import re
code_match = re.search(r'```python\n(.*?)```', generated_code, re.DOTALL)
if code_match:
code = code_match.group(1)
# Step 3: Validate syntax
with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
f.write(code)
temp_file = f.name
try:
result = subprocess.run(
['python', '-m', 'py_compile', temp_file],
capture_output=True,
text=True
)
if result.returncode == 0:
print("Code syntax is valid!")
print(code)
else:
print(f"Syntax error: {result.stderr}")
# Step 4: Request fix
fix_prompt = f"""
The following code has a syntax error:
{code}
Error message:
{result.stderr}
Please fix the syntax error and return the corrected code.
"""
fix_response = model.generate_content(fix_prompt, generation_config=config)
print(fix_response.text)
finally:
os.unlink(temp_file)
For web automation tasks using the model's tool capabilities:
import google.generativeai as genai
from google.generativeai.types import FunctionDeclaration, Tool
genai.configure(api_key="YOUR_API_KEY")
# Define tools the model can call
search_web = FunctionDeclaration(
name="search_web",
description="Search the web for information",
parameters={
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query"
}
},
"required": ["query"]
}
)
get_page_content = FunctionDeclaration(
name="get_page_content",
description="Retrieve the content of a web page",
parameters={
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The URL to fetch"
}
},
"required": ["url"]
}
)
extract_data = FunctionDeclaration(
name="extract_data",
description="Extract structured data from page content",
parameters={
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The page content to extract from"
},
"schema": {
"type": "string",
"description": "Description of the data structure to extract"
}
},
"required": ["content", "schema"]
}
)
tools = Tool(function_declarations= [search_web, get_page_content, extract_data])
model = genai.GenerativeModel(
'gemini-3-1-pro-preview',
tools= [tools]
)
# Start a chat with agentic capabilities
chat = model.start_chat()
response = chat.send_message("""
Research the top 5 programming languages by popularity in 2026.
For each language, find:
1. Current ranking
2. Year-over-year change
3. Primary use cases
4. Average developer salary
Return the results in a structured format.
""")
# Handle tool calls
for part in response.candidates [0].content.parts:
if hasattr(part, 'function_call'):
function_name = part.function_call.name
args = dict(part.function_call.args)
print(f"Model wants to call: {function_name}")
print(f"With arguments: {args}")
# In a real implementation, execute the function and return results
# result = execute_function(function_name, args)
# response = chat.send_message(result)
For video analysis tasks:
import google.generativeai as genai
from google.generativeai.types import GenerationConfig
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel('gemini-3-1-pro-preview')
# Upload video file
video_file = genai.upload_file("product_demo.mp4")
# Wait for processing
import time
while video_file.state.name == "PROCESSING":
time.sleep(2)
video_file = genai.get_file(video_file.name)
if video_file.state.name == "FAILED":
raise Exception("Video processing failed")
# Use medium thinking for video analysis
config = GenerationConfig(thinking_level="medium")
# Analyze the video
analysis_prompt = """
Analyze this video and provide:
1. **Content Summary**: What is happening in the video?
2. **Key Moments**: Identify the 5 most important moments with timestamps
3. **Speakers**: Identify any speakers and summarize their main points
4. **Visual Elements**: Describe any graphics, text overlays, or visual aids
5. **Production Quality**: Assess audio quality, video quality, editing
6. **Suggested Improvements**: Recommendations to improve the video
Provide timestamps in [MM:SS] format.
"""
response = model.generate_content(
[video_file, analysis_prompt],
generation_config=config
)
print(response.text)
# Clean up
genai.delete_file(video_file.name)
For high-volume processing where latency isn't critical:
import google.generativeai as genai
from google.generativeai.types import GenerationConfig
import asyncio
from typing import List
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel('gemini-3-1-pro-preview')
# Use low thinking for batch processing to optimize costs
config = GenerationConfig(thinking_level="low")
async def process_document(document: str, index: int) -> dict:
"""Process a single document and return structured result."""
prompt = f"""
Extract the following from this document:
- Category (one of: invoice, contract, report, letter, other)
- Date (YYYY-MM-DD format or "unknown")
- Key entities mentioned
- One-sentence summary
Return as JSON.
Document:
{document}
"""
try:
response = model.generate_content(prompt, generation_config=config)
return {
"index": index,
"success": True,
"result": response.text
}
except Exception as e:
return {
"index": index,
"success": False,
"error": str(e)
}
async def batch_process(documents: List [str], concurrency: int = 5) -> List [dict]:
"""Process multiple documents with controlled concurrency."""
semaphore = asyncio.Semaphore(concurrency)
async def limited_process(doc: str, idx: int) -> dict:
async with semaphore:
return await process_document(doc, idx)
tasks = [limited_process(doc, i) for i, doc in enumerate(documents)]
return await asyncio.gather(*tasks)
# Example usage
documents = [
"Invoice #12345 from ABC Corp dated January 15, 2026...",
"This Employment Agreement is entered into...",
"Q4 2025 Financial Report showing revenue of...",
# ... more documents
]
results = asyncio.run(batch_process(documents))
# Analyze results
successful = [r for r in results if r ["success"]]
failed = [r for r in results if not r ["success"]]
print(f"Processed {len(successful)}/{len(results)} successfully")
for failure in failed:
print(f"Failed document {failure ['index']}: {failure ['error']}")
Understanding how organizations deploy Gemini 3.1 Pro in production helps illustrate practical patterns and considerations.
Company Profile: Mid-size law firm with 50 attorneys handling commercial litigation
Challenge: Attorneys spent 30-40% of their time reviewing discovery documents, identifying relevant passages, and extracting key facts. The firm wanted to reduce this overhead while maintaining accuracy.
Implementation:
Results:
Key Lessons:
Company Profile: Online retailer with 10,000 daily customer inquiries
Challenge: Customer support costs were growing faster than revenue. The company needed to automate routine inquiries while maintaining customer satisfaction.
Implementation:
Results:
Key Lessons:
Company Profile: Pharmaceutical research organization with 20 years of research documents
Challenge: Researchers couldn't efficiently search historical research data. Knowledge was siloed in individual teams and document systems.
Implementation:
Results:
Key Lessons:
Company Profile: SaaS startup with 15-person engineering team
Challenge: Small team needed to ship features faster without compromising code quality. Hiring was difficult in competitive market.
Implementation:
Results:
Key Lessons:
This section addresses common problems developers encounter with Gemini 3.1 Pro and how to resolve them.
Symptoms: API returns 429 status codes, requests fail with rate limit messages, inconsistent availability.
Causes:
Solutions:
import time
import random
def make_request_with_retry(prompt, max_retries=5):
for attempt in range(max_retries):
try:
return model.generate_content(prompt)
except Exception as e:
if "429" in str(e) or "rate limit" in str(e).lower():
wait_time = (2 ** attempt) + random.random()
print(f"Rate limited. Waiting {wait_time:.2f}s...")
time.sleep(wait_time)
else:
raise
raise Exception("Max retries exceeded")
import asyncio
from datetime import datetime, timedelta
class RateLimiter:
def __init__(self, rpm_limit=150):
self.rpm_limit = rpm_limit
self.requests = []
async def wait_if_needed(self):
now = datetime.now()
minute_ago = now - timedelta(minutes=1)
self.requests = [r for r in self.requests if r > minute_ago]
if len(self.requests) >= self.rpm_limit:
wait_time = (self.requests [0] - minute_ago).total_seconds()
await asyncio.sleep(wait_time)
self.requests.append(now)
Upgrade to higher tier for production workloads
Use batch processing for non-real-time workloads (50% cost savings and often higher limits)
Symptoms: Same or similar prompts produce varying quality outputs, some responses excellent while others poor.
Causes:
Solutions:
config = GenerationConfig(
temperature=0.1, # Lower = more deterministic
thinking_level="medium"
)
# Instead of:
"Summarize this document"
# Use:
"""
Summarize the following document in exactly 3 paragraphs:
- Paragraph 1: Executive summary (2-3 sentences)
- Paragraph 2: Key findings (bullet points)
- Paragraph 3: Recommended actions
Maintain professional tone. Do not include information not present in the document.
Document:
{document}
"""
def generate_with_validation(prompt, validator_fn, max_attempts=3):
for attempt in range(max_attempts):
response = model.generate_content(prompt)
if validator_fn(response.text):
return response.text
else:
print(f"Validation failed, attempt {attempt + 1}")
raise Exception("Failed to generate valid output")
Symptoms: Model fails to find information that exists in provided context, provides incorrect citations, or invents information.
Causes:
Solutions:
Place important information at beginning and end of context
Use explicit retrieval prompts:
# Instead of:
"What does the contract say about termination?"
# Use:
"""
Search the provided contract for sections related to termination.
Quote the exact text of any relevant clauses.
If no termination clauses exist, explicitly state "No termination clauses found."
Contract:
{contract_text}
"""
def chunk_document(document, chunk_size=50000, overlap=1000):
chunks = []
for i in range(0, len(document), chunk_size - overlap):
chunk = document [i:i + chunk_size]
chunks.append(chunk)
return chunks
def search_in_chunks(document, query):
chunks = chunk_document(document)
results = []
for i, chunk in enumerate(chunks):
response = model.generate_content(f"""
Search this document section for: {query}
Document section {i + 1}:
{chunk}
""")
results.append(response.text)
# Synthesize results
synthesis = model.generate_content(f"""
Combine these search results into a coherent answer:
{results}
Original query: {query}
""")
return synthesis.text
Symptoms: API costs exceed budget, unexpected billing spikes, inefficient token usage.
Causes:
Solutions:
def get_thinking_level(task_complexity: str) -> str:
complexity_map = {
"simple": "low", # Classification, simple Q&A
"moderate": "medium", # Analysis, standard coding
"complex": "high" # Multi-step reasoning, proofs
}
return complexity_map.get(task_complexity, "medium")
from google.generativeai import caching
# Cache system prompt and few-shot examples
cache = caching.CachedContent.create(
model='gemini-3-1-pro-preview',
display_name='my-system-context',
contents= [system_prompt, few_shot_examples],
ttl=datetime.timedelta(minutes=60)
)
# Use cached context for subsequent requests
model = genai.GenerativeModel.from_cached_content(cache)
# Subsequent requests only pay for new input + output
Batch similar requests for 50% discount
Monitor and alert on costs:
import os
from google.cloud import billing_v1
def check_budget_status():
client = billing_v1.CloudBillingClient()
# Set up alerts when approaching budget limits
Symptoms: Requests fail with timeout errors, especially for complex tasks or high thinking level.
Causes:
Solutions:
import google.generativeai as genai
genai.configure(
api_key="YOUR_API_KEY",
transport='rest' # Sometimes more reliable
)
# Set longer timeout
import google.api_core.client_options as client_options
options = client_options.ClientOptions(
api_endpoint="generativelanguage.googleapis.com"
)
response = model.generate_content(prompt, stream=True)
full_response = ""
for chunk in response:
full_response += chunk.text
print(chunk.text, end="", flush=True)
Implement request chunking for very complex tasks
Consider lower thinking level if task doesn't require deep reasoning
Q: Is Gemini 3.1 Pro the same as Gemini 3 Pro?
A: No. Gemini 3.1 Pro is a significant update that adds a third thinking level (medium), integrates "Deep Think Mini" capabilities at the high thinking level, improves agentic performance dramatically (26+ percentage points on BrowseComp), and addresses hallucination issues reported in 3 Pro. The pricing and context window remain the same.
Q: When will Gemini 3.1 Pro reach general availability?
A: Google hasn't announced a specific date. The model is currently in preview while Google validates agentic workflow improvements. GA is expected within Q1 2026, but this is not confirmed.
Q: Can I use Gemini 3.1 Pro for commercial applications?
A: Yes, but note the preview status. The model may change before GA. Review Google's terms of service for specific commercial use guidelines and any restrictions that may apply.
Q: How does Gemini 3.1 Pro compare to Claude Opus 4.6?
A: Gemini 3.1 Pro excels at novel reasoning (77.1% vs 68.8% ARC-AGI-2), costs 60% less on input and 52% less on output, and has stronger web automation (85.9% vs ~82% BrowseComp). Claude Opus 4.6 has better long-context reliability (76% vs ~26% MRCR), larger output limit (128K vs 64K), and lower tool calling error rates. Choose based on your specific requirements.
Q: How does Gemini 3.1 Pro compare to GPT-5.2?
A: Gemini 3.1 Pro leads on novel reasoning (77.1% vs 54.2% ARC-AGI-2) and competitive coding (2887 vs 2393 Elo). GPT-5.2 dominates mathematical reasoning (100% AIME accuracy) and has lower hallucination rates. GPT-5.2 has slightly cheaper input ($1.75 vs $2.00) but more expensive output ($14 vs $12). Choose based on whether you prioritize reasoning or mathematical computation.
Q: What does Gemini 3.1 Pro cost?
A: Standard pricing is $2.00 per million input tokens and $12.00 per million output tokens for contexts under 200K tokens. For longer contexts (200K-1M), prices increase to $4.00 input and $18.00 output. Batch processing offers 50% discounts. Context caching saves up to 90% on repeated context.
Q: Is there a free tier?
A: There is no free tier for API access to gemini-3-1-pro-preview. You can experiment for free in Google AI Studio. Free tier limits for other Gemini models were significantly reduced in December 2025.
Q: How can I reduce my API costs?
A: Use lower thinking levels when possible, implement context caching for repeated prompts, use batch processing for non-real-time workloads, optimize prompts to reduce token usage, and monitor usage to identify optimization opportunities.
Q: What is the maximum context window?
A: 1 million tokens input. However, long-context reliability may degrade beyond 120-150K tokens based on historical Gemini 3 Pro performance. Independent testing for 3.1 Pro is pending.
Q: What is the maximum output length?
A: 64,000 tokens (approximately 50,000 words). This is half of Claude Opus 4.6's 128K limit.
Q: What thinking levels are available?
A: Three levels: low (fast, cheap), medium (balanced), and high (deep reasoning, "Deep Think Mini"). Gemini 3 Pro only had low and high. The new medium level is similar to the old high, while the new high is significantly more capable.
Q: Does Gemini 3.1 Pro support fine-tuning?
A: Not currently. Fine-tuning is available for Gemini 2.5 models through Vertex AI. Fine-tuning support for 3.1 Pro is expected after general availability.
Q: Can Gemini 3.1 Pro process images, video, and audio?
A: Yes. The model is natively multimodal and can process text, images, audio, video, and code. Video processing supports up to 10 FPS for detailed temporal understanding.
Q: Is Gemini 3.1 Pro available in GitHub Copilot?
A: Yes, in public preview. Users can enable it through the model picker in VS Code and optionally use their own API key.
Q: What SDKs are available?
A: Official SDKs exist for Python, JavaScript/Node.js, Go, and REST API access. The Python SDK (google-generativeai) is the most feature-complete.
Q: Does Gemini 3.1 Pro support function/tool calling?
A: Yes. The model natively supports parallel tool invocation and multimodal function responses. This enables agentic workflows where the model can call external tools, execute code, and combine results.
Q: Can I use Gemini 3.1 Pro with LangChain or LlamaIndex?
A: Yes. Both frameworks have Gemini integrations. Check their documentation for specific compatibility with the 3.1 Pro preview model identifier.
ARC-AGI-2: Abstraction and Reasoning Corpus for AGI, Version 2. A benchmark testing novel reasoning on problems the model couldn't have seen during training.
Agentic AI: AI systems capable of autonomous action, including tool use, multi-step planning, and environmental interaction.
Batch Processing: Processing multiple requests asynchronously with delayed delivery. Gemini offers 50% discounts for batch workloads.
BrowseComp: Benchmark testing web browsing and automation capabilities. Gemini 3.1 Pro scores 85.9%.
Context Caching: Storing frequently-used prompts or context on the server to reduce repeated token charges. Saves up to 90%.
Context Window: The maximum number of tokens a model can process in a single request. Gemini 3.1 Pro supports 1M tokens.
Deep Think: Google's specialized reasoning model optimized for complex problem-solving. Gemini 3.1 Pro at high thinking level runs a "mini" version.
Elo Rating: A ranking system (from chess) used in LiveCodeBench to compare model performance. Higher is better.
Function Calling: The ability of a model to request execution of external functions/tools and receive results.
GA (General Availability): When a product moves from preview to stable, production-ready status.
GPQA Diamond: Graduate-level Google-Proof Q&A benchmark testing PhD-level scientific reasoning. Gemini 3.1 Pro scores 94.3%.
Hallucination: When a model generates plausible-sounding but incorrect or fabricated information.
LiveCodeBench Pro: Benchmark testing code generation on recent problems the model couldn't have memorized.
MMMLU: Massive Multitask Multilingual Language Understanding benchmark.
MRCR: Multi-needle Retrieval with Correct Reasoning. Benchmark testing long-context retrieval accuracy.
Multimodal: Capable of processing multiple input types (text, images, audio, video).
Output Limit: Maximum tokens a model can generate in a single response. Gemini 3.1 Pro has 64K.
Preview: Pre-GA release status indicating the model may change before stable release.
RAG: Retrieval Augmented Generation. Architecture combining retrieval systems with generative AI.
RPD: Requests Per Day. A rate limit metric.
RPM: Requests Per Minute. A rate limit metric.
SWE-Bench Verified: Benchmark using real GitHub issues to test software engineering capability.
Terminal-Bench 2.0: Benchmark testing autonomous coding via terminal commands.
Thinking Level: Gemini 3.1 Pro parameter (low/medium/high) controlling reasoning depth.
Token: The unit of text processing. Roughly 3/4 of a word on average.
TPM: Tokens Per Minute. A rate limit metric.
Vertex AI: Google Cloud's enterprise AI platform with security features and fine-tuning capabilities.
This appendix provides additional benchmark context and historical comparison.
Gemini Model Evolution on ARC-AGI-2:
| Model | ARC-AGI-2 Score | Release Date |
|---|---|---|
| Gemini 1.5 Pro | ~15% | Feb 2024 |
| Gemini 2.0 Pro | ~22% | Sep 2024 |
| Gemini 2.5 Pro | ~28% | Dec 2024 |
| Gemini 3 Pro | 31.1% | Nov 2025 |
| Gemini 3.1 Pro | 77.1% | Feb 2026 |
The 2.5x improvement from 3 Pro to 3.1 Pro is unprecedented in the model series.
Competitor Comparison on Key Benchmarks:
| Benchmark | Gemini 3.1 Pro | Claude Opus 4.6 | GPT-5.2 | Gemini 3 Pro |
|---|---|---|---|---|
| ARC-AGI-2 | 77.1% | 68.8% | 54.2% | 31.1% |
| GPQA Diamond | 94.3% | ~92% | ~90% | 91.9% |
| SWE-Bench | 80.6% | 80.8% | ~78% | ~75% |
| LiveCodeBench (Elo) | 2887 | ~2600 | 2393 | 2439 |
| Terminal-Bench 2.0 | 68.5% | 65.4% | ~62% | 56.9% |
| BrowseComp | 85.9% | ~82% | ~75% | 59.2% |
| APEX-Agents | 33.5% | ~28% | 23.0% | 18.4% |
| MMMLU | 92.6% | ~91% | ~90% | ~90% |
| HLE (tools) | 51.4% | 53.1% | ~50% | ~45% |
| AIME 2025 | ~85% | ~82% | 100% | ~78% |
Bolded values indicate best-in-class for that benchmark.
Cost per 1M tokens processed (input + output at 1:1 ratio):
| Model | Cost | ARC-AGI-2 | Cost per % point |
|---|---|---|---|
| Gemini 3.1 Pro | $14 | 77.1% | $0.18 |
| Claude Opus 4.6 | $30 | 68.8% | $0.44 |
| GPT-5.2 | $15.75 | 54.2% | $0.29 |
Gemini 3.1 Pro delivers the best cost-efficiency for novel reasoning capability.
BrowseComp Task Breakdown (estimated):
| Task Type | Gemini 3.1 Pro | Gemini 3 Pro | Improvement |
|---|---|---|---|
| Form filling | ~92% | ~65% | +27% |
| Navigation | ~88% | ~62% | +26% |
| Data extraction | ~85% | ~58% | +27% |
| Multi-step tasks | ~78% | ~52% | +26% |
| Error recovery | ~80% | ~55% | +25% |
Improvements are relatively consistent across task types, suggesting fundamental capability gains rather than task-specific optimization.
This section covers advanced patterns for building production-ready applications with Gemini 3.1 Pro.
Model routing deploys multiple AI models and directs requests to the most appropriate one based on task characteristics. This pattern can reduce costs by 70-80% while maintaining quality.
from enum import Enum
from dataclasses import dataclass
from typing import Optional
import google.generativeai as genai
class ModelTier(Enum):
FAST_CHEAP = "gemini-3-1-flash"
BALANCED = "gemini-3-1-pro-preview"
PREMIUM = "claude-opus-4-6" # Via separate client
class TaskComplexity(Enum):
SIMPLE = "simple"
MODERATE = "moderate"
COMPLEX = "complex"
CRITICAL = "critical"
@dataclass
class RoutingDecision:
model: str
thinking_level: str
estimated_cost: float
rationale: str
class ModelRouter:
def __init__(self, gemini_key: str, claude_key: Optional [str] = None):
genai.configure(api_key=gemini_key)
self.gemini_flash = genai.GenerativeModel('gemini-3-1-flash')
self.gemini_pro = genai.GenerativeModel('gemini-3-1-pro-preview')
# Claude client would be initialized separately
def analyze_task(self, prompt: str) -> TaskComplexity:
"""Analyze a prompt to determine its complexity."""
# Simple heuristics (in production, use a classifier)
word_count = len(prompt.split())
has_code = "```" in prompt or "code" in prompt.lower()
has_reasoning = any(word in prompt.lower() for word in
["prove", "explain why", "analyze", "compare", "evaluate"])
has_math = any(word in prompt.lower() for word in
["calculate", "equation", "formula", "mathematical"])
if has_math and has_reasoning:
return TaskComplexity.CRITICAL
elif has_code and has_reasoning:
return TaskComplexity.COMPLEX
elif has_reasoning or word_count > 500:
return TaskComplexity.MODERATE
else:
return TaskComplexity.SIMPLE
def route(self, prompt: str, require_high_accuracy: bool = False) -> RoutingDecision:
"""Determine the best model for a given prompt."""
complexity = self.analyze_task(prompt)
if complexity == TaskComplexity.SIMPLE:
return RoutingDecision(
model="gemini-3-1-flash",
thinking_level="low",
estimated_cost=0.001,
rationale="Simple task, using fast model"
)
elif complexity == TaskComplexity.MODERATE:
return RoutingDecision(
model="gemini-3-1-pro-preview",
thinking_level="medium",
estimated_cost=0.01,
rationale="Moderate complexity, using balanced model"
)
elif complexity == TaskComplexity.COMPLEX:
return RoutingDecision(
model="gemini-3-1-pro-preview",
thinking_level="high",
estimated_cost=0.05,
rationale="Complex task, using pro model with deep thinking"
)
else: # CRITICAL
if require_high_accuracy:
return RoutingDecision(
model="claude-opus-4-6",
thinking_level="max",
estimated_cost=0.15,
rationale="Critical task requiring highest accuracy"
)
else:
return RoutingDecision(
model="gemini-3-1-pro-preview",
thinking_level="high",
estimated_cost=0.05,
rationale="Critical task, using pro model (accuracy not required)"
)
def execute(self, prompt: str, require_high_accuracy: bool = False) -> str:
"""Route and execute a prompt."""
decision = self.route(prompt, require_high_accuracy)
if decision.model == "gemini-3-1-flash":
response = self.gemini_flash.generate_content(prompt)
elif decision.model == "gemini-3-1-pro-preview":
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level=decision.thinking_level)
response = self.gemini_pro.generate_content(prompt, generation_config=config)
else:
# Would use Claude client here
raise NotImplementedError("Claude routing not implemented")
return response.text
When working with documents that approach or exceed the reliable context window, implement intelligent context management:
from typing import List, Tuple
import tiktoken
from dataclasses import dataclass
@dataclass
class DocumentChunk:
content: str
start_char: int
end_char: int
token_count: int
relevance_score: float = 0.0
class ContextManager:
def __init__(self, max_tokens: int = 100000):
self.max_tokens = max_tokens
self.encoding = tiktoken.encoding_for_model("gpt-4") # Approximation
def count_tokens(self, text: str) -> int:
"""Count tokens in a text string."""
return len(self.encoding.encode(text))
def chunk_document(
self,
document: str,
chunk_size: int = 10000,
overlap: int = 500
) -> List [DocumentChunk]:
"""Split a document into overlapping chunks."""
chunks = []
start = 0
while start < len(document):
end = start + chunk_size
content = document [start:end]
# Adjust to avoid splitting mid-sentence
if end < len(document):
last_period = content.rfind('.')
if last_period > chunk_size * 0.8: # Found period in last 20%
content = content [:last_period + 1]
end = start + last_period + 1
chunks.append(DocumentChunk(
content=content,
start_char=start,
end_char=end,
token_count=self.count_tokens(content)
))
start = end - overlap
return chunks
def score_chunks_for_query(
self,
chunks: List [DocumentChunk],
query: str,
model
) -> List [DocumentChunk]:
"""Score each chunk for relevance to a query."""
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level="low")
for chunk in chunks:
prompt = f"""
Rate the relevance of this document section to the query on a scale of 0-10.
Return ONLY a number.
Query: {query}
Document section:
{chunk.content [:2000]} # Use beginning for scoring
Relevance score (0-10):
"""
response = model.generate_content(prompt, generation_config=config)
try:
chunk.relevance_score = float(response.text.strip())
except ValueError:
chunk.relevance_score = 5.0 # Default to middle
return sorted(chunks, key=lambda x: x.relevance_score, reverse=True)
def build_context(
self,
chunks: List [DocumentChunk],
query: str,
system_prompt: str = ""
) -> str:
"""Build optimal context from scored chunks."""
system_tokens = self.count_tokens(system_prompt)
query_tokens = self.count_tokens(query)
available_tokens = self.max_tokens - system_tokens - query_tokens - 1000 # Buffer
selected_chunks = []
current_tokens = 0
for chunk in chunks:
if current_tokens + chunk.token_count <= available_tokens:
selected_chunks.append(chunk)
current_tokens += chunk.token_count
else:
break
# Sort by position to maintain document order
selected_chunks.sort(key=lambda x: x.start_char)
context = "\n\n---\n\n".join( [c.content for c in selected_chunks])
return f"{system_prompt}\n\nDocument:\n{context}\n\nQuery: {query}"
def answer_with_citations(
self,
document: str,
query: str,
model
) -> Tuple [str, List [str]]:
"""Answer a query with citations to source locations."""
chunks = self.chunk_document(document)
scored_chunks = self.score_chunks_for_query(chunks, query, model)
context = self.build_context(scored_chunks, query)
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level="medium")
prompt = f"""
{context}
Answer the query above based on the document provided.
Include specific citations in [brackets] with character ranges like [chars 1500-1700].
If information is not in the document, say so explicitly.
"""
response = model.generate_content(prompt, generation_config=config)
# Extract citations from response
import re
citations = re.findall(r'\ [chars (\d+)-(\d+)\]', response.text)
citation_texts = []
for start, end in citations:
citation_texts.append(document [int(start):int(end)])
return response.text, citation_texts
Ensure consistent, valid structured output from the model:
from pydantic import BaseModel, validator
from typing import List, Optional
import json
import re
class ExtractedEntity(BaseModel):
name: str
type: str
confidence: float
@validator('confidence')
def confidence_range(cls, v):
if not 0 <= v <= 1:
raise ValueError('Confidence must be between 0 and 1')
return v
class DocumentAnalysis(BaseModel):
summary: str
entities: List [ExtractedEntity]
key_dates: List [str]
sentiment: str
topics: List [str]
@validator('sentiment')
def valid_sentiment(cls, v):
valid = ['positive', 'negative', 'neutral', 'mixed']
if v.lower() not in valid:
raise ValueError(f'Sentiment must be one of {valid}')
return v.lower()
class StructuredOutputGenerator:
def __init__(self, model):
self.model = model
def generate_structured(
self,
prompt: str,
output_schema: type,
max_retries: int = 3
) -> BaseModel:
"""Generate validated structured output."""
schema_description = json.dumps(output_schema.schema(), indent=2)
enhanced_prompt = f"""
{prompt}
Return your response as valid JSON matching this schema:
{schema_description}
Return ONLY the JSON, no other text.
"""
from google.generativeai.types import GenerationConfig
config = GenerationConfig(
thinking_level="medium",
temperature=0.1 # Low temperature for consistency
)
for attempt in range(max_retries):
response = self.model.generate_content(enhanced_prompt, generation_config=config)
# Extract JSON from response
text = response.text.strip()
json_match = re.search(r'\{.*\}', text, re.DOTALL)
if json_match:
try:
data = json.loads(json_match.group())
return output_schema(**data)
except (json.JSONDecodeError, ValueError) as e:
if attempt == max_retries - 1:
raise ValueError(f"Failed to generate valid output: {e}")
# Request correction
enhanced_prompt = f"""
Your previous response had an error: {e}
Please try again with valid JSON matching this schema:
{schema_description}
Original request: {prompt}
"""
raise ValueError("Max retries exceeded")
# Usage example
generator = StructuredOutputGenerator(model)
document = """
Apple Inc. announced on January 15, 2026 that CEO Tim Cook will be
stepping down in Q3 2026. The news sent shockwaves through the tech
industry, though the company emphasized a smooth transition plan is
in place. Analysts at Goldman Sachs maintain their buy rating.
"""
analysis = generator.generate_structured(
prompt=f"Analyze this document:\n{document}",
output_schema=DocumentAnalysis
)
print(f"Summary: {analysis.summary}")
print(f"Entities: {analysis.entities}")
print(f"Sentiment: {analysis.sentiment}")
Implement effective conversation memory for multi-turn interactions:
from dataclasses import dataclass, field
from typing import List, Optional
from datetime import datetime
import json
@dataclass
class Message:
role: str # "user" or "assistant"
content: str
timestamp: datetime = field(default_factory=datetime.now)
token_count: int = 0
@dataclass
class ConversationMemory:
messages: List [Message] = field(default_factory=list)
max_tokens: int = 50000 # Reserve room for response
summary: Optional [str] = None
summary_cutoff: int = 0 # Messages before this are summarized
class ConversationManager:
def __init__(self, model, max_context_tokens: int = 50000):
self.model = model
self.memory = ConversationMemory(max_tokens=max_context_tokens)
self.encoding = tiktoken.encoding_for_model("gpt-4")
def count_tokens(self, text: str) -> int:
return len(self.encoding.encode(text))
def add_message(self, role: str, content: str):
"""Add a message to conversation history."""
message = Message(
role=role,
content=content,
token_count=self.count_tokens(content)
)
self.memory.messages.append(message)
self._manage_context()
def _manage_context(self):
"""Ensure context stays within token limits."""
total_tokens = sum(m.token_count for m in self.memory.messages)
if total_tokens > self.memory.max_tokens:
self._summarize_old_messages()
def _summarize_old_messages(self):
"""Summarize older messages to save context space."""
# Find messages to summarize (keep last 5)
if len(self.memory.messages) <= 5:
return
to_summarize = self.memory.messages [:-5]
to_keep = self.memory.messages [-5:]
# Create summary
history = "\n".join( [
f"{m.role}: {m.content}" for m in to_summarize
])
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level="low")
summary_prompt = f"""
Summarize this conversation history concisely, preserving key information:
{history}
Summary:
"""
response = self.model.generate_content(summary_prompt, generation_config=config)
# Update memory
self.memory.summary = response.text
self.memory.messages = to_keep
self.memory.summary_cutoff = len(to_summarize)
def build_prompt(self, new_message: str, system_prompt: str = "") -> str:
"""Build a complete prompt including history."""
parts = []
if system_prompt:
parts.append(f"System: {system_prompt}")
if self.memory.summary:
parts.append(f" [Previous conversation summary: {self.memory.summary}]")
for msg in self.memory.messages:
parts.append(f"{msg.role.capitalize()}: {msg.content}")
parts.append(f"User: {new_message}")
return "\n\n".join(parts)
def chat(
self,
user_message: str,
system_prompt: str = "",
thinking_level: str = "medium"
) -> str:
"""Process a chat message and return response."""
self.add_message("user", user_message)
prompt = self.build_prompt(user_message, system_prompt)
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level=thinking_level)
response = self.model.generate_content(prompt, generation_config=config)
self.add_message("assistant", response.text)
return response.text
def export_history(self) -> str:
"""Export conversation history as JSON."""
return json.dumps({
"summary": self.memory.summary,
"messages": [
{
"role": m.role,
"content": m.content,
"timestamp": m.timestamp.isoformat()
}
for m in self.memory.messages
]
}, indent=2)
Process multiple items in parallel and aggregate results:
import asyncio
from typing import List, Dict, Any, Callable
from dataclasses import dataclass
@dataclass
class ProcessingResult:
index: int
input: str
output: Any
success: bool
error: Optional [str] = None
class ParallelProcessor:
def __init__(
self,
model,
max_concurrency: int = 5,
thinking_level: str = "low"
):
self.model = model
self.semaphore = asyncio.Semaphore(max_concurrency)
self.thinking_level = thinking_level
async def process_single(
self,
index: int,
item: str,
prompt_template: str
) -> ProcessingResult:
"""Process a single item with rate limiting."""
async with self.semaphore:
try:
prompt = prompt_template.format(item=item)
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level=self.thinking_level)
# Run in executor since SDK is synchronous
loop = asyncio.get_event_loop()
response = await loop.run_in_executor(
None,
lambda: self.model.generate_content(prompt, generation_config=config)
)
return ProcessingResult(
index=index,
input=item,
output=response.text,
success=True
)
except Exception as e:
return ProcessingResult(
index=index,
input=item,
output=None,
success=False,
error=str(e)
)
async def process_batch(
self,
items: List [str],
prompt_template: str
) -> List [ProcessingResult]:
"""Process multiple items in parallel."""
tasks = [
self.process_single(i, item, prompt_template)
for i, item in enumerate(items)
]
return await asyncio.gather(*tasks)
async def process_and_aggregate(
self,
items: List [str],
prompt_template: str,
aggregation_prompt: str
) -> Dict [str, Any]:
"""Process items and aggregate results."""
# Process all items
results = await self.process_batch(items, prompt_template)
# Separate successes and failures
successes = [r for r in results if r.success]
failures = [r for r in results if not r.success]
# Aggregate successful results
if successes:
individual_results = "\n\n".join( [
f"Item {r.index}: {r.output}"
for r in successes
])
from google.generativeai.types import GenerationConfig
config = GenerationConfig(thinking_level="medium")
agg_prompt = aggregation_prompt.format(results=individual_results)
loop = asyncio.get_event_loop()
response = await loop.run_in_executor(
None,
lambda: self.model.generate_content(agg_prompt, generation_config=config)
)
aggregation = response.text
else:
aggregation = "No successful results to aggregate"
return {
"individual_results": successes,
"failures": failures,
"aggregation": aggregation,
"success_rate": len(successes) / len(results) if results else 0
}
# Usage example
async def analyze_reviews():
processor = ParallelProcessor(model, max_concurrency=10)
reviews = [
"Great product, fast shipping!",
"Terrible quality, broke after a week.",
"Average, nothing special.",
# ... more reviews
]
results = await processor.process_and_aggregate(
items=reviews,
prompt_template="Analyze the sentiment and key points of this review:\n{item}",
aggregation_prompt="""
Based on these individual review analyses:
{results}
Provide:
1. Overall sentiment distribution
2. Most common positive themes
3. Most common negative themes
4. Actionable recommendations
"""
)
print(f"Analyzed {len(results ['individual_results'])} reviews successfully")
print(f"Aggregation: {results ['aggregation']}")
# Run
asyncio.run(analyze_reviews())
When deploying Gemini 3.1 Pro in production, consider these security aspects.
Never expose API keys in client-side code or version control. Use environment variables or secrets management services:
import os
from google.cloud import secretmanager
def get_api_key() -> str:
"""Retrieve API key from Google Secret Manager."""
# In production, use Secret Manager
if os.getenv("ENVIRONMENT") == "production":
client = secretmanager.SecretManagerServiceClient()
name = f"projects/{os.getenv('PROJECT_ID')}/secrets/gemini-api-key/versions/latest"
response = client.access_secret_version(request={"name": name})
return response.payload.data.decode("UTF-8")
# In development, use environment variable
return os.getenv("GEMINI_API_KEY")
Validate and sanitize user inputs before sending to the API:
import re
from typing import Optional
class InputValidator:
MAX_INPUT_LENGTH = 100000 # Characters
BLOCKED_PATTERNS = [
r'(?i)ignore.*previous.*instructions',
r'(?i)system\s*prompt',
r'(?i)jailbreak',
]
@classmethod
def validate(cls, user_input: str) -> tuple [bool, Optional [str]]:
"""Validate user input. Returns (is_valid, error_message)."""
# Length check
if len(user_input) > cls.MAX_INPUT_LENGTH:
return False, f"Input exceeds maximum length of {cls.MAX_INPUT_LENGTH}"
# Check for prompt injection attempts
for pattern in cls.BLOCKED_PATTERNS:
if re.search(pattern, user_input):
return False, "Input contains blocked patterns"
# Check for excessive special characters
special_ratio = len(re.findall(r' [^\w\s]', user_input)) / len(user_input)
if special_ratio > 0.3:
return False, "Input contains too many special characters"
return True, None
@classmethod
def sanitize(cls, user_input: str) -> str:
"""Sanitize user input before processing."""
# Remove potential control characters
sanitized = re.sub(r' [\x00-\x1f\x7f-\x9f]', '', user_input)
# Normalize whitespace
sanitized = ' '.join(sanitized.split())
return sanitized
Filter sensitive information from model outputs:
import re
class OutputFilter:
SENSITIVE_PATTERNS = {
'email': r'\b [A-Za-z0-9._%+-]+@ [A-Za-z0-9.-]+\. [A-Z|a-z]{2,}\b',
'phone': r'\b\d{3} [-.]?\d{3} [-.]?\d{4}\b',
'ssn': r'\b\d{3} [-]?\d{2} [-]?\d{4}\b',
'credit_card': r'\b\d{4} [-\s]?\d{4} [-\s]?\d{4} [-\s]?\d{4}\b',
}
@classmethod
def filter_pii(cls, text: str) -> str:
"""Remove or mask PII from text."""
filtered = text
for pii_type, pattern in cls.SENSITIVE_PATTERNS.items():
filtered = re.sub(pattern, f' [REDACTED {pii_type.upper()}]', filtered)
return filtered
@classmethod
def check_for_sensitive_content(cls, text: str) -> list [str]:
"""Check for types of sensitive content found."""
found = []
for pii_type, pattern in cls.SENSITIVE_PATTERNS.items():
if re.search(pattern, text):
found.append(pii_type)
return found
Implement application-level rate limiting to prevent abuse:
from datetime import datetime, timedelta
from collections import defaultdict
import threading
class RateLimiter:
def __init__(
self,
requests_per_minute: int = 30,
requests_per_day: int = 1000
):
self.rpm_limit = requests_per_minute
self.rpd_limit = requests_per_day
self.minute_counts = defaultdict(list)
self.day_counts = defaultdict(list)
self.lock = threading.Lock()
def is_allowed(self, user_id: str) -> tuple [bool, Optional [str]]:
"""Check if a request is allowed for a user."""
now = datetime.now()
minute_ago = now - timedelta(minutes=1)
day_ago = now - timedelta(days=1)
with self.lock:
# Clean old entries
self.minute_counts [user_id] = [
t for t in self.minute_counts [user_id] if t > minute_ago
]
self.day_counts [user_id] = [
t for t in self.day_counts [user_id] if t > day_ago
]
# Check limits
if len(self.minute_counts [user_id]) >= self.rpm_limit:
return False, "Rate limit exceeded (per minute)"
if len(self.day_counts [user_id]) >= self.rpd_limit:
return False, "Rate limit exceeded (per day)"
# Record request
self.minute_counts [user_id].append(now)
self.day_counts [user_id].append(now)
return True, None
Maintain comprehensive audit logs for compliance and debugging:
import logging
import json
from datetime import datetime
from typing import Dict, Any
class AuditLogger:
def __init__(self, log_file: str = "audit.log"):
self.logger = logging.getLogger("audit")
handler = logging.FileHandler(log_file)
handler.setFormatter(logging.Formatter('%(message)s'))
self.logger.addHandler(handler)
self.logger.setLevel(logging.INFO)
def log_request(
self,
user_id: str,
prompt: str,
model: str,
thinking_level: str,
metadata: Dict [str, Any] = None
):
"""Log an API request."""
entry = {
"timestamp": datetime.now().isoformat(),
"event_type": "api_request",
"user_id": user_id,
"model": model,
"thinking_level": thinking_level,
"prompt_length": len(prompt),
"prompt_hash": hash(prompt), # For correlation without storing content
"metadata": metadata or {}
}
self.logger.info(json.dumps(entry))
def log_response(
self,
user_id: str,
response_length: int,
tokens_used: int,
latency_ms: float,
success: bool,
error: str = None
):
"""Log an API response."""
entry = {
"timestamp": datetime.now().isoformat(),
"event_type": "api_response",
"user_id": user_id,
"response_length": response_length,
"tokens_used": tokens_used,
"latency_ms": latency_ms,
"success": success,
"error": error
}
self.logger.info(json.dumps(entry))
Maximize performance and minimize costs with these optimization strategies.
Reduce token usage without sacrificing output quality:
Minimize response time:
If you're migrating from another AI model to Gemini 3.1 Pro, this section covers key differences and migration strategies.
Key Differences:
thinking_level instead of specific model variantsMigration Steps:
# Before (OpenAI)
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-5.2",
messages= [{"role": "user", "content": "Hello"}]
)
# After (Gemini)
import google.generativeai as genai
genai.configure(api_key="YOUR_KEY")
model = genai.GenerativeModel('gemini-3-1-pro-preview')
response = model.generate_content("Hello")
thinking_level="low"thinking_level="medium"thinking_level="high"Update tool/function calling syntax to match Gemini's format
Test prompt compatibility - some prompts may need adjustment for optimal results
Update cost projections based on Gemini pricing
Key Differences:
Migration Steps:
# Before (Claude)
from anthropic import Anthropic
client = Anthropic()
response = client.messages.create(
model="claude-opus-4-6",
max_tokens=4096,
messages= [{"role": "user", "content": "Hello"}]
)
# After (Gemini)
import google.generativeai as genai
genai.configure(api_key="YOUR_KEY")
model = genai.GenerativeModel('gemini-3-1-pro-preview')
response = model.generate_content("Hello")
# Claude style (separate system parameter)
# Gemini style (incorporate in prompt or use generation config)
model = genai.GenerativeModel(
'gemini-3-1-pro-preview',
system_instruction="You are a helpful assistant..."
)
Monitor long-context performance - if relying on Claude's strong retrieval, test carefully with Gemini
Adjust for output format differences - Claude and Gemini may structure responses differently
Update cost projections - Gemini is 60% cheaper on input, 52% cheaper on output
From Gemini 3 Pro:
gemini-3-1-pro-previewthinking_level="medium" option availablethinking_level="high" now triggers Deep Think Mini (different behavior)From Gemini 2.5 Pro:
From Gemini 1.5 Pro:
Before fully migrating:
Different industries have unique requirements when deploying AI models. Here are considerations for key sectors.
Regulatory Considerations:
Best Practices:
Recommended Configurations:
thinking_level="high" for clinical analysisRegulatory Considerations:
Best Practices:
Recommended Configurations:
Regulatory Considerations:
Best Practices:
Recommended Configurations:
thinking_level="high" for legal analysisConsiderations:
Best Practices:
Recommended Configurations:
Production deployments require robust monitoring to ensure reliability and catch issues early.
Performance Metrics:
Quality Metrics:
Cost Metrics:
from dataclasses import dataclass
from datetime import datetime
import time
import statistics
@dataclass
class RequestMetrics:
timestamp: datetime
latency_ms: float
input_tokens: int
output_tokens: int
thinking_level: str
success: bool
error_type: str = None
class MetricsCollector:
def __init__(self):
self.metrics: list [RequestMetrics] = []
def record(self, metrics: RequestMetrics):
self.metrics.append(metrics)
def get_latency_percentiles(self, window_minutes: int = 60) -> dict:
"""Calculate latency percentiles over recent window."""
cutoff = datetime.now() - timedelta(minutes=window_minutes)
recent = [m.latency_ms for m in self.metrics
if m.timestamp > cutoff and m.success]
if not recent:
return {"p50": 0, "p95": 0, "p99": 0}
recent.sort()
return {
"p50": recent [len(recent) // 2],
"p95": recent [int(len(recent) * 0.95)],
"p99": recent [int(len(recent) * 0.99)]
}
def get_error_rate(self, window_minutes: int = 60) -> float:
"""Calculate error rate over recent window."""
cutoff = datetime.now() - timedelta(minutes=window_minutes)
recent = [m for m in self.metrics if m.timestamp > cutoff]
if not recent:
return 0.0
errors = sum(1 for m in recent if not m.success)
return errors / len(recent)
def get_cost_estimate(self, window_minutes: int = 60) -> float:
"""Estimate cost over recent window."""
cutoff = datetime.now() - timedelta(minutes=window_minutes)
recent = [m for m in self.metrics if m.timestamp > cutoff]
total_cost = 0.0
for m in recent:
# Gemini 3.1 Pro pricing
input_cost = (m.input_tokens / 1_000_000) * 2.00
output_cost = (m.output_tokens / 1_000_000) * 12.00
total_cost += input_cost + output_cost
return total_cost
Set up alerts for:
Build applications that can adapt to model changes and improvements.
Abstract model-specific logic to enable easy model swapping:
from abc import ABC, abstractmethod
from typing import Any, Dict
class AIModel(ABC):
@abstractmethod
def generate(self, prompt: str, **kwargs) -> str:
pass
@abstractmethod
def get_model_name(self) -> str:
pass
@abstractmethod
def estimate_cost(self, input_tokens: int, output_tokens: int) -> float:
pass
class GeminiModel(AIModel):
def __init__(self, thinking_level: str = "medium"):
import google.generativeai as genai
self.model = genai.GenerativeModel('gemini-3-1-pro-preview')
self.thinking_level = thinking_level
def generate(self, prompt: str, **kwargs) -> str:
from google.generativeai.types import GenerationConfig
config = GenerationConfig(
thinking_level=kwargs.get('thinking_level', self.thinking_level)
)
response = self.model.generate_content(prompt, generation_config=config)
return response.text
def get_model_name(self) -> str:
return "gemini-3-1-pro-preview"
def estimate_cost(self, input_tokens: int, output_tokens: int) -> float:
return (input_tokens / 1_000_000) * 2.00 + (output_tokens / 1_000_000) * 12.00
# Easy to add Claude, GPT, or future models without changing application code
class ClaudeModel(AIModel):
# Implementation for Claude
pass
class ModelFactory:
@staticmethod
def create(model_name: str, **kwargs) -> AIModel:
if model_name.startswith("gemini"):
return GeminiModel(**kwargs)
elif model_name.startswith("claude"):
return ClaudeModel(**kwargs)
else:
raise ValueError(f"Unknown model: {model_name}")
Use configuration rather than hardcoded values:
# config.yaml
model:
default: gemini-3-1-pro-preview
fallback: gemini-3-flash
thinking_levels:
simple_tasks: low
standard_tasks: medium
complex_tasks: high
rate_limits:
requests_per_minute: 100
max_context_tokens: 100000
features:
enable_caching: true
enable_streaming: true
enable_tool_calling: true
Plan for model version changes:
This guide synthesizes information from over 25 sources including:
This guide reflects the AI model landscape as of February 2026. Pricing, benchmarks, and features change frequently—verify current details before making production decisions.
Last updated: February 20, 2026