Repository navigation
Configure OpenAI-compatible model providers - #1
Merged
Merged
Conversation
The packaged OpenCode 2.4.1 web interface has no provider screen, so there was no way to point the service at a model without shelling into the container. Add a Configure Model Providers action that writes provider entries into OpenCode's own config on the main volume, and keeps each provider's API key on the startos volume, passed to the server as OPENCODE_KEY_<ID>.
jonbotx
added a commit
that referenced
this pull request
Nov 25, 2026
Addresses the review on #2. - The action now owns only the providers it wrote: the `opencode.json` entries carrying `package: @opencode/ai/providers/openai-compatible`. It prefills and rebuilds those, and copies every other entry — and a `model` that names none of them — through untouched. `model` is now changed only when a Default is set or when it names a managed provider this save removes, so saving with nothing ticked no longer clears a model set to something else. - Docs: the served 2.4.1 web app does have Settings → Providers (the catalog lists 334 providers, and OpenCode ships a free default model). Restore the audit's step 4 and correct the "no provider screen" claims in `instructions.md` and `README.md`: hosted providers connect in the app, and this action is for OpenAI-compatible endpoints the catalog cannot reach. - Restore claims #1 had already removed: the image is pinned by tag and digest; drop "nothing upstream is disabled or skipped" (the self-updater is off), the warning restatement, and the StartOS address parenthetical. - Trim AGENTS.md to rules: drop the generic "Working here" block, the port bullet, and the image-pin bullet, and add the scoping rule for the action. - Cut the new comments to one fact each.
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 and why
The packaged OpenCode 2.4.1 web interface has no provider screen, so there was no way to point the service at a model without shelling into the container. This adds a Configure Model Providers action that connects any OpenAI-compatible endpoint — a self-hosted vLLM, LM Studio, or Ollama server, or a hosted API such as OpenRouter.
For each provider the action writes an entry into OpenCode's own config on the
mainvolume, and keeps the API key on thestartosvolume, handed to the server as anOPENCODE_KEY_<ID>environment variable and referenced from the config as{env:OPENCODE_KEY_<ID>}. Nothing Secret is written to the config file.Bumps
2.4.1:0→2.4.1:1. No migration: the change is an added optional key.Files
startos/fileModels/opencode.json.ts— tolerant model ofmain/.config/opencode/opencode.json(z.looseObject, unknown keys preserved).startos/fileModels/store.json.ts— addsproviderKeys.startos/actions/configureProviders.ts— one repeatable provider list (id, name, base URL, optional key, models, default toggle).startos/main.ts— injects each stored key reactively (a key change restarts the server; a provider-only change is picked up by OpenCode's live config reload).startos/utils.ts,actions/index.ts, i18n in 5 locales, README/instructions/AGENTS.Verification
Installed the CI-built
x86_64package on a StartOS 0.4.2 box and drove the action throughstart-cli:displayAs: name/uniqueBy: id, and prefills from the configured providers including their keys.opencode.jsonand its key tostore.json; the runningopencodeprocess (PID 3) carriesOPENCODE_KEY_<ID>in/proc/3/environ, and the server's/api/providerand/api/modellist the provider with the resolved key.apiKeyand no env var).theme,autoupdate) survive a save.tsc --noEmitand Prettier are clean; both arches build in CI.OpenRouter's own model fetch and a keyless local provider were exercised, so the config is accepted by the real server, not just by the schema.