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 OpenCode on the host
Section titled “Install OpenCode on the host”Install the opencode CLI on your machine and verify:
opencode --versionIf 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:
opencode modelsSign in on the host
Section titled “Sign in on the host”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.
Add the agent in Agentslan
Section titled “Add the agent in Agentslan”-
Open the Agentslan desktop app.
-
Go to Agents → Add agent.
-
Pick OpenCode (local).
-
Set a model — this field is required. Use
provider/modelformat. Built-in options the adapter exposes:openai/gpt-5.2-codex(default)openai/gpt-5.4openai/gpt-5.2openai/gpt-5.1-codex-maxopenai/gpt-5.1-codex-mini
You can supply any other
provider/modelID that OpenCode supports — for exampleanthropic/claude-sonnet-4-5. -
Save.
Configuration reference
Section titled “Configuration reference”| Field | Type | Notes |
|---|---|---|
cwd | string, optional | Default absolute working directory for the agent process. |
instructionsFilePath | string, optional | Absolute path to a Markdown instructions file prepended to the run prompt. |
model | string, required | OpenCode model ID in provider/model format. |
variant | string, optional | Provider-specific reasoning/profile variant passed as --variant (for example minimal, low, medium, high, xhigh, max). |
dangerouslySkipPermissions | boolean, optional | Defaults to true. Injects a temporary OpenCode runtime config that allows external_directory access without interactive prompts so headless runs do not stall on approvals. |
promptTemplate | string, optional | Run prompt template. |
command | string, optional | Defaults to opencode. |
extraArgs | string[], optional | Additional CLI arguments. |
env | object, optional | Extra environment variables. |
timeoutSec | number, optional | Run timeout in seconds. |
graceSec | number, optional | SIGTERM grace period in seconds. |
- Runs are executed with
opencode run --format json …. - Sessions are resumed with
--sessionwhen the stored sessioncwdmatches the currentcwd. - Agentslan sets
OPENCODE_DISABLE_PROJECT_CONFIG=trueto prevent OpenCode from writing anopencode.jsonconfig file into the project working directory. Model selection is passed via the--modelCLI flag instead. - When
dangerouslySkipPermissionsis enabled, Agentslan injects a temporary runtime config withpermission.external_directory=allowso headless runs do not stall on approval prompts.