Skip to content

[Feature]: Support separate Zen and Go API key env vars #87790

Description

@olisikh

Summary

Support OPENCODE_ZEN_API_KEY and OPENCODE_GO_API_KEY as primary environment variables for Opencode GO (Subscription API KEY) and Opencode ZEN (Pay-as-you-go API key) providers.

Problem to solve

Currently OPENCODE_API_KEY is used by both opencode-go and opencode plugins which makes it a mess, it is wrong.

Both opencode and opencode-go plugins use the same OPENCODE_API_KEY, so user can't provide 2 separate API keys for both offerings. Openclaw would use OPENCODE_API_KEY for both opencode and opencode-go plugins, making it impossible to switch between ZEN and GO at the same time.

Proposed solution

Instead Openclaw should support OPENCODE_ZEN_API_KEY as primary env variable in opencode plugin, and OPENCODE_GO_API_KEY in opencode-go plugin. This ensures user can specify 2 API keys and control which offering from Opencode is actually used.

Fallback to OPENCODE_API_KEY would preserve backward compatibility, in case if user uses only opencode plugin or opencode-go plugin.

Alternatives considered

No response

Impact

Affected: opencode and opencode-go plugins, env variables management, but with backward compatibility preserved
Severity: blocks workflow
Frequency: always
Consequence: extra manual work, errors

Evidence/examples

No response

Additional information

Tried to address this in this PR #87762, but can't make it green.

It does work locally however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions