gemini-3.1-pro-preview — API, Pricing & Context Window | Vivgrid
gemini-3.1-pro-preview on Vivgrid: Google's high-end multimodal coding model with a ~1M-token context window across text, image, video, audio and PDF.
gemini-3.1-pro-preview is Google's high-end Gemini model, positioned for coding and complex multimodal reasoning. It accepts text, image, video, audio, and PDF within a ~1.05M-token context window.
On Vivgrid it runs as a globally centralized model. Because it relies on Google's global endpoint, regional acceleration is limited — but it remains available through the same unified API as the rest of the catalog.
Specifications
| Provider | |
| Model ID | gemini-3.1-pro-preview |
| Best for | Coding |
| Available on | Vibe coding |
| Context window | 1,048,576 tokens |
| Max output | 65,536 tokens |
| Modalities | Text, Image, Video, Audio, PDF |
| Tool / function calling | Yes |
| Knowledge cutoff | 2025-01 |
| Acceleration | 🌐 Global (Centralized) |
Pricing
Pricing in USD per 1M tokens.
| Input | Cached input | Output |
|---|---|---|
| $3.00 | $0.30 | $12.00 |
What one request costs
The rates above applied to a 20K-token prompt with a 2K-token reply — a typical single agent turn, small enough that every request is billed at the base rate.
| Request | Cost |
|---|---|
| Cold prompt, nothing cached | $0.0840 |
| Warm prompt, 90% of the input served from cache | $0.0354 |
Use gemini-3.1-pro-preview in your coding agent
gemini-3.1-pro-preview works with the same Vivgrid key and https://api.vivgrid.com/v1 endpoint as every other model in the catalog. Grab your API key from the Vivgrid Console, then drop one of the configurations below into your agent of choice.
OpenCode
OpenCode has Vivgrid built in, so you can use gemini-3.1-pro-preview without writing any config: open /models, search for vivgrid, paste your API key and pick the model. The OpenCode tutorial walks through it step by step.
Prefer to configure it by hand? Install OpenCode:
npm i -g opencode-aiDeclare gemini-3.1-pro-preview under the Vivgrid provider in your global OpenCode config, ~/.config/opencode/opencode.json. The @ai-sdk/openai-compatible provider talks to Vivgrid over Chat Completions (/v1/chat/completions):
{
"$schema": "https://opencode.ai/config.json",
"model": "vivgrid/gemini-3.1-pro-preview",
"provider": {
"vivgrid": {
"npm": "@ai-sdk/openai-compatible",
"name": "Vivgrid",
"options": {
"baseURL": "https://api.vivgrid.com/v1",
"apiKey": "{env:VIVGRID_API_KEY}"
},
"models": {
"gemini-3.1-pro-preview": {
"name": "gemini-3.1-pro-preview",
"tool_call": true,
"attachment": true,
"modalities": { "input": ["text", "image", "video", "audio", "pdf"], "output": ["text"] },
"limit": { "context": 1048576, "output": 65536 }
}
}
}
}
}Export your key and launch OpenCode:
export VIVGRID_API_KEY="viv-xxxxxxxxxxxxx"
opencodeUse /models to switch between gemini-3.1-pro-preview and other Vivgrid models mid-session. See the full OpenCode tutorial.
Pi
Install Pi:
npm install -g --ignore-scripts @earendil-works/pi-coding-agentAdd gemini-3.1-pro-preview to the Vivgrid provider in ~/.pi/agent/models.json. Pi talks to Vivgrid over Chat Completions (/v1/chat/completions):
{
"providers": {
"vivgrid": {
"baseUrl": "https://api.vivgrid.com/v1",
"apiKey": "viv-xxxxxxxxxxxxx",
"api": "openai-completions",
"compat": {
"sendSessionAffinityHeaders": true
},
"models": [
{
"id": "gemini-3.1-pro-preview",
"input": ["text", "image"],
"contextWindow": 1048576,
"maxTokens": 65536
}
]
}
}
}Make it the model Pi starts with in ~/.pi/agent/settings.json:
{
"defaultProvider": "vivgrid",
"defaultModel": "gemini-3.1-pro-preview"
}Then verify and start Pi:
pi --list-models vivgrid
piOr run a one-shot prompt without entering the TUI:
pi -p "explain the auth flow in this repo" --model vivgrid/gemini-3.1-pro-previewSee the full Pi tutorial.
API surfaces
The Vivgrid Console catalogs gemini-3.1-pro-preview on one surface, all behind the same API key. The endpoint shown is the one the Console previews for that surface.
| Surface | Primary endpoint | Use it for |
|---|---|---|
| Vibe coding | /chat/completions | Coding CLIs and IDE agents that drive the model themselves — point the tool at Vivgrid and keep your own loop. |
Quick start
Get an API key from the Vivgrid Console, then call gemini-3.1-pro-preview directly.
curl https://api.vivgrid.com/v1/chat/completions \
-H "Authorization: Bearer $VIVGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-pro-preview",
"messages": [
{ "role": "user", "content": "Say hello in English, Chinese and Spanish." }
],
"stream": true
}'Ideal use cases
- Multimodal coding and reasoning agents
- Tasks blending long text with images, video, audio, or PDFs
- Large-context analysis up to ~1M tokens
- Workflows that benefit from Gemini's native multimodality
Related models
- gemini-4-argon — the latest flagship Gemini release
- gpt-6-astra — OpenAI's frontier gpt-6 coding model
- gemini-3.8-flash — faster Gemini sibling
gemini-3.5-flash
gemini-3.5-flash on Vivgrid: Google's fast multimodal model with a 1M-token context window across text, image, video, audio and PDF.
gemini-3.1-flash-lite-preview
gemini-3.1-flash-lite-preview on Vivgrid: Google's lightweight multimodal model with a ~1M-token context window at a very low price.