How do I use Gemini in OpenCode?
OpenCode reaches Gemini two ways: its built-in Google provider with a Gemini API key, or a standardcompute provider in opencode.json (base URL https://api.stdcmpt.com/v1) with google/gemini-3.8-flash as the model. The second runs on a plan from $19 a month that returns HTTP 402 to new requests once the compute budget is used, and adds 3.1 Pro on the plan agent.
{
"$schema": "https://opencode.ai/config.json",
"model": "standardcompute/google/gemini-3.8-flash",
"small_model": "standardcompute/google/gemini-3.5-flash-lite",
"agent": {
"plan": { "model": "standardcompute/google/gemini-3.1-pro-preview" }
},
"provider": {
"standardcompute": {
"npm": "@ai-sdk/openai-compatible",
"name": "Standard Compute",
"options": {
"baseURL": "https://api.stdcmpt.com/v1",
"apiKey": "{env:STANDARDCOMPUTE_API_KEY}"
},
"models": {
"google/gemini-3.8-flash": {
"name": "Gemini 3.8 Flash",
"reasoning": true,
"attachment": true,
"modalities": { "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 400000, "output": 32000 }
},
"google/gemini-3.1-pro-preview": {
"name": "Gemini 3.1 Pro Preview",
"reasoning": true,
"attachment": true,
"modalities": { "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 400000, "output": 32000 }
},
"google/gemini-3.5-flash-lite": {
"name": "Gemini 3.5 Flash-Lite",
"reasoning": true,
"attachment": true,
"modalities": { "input": ["text", "image"], "output": ["text"] },
"limit": { "context": 400000, "output": 32000 }
}
}
}
}
}
All three Gemini models read images, so each carries attachment and modalities. Merge into your existing opencode.json.
Can OpenCode use a Gemini subscription?
Not officially. OpenCode's built-in Google provider takes an API key (GEMINI_API_KEY, GOOGLE_API_KEY or GOOGLE_GENERATIVE_AI_API_KEY), and none of the sign-in plugins it ships is for Google. Community plugins that reuse a Gemini plan are listed on OpenCode's ecosystem page; OpenCode does not document or support them.
Three Gemini models, three OpenCode slots
| Slot | Model ID | Typical day at list price |
|---|---|---|
| model (build) | google/gemini-3.8-flash | $1.54 this year, $3.08 from January |
| agent.plan.model | google/gemini-3.1-pro-preview | $4.19 |
| small_model | google/gemini-3.5-flash-lite | Light calls only, so a small share of the day |
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. A typical day is 8.5M tokens and a busy one 86.7M, 87.2% of input as cache reads: the median and 90th-percentile coding-agent day in our Agent Burn Index, measured on OpenCode, Cline, Kilo and similar agents, September 13 to October 12, 2026. Priced at the list rates above; your own days will differ.
What works with Gemini in OpenCode
- Screenshots work; all three models read images, and the config declares it.
- Gemini always reasons. An explicit request to switch reasoning off runs at low effort instead of failing.
The catch
For Gemini alone, OpenCode's built-in Google provider with your own key is the shorter path: it pays Google directly, and Google's free tier is enough to try it. Gemini is not in OpenCode Go.
Where Standard Compute fits
Gemini on the build agent and Claude Sonnet 5.5 on the plan agent is a valid opencode.json on one key. At this year's list price the Starter plan's $20 compute budget covers about 12 typical 3.8 Flash days.
FAQ
Which Gemini is best in OpenCode?
3.8 Flash for building, 3.1 Pro for planning and hard steps. 3.1 Pro costs nearly three times as much per day at this year's list prices, which is why it sits on the plan agent.
Is Gemini CLI a better way to use my Google subscription?
For a Google AI subscription, Google's own Gemini CLI is the supported terminal agent. OpenCode with Gemini makes sense when you want OpenCode's workflow or several model vendors in one session.