Docs(opencode): add API key provider config example#1209
Open
smallgun01 wants to merge 2 commits into
Open
Conversation
thepagent
reviewed
Jun 26, 2026
| "opencode-go": { | ||
| "options": { | ||
| "baseURL": "https://opencode.ai/zen/go/v1", | ||
| "apiKey": "${OPENCODE_API_KEY}" |
Collaborator
There was a problem hiding this comment.
should it be {env:VAR} format?
Author
There was a problem hiding this comment.
You're right — {env:OPENCODE_API_KEY} is the official portable syntax per opencode docs.
Updating the example.
Side note for anyone reading: the ${OPENCODE_API_KEY} form in a kubectl exec heredoc also
works because the shell expands it before writing the file — but only in shell-generated configs.
For users hand-writing opencode.json or running via Docker CMD / systemd, {env:VAR} is the
only correct option.
Thanks @thepagent.
The shell-style `${OPENCODE_API_KEY}` worked in the kubectl exec heredoc
because bash expands it before writing, but `{env:VAR}` is the portable
opencode-native form documented at
https://opencode.ai/docs/config/#env-vars.
Closes review feedback from @thepagent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
The existing
docs/opencode.mdexamples (Ollama Cloud, xAI Grok) only cover OAuth-based providers. API-key-based providers like opencode-go require a different config structure — the fullprovider.options.apiKeyblock — which is not documented anywhere. Users hit this gap immediately when trying to set up API-key providers.Closes #1200
At a Glance
N/A — docs-only change.
Prior Art & Industry Research
Not applicable — docs-only change, adding a missing config example.
Proposed Solution
Add a new
## Example: API Key Providerssection todocs/opencode.md, placed after the existing xAI Grok example and before## Notes. The example uses opencode-go as a representative API-key provider, showing:provider.options.apiKey+modelsblock${OPENCODE_API_KEY}env var expansionWhy this approach?
Follows the exact same structure and conventions as the existing two provider examples (authenticate → set config → restart → verify). Uses
kubectl exec+ heredoc format consistent with the rest of the doc. Minimal, focused — one realistic example covers the pattern for all API-key providers.Alternatives Considered
kubectl create secretstep: unnecessary noise — Kubernetes Secret creation is covered elsewhere and varies by deployment.Validation
kubectl execheredoc syntax matches existing examples (unquoted<< EOFallows env var expansion)