GewoonJaap/gemini-cli-openai
Expose Gemini CLI endpoints as OpenAI API with Cloudflare Workers
What it solves
This project provides a proxy layer that transforms Google's Gemini models into OpenAI-compatible endpoints. This allows users to access Gemini's advanced AI capabilities using the familiar OpenAI API patterns, SDKs, and existing AI clients (like Open WebUI or Cline) without needing to change their application logic.
How it works
It is deployed as a Cloudflare Worker, acting as a bridge between the client and Google's APIs. It uses OAuth2 authentication (via the official Gemini CLI) to access Google's models, eliminating the need for traditional API keys. It handles the translation of OpenAI-style requests and responses, including support for streaming, vision, and tool calling.
Who it’s for
Developers and AI enthusiasts who want to use Gemini models within tools and applications that only support the OpenAI API format, or those who want to leverage Google's free tier via the Code Assist API.
Highlights
- OpenAI Compatibility: Drop-in replacement for OpenAI endpoints, supporting official SDKs and libraries.
- OAuth2 Authentication: Uses Google account authentication instead of API keys.
- Real-time Streaming: Supports server-sent events for live responses.
- Advanced Reasoning: Support for Gemini's native thinking capabilities with configurable reasoning budgets and effort levels.
- Auto Model Switching: Automatically falls back from Pro to Flash models when rate limits are encountered.
- Multimodal Support: Handles vision conversations with images via base64 or URLs.
- Tool Calling: Full support for OpenAI-compatible function calling.
- Ledge Deployment: Global edge deployment via Cloudflare Workers for low latency.
Related
- Project
- Project
- Project
- Project