Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions content/manuals/ai/sandboxes/agents/opencode.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ $ sbx secret set -g openrouter
You only need to configure the providers you want to use. OpenCode detects
available credentials and offers those providers in the TUI.

### OpenCode Zen API keys

OpenCode Zen API keys aren't part of the built-in OpenCode credentials that
`sbx secret set` supports. To use an OpenCode Zen API key, store it as a
[custom secret](../security/credentials.md#custom-secrets):

Set the `OPENCODE_API_KEY` environment variable on the host, then store it:
Comment thread
dvdksn marked this conversation as resolved.
Comment thread
dvdksn marked this conversation as resolved.

```console
$ sbx secret set-custom -g \
--host opencode.ai \
--env OPENCODE_API_KEY \
--value "$OPENCODE_API_KEY"
```

Custom secrets keep the real key in the host secret store. The sandbox receives
`OPENCODE_API_KEY` as a placeholder, and the host-side proxy replaces that
placeholder with the real key on requests to `opencode.ai`.

OpenCode Zen also requires network access to `opencode.ai`:

```console
$ sbx policy allow network opencode.ai:443
```

If you add the custom secret globally with `-g`, recreate existing OpenCode
sandboxes so the new environment variable is available inside the sandbox.

## Configuration

Sandboxes don't pick up user-level configuration from your host. Only
Expand Down