๐Ÿค–HermesBlog
Hermes Feature Guides ยท Part 18/9/2026

Credential Pools โ€” Rotate API Keys

Credential Pools โ€” Rotate API Keys โ€” easy-to-understand guide based on official docs

Imagine showing up at an amusement park with a single ticket, only to be told mid-ride that your daily quota is exhausted. Frustrating, right? Now imagine holding a stack of tickets โ€” when one runs out, you simply pull out the next. Thatโ€™s exactly what a credential pool does for your AI agent.

Why You Need a Credential Pool

AI providers like OpenRouter and Anthropic enforce rate limits and billing caps on every API key. When you hammer a single key with requests, youโ€™ll inevitably hit 429 (too many requests) or 402 (payment required) errors.

Hermes Agentโ€™s credential pool lets you register multiple keys for the same provider. When one key taps out, the system automatically rotates to a healthy one โ€” your conversation never skips a beat.

Note: A credential pool rotates keys within the same provider. A โ€œfallback providerโ€ switches to a completely different service. The system tries the pool first, and only falls back when all keys are exhausted.

How It Works

Your request
  โ†’ Pick a key from the pool (round-robin / least-used / fill-first / random)
  โ†’ Send to provider
  โ†’ Hit 429 rate limit?
      โ†’ If "usage limit reached" (e.g., ChatGPT's message) โ†’ switch key immediately (retrying is pointless)
      โ†’ If temporary throttle โ†’ retry once; if it fails again, switch keys
      โ†’ All keys exhausted โ†’ activate fallback provider
  โ†’ Hit 402 billing error?
      โ†’ Switch keys immediately (the failed key cools down for 1 hour)
  โ†’ Hit 401 auth expired?
      โ†’ Try refreshing the token (OAuth)
      โ†’ Refresh fails โ†’ switch keys
  โ†’ Success โ†’ continue the conversation

Quick Start

If you already have one API key (in your .env file), Hermes treats it as a single-key pool automatically. To enjoy multi-key rotation, just add more:

hermes auth add openrouter --api-key sk-or-v1-your-second-key

Run the command again with additional keys to grow your pool.

โš ๏ธ Important: Key Rotation Resets Prompt Caching

Providers (Anthropic, OpenAI, OpenRouter) bind prompt caches to specific accounts/API keys. When the system switches to a fresh key, that key has no cache of your conversation โ€” the next request must read the full history at full price. If you later rotate back to a previous key, its cache may still be valid (typically minutes to hours), but every rotation triggers at least one full-price read.

What this means: In long conversations, each key rotation adds a small cost โ€” but the benefit is uninterrupted dialogue. Itโ€™s a trade-off worth understanding.

๐Ÿ’ก Pro Tip

Credential pools shine for providers using API keys. If youโ€™re on Nous Portal (one OAuth token grants access to 300+ models), you usually donโ€™t need a pool โ€” a single Portal account suffices.

Summary

A credential pool gives your AI assistant several โ€œspare keysโ€ โ€” when one hits a limit or billing error, it automatically switches to the next, keeping your conversation flowing. For heavy API key users, this is a genuinely practical feature. Just keep the cache-reset cost in mind and plan your key count wisely for long sessions.

Practical advice: If you frequently hit rate limits, start by adding 2โ€“3 keys. If thatโ€™s still not enough, consider configuring a fallback provider as a safety net.

๐Ÿ“– Official Docs

This article is based on the official Hermes Agent documentation:Official docs โ€บ user-guide/checkpoints-and-rollback