Skip to content

OpenCode

OpenCode is a multi-provider AI coding CLI. Agentslan dispatches it with opencode run --format json …, requires an explicit provider/model value, and keeps OpenCode from writing config into your project working directory.

The adapter type inside Agentslan is opencode_local and the menu label is OpenCode (local).

Install the opencode CLI on your machine and verify:

Terminal window
opencode --version

If opencode is at a non-standard path, set the adapter’s command field to the absolute path. To list available models in provider/model format, run:

Terminal window
opencode models

OpenCode routes to upstream providers (OpenAI, Anthropic, etc.); sign in to those providers per OpenCode’s instructions before connecting it to Agentslan. Provider credentials and the OpenCode session live on the host machine — Agentslan never proxies them.

  1. Open the Agentslan desktop app.

  2. Go to Agents → Add agent.

  3. Pick OpenCode (local).

  4. Set a model — this field is required. Use provider/model format. Built-in options the adapter exposes:

    • openai/gpt-5.2-codex (default)
    • openai/gpt-5.4
    • openai/gpt-5.2
    • openai/gpt-5.1-codex-max
    • openai/gpt-5.1-codex-mini

    You can supply any other provider/model ID that OpenCode supports — for example anthropic/claude-sonnet-4-5.

  5. Save.

FieldTypeNotes
cwdstring, optionalDefault absolute working directory for the agent process.
instructionsFilePathstring, optionalAbsolute path to a Markdown instructions file prepended to the run prompt.
modelstring, requiredOpenCode model ID in provider/model format.
variantstring, optionalProvider-specific reasoning/profile variant passed as --variant (for example minimal, low, medium, high, xhigh, max).
dangerouslySkipPermissionsboolean, optionalDefaults to true. Injects a temporary OpenCode runtime config that allows external_directory access without interactive prompts so headless runs do not stall on approvals.
promptTemplatestring, optionalRun prompt template.
commandstring, optionalDefaults to opencode.
extraArgsstring[], optionalAdditional CLI arguments.
envobject, optionalExtra environment variables.
timeoutSecnumber, optionalRun timeout in seconds.
graceSecnumber, optionalSIGTERM grace period in seconds.
  • Runs are executed with opencode run --format json ….
  • Sessions are resumed with --session when the stored session cwd matches the current cwd.
  • Agentslan sets OPENCODE_DISABLE_PROJECT_CONFIG=true to prevent OpenCode from writing an opencode.json config file into the project working directory. Model selection is passed via the --model CLI flag instead.
  • When dangerouslySkipPermissions is enabled, Agentslan injects a temporary runtime config with permission.external_directory=allow so headless runs do not stall on approval prompts.