Skip to main content
Google’s Gemini models are available through Google AI Studio. They offer some of the largest context windows in the industry (1M+ tokens), making them excellent for tasks that involve large codebases.

Setup

Get your API key from Google AI Studio.
export GEMINI_API_KEY=AIza...

Config

{
  "providers": {
    "google": "${GEMINI_API_KEY}"
  }
}

Use it

{
  "agents": [
    { "name": "coder", "model": "google:gemini-2.5-pro" }
  ]
}
Polpo auto-infers google from the gemini- prefix.

Models

ModelBest forContextReasoningVision
gemini-3-pro-previewLatest — state-of-art reasoning and agentic coding1M+YesYes
gemini-3-flash-previewFast Gemini 3 variant1M+YesYes
gemini-2.5-proComplex reasoning, large codebases (GA)1M+YesYes
gemini-2.5-flashFast and cheap, good quality (GA)1M+YesYes
gemini-2.5-flash-liteLowest latency/cost in 2.5 family1M+YesYes
gemini-2.0-flashPrevious generation, very fast1MNoYes
Also available: gemini-1.5-pro, gemini-1.5-flash, gemini-1.5-flash-8b, gemini-2.0-flash-lite
Gemini’s 1M+ token context window means it can process entire codebases in a single prompt. This makes it a strong choice for architecture-level tasks and cross-file refactoring.

Features

FeatureSupported
StreamingYes
Tool useYes
Vision (images)Yes
ReasoningYes (Gemini 3.x, 2.5 Pro, 2.5 Flash)

Pricing

ModelInput (per 1M tokens)Output (per 1M tokens)
gemini-3-pro-previewPreview pricing — check Google AI Studio
gemini-3-flash-previewPreview pricing — check Google AI Studio
gemini-2.5-pro$1.25$10.00
gemini-2.5-flash$0.15$0.60
gemini-2.5-flash-lite$0.075$0.30
gemini-2.0-flash$0.10$0.40

Provider Details

Provider IDgoogle
Env variableGEMINI_API_KEY
API typeGemini API
Auto-infer prefixgemini-

OAuth: Use Your Google Account

You can use your Google account to access Gemini models directly — no API key needed. Google offers two OAuth flows that both give access to the same Gemini models.

Gemini CLI Flow

polpo auth login google-gemini-cli
Uses Auth Code + PKCE with a localhost callback on port 8085:
  1. Polpo opens a browser for Google OAuth consent
  2. Authorize with your Google account
  3. The callback server on localhost:8085 captures the token automatically
  4. If the callback fails, paste the redirect URL manually
Logging in to Google Gemini CLI...

Opening browser for Google OAuth...
Waiting for callback on localhost:8085...

Login successful!
Profile saved as: google-gemini-cli:user@gmail.com
Stored in ~/.polpo/auth-profiles.json

Antigravity Flow

An alternative Google OAuth flow on a different port:
polpo auth login google-antigravity
Same Auth Code + PKCE flow, but the callback server runs on port 51121. Useful if port 8085 is taken.
Logging in to Google Antigravity...

Opening browser for Google OAuth...
Waiting for callback on localhost:51121...

Login successful!
Profile saved as: google-antigravity:user@gmail.com
Stored in ~/.polpo/auth-profiles.json
Both flows access the same Gemini models. Choose whichever port is available on your machine. If you log in with both, Polpo treats them as separate profiles and rotates between them.

Token Refresh

OAuth tokens expire. Polpo handles this automatically:
  • Before each API call, Polpo checks if the token is expired
  • If expired and a refresh token exists, it refreshes silently via Google Cloud token refresh
  • If no refresh token is available, the profile is skipped and Polpo falls back to other credentials

Multiple Accounts & Profile Rotation

You can log in with multiple Google accounts and even mix flows:
google-gemini-cli:personal@gmail.com
google-gemini-cli:work@company.com
google-antigravity:personal@gmail.com
Polpo rotates between all Google profiles: oldest lastUsed first, skipping profiles in cooldown or billing disable.

Billing Disable

If your Google account quota is exceeded, the profile enters billing disable — a longer backoff (5h → 10h → 20h → 24h cap) than regular rate-limit cooldown. Other Google profiles or the GEMINI_API_KEY continue working normally.

Session Pinning

Pin a specific Google profile for the session:
/model google/gemini-2.5-pro@google-gemini-cli:personal@gmail.com
Reset with /model reset.

Resolution Order

1. polpo.json providers.google.apiKey       (config wins)
2. GEMINI_API_KEY environment variable       (env var)
3. Stored google-gemini-cli OAuth profiles   (auto-refresh)
4. Stored google-antigravity OAuth profiles  (auto-refresh)
For the full authentication system — all OAuth providers, CLI commands, profile rotation algorithm, and security details — see the Authentication guide.

Notes

  • Gemini 2.5 Pro is cost-effective compared to Claude Opus or GPT o3 while offering competitive quality for coding tasks.
  • The massive context window makes Gemini a natural choice for the orchestrator model when you need it to reason across many files.
  • For enterprise use with VPC-SC, CMEK, or data residency requirements, use Google Vertex AI instead.