OpenAI-compatible local proxy for Gemini.
- Exposes
POST /v1/chat/completions - Exposes
GET /v1/models - Exposes
GET /healthz - Keeps Gemini OAuth and upstream forwarding inside this proxy
- Supports request auth, concurrency limiting, logs, and
${VAR}config expansion
cargo build --release# Login
./target/release/gemini-proxy login
# Start server (foreground)
./target/release/gemini-proxy serve
# Start server (background daemon)
./target/release/gemini-proxy serve --daemon
# Stop daemon
./target/release/gemini-proxy stop
# Check status
./target/release/gemini-proxy status
# Check quota
./target/release/gemini-proxy quotaDefault bind:
http://127.0.0.1:8045
Config path:
~/.gemini-proxy/config.json
Supported values include:
bindapi_keymax_concurrent_requestsupstream_proxy.enabledupstream_proxy.urloauth.client_keyoauth.redirect_uri
Example:
{
"bind": "127.0.0.1:8045",
"api_key": "${GEMINI_PROXY_API_KEY}",
"max_concurrent_requests": 16,
"upstream_proxy": {
"enabled": false,
"url": "http://127.0.0.1:7897"
},
"oauth": {
"client_key": "${GEMINI_PROXY_CLIENT_ID}",
"redirect_uri": "http://127.0.0.1:8045/callback"
}
}Environment variables can be used with ${NAME} syntax.
Manage upstream proxy for OAuth and API calls:
./target/release/gemini-proxy proxy set socks5://127.0.0.1:1080
./target/release/gemini-proxy proxy enable
./target/release/gemini-proxy proxy disable
./target/release/gemini-proxy proxy showSet these before login:
GEMINI_PROXY_GOOGLE_CLIENT_IDGEMINI_PROXY_GOOGLE_CLIENT_SECRET
Fallback names are also accepted:
GEMINI_PROXY_CLIENT_IDGEMINI_PROXY_CLIENT_SECRET
Point CCP to this proxy as an OpenAI-compatible provider:
providers:
gemini:
type: openai-compatible
base_url: http://127.0.0.1:8045
api_key: ${GEMINI_PROXY_API_KEY}
max_concurrent_requests: 16Model aliases should map Claude names to Gemini model names handled by this proxy.
Non-streaming:
curl http://127.0.0.1:8045/v1/chat/completions \
-H "Authorization: Bearer $GEMINI_PROXY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-2.5-flash","messages":[{"role":"user","content":"hi"}]}'Streaming:
curl http://127.0.0.1:8045/v1/chat/completions \
-H "Authorization: Bearer $GEMINI_PROXY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-2.5-flash","messages":[{"role":"user","content":"hi"}],"stream":true}'Logs are written under:
~/.gemini-proxy/logs/