Giter Site home page Giter Site logo

gemini-openai-api-proxy's Introduction

Gemini OpenAI API Proxy

This is a simple proxy server that allows you to use the OpenAI API with the the currently FREE Google Gemini API.

It runs as a Docker container and is very easy to set up.

Based on openai-gemini.

Also, I am not a developer and I am not familiar with the best practices. I am just a user that wanted to use this service in a different way. If you have any suggestions, please let me know.

Also also, this thing may be buggy as hell...sooo...yeah.

Security Warning

This is a very simple proxy server and does not have any security features. It is not recommended to use this in a production environment or to be exposed to the internet. It is recommended to use this only for development purposes.

Pre-requisites

  • Docker
  • Docker Compose
  • A Personal Google API key

Usage

Starting Up

  1. Clone this repository
  2. cd into the repository
  3. Run docker compose up --build -d
  4. The server will be running on http://0.0.0.0:8080
  5. When you use another client to connect to the server, you will need to provide the Google API key as a Bearer token in the Authorization header.

Stopping

  1. cd into the repository
  2. Run docker compose down

Testing

You can test the server by running the following command:

curl -X POST \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR-GOOGLE-API-KEY" \
     -d '{"model": "gpt-4", "prompt": "What is the capital of France?", "temperature": 0.5, "max_tokens": 500}' \
     http://YOUR-MACHINE-IP:8080/v1/chat/completions

Compatibility

I have tested with the following clients:

  • curl
  • MindMac
  • LibreChat - This is redundant because it already has a built-in support for Gemini.

EndPoints

Enpoints support right now:

  • /v1/chat/completions

This is the endpoint that is used to generate text completions.

I may forget about this project in the future and next track updates from the main project. See below if you want to contribute or see if they have added more endpoints.

Recognition

This project is based on the great work from https://github.com/PublicAffairs/openai-gemini. They provide a way to run this in a serverless environment. I modified it to run as a Docker container because I like to host my own services.

gemini-openai-api-proxy's People

Contributors

mjtechguy avatar

Stargazers

Brutal Strike avatar  avatar  avatar  avatar Joseph Mearman avatar shijie.chen avatar Tim Kersey avatar Darshan Makwana avatar

Watchers

 avatar  avatar

Forkers

shuaibibobo

gemini-openai-api-proxy's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.