General Introduction
Gemini The OpenAI API Agent is a free and server-maintenance-free OpenAI-compatible endpoint. Users can easily deploy it to platforms such as Vercel, Netlify and Cloudflare for personal use. The project aims to facilitate users who need the OpenAI API but don't want the burden of server maintenance.
Function List
- Free OpenAI-compatible endpoints available
- No server maintenance required
- Support for multi-platform deployments (Vercel, Netlify, Cloudflare)
- Provide local development mode
- Support for multiple API base paths (/v1, /edge/v1)
- Compatible with multiple development environments (Node, Deno, Bun)
Using Help
Installation and deployment
- Get Google API key: First, you need a personal Google API key. You can get it using a VPN even if you are located in an unsupported region (e.g. Europe).
- Deployment to Vercel::
- Register or login to your Vercel account.
- Clone the project repository and go to the project directory.
- Using commands
vercel deploy
Deployment. - Local development mode: using commands
vercel dev
Start the local development server.
- Deploy to Netlify::
- Register or log in to your Netlify account.
- Clone the project repository and go to the project directory.
- Using commands
netlify deploy
Deployment. - Local development mode: using commands
netlify dev
Start the local development server.
- Deploying to Cloudflare::
- Register or log in to your Cloudflare Workers account.
- Paste in Cloudflare Workers Playground
src/worker.mjs
and click the "Deploy" button. - Or use the command line tool
wrangler deploy
Deployment. - Local development mode: using commands
wrangler dev
Start the local development server.
Usage
- Configuring the API Address: Enter your API address and Gemini API key in your software settings. the API base path format is
https://your-deployed-site/v1
The - Environment variable settings: For some command-line tools, you may need to set environment variables, for example:
OPENAI_BASE_URL=https://your-deployed-site/v1
OPENAI_API_BASE=https://your-deployed-site/v1
- Using the API: Most of the parameters that apply to the OpenAI API can be used in the Gemini API, except for function calls. You can use the following parameters:
temperature
: Controls the randomness of the generated text, ranging from 0.0 to 2.0 (Gemini supports higher values).completions
: The number of generated texts.embeddings
: Generate an embedded representation of the text.
caveat
- After deployment, accessing the API address directly in a browser will show a 404 error, which is normal because the API is not designed for direct browser access.
- Ensure that the API address and key are properly configured in the software settings.
- Some software tools may not support overriding OpenAI endpoints, but many do, and the settings may be hidden in Advanced Settings or configuration files.