You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow using Gemini CLI for free Gemini requests #402
I'm going to apologise in advance if this is a unreasonable request, but Gemini CLI has a very generous free tier and it would be quite nice to route Gemini requests through it (especially since it costs Google the same amount of money anyway)
Reacted by Lucas, Phil Helm, Xuan Hien, Art Shendrik and Talina Shrotriya
Reacted by Yumi Izumi, beeman, trinhlehainamvice, João Ribeiro, John Carson, Adam Spiers, Trinh Le Hai Nam, Mahad Kalam, icmecodes, Phil Helm and 1 more
I configured it per the README on that project, and set up the provider in opencode. The only quirk is that I was getting invalid JSON errors when setting it up as an OpenAI compatible provider, it needed to be configured as a google provider:
I configured it per the README on that project, and set up the provider in opencode. The only quirk is that I was getting invalid JSON errors when setting it up as an OpenAI compatible provider, it needed to be configured as a google provider:
@nitish-raj Yeah, sometimes messages hang and I have to abort and resend, but otherwise it works well. My config is just the example from the CLIProxyAPI readme, with different local keys, a different auth directory, and no API keys added:
# Server port
port: 8317
# Management API settings
remote-management:
# Whether to allow remote (non-localhost) management access.
# When false, only localhost can access management endpoints (a key is still required).
allow-remote: false
# Management key. If a plaintext value is provided here, it will be hashed on startup.
# All management requests (even from localhost) require this key.
# Leave empty to disable the Management API entirely (404 for all /v0/management routes).
secret-key: "REDACTED"
# Authentication directory (supports ~ for home directory)
auth-dir: "~/.cache/cli-proxy-api"
# Enable debug logging
debug: true
# Proxy URL. Supports socks5/http/https protocols. Example: socks5://user:pass@192.168.1.1:1080/
proxy-url: ""
# Number of times to retry a request. Retries will occur if the HTTP response code is 403, 408, 500, 502, 503, or 504.
request-retry: 3
# Quota exceeded behavior
quota-exceeded:
switch-project: true # Whether to automatically switch to another project when a quota is exceeded
switch-preview-model: true # Whether to automatically switch to a preview model when a quota is exceeded
# API keys for authentication
api-keys:
- "REDACTED"
I successfully installed gemini api key with cliproxyapi,
"""
CLIProxyAPI Version: dev, Commit: none, BuiltAt: unknown
API server started successfully
server clients and configuration updated: 11 clients (2 auth files + 4 GL API keys + 2 Claude API keys + 1 Codex keys + 2 OpenAI-compat)
"""
Very cool. I was just searching for that to prepare for the launch of Gemini 3 next week. Google has actually 1500 requests per day included with the $20 Google AI Pro subscription.
I've submitted a PR to @jenslys plugin repo to add better retry handling for the tight rate limits Gemini 3 Pro has right now. That should make it work better for everyone.
Reacted by Henry Moran, Omer Dangoor and Jens Lystad
Activity
BasixKOR commentedon Jun 25, 2025
Note that the authentication scheme Gemini CLI uses is public: https://github.com/google-gemini/gemini-cli/blob/main/packages/core/src/code_assist/oauth2.ts
thdxr commentedon Jun 25, 2025
this would honestly be a great PR it might fit in very nicely into how claude pro/max is implemented
sockthedev commentedon Jun 26, 2025
one tui to rule them all...
izyuumi commentedon Jun 26, 2025
Does something like this work?
aryasaatvik commentedon Jun 26, 2025
got it working with with custom ai sdk provider. here is my config
~/.config/opencode.json.this needs you to use gemini cli to login initially
https://gist.github.com/aryasaatvik/4eb60e53290b4d483bd1fe40dae6fc48
fer-ri commentedon Aug 3, 2025
any update? I open gist from @aryasaatvik but seems not working anymore too.
hrstoyanov commentedon Aug 8, 2025
With Qwen Coder CLI now out, this is becoming very interesting:
I suspect more (Chineses) AI labs will clone Gemini CLI and couple it with OAuth + generaous free daily usage quota.
That is an opportunity for OpenCode to rule them all, @thdxr
frap129 commentedon Sep 24, 2025
In case anyone else is also trying to get this working, I was able to do it using https://github.com/router-for-me/CLIProxyAPI.
I configured it per the README on that project, and set up the provider in opencode. The only quirk is that I was getting invalid JSON errors when setting it up as an OpenAI compatible provider, it needed to be configured as a google provider:
Hope this helps
fer-ri commentedon Sep 24, 2025
Thanks a lot
hrstoyanov commentedon Sep 24, 2025
So CLIProxyAPI doesn't not use OAuth, you need to provide API key?
frap129 commentedon Sep 24, 2025
@hrstoyanov It uses oauth. The API key in the opencode config is for connecting to the local CLIProxyAPI server.
nitish-raj commentedon Sep 27, 2025
@frap129 is this still working for you? For me it doesn't seem to connect. Could you share your config file rom CLIProxyAPI?
frap129 commentedon Sep 27, 2025
@nitish-raj Yeah, sometimes messages hang and I have to abort and resend, but otherwise it works well. My config is just the example from the CLIProxyAPI readme, with different local keys, a different auth directory, and no API keys added:
JunarisAlf commentedon Oct 1, 2025
@frap129 very nice, the openAI compatible is work well on kilo code, but i'm wondering why is not on opencode
ydevx commentedon Oct 6, 2025
I successfully installed gemini api key with cliproxyapi,
"""
CLIProxyAPI Version: dev, Commit: none, BuiltAt: unknown
API server started successfully
server clients and configuration updated: 11 clients (2 auth files + 4 GL API keys + 2 Claude API keys + 1 Codex keys + 2 OpenAI-compat)
"""
but in opencode, I tried call gemini,
then nothing shows up. Stack forever
rekram1-node commentedon Oct 6, 2025
@ygit1 unfamiliar with it, could you try doing:
opencode run hello --print-logs
and show output?
is the proxy gemini api compliant or does it do openai compatible?
luckycold commentedon Oct 24, 2025
Someone just quietly made this apparently:
https://github.com/shantur/opencode-gemini-auth
jenslys commentedon Nov 1, 2025
I have also created a plugin for this https://github.com/jenslys/opencode-gemini-auth
Jonathan-Garcia1 commentedon Nov 9, 2025
does https://github.com/shantur/opencode-gemini-auth or https://github.com/jenslys/opencode-gemini-auth work? are they safe?
olafgeibig commentedon Nov 16, 2025
Very cool. I was just searching for that to prepare for the launch of Gemini 3 next week. Google has actually 1500 requests per day included with the $20 Google AI Pro subscription.
https://developers.google.com/gemini-code-assist/resources/quotas
ben-vargas commentedon Nov 20, 2025
I've submitted a PR to @jenslys plugin repo to add better retry handling for the tight rate limits Gemini 3 Pro has right now. That should make it work better for everyone.
iamhenry commentedon Nov 20, 2025
@olafgeibig unfortunately Pro sub cant access G3 yet. Only Ultra
bitnom commentedon Nov 21, 2025
I think you just got it on pro
iamhenry commentedon Nov 24, 2025
@bitnom it's avaliable for Pro plan users?
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
Merge pull request anomalyco#402 from different-ai/feat/settings-tool…