How do I use Gemini in the Pi coding agent?
Pi uses Gemini through its built-in google provider with GEMINI_API_KEY, or through a standardcompute provider in ~/.pi/agent/models.json (baseUrl https://api.stdcmpt.com/v1) started with pi --provider standardcompute --model google/gemini-3.8-flash. The second bills a plan from $19 a month that returns HTTP 402 to new requests once the compute budget is used.
{
"providers": {
"standardcompute": {
"baseUrl": "https://api.stdcmpt.com/v1",
"api": "openai-completions",
"apiKey": "$STANDARDCOMPUTE_API_KEY",
"models": [
{
"id": "google/gemini-3.8-flash",
"name": "Gemini 3.8 Flash",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 400000,
"maxTokens": 32000
},
{
"id": "google/gemini-3.1-pro-preview",
"name": "Gemini 3.1 Pro Preview",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 400000,
"maxTokens": 32000
}
]
}
}
}
Ctrl+S in the /model picker saves the choice to settings.json as defaultProvider and defaultModel, so later sessions start on Gemini without flags.
Why /login no longer offers Gemini
Pi 0.71.0 (April 30, 2026) removed its built-in Google Gemini CLI and Google Antigravity login, so a Google AI subscription no longer signs Pi in. The google provider now takes an API key from GEMINI_API_KEY, and google-vertex takes Vertex credentials.
The --provider trap
Pi reads --model google/gemini-3.8-flash as its own google provider, because the part before the first slash names a provider it knows. Pass --provider standardcompute, or the full ref standardcompute/google/gemini-3.8-flash, to reach this endpoint. In settings.json, defaultProvider and defaultModel resolve exactly.
What works with Gemini in Pi
| Pi feature | On Gemini through Standard Compute |
|---|---|
| Images | Read, because the models list text and image input |
| Thinking levels | Shift+Tab or /thinking cycles off to high; Pi sends the level as reasoning_effort, which overrides the Models page. Gemini always reasons, so off leaves it at its default |
| Context | Pi assumes 128,000 when contextWindow is missing; the config sets 400,000 |
From Pi's models, CLI and settings docs and its source, checked October 14, 2026.
What a day of Gemini costs
| Per day | 3.8 Flash, 2026 | 3.8 Flash, 2027 | 3.1 Pro |
|---|---|---|---|
| Typical day | $1.54 | $3.08 | $4.19 |
| Busy day | $16 | $31 | $43 |
Gemini API paid tier per million tokens: 3.8 Flash $0.75 input, $0.075 cached, $3.75 output through December 31, 2026, then $1.50, $0.15, $7.50; 3.1 Pro $2, $0.20, $12 up to 200K. Source. The Agent Burn Index measures coding agents such as OpenCode, Cline and Kilo; Pi is not broken out, so these figures use its median and 90th-percentile coding-agent day (September 13 to October 12, 2026) as a stand-in. Priced at the list rates above; your own days will differ.
The catch
Pi's built-in google provider with your own GEMINI_API_KEY is the shortest route for Gemini alone, and Google's free tier is enough to try it. Its catalog also lists gemini-3.8-flash and gemini-3.1-pro-preview.
Where Standard Compute fits
Add Claude or GPT entries to the same standardcompute provider and Ctrl+P cycles between them and Gemini mid-session, on one key.
FAQ
Why doesn't my Standard Compute model show in /model?
Pi hides a custom model until its key resolves. Export STANDARDCOMPUTE_API_KEY in the shell that starts Pi, and run pi --list-models to see models.json errors.