A free Gemini web interface proxy that works as an OpenAI-compatible API for OpenCode. This project allows you to use your free Gemini web subscription as a local API provider with full tool calling support.
Educational Purpose: This project is created for learning purposes to demonstrate how to build custom providers for OpenCode using browser automation.
- Converts Gemini web interface into an OpenAI-compatible API
- Enables free Gemini usage in OpenCode without API keys
- Supports tool calling and function execution
- Maintains persistent login sessions
- Works completely locally on your machine
- Uses Playwright to automate the Gemini web interface
- Translates OpenCode requests to Gemini web format
- Extracts responses and converts them back to OpenAI format
- Handles tool calling through advanced prompt engineering
- Maintains session state for continuous conversations
- Python 3.8 or higher
- Google account with Gemini access
- Chrome browser installed
- OpenCode installed
git clone <repository-url>
cd gemini-web-proxy
chmod +x setup.sh
./setup.shgit clone <repository-url>
cd gemini-web-proxy# Install Python dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromiumpython run.pyOn first run:
- Chrome browser will open automatically
- Log in to your Google account
- Navigate to Gemini if not redirected automatically
- Wait for "Login saved" message
- Browser will restart in headless mode
Add this configuration to your OpenCode config file:
Location: ~/.config/opencode/opencode.json or your project's opencode.json
{
"providers": {
"00bx-gemini": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:8080/v1",
"apiKey": "not-needed"
},
"models": {
"00bx-gemini-web": {}
}
}
}
}python run.pyThe proxy will start on http://localhost:8080
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "00bx-gemini-web",
"messages": [{"role": "user", "content": "Hello!"}]
}'Once configured, simply use OpenCode normally. All requests will be routed through your free Gemini web interface.
- Free Usage: No API keys or paid subscriptions required
- Tool Calling: Full support for OpenCode's tool system
- Persistent Sessions: Login once, use indefinitely
- Local Operation: Everything runs on your machine
- OpenAI Compatible: Works with any OpenAI-compatible client
If login fails or expires:
# Reset the session
rm -rf ~/.gemini-service
python run.py- Ensure Chrome is installed and accessible
- Check that port 8080 is not in use
- Verify your Google account has Gemini access
- Try restarting the proxy
Make sure your OpenCode configuration matches exactly:
- Provider name:
00bx-gemini - Model name:
00bx-gemini-web - Base URL:
http://localhost:8080/v1
gemini-web-proxy/
├── server.py # Main proxy server
├── run.py # Startup script
├── requirements.txt # Python dependencies
├── README.md # This file
└── .gitignore # Git ignore rules
OpenCode → HTTP Request → Gemini Proxy → Browser Automation → Gemini Web
← Response Processing ←
- Sessions are stored in
~/.gemini-service/ - Chrome profile data persists between runs
- Login state is maintained automatically
The proxy includes advanced prompt engineering to ensure Gemini properly formats tool calls for OpenCode compatibility.
- Requires active internet connection
- Dependent on Gemini web interface stability
- May need updates if Gemini changes their interface
- Rate limited by Gemini's web interface limits
This is an educational project. Feel free to fork and experiment.
MIT License - See LICENSE file for details
This project is for educational purposes only. Users are responsible for complying with Google's terms of service. The authors are not responsible for any misuse or violations.