google/gemini-3.1-pro-preview

Gemini 3.1 Pro Preview

图像理解音频输入视频输入PDF 输入函数调用推理提示缓存网页搜索

Gemini 3.1 Pro Preview is Google’s frontier reasoning model, delivering enhanced software engineering performance, improved agentic reliability, and more efficient token usage across complex workflows. Building on the multimodal foundation of the Gemini 3 series, it combines high-precision reasoning across text, image, video, audio, and code with a 1M-token context window. Reasoning Details must be preserved when using multi-turn tool calling, see our docs here: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning. The 3.1 update introduces measurable gains in SWE benchmarks and real-world coding environments, along with stronger autonomous task execution in structured domains such as finance and spreadsheet-based workflows. Designed for advanced development and agentic systems, Gemini 3.1 Pro Preview improves long-horizon stability and tool orchestration while increasing token efficiency. It introduces a new medium thinking level to better balance cost, speed, and performance. The model excels in agentic coding, structured planning, multimodal analysis, and workflow automation, making it well-suited for autonomous agents, financial modeling, spreadsheet automation, and high-context enterprise tasks.

上下文窗口1M
最大输出 Token65K
支持协议
发布日期—

能力与模态

当前模型版本支持的输入输出能力

输入模态
文本
图像
音频
视频
文件
输出模态
文本

模型价格

价格与能力以接口实时数据为准

按量计费
输入价格
$2 / M
输出价格
$12 / M
缓存读取
$0.2 / M
阶梯价格按输入长度、图片像素或场景等条件适用对应档位单价。

≥ 200K tokens

输入价格
$4 / M$2
2× 基础价
输出价格
$18 / M$12
1.5× 基础价
缓存读取
$0.4 / M$0.2
2× 基础价

API 接口

当前模型可以使用的调用端点

原生协议 2

/v1beta/models/{model}:streamGenerateContent
/v1beta/models/{model}:generateContent

转换协议 3

/v1/responses
/v1/chat/completions
/v1/messages

API 接入示例

选择协议与语言,配置 API Key 后运行

generateContent

先在环境变量中配置平台密钥 AI_GATEWAY_API_KEY · 适用于 Bash / zsh / WSL。

POSThttps://api.tikway.ai/v1beta/models/google/gemini-3.1-pro-preview:generateContent
curl --fail-with-body 'https://api.tikway.ai/v1beta/models/google/gemini-3.1-pro-preview:generateContent' \
  -H "x-goog-api-key: $AI_GATEWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "用三句话介绍 Tikway"
        }
      ]
    }
  ]
}'
查看完整接入文档

模型接入常见问题

调用 Gemini 3.1 Pro Preview 应填写哪个模型 ID?

本页模型 ID 为 google/gemini-3.1-pro-preview。按对应协议原样复制,不能用展示名称代替,也不要自行增删前缀。

Gemini 3.1 Pro Preview 支持哪些 API 协议?

目录当前列出的协议为:Gemini。查看本页调用示例中的完整端点、鉴权方式和参数;不同协议不能直接共用请求体。

Gemini 3.1 Pro Preview 的上下文长度是多少?

目录显示上下文为 1M。最大输出与上下文是不同约束,实际请求还要核对本页能力及参数范围。

如何估算 Gemini 3.1 Pro Preview 的费用?

普通输入价格:$2 / M;普通输出价格:$12 / M。完整费用还要核对本页计费单位、缓存、多模态及账户规则。

接入教程

AI API 中转 · 多模型接入Gemini API · generateContentAI Agent · 智能体 API 接入Gemini API 接入教程:用 Tikway 调用 generateContent 协议AI API 费用怎么算?Tikway Token 计费与报错排查Tikway 模型与费用核对:模型 ID、调用记录与证据边界