From ea5079fd4e57077abb98da5084fcae480cc21277 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Wed, 30 Sep 2026 15:46:52 +0700 Subject: [PATCH] feat(opencode): pass OPENCODE_API_KEY for OpenCode Go and Zen --- alloy/{docker-compose.yml => compose.yml} | 0 couchbase/{docker-compose.yml => compose.yml} | 0 opencode/.env.example | 4 ++++ opencode/README.md | 11 +++++++++-- opencode/compose.yml | 1 + traffmonetizer/{docker-compose.yml => compose.yml} | 0 6 files changed, 14 insertions(+), 2 deletions(-) rename alloy/{docker-compose.yml => compose.yml} (100%) rename couchbase/{docker-compose.yml => compose.yml} (100%) rename traffmonetizer/{docker-compose.yml => compose.yml} (100%) diff --git a/alloy/docker-compose.yml b/alloy/compose.yml similarity index 100% rename from alloy/docker-compose.yml rename to alloy/compose.yml diff --git a/couchbase/docker-compose.yml b/couchbase/compose.yml similarity index 100% rename from couchbase/docker-compose.yml rename to couchbase/compose.yml diff --git a/opencode/.env.example b/opencode/.env.example index b72eaf5..c31fc21 100644 --- a/opencode/.env.example +++ b/opencode/.env.example @@ -11,6 +11,10 @@ OPENCODE_SERVER_PASSWORD= # Username to pair with it. opencode defaults to `opencode` when unset. OPENCODE_SERVER_USERNAME=opencode +# OpenCode Go / Zen API key from the OpenCode Console. Leave blank to log in +# with `opencode auth login` instead. +OPENCODE_API_KEY= + # Git identity for the commits the agent makes, as author and committer. git # reads these directly, so no `git config` step is needed. GIT_NAME= diff --git a/opencode/README.md b/opencode/README.md index 7b6ebbc..3a3d5b7 100644 --- a/opencode/README.md +++ b/opencode/README.md @@ -11,7 +11,13 @@ apk layer puts them back. ## Setup -Logging in to a model provider is the one step the UI cannot do. After the +For OpenCode Go (or Zen), set `OPENCODE_API_KEY` to the key from the OpenCode +Console and skip the login below. opencode picks the key up from the +environment for both the `opencode-go` and `opencode` providers — models.dev, +where opencode gets its provider list, names `OPENCODE_API_KEY` as their +variable — so no `auth.json` entry or config file is needed. + +Any other provider needs a login, the one step the UI cannot do. After the first deploy, from a shell: ```sh @@ -46,9 +52,10 @@ root terminal. | --- | --- | | `OPENCODE_SERVER_PASSWORD` | Web UI and API login. Blank means no authentication at all. Generate with `openssl rand -base64 24`. | | `OPENCODE_SERVER_USERNAME` | Username to go with it. opencode falls back to `opencode`. | +| `OPENCODE_API_KEY` | OpenCode Go / Zen API key. Optional; blank means log in instead. | | `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity for the agent's commits. | -Model provider credentials are not variables — see [Setup](#setup). +Other model provider credentials are not variables — see [Setup](#setup). ## Storage diff --git a/opencode/compose.yml b/opencode/compose.yml index 5fce87e..b405eaf 100644 --- a/opencode/compose.yml +++ b/opencode/compose.yml @@ -11,6 +11,7 @@ services: environment: - OPENCODE_SERVER_PASSWORD=${OPENCODE_SERVER_PASSWORD} - OPENCODE_SERVER_USERNAME=${OPENCODE_SERVER_USERNAME} + - OPENCODE_API_KEY=${OPENCODE_API_KEY} - TZ=Asia/Ho_Chi_Minh - GIT_AUTHOR_NAME=${GIT_NAME} - GIT_AUTHOR_EMAIL=${GIT_EMAIL} diff --git a/traffmonetizer/docker-compose.yml b/traffmonetizer/compose.yml similarity index 100% rename from traffmonetizer/docker-compose.yml rename to traffmonetizer/compose.yml