{"id":30020425,"url":"https://github.com/p32929/openai-gemini-api-key-rotator","last_synced_at":"2025-11-02T17:01:48.632Z","repository":{"id":307633800,"uuid":"1030187131","full_name":"p32929/openai-gemini-api-key-rotator","owner":"p32929","description":"A robust Node.js proxy server that automatically rotates API keys for Gemini and OpenAI APIs when rate limits (429 errors) are encountered. Built with zero dependencies and comprehensive logging.","archived":false,"fork":false,"pushed_at":"2025-08-01T08:18:59.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-01T10:43:00.395Z","etag":null,"topics":["api-key","api-key-rotation","gemini","google-gemini","groq","javascript","js","llm","llm-api","multiple-api-keys","no-dependencies","node","nodejs","ollama","open-source","openai","openai-chatgpt","openrouter","rotate-api-key"],"latest_commit_sha":null,"homepage":"","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/p32929.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":"2025-08-01T08:18:12.000Z","updated_at":"2025-08-01T08:41:04.000Z","dependencies_parsed_at":"2025-08-01T10:43:01.473Z","dependency_job_id":"7424c8ce-0d10-4e3f-8522-b1ecbc196e50","html_url":"https://github.com/p32929/openai-gemini-api-key-rotator","commit_stats":null,"previous_names":["p32929/openai-gemini-api-key-rotator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/p32929/openai-gemini-api-key-rotator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2Fopenai-gemini-api-key-rotator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2Fopenai-gemini-api-key-rotator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2Fopenai-gemini-api-key-rotator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2Fopenai-gemini-api-key-rotator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p32929","download_url":"https://codeload.github.com/p32929/openai-gemini-api-key-rotator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2Fopenai-gemini-api-key-rotator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269005883,"owners_count":24343406,"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","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api-key","api-key-rotation","gemini","google-gemini","groq","javascript","js","llm","llm-api","multiple-api-keys","no-dependencies","node","nodejs","ollama","open-source","openai","openai-chatgpt","openrouter","rotate-api-key"],"created_at":"2025-08-06T02:01:55.748Z","updated_at":"2025-11-02T17:01:48.618Z","avatar_url":"https://github.com/p32929.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openai-gemini-api-key-rotator\n\nNode.js proxy server for automatic API key rotation across multiple LLM providers (OpenAI, Gemini, Groq, OpenRouter, etc.). ***Zero external dependencies***.\n\n## Features\n\n- **Automatic Key Rotation**: Rotates keys on configurable status codes (default: 429)\n- **Universal API Compatibility**: Works with any OpenAI or Gemini-compatible API\n- **Smart Key Shuffling**: Avoids recently failed keys using intelligent rotation\n- **Live Key Validation**: API keys automatically tested before saving\n- **Hot Configuration**: Add, edit, rename, or delete providers without restart\n- **Custom Status Codes**: Configure which HTTP codes trigger rotation per request\n- **Optional Access Control**: Secure providers with access keys requiring authorization\n- **Default Models**: Pre-save models for easy curl command generation\n- **Modern Admin Panel**: Dark/light theme support for comfortable management\n- **Request Monitoring**: Last 100 requests logged in memory with details\n\n## Quick Start\n\n```bash\ngit clone https://github.com/p32929/openai-gemini-api-key-rotator.git\ncd openai-gemini-api-key-rotator\ncp .env.example .env\n# Edit .env: Set PORT and ADMIN_PASSWORD\nnpm start\n```\n\nAccess admin panel: `http://localhost:8990/admin`\n\n## Configuration\n\n```env\nPORT=8990\nADMIN_PASSWORD=your-secure-password\n```\n\nVisit http://localhost:8990/admin to configure your providers and start using the API.\n\n## API Usage Examples\n\n### OpenAI-Compatible APIs\n```bash\ncurl -X POST \"http://localhost:8990/groq/chat/completions\" \\\n  -H \"Authorization: Bearer [STATUS_CODES:429][ACCESS_KEY:your-access-key]\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"openai/gpt-oss-120b\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": \"Hello! Please say hello back.\"\n      }\n    ]\n  }'\n```\n\n### Gemini-Compatible APIs\n```bash\ncurl -X POST \"http://localhost:8990/gemini/models/gemini-2.5-flash:generateContent\" \\\n  -H \"x-goog-api-key: [STATUS_CODES:429][ACCESS_KEY:your-access-key]\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"contents\": [\n      {\n        \"parts\": [\n          {\n            \"text\": \"Hello! Please say hello back.\"\n          }\n        ]\n      }\n    ]\n  }'\n```\n\n**Note**: Replace `your-access-key` with your provider's ACCESS_KEY if configured. If no ACCESS_KEY is set for the provider, you can omit the `[ACCESS_KEY:...]` parameter entirely.\n\n## Changelog\n\n### Version 4.x.x\n- Dynamic status code configuration via headers\n- Optional ACCESS_KEY for provider-level security\n- Enhanced admin panel with improved UX\n- Auto-generated curl commands reflect the new API format\n\n**Breaking Changes**:\n- API endpoints changed from `/provider/v1/*` to `/provider/*`\n- Version suffix (`/v1`) now derived from provider's base URL configuration\n- **Migration**: Simply copy the curl command from admin panel to see the new format in action\n\n### Version 3.x.x\n- Enhanced admin panel with better UI/UX\n- No breaking changes\n\n### Version 2.x.x\n- Added admin panel for dynamic provider management\n- No breaking changes\n\n### Version 1.x.x\n- Basic API key rotation\n- OpenAI and Gemini-compatible API support\n\n### Screenshot\n\n\u003cimg width=\"3024\" height=\"1714\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/f265cc8f-941e-43e4-998e-c713dacfd248\" /\u003e\n\n\u003cimg width=\"3024\" height=\"3652\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/21bd17c3-763c-482a-97c0-115d8b395d65\" /\u003e\n\n\u003cimg width=\"3024\" height=\"1714\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/0de6654d-eea8-49ad-9c19-7f2a799b604e\" /\u003e\n\n## Contributing\n\nContributions are warmly welcomed and greatly appreciated! Whether it's a bug fix, new feature, or improvement, your input helps make this project better for everyone.\n\n**Before submitting a pull request**, please:\n1. Create an issue describing the feature or bug fix you'd like to work on\n2. Wait for discussion and approval to ensure alignment with project goals\n3. Fork the repository and create your feature branch\n4. Submit your pull request with a clear description of changes\n\nThis approach helps avoid duplicate efforts and ensures smooth collaboration. Thank you for considering contributing!\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp32929%2Fopenai-gemini-api-key-rotator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp32929%2Fopenai-gemini-api-key-rotator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp32929%2Fopenai-gemini-api-key-rotator/lists"}