Gemini 3.1 Pro Preview

Models

Model details

Model
gemini-3.1-pro
Provider
opencode
API
google-generative-ai
Base URL
https://opencode.ai/zen/v1
Input
text, image
Reasoning
Yes
Context window
1,048,576
Max tokens
65,536
Show configuration
{
  "providers": {
    "opencode": {
      "apiKey": "YOUR_API_KEY",
      "models": [
        {
          "id": "gemini-3.1-pro",
          "name": "Gemini 3.1 Pro Preview",
          "reasoning": true,
          "input": [
            "text",
            "image"
          ],
          "thinkingLevelMap": {
            "off": null,
            "minimal": null,
            "low": "low",
            "medium": "medium",
            "high": "high",
            "xhigh": null,
            "max": null
          },
          "contextWindow": 1048576,
          "maxTokens": 65536,
          "cost": {
            "input": 2,
            "output": 12,
            "cacheRead": 0.2,
            "cacheWrite": 0
          }
        }
      ],
      "api": "google-generative-ai",
      "baseUrl": "https://opencode.ai/zen/v1"
    }
  }
}

Pricing

USD per million tokens. A tier is selected from the total input tokens in each request and applies to that entire request.

Pricing rates for Gemini 3.1 Pro Preview
Request inputInputOutputCache readCache write
All requests$2$12$0.2$0

Session cost calculator

Estimate the requests made during an agent session. A user turn can make several model calls while using tools, so costs are calculated per model request.

Session shape
Rounded median shapes from recent Pi agent sessions.
Warm-request cache reuse
Effective token reuse combines partial hits and occasional complete misses.
Estimated session$0.00
Uncached input
—
Cache reads
—
Uncached prefixes
—
Cache writes
—
Output
—
Without caching
—

The first request starts cold unless marked otherwise. Output is billed separately from context growth because reasoning tokens are not always retained. This remains a directional estimate: providers differ in eligibility, rounding, and retention.

Compatibility flags

This API has no model compatibility flags.