Skip to content

Support multiple API keys per provider with fallback logic #1326

Closed

Description

@FabyoSK

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

Activity

  1. self-assigned this
    on Jul 26, 2025
  2. thdxr commented on Aug 12, 2025

    @thdxr
    Member

    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!

  3. s-khaon commented on Jan 28, 2026

    @s-khaon

    +1

  4. fadedlamp42 commented on Feb 17, 2026

    @fadedlamp42

    +1, would love simple array support in auth.json (so key for a single key or keys for multiple)

  5. George-RD commented on Feb 23, 2026

    @George-RD

    Please!

  6. harish2222 commented on Jun 20, 2026

    @harish2222

    ya bro please it will help alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions