opencode-gemini-cli-providerUse Gemini CLI as an OpenCode language model provider without an API key
0
17
4 in 7 days
21.5
Multi-signal model
3 months ago
2026-04-24
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-gemini-cli-provider@0.1.0"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-gemini-cli-provider@0.1.0"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-gemini-cli-provideropencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
Use Gemini CLI as an OpenCode provider without a Gemini API key.
The plugin registers gemini-local/* models and calls your local gemini command directly. There is no local HTTP server and no provider block to copy into opencode.json.
Quick Start
# 1. Install Gemini CLI
brew install gemini-cli
# 2. Make sure Gemini CLI works first
gemini -p "Say hi" -m gemini-3.1-flash-lite-preview
# 3. Optional: configure a proxy if your Gemini CLI needs one
mkdir -p ~/.config/opencode
printf '{"proxy":"http://127.0.0.1:10808"}\n' > ~/.config/opencode/gemini-proxy.json
# 4. Install the plugin globally
opencode plugin -g opencode-gemini-cli-provider
# 5. Verify models are available
opencode models | grep gemini-local
# 6. Test
opencode run "Say hello" --model gemini-local/gemini-3.1-flash-lite-preview
Models
The plugin currently exposes:
gemini-local/gemini-3-flash-preview
gemini-local/gemini-3.1-flash-lite-preview
gemini-local/gemini-3.1-pro-preview
Proxy Configuration
Proxy is often required in regions where Gemini is not directly reachable. The plugin checks proxy settings in this order:
https_proxyorHTTPS_PROXYfrom the environment that startsopencode~/.config/opencode/gemini-proxy.json- no proxy
Option A: Environment Variable
Use this when you only want the proxy for the current shell:
export https_proxy=http://127.0.0.1:10808
export http_proxy=http://127.0.0.1:10808
opencode run "Say hello" --model gemini-local/gemini-3.1-flash-lite-preview
Option B: Config File
Use this when you want OpenCode to remember the proxy:
mkdir -p ~/.config/opencode
printf '{"proxy":"http://127.0.0.1:10808"}\n' > ~/.config/opencode/gemini-proxy.json
Change http://127.0.0.1:10808 to your own proxy address.
If you do not need a proxy, do not create this file.
OpenCode Configuration
Only the plugin needs to be configured. Do not manually add a provider.gemini-local block.
Example opencode.json:
{
"plugin": [
"opencode-gemini-cli-provider"
]
}
You can set Gemini as your default model if desired:
{
"model": "gemini-local/gemini-3.1-flash-lite-preview"
}
Troubleshooting
Check Gemini CLI first:
gemini -p "Say hi" -m gemini-3.1-flash-lite-preview
Check plugin registration:
opencode models | grep gemini-local
opencode debug config | grep -A 8 gemini-local
If responses hang, confirm the proxy is available and Gemini CLI can use it:
export https_proxy=http://127.0.0.1:10808
gemini -p "Say hi" -m gemini-3.1-flash-lite-preview -o json
Gemini CLI can be slow to start. A first response around 10-20 seconds is normal.
Development
npm install
opencode plugin add $(pwd)
opencode run "Say hello" --model gemini-local/gemini-3.1-flash-lite-preview
License
MIT