Google Gemini with DevFlow: setup, scope and limits
A Google AI key lets DevFlow's OpenCode agents call Gemini models on your own account. The workspace stores it once, and every run with a google/ model ID uses it. Setup is 5 steps in Workspace Settings → Billing → Model access.
- Kind
- Model provider
- Where to set it up
- Workspace Settings → Billing → Model access
- Plan
- All plans
- Agent roles
- Any OpenCode role set to a google/ model
- Verified
- 1 Oct 2026
Setup steps
- Create an API key. Create a key for the Generative Language API, the API behind Gemini.
- Open the Billing tab. As an owner, open the Billing tab and find "Model access"; if the provider cards are folded away, click "Manage keys".
- Add the key under Add provider. The card labelled "Google (Gemini)" appears only once a key exists. Use "Add provider": enter
GOOGLE_GENERATIVE_AI_API_KEY, paste the secret into "API key" and click "Add". - Test the key. Click "Test" on the Google (Gemini) card. DevFlow requests the model list at
/v1beta/models, passing the key as a query parameter, and reports the answer. A key typed into the field but not yet saved is tested in place of the stored one, so a replacement can be checked before it goes live. - Select the models. In the Execution tab, set "OpenCode Model", a tier or a role override to an ID such as
google/gemini-2.5-pro.
What it does
Different client libraries read different variable names, so DevFlow fans one saved key out to three: GOOGLE_GENERATIVE_AI_API_KEY, GOOGLE_API_KEY and GEMINI_API_KEY. A row saved under any of these names therefore works the same way.
IDs such as google/gemini-2.5-pro can serve as the default OpenCode Model, back a tier or be pinned to one role. Planning and verification always ask for the highest reasoning effort, whichever provider serves them; a model that cannot honour the option ignores it or returns an error.
Gemini requests are not routed through the optional context-compression proxy, which fronts only Anthropic and OpenAI. Requests therefore always reach the Generative Language API directly, or through DevFlow's relay when that is on.
For each run, DevFlow stores input, output, cache-read and cache-write token counts as the OpenCode CLI reports them. Prompt-cache use thus appears in the same per-run records as for every other provider, ready for cost comparison.
Before the first task, "Check readiness" in the Repositories tab confirms that the default model and every per-role override have a credential, so a missing key shows up there instead of failing mid-task.
A single run may last up to 90 minutes and is stopped after 45 minutes without output, whatever the provider. Only the operator can change either limit, through AGENT_TIMEOUT_MINUTES and AGENT_IDLE_TIMEOUT_MINUTES.
Requirements
- The owner role in the DevFlow workspace, since every key route checks ownership.
- A key whose project has access to the models the workspace names.
- The OpenCode backend, which reads stored keys; the optional Claude Code backend does not, since it signs in with the server's own CLI session.
Limits
- The "Test" button appears only for the first two names; a row saved under the third,
GEMINI_API_KEY, shows no "Test" button and is checked by running a task. - With the model relay on, which container mode enforces, each run carries a short-lived token and the relay attaches the stored key in the
x-goog-api-keyheader. - The monthly spend cap is checked before each task launch, so a task over the cap fails with a stated reason before any request leaves DevFlow.
- Rate-limit, overload and unavailable answers (429, 529 and 503) are retried with exponential backoff, from 2 to 60 seconds, for up to 4 attempts; any other error fails the run at once.
FAQ
Why is the Google (Gemini) card missing from a new DevFlow workspace?
DevFlow steers new workspaces to OpenRouter or a custom key, so the Anthropic, OpenAI and Google cards appear only after a key with their exact env name is stored.
Does DevFlow switch on prompt caching for Gemini?
No. Prompt caching for Gemini belongs to Google and the OpenCode CLI, and DevFlow has no setting that turns it on or off.
Sources
Every fact above comes from these files in the DevFlow repository.
internal/relay/providers.gointernal/agent/opencode_backend.gointernal/api/opencode_key_tester.gointernal/agent/backend.gointernal/agent/transient_error.gointernal/api/handlers_opencode_keys.gointernal/api/server.gointernal/api/handlers_readiness.goweb/src/lib/components/ApiKeysManager.svelteweb/src/lib/components/billing/ModelAccess.svelteweb/src/lib/components/WorkspaceSettings.sveltemigrations/0044_agent_invocations.up.sqlCLAUDE.md