For the complete documentation index, see llms.txt. A markdown version of this page is at /reference/tools/tool-configuration/opencode/index.md.

opencode

OpenCode works on a workstation with no configuration. This is for when you want to set its model, agents or providers once for every workstation.

Install OpenCode with the opencode devtool and it is ready to use. Add this toolconfig when you want to change its settings. Write the settings under settings, in OpenCode’s own keys:

toolconfigs:
  - name: opencode
    config:
      settings:
        model: anthropic/claude-sonnet-4-5
        small_model: anthropic/claude-haiku-4-5

Ringleader merges those keys into ~/.config/opencode/opencode.json, owned by the login user and readable by nobody else.

File merging

OpenCode writes to the same file when you change a setting in it, so Ringleader does not replace the whole file. Instead it works one top-level key at a time:

  • A key you declare is written on every configuration pass, so a change made inside the workstation to that key is put back.
  • A key you never declared is left alone.
  • A key you stop declaring is removed on the next pass.

Remove the toolconfig and Ringleader removes the keys it wrote. The file itself stays.

Key names and values are OpenCode’s, and Ringleader passes them through unchanged, so any setting OpenCode accepts in that file works here. Any string may carry a ${secret:NAME} reference, which is filled in on the workstation.

Models and your organization’s policy

Your organization’s policy (Policy and OrgPolicy) can limit which LLM providers and models a workstation names. When it does, applying the config checks every place in settings where OpenCode chooses a model or a provider:

  • model and small_model.
  • The model of each entry under agent, command and mode, and under their plural spellings agents, commands and modes.
  • Each provider name under provider.

A model can be written as provider/model or as an object with providerID and model (or modelID), and both forms are checked. The provider is checked against the policy’s provider rules, and the model name after the slash against its model rules. A value outside the policy is refused when you apply, and the message names the field.

A model written with {env:…} or {file:…} is checked as written, because OpenCode fills it in only later. A policy that allows only the models it lists therefore refuses it.

config fields

FieldTypeDescription
settingsobjectOpenCode settings, merged key by key into ~/.config/opencode/opencode.json. Must be an object.

Example

apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
  name: opencode-box
  namespace: local
spec:
  selector:
    matchLabels:
      tier: dev
  devtools:
    - name: nodejs
      version: "24"
    - name: opencode
  toolconfigs:
    - name: opencode
      config:
        settings:
          model: anthropic/claude-sonnet-4-5
          agent:
            review:
              model: anthropic/claude-haiku-4-5

Notes

  • This toolconfig writes only the one user-owned file. Ringleader’s two OpenCode defaults live elsewhere, as OpenCode defaults describes.
  • OpenCode is not in the set of tools Ringleader pre-trusts folders for.