gemini-openai-proxy  by zhu327

API proxy for OpenAI to Google Gemini protocol conversion

created 1 year ago
674 stars

Top 51.2% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a proxy server that translates requests from the OpenAI API protocol to the Google Gemini Pro protocol. It allows applications designed for OpenAI's API to seamlessly interact with Google's Gemini models, supporting chat completions and embeddings. The target audience includes developers who want to leverage Gemini's capabilities within existing OpenAI-based workflows or applications.

How It Works

The proxy acts as an intermediary, receiving requests formatted for OpenAI's API (e.g., /v1/chat/completions, /v1/embeddings). It then maps these requests, including model names and parameters, to their corresponding Gemini API equivalents. The core advantage is enabling compatibility without modifying applications that are already integrated with the OpenAI API specification.

Quick Start & Requirements

  • Install/Run: docker run --restart=unless-stopped -it -d -p 8080:8080 --name gemini zhu327/gemini-openai-proxy:latest
  • Prerequisites: Google AI Studio API Key.
  • Setup: Minimal, primarily requires Docker and a Google AI Studio API key.
  • Docs: https://ai.google.dev/gemini-api/docs/openai (for official Gemini OpenAI compatibility)

Highlighted Details

  • Supports Chat Completion and Embeddings endpoints.
  • Handles model mapping (e.g., gpt-4 to gemini-1.5-flash-002, gpt-4-vision-preview to gemini-1.5-flash-latest or gemini-1.5-pro-latest).
  • Allows direct model referencing by disabling model mapping via DISABLE_MODEL_MAPPING=1.
  • Supports multimodal inputs for vision models.

Maintenance & Community

  • The project is maintained by zhu327.
  • No specific community channels (Discord/Slack) or roadmap are explicitly mentioned in the README.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive for commercial use and integration with closed-source applications.

Limitations & Caveats

Google AI Studio now offers its own official OpenAI-compatible API endpoint, which may supersede the need for this proxy. The README notes that users are recommended to use the official compatibility API.

Health Check
Last commit

1 month ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
36 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.