inference-providers

Gemini 3.1 Pro

by google · family gemini

Facts

Release date2026-02-19
Retired date
Knowledge cutoff
Context (max)1,048,576
Max output65,536
Modalitiestext, image → text
Aliasesgemini-3.1-pro-previewgemini-3-pro-preview
Open weightsno
DescriptionPreview-only; tiered pricing (≤200K $2/$12, >200K $4/$18); carries the gemini-3-pro-preview alias since 2026-03-09.

Unknown values are shown as —.

Offerings

ProviderWire IDVariantEndpointProtocolStatusPrice (USD / Mtok)Reasoning
Google Gemini APIgemini-3.1-pro-previewprogenerate-contentgoogle-generate-contentpreview2.00 / 12.00effort · default on · mandatory · returns thought_parts · round-trips thought_signature
OpenCode Zengemini-3.1-proprochat-completionsopenai-chatga2.00 / 12.00effort · default on · mandatory · returns thought_parts · round-trips thought_signature
OpenRoutergoogle/gemini-3.1-pro-previewprochat-completionsopenai-chatga2.00 / 12.00effort · default on · returns reasoning_content · round-trips reasoning_content

Reasoning controls

Google Gemini API· gemini-3.1-pro-preview· generate-content effort

generationConfig.thinkingConfig.thinkingLevel lowmediumhigh●

effort · default on · mandatory · returns thought_parts · round-trips thought_signature

OpenCode Zen· gemini-3.1-pro· chat-completions effort

thinkingLevel lowmediumhigh●

effort · default on · mandatory · returns thought_parts · round-trips thought_signature

OpenRouter· google/gemini-3.1-pro-preview· chat-completions effort

reasoning.effort nonelowmedium●highxhighmax

effort · default on · returns reasoning_content · round-trips reasoning_content

Example requests

Google Gemini API · google-generate-content · gemini-3.1-pro-preview

curl 'https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-pro-preview:generateContent' \
  -H 'Content-Type: application/json' \
  -H 'x-goog-api-key: <YOUR_API_KEY>' \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Tell me about the weather."
        }
      ]
    }
  ],
  "generationConfig": {
    "thinkingConfig": {
      "thinkingLevel": "high"
    }
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-pro-preview:generateContent",
    headers={
      "Content-Type": "application/json",
      "x-goog-api-key": "<YOUR_API_KEY>"
    },
    json={
      "contents": [
        {
          "parts": [
            {
              "text": "Tell me about the weather."
            }
          ]
        }
      ],
      "generationConfig": {
        "thinkingConfig": {
          "thinkingLevel": "high"
        }
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-pro-preview:generateContent", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-goog-api-key": "<YOUR_API_KEY>"
  },
  body: JSON.stringify({
    "contents": [
      {
        "parts": [
          {
            "text": "Tell me about the weather."
          }
        ]
      }
    ],
    "generationConfig": {
      "thinkingConfig": {
        "thinkingLevel": "high"
      }
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include thought_signature artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).

OpenCode Zen · openai-chat · gemini-3.1-pro

curl 'https://opencode.ai/zen/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gemini-3.1-pro",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "thinkingLevel": "high"
}'
Python (requests)
import requests

resp = requests.post(
    "https://opencode.ai/zen/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "gemini-3.1-pro",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "thinkingLevel": "high"
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://opencode.ai/zen/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "gemini-3.1-pro",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "thinkingLevel": "high"
  }),
})
console.log(await resp.json())
  • ⚠ Responses include thought_signature artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).

OpenRouter · openai-chat · google/gemini-3.1-pro-preview

curl 'https://openrouter.ai/api/v1/chat/completions' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemini-3.1-pro-preview",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about the weather."
    }
  ],
  "reasoning": {
    "effort": "medium"
  }
}'
Python (requests)
import requests

resp = requests.post(
    "https://openrouter.ai/api/v1/chat/completions",
    headers={
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json"
    },
    json={
      "model": "google/gemini-3.1-pro-preview",
      "messages": [
        {
          "role": "user",
          "content": "Tell me about the weather."
        }
      ],
      "reasoning": {
        "effort": "medium"
      }
    },
)
print(resp.json())
TypeScript (fetch)
const resp = await fetch("https://openrouter.ai/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "model": "google/gemini-3.1-pro-preview",
    "messages": [
      {
        "role": "user",
        "content": "Tell me about the weather."
      }
    ],
    "reasoning": {
      "effort": "medium"
    }
  }),
})
console.log(await resp.json())
  • ⚠ Responses include reasoning_content artifacts — pass them back unmodified on subsequent turns (dropping them triggers 400s or quality loss).