[PR #5906] fix(providers.opencode): check config for api key in addition to auth #11638

Closed
opened 2026-02-16 18:16:32 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5906

State: closed
Merged: Yes


Without this, you can't use ~/.config/opencode/opencode.json to set the opencode API key without also having .opencode.key in ~/.local/share/opencode/auth.json set to any string. Notably, this means you can't store your opencode zen api key in an environment variable without also exposing it (or some other string) in auth.json.

Note: although I tested this change and I understand what it does (it's two lines), this code was written by an AI and I don't know typescript that well, so feel free to say if there's something I should do differently.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5906 **State:** closed **Merged:** Yes --- Without this, you can't use `~/.config/opencode/opencode.json` to set the `opencode` API key without also having `.opencode.key` in `~/.local/share/opencode/auth.json` set to any string. Notably, this means you can't store your opencode zen api key in an environment variable without also exposing it (or some other string) in `auth.json`. Note: although I tested this change and I understand what it does (it's two lines), this code _was_ written by an AI and I don't know typescript that well, so feel free to say if there's something I should do differently.
yindo added the pull-request label 2026-02-16 18:16:32 -05:00
yindo closed this issue 2026-02-16 18:16:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11638