Support multiple API keys per provider with fallback logic #923

Closed
opened 2026-02-16 17:28:47 -05:00 by yindo · 2 comments
Owner

Originally created by @FabyoSK on GitHub (Jul 25, 2025).

Originally assigned to: @thdxr on GitHub.

Problem

Under heavy usage, multiple Opencode instances hit rate limits, causing failures and interrupting sessions.

Proposed Solution

Allow users to configure multiple API keys for each LLM provider and automatically fallback to the next key when the current one returns a rate limit error (e.g. HTTP 429) or other failures.

On each request:

  1. Try with the primary key.
  2. If rate‑limited or failed, automatically retry with the next key.
  3. Continue until a key succeeds or all fail.
  4. Provide optional logs/metrics showing fallback usage (which key, error type).
Originally created by @FabyoSK on GitHub (Jul 25, 2025). Originally assigned to: @thdxr on GitHub. ### **Problem** Under heavy usage, multiple Opencode instances hit rate limits, causing failures and interrupting sessions. ### **Proposed Solution** Allow users to configure **multiple API keys for each LLM provider** and automatically fallback to the next key when the current one returns a rate limit error (e.g. HTTP 429) or other failures. **On each request:** 1. Try with the primary key. 2. If rate‑limited or failed, automatically retry with the next key. 3. Continue until a key succeeds or all fail. 4. Provide optional logs/metrics showing fallback usage (which key, error type).
yindo closed this issue 2026-02-16 17:28:47 -05:00
Author
Owner

@thdxr commented on GitHub (Aug 12, 2025):

Closing this issue as it's not currently planned for implementation unless there's more demand from the community. If multiple users request this feature or you're experiencing significant rate limiting issues, please feel free to open a new issue with updated use cases and we can reconsider. Thanks for the suggestion!

@thdxr commented on GitHub (Aug 12, 2025): Closing this issue as it's not currently planned for implementation unless there's more demand from the community. If multiple users request this feature or you're experiencing significant rate limiting issues, please feel free to open a new issue with updated use cases and we can reconsider. Thanks for the suggestion!
Author
Owner

@s-khaon commented on GitHub (Jan 27, 2026):

+1

@s-khaon commented on GitHub (Jan 27, 2026): +1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#923