Skip to content

[FEATURE]: Support multiple API keys per provider with fallback logic #16038

@yogeek

Description

@yogeek

Describe the enhancement you want to request

as #1326 has been closed and it seems the feature has gained some interest, here is another issue as suggested

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:

  • Try with the primary key.
  • If rate‑limited or failed, automatically retry with the next key.
  • Continue until a key succeeds or all fail.
  • Provide optional logs/metrics showing fallback usage (which key, error type).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions