Clients

OpenCode

Run OpenCode through OpenLLM with openllm opencode, which adds an openllm provider with all your models per session and leaves your own config untouched.

Commandopenllm opencode
ModePer session. Nothing is installed.
Talks toOpenAI-compatible Chat Completions at <gateway>/v1
Default modelopenllm/ultra
Skip approvalsNot available. OpenCode has no such flag.
RemoveNothing to remove. Run opencode directly.

Before you begin

  • Install the OpenLLM CLI. See Install.
  • Install OpenCode so that opencode is on your PATH. If it is missing, openllm opencode prints the official installer, https://opencode.ai/install.
  • Have at least one model available. See Providers.

Set up with openllm opencode

openllm opencode

Every argument after opencode goes to OpenCode unchanged, so openllm opencode run "…" runs a non-interactive task. OpenLLM's own flags go before the client name: --new and --attach [id]. openllm -d opencode exits with an error, because OpenCode has no skip-approvals flag.

At launch, OpenLLM picks a gateway: your local daemon at http://127.0.0.1:8787 if it answers, otherwise https://www.openllm.sh. It then:

  1. Reads your ~/.config/opencode/opencode.json (or $XDG_CONFIG_HOME/opencode/opencode.json).
  2. Merges in an openllm provider: @ai-sdk/openai-compatible with baseURL set to <gateway>/v1, your key, and every model in your catalog.
  3. Sets the default model to openllm/ultra and adds the openllm MCP server.
  4. Writes the result to ~/.openllm/run/opencode/<pid>/opencode.json and points OPENCODE_CONFIG at it.

The merged file contains your key. It is readable only by you and is deleted when OpenCode exits. If your own config cannot be parsed, OpenLLM uses its provider block alone; it never writes your file back.

Interactive sessions run in a background session host. Run openllm --new opencode to skip the offer to attach to a running session.

Choose models

OpenCode shows OpenLLM models as openllm/<id>: openllm/ultra, openllm/plus, openllm/lite, and openllm/<provider>/<model> for each model you have activated. The default is openllm/ultra.

To pin a model, pick it in OpenCode's model picker. For a non-interactive run, pass OpenCode's flag: openllm opencode run --model openllm/plus "…". To change what the aliases resolve to, edit the chains in Configuration. See Routing and fallback.

OpenCode sessions get OpenLLM memory tools through MCP. See Memory.

Who pays for a request

The model that serves the request decides. A subscription hop runs on your own login through the daemon on one of your devices. An API-key hop bills your provider account. Included openllm/ models count against your plan's allowance. See Providers and Plans and limits.

Check that it works

openllm opencode run "Reply with OK"

The reply prints to your terminal. Open Overview in the app: the request appears with the model that served it.

Common problems

SymptomCauseFix
OpenCode is not installedopencode is not on your PATHInstall OpenCode, then run openllm opencode again
OpenCode has no skip-approvals flag, so -d does not apply.-d has no OpenCode equivalentRun without -d
No models are available for your OpenLLM account.Nothing in your model listConnect a provider on Providers
The openllm provider lists no modelsThe catalog fetch failed at launchCheck your connection and launch again
A new provider's models are missingThe catalog is read at launchExit and run openllm opencode again

For anything else, see Troubleshooting.

Remove it

There is nothing to uninstall. Exit OpenCode and run opencode directly to use it without OpenLLM. Temporary files are deleted on exit.

Last updated on

On this page