Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

openrouter-load-balancing

Skill by jeremylongshore

Distributes OpenRouter API requests across multiple keys and models for higher throughput. Built for developers scaling past single-key rate limits or building high-availability systems.

  • Score 76
  • 3k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install openrouter-load-balancing

Built from the published package, never by AI.

git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-load-balancing ~/.claude/skills/openrouter-load-balancing

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install openrouter-load-balancing in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

The openrouter-load-balancing skill covers distributing OpenRouter requests across multiple API keys to scale beyond single-key rate limits. It provides a round-robin KeyPool that skips keys after three consecutive errors and recovers them after a 60 second cooldown. A balanced_completion() helper retries on RateLimitError with the next healthy key.

It also covers concurrent batch requests with an asyncio.Semaphore, provider-level routing through OpenRouter's provider order and fallback options, and per-key quota checks via the auth key endpoint. The skill notes that OpenRouter offers server-side load balancing via provider routing and the :nitro variant. It is aimed at developers building high-throughput or high-availability systems on OpenRouter. It assumes Python with the OpenAI SDK and requests installed.

Written from the project's SKILL.md and checked against it.

What it can do

  • KeyPoolRound-robin API key rotation with a circuit breaker and 60 second recovery cooldown.
  • balanced_completion()Sends chat requests and retries with the next healthy key on RateLimitError.
  • parallel_completions()Processes multiple prompts concurrently, capped by an asyncio.Semaphore.
  • Provider-level load balancingPasses a provider order and allow_fallbacks so OpenRouter can spread a model across providers.
  • check_rate_limits()Reads rate limit and credit usage for each key from GET /api/v1/auth/key.

What you need

  • Two or more OpenRouter API keys
  • OPENROUTER_API_KEY for the concurrent processing pattern
  • Python 3.8+
  • OpenAI SDK and requests packages
  • Adequate credits on every key in the pool

Try asking

  • Set up a key pool and send my chat requests across it.
  • Run these 20 prompts concurrently with a concurrency limit of 3.
  • Check the rate limit and credit usage for each of my OpenRouter keys.

Good to know

  • Round-robin rotation does not account for in-flight requests, according to the error table.
  • If all keys are unhealthy, the pool returns a key anyway.
  • Code examples are in Python.

Security check

B
  • Allowed to use Write, Edit without limitsIn SKILL.md

Checked automatically: skills/.curated/openrouter-load-balancing/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

Allowed tools: ReadWriteEditGrepBash(python3:*)

Alternatives to openrouter-load-balancing

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

openrouter-load-balancing: common questions

Does this need more than one OpenRouter key?

The KeyPool pattern is built around two or more keys. The source says each key gets its own quota, so more keys raise the effective rate limit.

What happens when a key keeps failing?

After 3 errors the key is marked unhealthy. It recovers after a 60 second cooldown.

Does it cover provider routing?

Yes. It passes a provider order with allow_fallbacks so OpenRouter can spread a model across providers such as Anthropic, AWS Bedrock and GCP Vertex.

How do I install openrouter-load-balancing?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is openrouter-load-balancing free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is openrouter-load-balancing safe to use?

It scores 76 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.

What are alternatives to openrouter-load-balancing?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

openrouter-load-balancing Install

Add to stack

Loading.