{"id":22372227,"url":"https://github.com/publicaffairs/openai-gemini","last_synced_at":"2025-05-13T19:06:26.162Z","repository":{"id":223582092,"uuid":"759825266","full_name":"PublicAffairs/openai-gemini","owner":"PublicAffairs","description":"Gemini ➜ OpenAI API proxy. Serverless!","archived":false,"fork":false,"pushed_at":"2025-04-18T19:54:55.000Z","size":40,"stargazers_count":1740,"open_issues_count":4,"forks_count":5270,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-27T19:59:45.873Z","etag":null,"topics":["chatgpt-api","gemini-ai","gemini-pro","gemini-pro-vision","gpt-4-vision-preview","openai","proxy","serverless"],"latest_commit_sha":null,"homepage":"https://my-openai-gemini-demo.vercel.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PublicAffairs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-19T12:07:50.000Z","updated_at":"2025-04-27T10:44:20.000Z","dependencies_parsed_at":"2025-04-25T22:57:14.918Z","dependency_job_id":"d7d92a6f-9188-497a-ab9d-16423a941839","html_url":"https://github.com/PublicAffairs/openai-gemini","commit_stats":null,"previous_names":["publicaffairs/openai-gemini"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PublicAffairs%2Fopenai-gemini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PublicAffairs%2Fopenai-gemini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PublicAffairs%2Fopenai-gemini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PublicAffairs%2Fopenai-gemini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PublicAffairs","download_url":"https://codeload.github.com/PublicAffairs/openai-gemini/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010810,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt-api","gemini-ai","gemini-pro","gemini-pro-vision","gpt-4-vision-preview","openai","proxy","serverless"],"created_at":"2024-12-04T20:34:24.254Z","updated_at":"2025-05-13T19:06:26.136Z","avatar_url":"https://github.com/PublicAffairs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Why\n\nThe Gemini API is [free](https://ai.google.dev/pricing \"limits applied!\"),\nbut there are many tools that work exclusively with the OpenAI API.\n\nThis project provides a personal OpenAI-compatible endpoint for free.\n\n\n## Serverless?\n\nAlthough it runs in the cloud, it does not require server maintenance.\nIt can be easily deployed to various providers for free\n(with generous limits suitable for personal use).\n\n\u003e [!TIP]\n\u003e Running the proxy endpoint locally is also an option,\n\u003e though it's more appropriate for development use.\n\n\n## How to start\n\nYou will need a personal Google [API key](https://makersuite.google.com/app/apikey).\n\n\u003e [!IMPORTANT]\n\u003e Even if you are located outside of the [supported regions](https://ai.google.dev/gemini-api/docs/available-regions#available_regions),\n\u003e it is still possible to acquire one using a VPN.\n\nDeploy the project to one of the providers, using the instructions below.\nYou will need to set up an account there.\n\nIf you opt for “button-deploy”, you'll be guided through the process of forking the repository first,\nwhich is necessary for continuous integration (CI).\n\n\n### Deploy with Vercel\n\n [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/PublicAffairs/openai-gemini\u0026repository-name=my-openai-gemini)\n- Alternatively can be deployed with [cli](https://vercel.com/docs/cli):\n  `vercel deploy`\n- Serve locally: `vercel dev`\n- Vercel _Functions_ [limitations](https://vercel.com/docs/functions/limitations) (with _Edge_ runtime)\n\n\n### Deploy to Netlify\n\n[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/PublicAffairs/openai-gemini\u0026integrationName=integrationName\u0026integrationSlug=integrationSlug\u0026integrationDescription=integrationDescription)\n- Alternatively can be deployed with [cli](https://docs.netlify.com/cli/get-started/):\n  `netlify deploy`\n- Serve locally: `netlify dev`\n- Two different api bases provided:\n  - `/v1` (e.g. `/v1/chat/completions` endpoint)  \n    _Functions_ [limits](https://docs.netlify.com/functions/get-started/?fn-language=js#synchronous-function-2)\n  - `/edge/v1`  \n    _Edge functions_ [limits](https://docs.netlify.com/edge-functions/limits/)\n\n\n### Deploy to Cloudflare\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/PublicAffairs/openai-gemini)\n- Alternatively can be deployed manually pasting content of [`src/worker.mjs`](src/worker.mjs)\n  to https://workers.cloudflare.com/playground (see there `Deploy` button).\n- Alternatively can be deployed with [cli](https://developers.cloudflare.com/workers/wrangler/):\n  `wrangler deploy`\n- Serve locally: `wrangler dev`\n- _Worker_ [limits](https://developers.cloudflare.com/workers/platform/limits/#worker-limits)\n\n\n### Deploy to Deno\n\nSee details [here](https://github.com/PublicAffairs/openai-gemini/discussions/19).\n\n\n### Serve locally - with Node, Deno, Bun\n\nOnly for Node: `npm install`.\n\nThen `npm run start` / `npm run start:deno` / `npm run start:bun`.\n\n\n#### Dev mode (watch source changes)\n\nOnly for Node: `npm install --include=dev`\n\nThen: `npm run dev` / `npm run dev:deno` / `npm run dev:bun`.\n\n\n## How to use\nIf you open your newly-deployed site in a browser, you will only see a `404 Not Found` message. This is expected, as the API is not designed for direct browser access.\nTo utilize it, you should enter your API address and your Gemini API key into the corresponding fields in your software settings.\n\n\u003e [!NOTE]\n\u003e Not all software tools allow overriding the OpenAI endpoint, but many do\n\u003e (however these settings can sometimes be deeply hidden).\n\nTypically, you should specify the API base in this format:  \n`https://my-super-proxy.vercel.app/v1`\n\nThe relevant field may be labeled as \"_OpenAI proxy_\".\nYou might need to look under \"_Advanced settings_\" or similar sections.\nAlternatively, it could be in some config file (check the relevant documentation for details).\n\nFor some command-line tools, you may need to set an environment variable, _e.g._:\n```sh\nOPENAI_BASE_URL=\"https://my-super-proxy.vercel.app/v1\"\n```\n_..or_:\n```sh\nOPENAI_API_BASE=\"https://my-super-proxy.vercel.app/v1\"\n```\n\n\n## Models\n\nRequests use the specified [model] if its name starts with \"gemini-\", \"gemma-\", \"learnlm-\", \nor \"models/\". Otherwise, these defaults apply:\n\n- `chat/completions`: `gemini-2.0-flash`\n- `embeddings`: `text-embedding-004`\n\n[model]: https://ai.google.dev/gemini-api/docs/models/gemini\n\n\n## Built-in tools\n\nTo use the **web search** tool, append \":search\" to the model name\n(e.g., \"gemini-2.0-flash:search\").\n\nNote: The `annotations` message property is not implemented.\n\n\n## Media\n\n[Vision] and [audio] input supported as per OpenAI [specs].\nImplemented via [`inlineData`](https://ai.google.dev/api/caching#Part).\n\n[vision]: https://platform.openai.com/docs/guides/vision\n[audio]: https://platform.openai.com/docs/guides/audio?audio-generation-quickstart-example=audio-in\n[specs]: https://platform.openai.com/docs/api-reference/chat/create\n\n---\n\n## Supported API endpoints and applicable parameters\n\n- [x] `chat/completions`\n\n  Currently, most of the parameters that are applicable to both APIs have been implemented.\n  \u003cdetails\u003e\n\n  - [x] `messages`\n      - [x] `content`\n      - [x] `role`\n          - [x] \"system\" (=\u003e`system_instruction`)\n          - [x] \"user\"\n          - [x] \"assistant\"\n          - [x] \"tool\"\n      - [ ] `name`\n      - [x] `tool_calls`\n  - [x] `model`\n  - [x] `frequency_penalty`\n  - [ ] `logit_bias`\n  - [ ] `logprobs`\n  - [ ] `top_logprobs`\n  - [x] `max_tokens`, `max_completion_tokens`\n  - [x] `n` (`candidateCount` \u003c8, not for streaming)\n  - [x] `presence_penalty`\n  - [x] `response_format`\n      - [x] \"json_object\"\n      - [x] \"json_schema\" (a select subset of an OpenAPI 3.0 schema object)\n      - [x] \"text\"\n  - [x] `seed`\n  - [x] `stop`: string|array (`stopSequences` [1,5])\n  - [x] `stream`\n  - [x] `stream_options`\n      - [x] `include_usage`\n  - [x] `temperature` (0.0..2.0 for OpenAI, but Gemini supports up to infinity)\n  - [x] `top_p`\n  - [x] `tools`\n  - [x] `tool_choice`\n  - [ ] `parallel_tool_calls` (is always active in Gemini)\n\n  \u003c/details\u003e\n- [ ] `completions`\n- [x] `embeddings`\n- [x] `models`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpublicaffairs%2Fopenai-gemini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpublicaffairs%2Fopenai-gemini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpublicaffairs%2Fopenai-gemini/lists"}