gemini-cli-openai  by GewoonJaap

Expose Gemini CLI as OpenAI API via Cloudflare Workers

created 1 month ago
423 stars

Top 70.7% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a Cloudflare Worker that exposes Google's Gemini models via an OpenAI-compatible API. It's designed for developers and users who want to leverage Gemini's advanced AI capabilities through familiar OpenAI SDKs and tools, offering a seamless integration experience without requiring direct API keys.

How It Works

The worker acts as a proxy, translating OpenAI API requests into the format expected by Google's Code Assist API. It utilizes OAuth2 authentication, managed via Cloudflare Workers KV storage for token caching and refresh, eliminating the need for users to handle API keys directly. This approach allows for low-latency, globally distributed access to Gemini models, supporting features like streaming, tool calling, and multimodal input.

Quick Start & Requirements

  • Install: npm install -g @cloudflare/wrangler
  • Prerequisites: Google Account with Gemini access, Cloudflare Account, Wrangler CLI.
  • Setup: Obtain OAuth2 credentials from gemini-cli, create a KV namespace, configure .dev.vars with credentials, and deploy using wrangler deploy.
  • Docs: https://github.com/GewoonJaap/gemini-cli-openai

Highlighted Details

  • OpenAI-compatible API supporting SDKs and clients like Open WebUI.
  • OAuth2 authentication via Google account, no API keys needed.
  • Supports Gemini 2.5 Pro/Flash with advanced reasoning and tool/function calling.
  • Multimodal (vision) support for image inputs via base64 or URLs.

Maintenance & Community

The project is maintained by GewoonJaap. Contributions are welcome via pull requests.

Licensing & Compatibility

Licensed under the MIT License. Compatible with commercial and closed-source applications.

Limitations & Caveats

Relies on Google's Code Assist API, which may have usage limits and terms of service. Users must ensure compliance with Google's policies. The "thinking" feature might require specific configuration for optimal results.

Health Check
Last commit

3 days ago

Responsiveness

Inactive

Pull Requests (30d)
40
Issues (30d)
8
Star History
447 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.