{"slug": "show-hn-turn-your-google-accounts-into-a-free-load-balanced-llm-api-gateway", "title": "Show HN: Turn your Google accounts into a free, load-balanced LLM API gateway", "summary": "OpenGem, an open-source tool, allows users to turn one or more Google accounts into a local, load-balanced LLM API gateway that supports native Gemini, OpenAI, and Anthropic endpoints. The project, designed for personal, educational, and research use, provides a Next.js admin console for managing API keys, monitoring usage, and rotating accounts with automatic quota handling. By running the gateway locally, users can create their own API keys and route requests through multiple Google accounts, effectively creating a free, load-balanced alternative to paid API services.", "body_md": "OpenGem turns one or more Google accounts into a local, load-balanced Gemini gateway. It exposes the native Gemini API shape and also accepts OpenAI Chat Completions and Anthropic Messages requests, so most SDKs can point at your OpenGem server with only a base URL change.\n\nIt is designed for personal, educational and research usage. You run the gateway, connect your own Google accounts, create your own API keys, and monitor usage from the admin console.\n\n**Next.js admin console** with a rebuilt setup wizard, dashboard, logs, API keys, docs, settings and chat playground.**Native Gemini endpoint**:`POST /v1beta/models/{model}:generateContent`\n\n.**OpenAI-compatible endpoint**:`POST /v1/chat/completions`\n\nand`GET /v1/models`\n\n.**Anthropic-compatible endpoint**:`POST /v1/messages`\n\n.**Multi-account rotation** with cooldowns, retries, quota handling and automatic account reactivation.**Local SQLite backend** using Node.js`node:sqlite`\n\n, plus optional Firebase Firestore.**Secure API key store** with hashed keys, JWT admin sessions, rate limiting and Helmet headers.**Streaming support** across Gemini, OpenAI-compatible and Anthropic-compatible surfaces.**Function calling, system prompts, tool payloads, image payloads and request logging**.** No legacy**: the UI is now built through Next static export and served from`public/`\n\nfrontend`out/`\n\n.\n\n- Node.js\n`22.5.0`\n\nor newer - npm\n- At least one Google account\n- Optional: Firebase project, only if you choose Firestore instead of local SQLite\n\n```\ngit clone https://github.com/arifozgun/OpenGem.git\ncd OpenGem\nnpm install\nnpm run build\nnpm start\n```\n\nOpen `http://localhost:3050`\n\n.\n\nOn a fresh install, OpenGem redirects to `/setup`\n\nwhere you choose the database backend and create the admin account. After setup, sign in, connect Google accounts, then create an API key from the dashboard.\n\nFor development:\n\n```\nnpm run dev\n```\n\nThe default server bind is `127.0.0.1:3050`\n\n. Use `HOST=0.0.0.0`\n\nonly when you intentionally expose the process behind your own network controls.\n\nAll endpoints accept the same OpenGem API keys.\n\n```\nAuthorization: Bearer sk-your-api-key\nx-goog-api-key: sk-your-api-key\nx-api-key: sk-your-api-key\n?key=sk-your-api-key\ncurl -X POST \"http://localhost:3050/v1beta/models/gemini-3.1-pro-preview:generateContent?key=sk-your-api-key\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"contents\":[{\"parts\":[{\"text\":\"Hello from OpenGem\"}]}]}'\njs\nimport { GoogleGenAI } from \"@google/genai\";\n\nconst ai = new GoogleGenAI({\n  apiKey: \"sk-your-api-key\",\n  baseUrl: \"http://localhost:3050\",\n});\n\nconst response = await ai.models.generateContent({\n  model: \"gemini-3.1-pro-preview\",\n  contents: \"Explain OpenGem in one paragraph.\",\n});\n\nconsole.log(response.text);\npython\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({\n  apiKey: \"sk-your-api-key\",\n  baseURL: \"http://localhost:3050/v1\",\n});\n\nconst response = await client.chat.completions.create({\n  model: \"gpt-4o\",\n  messages: [{ role: \"user\", content: \"Hello!\" }],\n});\n\nconsole.log(response.choices[0].message.content);\npython\nimport Anthropic from \"@anthropic-ai/sdk\";\n\nconst client = new Anthropic({\n  apiKey: \"sk-your-api-key\",\n  baseURL: \"http://localhost:3050\",\n});\n\nconst response = await client.messages.create({\n  model: \"claude-3-5-sonnet-latest\",\n  max_tokens: 1024,\n  messages: [{ role: \"user\", content: \"Write a short haiku.\" }],\n});\n\nconsole.log(response.content);\n```\n\nThe dashboard includes:\n\n**Overview**: request totals, success rate, active accounts and token usage.** Accounts**: connect Google accounts, reactivate cooled-down accounts and remove accounts.** API Keys**: create, copy-once and revoke gateway keys.** Request Logs**: inspect prompt, response, model, fallback and token metadata.** Documentation**: endpoint quick reference and an API playground.** Chat**: authenticated Gemini chat with streamed responses and thinking sections.** Settings**: database backend switching, credential rotation and privacy mode.\n\nOpenGem stores runtime configuration in `config.json`\n\nafter setup. Local data lives in `data/db.sqlite`\n\nwhen SQLite is selected. Both are ignored by git.\n\nUseful environment variables:\n\n```\nPORT=3050\nHOST=127.0.0.1\nCORS_ORIGIN=https://your-domain.example\n```\n\nWhen using Firebase, paste the Web app config in the setup wizard or in Settings when switching backends.\n\nThe backend is still Express + TypeScript, while the UI is a static Next.js export.\n\n```\nnpm run build:server  # compiles src/ to dist/\nnpm run build:web     # exports app/ to out/\nnpm run build         # runs both\n```\n\n`npm start`\n\nserves API routes and the built Next UI from the same port.\n\n```\nOpenGem/\n├── app/                    # Next.js admin console and setup wizard\n│   ├── assets/             # UI images/icons imported by Next\n│   ├── setup/              # Setup wizard route\n│   └── opengem-console.jsx # Dashboard application\n├── components/ui/          # shadcn-style UI primitives\n├── lib/                    # Frontend utilities\n├── src/\n│   ├── controllers/        # Gemini, OpenAI and Anthropic handlers\n│   ├── middleware/         # Admin auth middleware\n│   └── services/           # Config, database, OAuth, streaming, retry logic\n├── dist/                   # Compiled backend output\n├── out/                    # Next static export output\n├── data/                   # Local SQLite data, ignored by git\n├── config.json             # Runtime config, ignored by git\n├── app.js                  # Production entry for Passenger/cPanel\n└── package.json\n```\n\n- Keep\n`config.json`\n\n,`.env`\n\nand`data/`\n\nprivate. - Place production deployments behind nginx, Cloudflare or another trusted reverse proxy.\n- Keep the Node process bound to loopback unless you know why it must be exposed.\n- Regenerate API keys after switching database backends; raw key material is intentionally not recoverable.\n\nMIT. See [LICENSE](/arifozgun/OpenGem/blob/main/LICENSE).", "url": "https://wpnews.pro/news/show-hn-turn-your-google-accounts-into-a-free-load-balanced-llm-api-gateway", "canonical_source": "https://github.com/arifozgun/OpenGem", "published_at": "2026-05-27 16:01:37+00:00", "updated_at": "2026-05-27 16:16:24.158719+00:00", "lang": "en", "topics": ["ai-tools", "ai-infrastructure", "large-language-models", "generative-ai", "ai-products"], "entities": ["OpenGem", "Gemini", "Google", "OpenAI", "Anthropic", "Next.js", "Firebase", "Node.js"], "alternates": {"html": "https://wpnews.pro/news/show-hn-turn-your-google-accounts-into-a-free-load-balanced-llm-api-gateway", "markdown": "https://wpnews.pro/news/show-hn-turn-your-google-accounts-into-a-free-load-balanced-llm-api-gateway.md", "text": "https://wpnews.pro/news/show-hn-turn-your-google-accounts-into-a-free-load-balanced-llm-api-gateway.txt", "jsonld": "https://wpnews.pro/news/show-hn-turn-your-google-accounts-into-a-free-load-balanced-llm-api-gateway.jsonld"}}