KeyStream-Gemini is a high-performance reverse proxy designed to optimize Google Gemini API usage through intelligent key rotation and real-time monitoring. It ensures high availability and bypasses rate limits by dynamically managing a pool of API keys.

- Dynamic Key Rotation: Automatically cycles through API keys to maintain continuous service availability.
- Real-time Observability: Web-based dashboard featuring traffic metrics, key health status, and backend logs.
- Model Synchronization: Automated discovery and update of available Gemini models via Google API.
- Native Streaming Support: Optimized handling of Server-Sent Events (SSE) for fluid AI interactions.
- OpenAI Compatibility: Standardized interface for seamless integration with tools like Continue.dev.
- Node.js 18 or higher
- npm or Yarn
- Google Gemini API Keys
-
Clone the repository
git clone https://github.com/billtruong003/KeyStream-Gemini.git cd KeyStream-Gemini -
Install dependencies
npm install
-
Initialize the key store Create a
keys.jsonfile in the root directory:- macOS/Linux:
echo "[]" > keys.json - Windows:
Set-Content -Path ".\keys.json" -Value "[]"
- macOS/Linux:
-
Start the server
npm start
The gateway will be accessible at
http://localhost:13337.
KeyStream-Gemini provides an OpenAI-compatible endpoint. To integrate with your AI tools, use the following configuration:
- Base URL:
http://localhost:13337/v1 - API Key:
sk-keystream(The proxy handles actual authentication)
models:
- name: "⚡ gemini-3-pro-preview"
model: "gemini-3-pro-preview"
provider: openai
apiBase: "http://localhost:13337/v1"
apiKey: "sk-local-proxy"
contextLength: 128000To run the server in development mode with auto-reload:
npm install -g nodemon
nodemon server.jsDistributed under the MIT License.
1. Why should I use KeyStream-Gemini instead of Cursor Pro or other proxy tools?
- Plug-and-Play: This is a "5-minute setup" solution. While other tools might require complex Terminal configurations or DevOps knowledge, KeyStream-Gemini is designed for developers who want to focus on coding (like Game Devs or Web Devs) rather than environment troubleshooting. Just
npm install/startand you're good to go. - Total Control: This is a Local Proxy. Your keys and data stay on your machine. You aren't dependent on any third-party middleman servers that might go down or lag.
- Stability: If an error occurs, you can see exactly why in your own logs and fix it instantly.
2. How does this handle Google's strict Rate Limits (Quota)?
- The core of this tool is Intelligent Key Rotation.
- Pro Tip: By setting up a few "clone" accounts and enabling the Google Cloud Billing (to claim the $300 Free Trial), you can bypass the standard free tier limits. With a pool of 5-10 "Billing-enabled" keys, you will have thousands of requests per day—more than enough to build complex features all day long without hitting a wall.
3. Is my data secure?
- 100% Secure. Since the proxy runs locally on your hardware, your API keys (stored in
keys.json) and your source code never leave your environment. Data is sent directly from your machine to Google’s official APIs.
4. Can I use this with other AI tools besides Continue.dev?
- Yes! Because KeyStream-Gemini provides an OpenAI-compatible endpoint, you can use it with any tool that allows a custom
apiBaseorbaseURL, including VS Code extensions, CLI tools, or even your own custom Python/Node.js scripts.
5. Why did you build this instead of using existing open-source proxies?
- I built this for myself first. I tried several complex open-source proxies, but they often took hours to set up, crashed unexpectedly, or were too "heavy" for simple local use. I wanted something lightweight that I could fix myself if it broke. I shared it because my friends found it useful, and I hope you do too!
If you have ideas for new features or "underground" tips for optimizing Gemini usage, feel free to open an Issue or a Pull Request!