Current as of April 2026. Google’s Gemini models are uniquely suited for OpenCode users who need to process massive repositories. With a standard 1-million-token context window across the entire lineup, these models allow you to feed entire codebases into the CLI without the aggressive pruning required by other providers. While tool-calling reliability has historically been a weak point, the latest 2.x and 3.x iterations have stabilized significantly for standard file system operations.
The quick answer
| Model | Input / Output | Context | Best For |
|---|---|---|---|
| Gemini 2.0 Flash | $0.10 / $0.40 | 1.0M | The Budget Repository Scanner |
| Gemini 2.5 Flash | $0.30 / $2.50 | 1.0M | Logic Stability Upgrade |
| Gemini 3 Flash | $0.50 / $3.00 | 1.0M | High-Volume Generation |
| Gemini 2.5 Pro | $1.25 / $10 | 1.0M | Reliable Tool Integration |
| Gemini 3.1 Pro | $2.00 / $12 | 1.0M | The Architectural Specialist |
Start with Gemini 2.0 Flash unless you have a specific reason to pick another. It offers the best price-to-performance ratio for CLI-based coding. At $0.10 per million input tokens, it is roughly 10x cheaper than the Pro models while maintaining enough logic to handle standard OpenCode tool calls and file edits.
Gemini 2.0 Flash — The Budget Repository Scanner
This is the entry point for large-scale context. At $0.10/M input and $0.4/M output, it is the most cost-effective way to use OpenCode for repo-wide searches. The 8K output limit is a bottleneck for generating large files, but it is sufficient for most surgical code edits and documentation lookups.
Gemini 2.5 Flash — Logic Stability Upgrade
Priced at $0.30/M input, this model is three times the cost of 2.0 Flash. It provides better adherence to complex system prompts and project-specific linting rules. Choose this if 2.0 Flash fails to respect your OpenCode configuration or struggles with multi-step tool sequences.
Gemini 3 Flash — High-Volume Generation
The standout feature here is the 66K output limit, a massive jump from the 8K cap on earlier Flash models. For $0.50/M input, it allows OpenCode to write entire modules or large boilerplate sets in a single pass. It includes a reasoning mode that helps with debugging, though the preview status means occasional latency spikes.
Gemini 2.5 Pro — Reliable Tool Integration
At $1.25/M input, this model is designed for users who find the Flash series too prone to hallucinations in deep dependency trees. It is more reliable at following strict JSON schemas for tool calls, which reduces the ‘retry’ overhead in OpenCode when performing complex refactors.
Gemini 3.1 Pro — The Architectural Specialist
This is the most capable model in the family, costing $2/M input and $12/M output. It combines a 66K output window with advanced reasoning capabilities. It is the only choice for OpenCode tasks that require understanding complex architectural patterns across a 1M token context window where smaller models lose track of imports.
Setup in OpenCode
To configure Gemini, add your provider details to ~/.config/opencode/opencode.jsonc. You must use the @ai-sdk/openai-compatible adapter to bridge the Google API. Store your API key in ~/.local/share/opencode/auth.json under the corresponding provider key. Most users should start with the 2.0-flash-001 preset for immediate use.
Running through haimaker.ai
All Gemini models are also available through haimaker.ai. Wire haimaker as a single OpenAI-compatible provider and you get Gemini alongside every other frontier model:
{
"provider": {
"haimaker": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://api.haimaker.ai/v1"
}
}
}
}
Direct provider setup
OpenCode ships with a built-in preset for Google. You do not need to configure a custom provider — just drop your API key into ~/.local/share/opencode/auth.json:
{
"google": {
"type": "api",
"key": "your-google-api-key"
}
}
Restart OpenCode and Google models appear under /models. For providers not in the built-in directory (or to hit them through a gateway like haimaker), see the custom provider guide.
Bottom line
Use Gemini 2.0 Flash for daily CLI tasks and repository indexing to save money; reserve Gemini 3.1 Pro for complex debugging sessions that require deep reasoning and large file writes.
USE GEMINI IN OPENCODE WITH HAIMAKER
See our OpenCode custom provider guide. See our Haimaker + OpenCode setup.