Skip to content

feat: add support for API key pooling and intelligent rotation#341

Open
jsonetech wants to merge 2 commits intoAlishahryar1:mainfrom
jsonetech:feat/nvidia-nim-key-pooling
Open

feat: add support for API key pooling and intelligent rotation#341
jsonetech wants to merge 2 commits intoAlishahryar1:mainfrom
jsonetech:feat/nvidia-nim-key-pooling

Conversation

@jsonetech
Copy link
Copy Markdown

Summary

This PR implements a robust API key pooling and rotation system, specifically designed to help users maximize their rate limits on providers like NVIDIA NIM.

Changes

  • KeyPool Manager: Introduced a new KeyPool class in providers/pool.py that handles:
    • Intelligent Rotation: Picks the least recently used key to balance load.
    • Reactive Blocking: Automatically detects 429 (Rate Limit) errors and skips blocked keys until they are ready.
  • Settings Support: Updated config/settings.py to allow NVIDIA_NIM_API_KEY to be a comma-separated list.
  • Provider Integration: Updated OpenAIChatTransport to support the pool, allowing it to swap keys dynamically per request.
  • Catalog Update: Added pool_attr to ProviderDescriptor for clean integration of new poolable providers.

Why

Users of free NVIDIA NIM accounts often hit rate limits quickly. This feature allows them to pool multiple keys and use them as a single, larger quota, significantly improving the stability of the proxy.

Testing

  • Verified with unit tests for KeyPool rotation and blocking logic.
  • Smoke tested the integration with the NvidiaNimProvider.

jsonetech added 2 commits May 4, 2026 15:27
This change allows providers (like NVIDIA NIM) to use a pool of API keys. It includes a KeyPool manager that handles intelligent rotation, skips keys that hit rate limits, and picks the best available key for each request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant