{"id":28308651,"url":"https://github.com/reinskywalker/cy-gemma-server","last_synced_at":"2025-10-27T04:17:04.121Z","repository":{"id":293977641,"uuid":"985339763","full_name":"reinskywalker/cy-gemma-server","owner":"reinskywalker","description":" it's an API server. It juggles Google Gemini API keys. You throw in a bunch of them and it'll figure out which ones still have a pulse.","archived":false,"fork":false,"pushed_at":"2025-05-18T09:15:11.000Z","size":937,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T01:36:48.692Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reinskywalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-05-17T14:57:33.000Z","updated_at":"2025-05-18T09:15:49.000Z","dependencies_parsed_at":"2025-05-18T10:34:28.819Z","dependency_job_id":null,"html_url":"https://github.com/reinskywalker/cy-gemma-server","commit_stats":null,"previous_names":["reinskywalker/cy-gemma-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reinskywalker/cy-gemma-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinskywalker%2Fcy-gemma-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinskywalker%2Fcy-gemma-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinskywalker%2Fcy-gemma-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinskywalker%2Fcy-gemma-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reinskywalker","download_url":"https://codeload.github.com/reinskywalker/cy-gemma-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinskywalker%2Fcy-gemma-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010516,"owners_count":26084757,"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-10-12T02:00:06.719Z","response_time":53,"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":[],"created_at":"2025-05-24T08:08:40.385Z","updated_at":"2025-10-12T06:35:31.644Z","avatar_url":"https://github.com/reinskywalker.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# cy-gemma-server\n\nSo this thing right here, it's an API server. It juggles Google Gemini API keys. You throw in a bunch of them and it'll figure out which ones still have a pulse.\n\nBuilt on Next.js (app router) with zero intention of looking pretty. Connects to MongoDB, filters crap keys, stores the good ones, and hands them out one by one based on how much abuse they've taken.\n\n---\n\n## What It Does (Barely)\n\n- `GET /api/ai/key?secret=...`  \n  Gives you the least-abused key that still responds to \"Hi\".  \n  Requires secret or it won’t talk to you.  \n  Picks based on `hit` count, so yeah, round robin-ish.\n\n- `POST /api/ai/key`  \n  Feed it a single key (plus your secret)  \n  It'll check if the key's alive  \n  If it's not, you'll be ignored.  \n  If it's a dupe, also ignored.\n\n- `GET /api/ai/keys?secret=...`  \n  Just dumps all keys in your DB sorted by usage.  \n  Nothing fancy, no hiding.\n\n- `POST /api/ai/keys`  \n  Throw in an array of keys. It'll silently validate one by one.  \n  Junk keys get silently trashed.  \n  Duplicates are ignored.  \n  Returns what it kept.\n\n---\n\n## How Keys Are Validated\n\nThere’s a `validate()` helper. It says \"Hi\" to Gemini with each key.\n\nIf Gemini replies? Cool.  \nIf it doesn’t? Into the bin.\n\nNo retries. No mercy.  \nAlso logs the first 10 characters of each key, because full keys are none of your business.\n\n---\n\n## Tech Used (because you’ll ask)\n\n- Next.js 14  \n- MongoDB (via Mongoose)  \n- TypeScript, obviously  \n- Axios to bother Google's endpoint  \n- Tailwind is there but probably irrelevant here  \n- Styled-components, because why not\n\n---\n\n## Setup (if you’re into that)\n\nCreate a `.env` file like this:\n\n```\n\nMONGODB\\_URI=mongodb+srv://something\nGEMINI\\_API\\_KEY=whatever-you-call-secret\nGEMINI\\_SECRET=post-secret-thing\n\n```\n\nThen run it:\n\n```\n\nnpm install\nnpm run dev\n\n```\n\nGood luck.\n\n---\n\n## Notes You’ll Ignore\n\n- If you abuse `GET /api/ai/key`, it’ll cycle keys with the lowest `hit`. No rate limit here, congrats.\n- No logging middleware. If it breaks, check your terminal. That’s all you get.\n- The secret checks are there just to keep randoms out. This ain't production-grade auth. You’ve been warned.\n- No Swagger docs. Read the code. You’re a dev, not a customer.\n\n---\n\n## Final Thought\n\nYes, it works. No, it won’t scale unless you baby it.  \nYou wanna scale? Rate limit it yourself, fix the error handling, add Redis, cry a little, then try again.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinskywalker%2Fcy-gemma-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freinskywalker%2Fcy-gemma-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinskywalker%2Fcy-gemma-server/lists"}