惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
博客园_首页
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
小众软件
小众软件
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Recent Announcements
Recent Announcements
M
MIT News - Artificial intelligence
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog

Hacker News - Newest: "LLM"

GitHub - lechmazur/position_bias: A benchmark for testing whether LLM judges keep the same preference when two lightly edited versions of the same story are shown in opposite orders. Flex routing (EU and EFTA) Dark Factories: Retooling for LLM Velocity Ask HN: What would be the impact of a LLM output injection attack? GitHub - Oaklight/llm-rosetta: Production-ready LLM API translation layer for Python — bidirectional conversion between OpenAI, Anthropic & Google formats via hub-and-spoke IR. Optional API gateway. Streaming & non-streaming. Zero core deps. Contributions welcome! GitHub - browser-use/browser-harness: Self-healing browser harness that enables LLMs to complete any task. GitHub - moeen-mahmud/remen: Remen turns thoughts into something you can return to Analyzing 156 LLM Launch Posts on Hacker News ChatGPT vs Gemini vs Claude: The Best LLM Subscription You Should Buy GitHub - salaamalykum/quran-semantic-search: High-density RAG Semantic Search Engine & Quran Corpus (GEO/SEO Architecture) GitHub - NVIDIA/TensorRT-LLM: TensorRT LLM provides users with an easy-to-use Python API to define Large Language Models (LLMs) and supports state-of-the-art optimizations to perform inference efficiently on NVIDIA GPUs. TensorRT LLM also contains components to create Python and C++ runtimes that orchestrate the inference execution in a performant way. The State of LLM Bug Bounties in 2026 Operational Readiness Criteria for Tool-Using LLM Agents Meshcore: Architecture for a Decentralized P2P LLM Inference Network How an LLM becomes more coherent as we train it GitHub - seetrex-ai/laimark GitHub - Jossifresben/BibCrit: AI-assited biblical textual criticism GitHub - wastedcode/memex: File system based wiki, maintained by Claude 99helpers.com GitHub - cliver-project/AITrigram GitHub - unbody-io/adapt: A self-evolving memory layer for AI agents. GitHub - hb20007/awesome-gen-ai-fails: A list of incidents where reliance on generative AI and LLMs resulted in harm to companies, individuals, or society GitHub - nevenkordic/localmind: Run any local LLM with persistent memory and context. CLI agent over Ollama with SQLite-backed hybrid recall. No cloud. Ask HN: What are the machine requirements for a LLM like Llama-3.1-8B? Faster LLM Inference via Sequential Monte Carlo grpo explained: group relative policy optimization for llm finetuning - cgft Stop comparing price per million tokens: the hidden LLM API costs · TensorZero Andrej Karpathy's LLM Wiki Is a Bad Idea GitHub - GG-QandV/mnemostroma: Offline RAM-first cognitive leer/coprocessor for AI agents and robotics. Solves "Context Abandonment" with 20-80ms latency using a dual-thread biomimetic memory architecture (ONNX + SQLite WAL). mempalace/agent at agent · skorotkiewicz/mempalace
GitHub - p32929/rotato: A robust Node.js proxy server tha...
heliskyr2 · 2026-05-03 · via Hacker News - Newest: "LLM"

openai-gemini-api-key-rotator

Node.js proxy server for automatic API key rotation across multiple LLM providers (OpenAI, Gemini, Groq, OpenRouter, etc.). Includes a built-in Telegram bot for chatting with any model. Zero external dependencies.

Features

  • Automatic Key Rotation: Rotates keys on configurable status codes (default: 429)
  • Universal API Compatibility: Works with any OpenAI or Gemini-compatible API
  • Streaming Support: Full pass-through for SSE/streaming responses ("stream": true)
  • Smart Key Shuffling: Avoids recently failed keys using intelligent rotation
  • Key Management: Reorder keys, disable/enable individual keys or entire providers
  • Key Usage Tracking: See how many times each key has been used (in-memory)
  • Live Key Validation: API keys automatically tested before saving
  • Hot Configuration: Add, edit, rename, or delete providers without restart
  • Custom Status Codes: Configure which HTTP codes trigger rotation per request
  • Optional Access Control: Secure providers with access keys requiring authorization
  • Default Models: Pre-save models for easy curl command generation
  • Modern Admin Panel: Dark/light theme support for comfortable management
  • Request Monitoring: Last 100 requests logged with key usage details (which key succeeded/failed)
  • File Logging: All API requests logged to logs.jsonl with debounced writes for performance
  • Telegram Bot: Chat with any configured model directly from Telegram (text, images, image generation)

Quick Start

git clone https://github.com/p32929/openai-gemini-api-key-rotator.git
cd openai-gemini-api-key-rotator
cp .env.example .env
# Edit .env: Set PORT and ADMIN_PASSWORD
npm start

Access admin panel: http://localhost:8990/admin

Configuration

PORT=8990
ADMIN_PASSWORD=your-secure-password

Visit http://localhost:8990/admin to configure your providers and start using the API.

Telegram Bot

Chat with any of your configured models directly from Telegram. Set it up from the admin panel (Settings icon) or add these to your .env:

TELEGRAM_BOT_TOKEN=your-bot-token-from-botfather
TELEGRAM_ALLOWED_USERS=123456789,987654321

Leave TELEGRAM_ALLOWED_USERS empty to allow anyone.

Setup

  1. Open Telegram and message @BotFather
  2. Send /newbot and follow the prompts to create your bot
  3. Copy the bot token
  4. Go to the admin panel → click the Settings icon (next to theme toggle) → paste the token and save
  5. To find your User ID, message @userinfobot on Telegram

Bot Commands

Command Description
/models Select a provider and model (interactive buttons)
/clear Clear conversation history
/logs View recent API logs with details
/status Show current model and history size
/help Show available commands

Bot Features

  • Model Selection: Browse providers → fetch available models → select, or type a custom model name
  • Conversation History: Maintains up to 50 messages per user
  • Image Input: Send photos to vision-capable models (auto-converts to base64)
  • Image Generation: Supports image gen models — renders base64 and URL responses as Telegram photos
  • All requests go through the proxy, so you get key rotation, access key validation, and logging automatically

API Usage Examples

OpenAI-Compatible APIs

curl -X POST "http://localhost:8990/groq/chat/completions" \
  -H "Authorization: Bearer [STATUS_CODES:429][ACCESS_KEY:your-access-key]" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-120b",
    "messages": [
      {
        "role": "user",
        "content": "Hello! Please say hello back."
      }
    ]
  }'

Gemini-Compatible APIs

curl -X POST "http://localhost:8990/gemini/models/gemini-2.5-flash:generateContent" \
  -H "x-goog-api-key: [STATUS_CODES:429][ACCESS_KEY:your-access-key]" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Hello! Please say hello back."
          }
        ]
      }
    ]
  }'

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.

File Logging

All API requests are automatically logged to logs.jsonl in the project root. Writes are debounced (5 seconds) for performance — multiple requests within the window are batched into a single disk write. Each line is a JSON object:

{"timestamp":"2026-04-01T15:33:15.221Z","requestId":"h8j4pqqot","method":"POST","endpoint":"/chat/completions","provider":"cerebras","status":200,"responseTime":497,"error":null,"clientIp":"::ffff:127.0.0.1","keyUsed":"csk-...9ft2","failedKeys":[]}

Changelog

Version 6.x.x

  • Telegram Bot — chat with any model from Telegram with interactive model selection, conversation history, image input/output support
  • File Logging — all API requests logged to logs.jsonl with debounced writes
  • Settings Panel — gear icon in admin panel for configuring Telegram bot
  • Admin panel improvements: password input autofocus, logs sorted newest-first, disabled providers shown at bottom

Version 5.x.x

  • Streaming support — SSE responses piped through without buffering
  • Disable/enable individual API keys (persisted via ~ prefix in .env)
  • Disable/enable entire providers (_DISABLED=true in .env)
  • Reorder API keys to control rotation priority
  • Per-key usage tracking displayed in admin panel
  • Logs now show which key was used and which keys failed per request

Version 4.x.x

  • Dynamic status code configuration via headers
  • Optional ACCESS_KEY for provider-level security
  • Enhanced admin panel with improved UX
  • Auto-generated curl commands reflect the new API format

Breaking Changes:

  • API endpoints changed from /provider/v1/* to /provider/*
  • Version suffix (/v1) now derived from provider's base URL configuration
  • Migration: Simply copy the curl command from admin panel to see the new format in action

Version 3.x.x

  • Enhanced admin panel with better UI/UX
  • No breaking changes

Version 2.x.x

  • Added admin panel for dynamic provider management
  • No breaking changes

Version 1.x.x

  • Basic API key rotation
  • OpenAI and Gemini-compatible API support

Screenshot

Image Image Image

Contributing

Contributions 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.

Before submitting a pull request, please:

  1. Create an issue describing the feature or bug fix you'd like to work on
  2. Wait for discussion and approval to ensure alignment with project goals
  3. Fork the repository and create your feature branch
  4. Submit your pull request with a clear description of changes

This approach helps avoid duplicate efforts and ensures smooth collaboration. Thank you for considering contributing!

License

This project is licensed under the MIT License - see the LICENSE file for details.