https://github.com/PublicAffairs/openai-gemini Skip to content Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} PublicAffairs / openai-gemini Public * Notifications * Fork 5 * Star 6 * Gemini OpenAI API proxy. Serverless! my-openai-gemini-demo.vercel.app/ License MIT license 6 stars 5 forks Branches Tags Activity Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights PublicAffairs/openai-gemini This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 9 Commits .github/workflows .github/ workflows api api netlify netlify public public src src .editorconfig .editorconfig .gitignore .gitignore LICENSE LICENSE netlify.toml netlify.toml readme.MD readme.MD vercel.json vercel.json wrangler.toml wrangler.toml View all files Repository files navigation * README * MIT license Why The Gemini API is free, but there are many tools that work exclusively with the OpenAI API. This project provides a personal OpenAI-compatible endpoint for free. Serverless? Although it runs in the cloud, it does not require server maintenance. It can be easily deployed to various providers for free (with generous limits suitable for personal use). Tip Running the proxy endpoint locally is also an option, though it's more appropriate for development use. How to start You will need a personal Google API key. Important Even if you are located outside of the supported regions (e.g., in Europe), it is still possible to acquire one using a VPN. Deploy the project to one of the providers, using the instructions below. You will need to set up an account there. If you opt for "button-deploy", you'll be guided through the process of forking the repository first, which is necessary for continuous integration (CI). Deploy with Vercel Deploy with Vercel * Alternatively can be deployed with cli: vercel deploy * Serve locally: vercel dev * Vercel Functions limitations (with Edge runtime) Deploy to Netlify Deploy to Netlify * Alternatively can be deployed with cli: netlify deploy * Serve locally: netlify dev * Two different api bases provided: + /v1 (e.g. /v1/chat/completions endpoint) Functions limits + /edge/v1 Edge functions limits Deploy to Cloudflare Deploy to Cloudflare Workers * Alternatively can be deployed manually pasting content of src/ worker.mjs to https://workers.cloudflare.com/playground (see there Deploy button). * Alternatively can be deployed with cli: wrangler deploy * Serve locally: wrangler dev * Worker limits How to use Note Not all tools allows overriding the OpenAI endpoint, but many do (however these settings can sometimes be deeply hidden). Use the endpoint address wherever you can specify it. The relevant field may be labeled as "OpenAI proxy". You might need to look under "Advanced settings" or similar sections. Or in some config file. For some command-line tools, you may need to set an environment variable, e.g.: set OPENAI_BASE_URL=https://my-super-proxy.vercel.app/v1 ..or: set OPENAI_API_BASE=https://my-super-proxy.vercel.app/v1 --------------------------------------------------------------------- Possible further development * [*] chat/completions Currently, most of the parameters that are applicable to both APIs have been implemented, with the exception of function calls. + [*] messages o [*] content o [*] role # [*] system (=>user) # [*] user # [*] assistant # [ ] tool (v1beta) o [ ] name o [ ] tool_calls + [*] model (value ignored, autoselect "gemini-pro", or "-vision" for "gpt-4-vision-preview" request) + [ ] frequency_penalty + [ ] logit_bias + [ ] logprobs + [ ] top_logprobs + [*] max_tokens + [*] n (candidateCount <8) n.b.: atm api does not accept >1 + [ ] presence_penalty + [ ] response_format + [ ] seed + [*] stop: string|array (stopSequences [1,5]) + [*] stream + [*] temperature (0.0..1.0) o [ ] <0, >1..2 + [*] top_p + [ ] tools (v1beta) + [ ] tool_choice (v1beta) + [ ] user * [ ] completions * [ ] embeddings * [ ] models About Gemini OpenAI API proxy. Serverless! my-openai-gemini-demo.vercel.app/ Topics serverless proxy openai chatgpt-api gemini-ai Resources Readme License MIT license Activity Custom properties Stars 6 stars Watchers 1 watching Forks 5 forks Report repository Languages * JavaScript 100.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.