Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenCode CLI reference - Settings

OpenCode opencode.json settings

OpenCode documents 147 settings keys, including $schema, model and small_model. These keys go in OpenCode's opencode.json and the other config files it reads. Each row gives the docs' description, accepted values and an example where one is documented.

Last verified 15 official pagesFull OpenCode reference

OpenCode settings keys
KeyDescriptionExample
$schema

Schema URL for editor validation/autocomplete.

https://opencode.ai/config.json

Docs: $schema
-no example
model

Default model in provider/model format.

string

Docs: model
-no example
small_model

Separate model for lightweight tasks like title generation; defaults to a cheaper provider model or falls back to the main model.

string

Docs: small_model
-no example
provider

Provider configuration, including options and models.

object

Docs: provider
-no example
provider.<id>.options.timeout

Request timeout in ms; set false to disable.

number or false; default 300000

Docs: provider.<id>.options.timeout
-no example
provider.<id>.options.headerTimeout

Timeout in ms to wait for response headers; set false to disable.

number or false; default 300000

Docs: provider.<id>.options.headerTimeout
-no example
provider.<id>.options.chunkTimeout

Timeout in ms between streamed response chunks; request aborts if exceeded. Set false to disable.

number or false; default 900000

Docs: provider.<id>.options.chunkTimeout
-no example
provider.<id>.options.setCacheKey

Ensures a cache key is always set for the designated provider.

boolean

Docs: provider.<id>.options.setCacheKey
-no example
provider.<id>.options.baseURL

Custom base URL for a provider, useful for proxies or custom endpoints.

string

Docs: provider.<id>.options.baseURL
-no example
provider.<id>.options.apiKey

Optional API key for a provider if not using auth; supports {env:...} and {file:...}.

string

Docs: provider.<id>.options.apiKey
-no example
provider.<id>.options.headers

Custom headers sent with each request.

object

Docs: provider.<id>.options.headers
-no example
provider.<id>.options.region

Amazon Bedrock AWS region.

string; defaults to AWS_REGION or us-east-1

Docs: provider.<id>.options.region
-no example
provider.<id>.options.profile

Amazon Bedrock named AWS profile.

string; defaults to AWS_PROFILE

Docs: provider.<id>.options.profile
-no example
provider.<id>.options.endpoint

Amazon Bedrock custom endpoint URL for VPC endpoints; alias for baseURL and takes precedence.

string

Docs: provider.<id>.options.endpoint
-no example
provider.<id>.blacklist

Hides the listed model IDs from the /models picker.

array of model IDs

Docs: provider.<id>.blacklist
-no example
provider.<id>.whitelist

Keeps only the listed model IDs in the /models picker.

array of model IDs

Docs: provider.<id>.whitelist
-no example
provider.<id>.npm

AI SDK package to use, e.g. @ai-sdk/openai-compatible for /v1/chat/completions or @ai-sdk/openai for /v1/responses.

string

Docs: provider.<id>.npm
-no example
provider.<id>.name

Display name for a custom provider in the UI.

string

Docs: provider.<id>.name
-no example
provider.<id>.models

Available models for a provider, keyed by model ID.

object

Docs: provider.<id>.models
-no example
provider.<id>.models.<model>.limit.context

Maximum input tokens the model accepts.

number

Docs: provider.<id>.models.<model>.limit.context
-no example
provider.<id>.models.<model>.limit.output

Maximum tokens the model can generate.

number

Docs: provider.<id>.models.<model>.limit.output
-no example
provider.<id>.models.<model>.options

Global model options passed to the provider (e.g. reasoningEffort, thinking).

object

Docs: provider.<id>.models.<model>.options
-no example
provider.<id>.models.<model>.variants

Custom or overridden model variants; a variant can be disabled with disabled: true.

object

Docs: provider.<id>.models.<model>.variants
-no example
shell

Shell used for the interactive terminal and compatible agent tool calls; absolute path or short name.

string; auto-detected by OS

Docs: shell
-no example
tools

Enables or disables tools the LLM can use (legacy, deprecated in favor of permission); supports wildcards.

object of tool -> boolean

Docs: tools
-no example
server

Server settings for opencode serve and opencode web.

object

Docs: server
-no example
server.port

Port to listen on.

number

Docs: server.port
-no example
server.hostname

Hostname to listen on; defaults to 0.0.0.0 when mdns is enabled and no hostname is set.

string

Docs: server.hostname
-no example
server.mdns

Enables mDNS service discovery.

boolean

Docs: server.mdns
-no example
server.mdnsDomain

Custom mDNS domain name.

string; default opencode.local

Docs: server.mdnsDomain
-no example
server.cors

Additional full origins allowed for CORS.

array of origins

Docs: server.cors
-no example
experimental

Options under active development; not stable.

object

Docs: experimental
-no example
experimental.policies

Ordered policy statements allowing or denying actions on resources (currently provider.use).

array

Docs: experimental.policies
-no example
experimental.policies[].effect

Policy effect.

allow or deny

Docs: experimental.policies[].effect
-no example
experimental.policies[].action

Operation controlled by the policy.

provider.use

Docs: experimental.policies[].action
-no example
experimental.policies[].resource

Resource ID or wildcard pattern (* and ?) the statement applies to.

string

Docs: experimental.policies[].resource
-no example
attachment.image.auto_resize

Resizes images exceeding limits before provider requests; false rejects oversized images.

boolean; default true

Docs: attachment.image.auto_resize
-no example
attachment.image.max_width

Maximum image width in pixels before resizing or rejection.

number; default 2000

Docs: attachment.image.max_width
-no example
attachment.image.max_height

Maximum image height in pixels before resizing or rejection.

number; default 2000

Docs: attachment.image.max_height
-no example
attachment.image.max_base64_bytes

Maximum base64-encoded image payload size.

number; default 5242880

Docs: attachment.image.max_base64_bytes
-no example
agent

Configures built-in or custom agents by name.

object

Docs: agent
-no example
default_agent

Default primary agent when none is specified; falls back to build with a warning if missing or a subagent.

string; e.g. build or plan

Docs: default_agent
-no example
subagent_depth

How deeply subagents can invoke other subagents; 0 prevents all subagent launches.

number; default 1

Docs: subagent_depth
-no example
command

Custom commands for repetitive tasks.

object

Docs: command
-no example
snapshot

Enables snapshots used to undo/revert agent file changes; disabling avoids slow indexing in large repos.

boolean; default true

Docs: snapshot
-no example
autoupdate

Automatic update downloads at startup; notify only shows when a new version is available (not for package-manager installs).

true, false, or "notify"

Docs: autoupdate
-no example
formatter

Enables and configures code formatters; omit to keep formatters disabled.

true, false, or object

Docs: formatter
-no example
lsp

Enables and configures LSP servers; omit to keep LSP disabled.

true, false, or object

Docs: lsp
-no example
permission

Controls whether actions run automatically, prompt, or are blocked; can be a single action or per-tool rules.

allow, ask, deny, or object

Docs: permission
-no example
compaction.auto

Automatically compacts the session when context is full.

boolean; default true

Docs: compaction.auto
-no example
compaction.prune

Removes old tool outputs to save tokens.

boolean; default false

Docs: compaction.prune
-no example
compaction.reserved

Token buffer for compaction to avoid overflow during compaction.

number

Docs: compaction.reserved
-no example
watcher.ignore

Glob patterns ignored by the file watcher; common dependency, VCS, build and cache dirs are ignored automatically.

array of globs

Docs: watcher.ignore
-no example
mcp

MCP server definitions keyed by name.

object

Docs: mcp
-no example
plugin

npm plugins to load.

array of package names

Docs: plugin
-no example
instructions

Paths, glob patterns or remote URLs of instruction files combined with AGENTS.md; remote URLs use a 5 second timeout.

array of strings

Docs: instructions
-no example
disabled_providers

Provider IDs that won't be loaded even if credentials exist; takes priority over enabled_providers.

array of provider IDs

Docs: disabled_providers
-no example
enabled_providers

Allowlist of provider IDs; all others are ignored.

array of provider IDs

Docs: enabled_providers
-no example
references

Local directories or Git repositories made available as project references by alias.

object

Docs: references
-no example
references.<alias>.path

Local reference directory (relative to config, absolute, or ~).

string

Docs: references.<alias>.path
-no example
references.<alias>.repository

Git URL, host/path, or GitHub owner/repo reference, materialized in the local repository cache.

string

Docs: references.<alias>.repository
-no example
references.<alias>.branch

Optional Git branch or ref; defaults to the repository's default branch.

string

Docs: references.<alias>.branch
-no example
references.<alias>.description

Guidance describing when agents should use the reference; references with descriptions are included in agent context.

string

Docs: references.<alias>.description
-no example
references.<alias>.hidden

Hides the reference from TUI @ autocomplete only.

boolean

Docs: references.<alias>.hidden
-no example
agent.<name>.description

Brief description of what the agent does and when to use it; required.

string

Docs: agent.<name>.description
-no example
agent.<name>.temperature

Randomness of responses; defaults are model-specific (typically 0, 0.55 for Qwen).

number, typically 0.0-1.0

Docs: agent.<name>.temperature
-no example
agent.<name>.steps

Maximum agentic iterations before the agent must respond with text only (legacy maxSteps is deprecated).

number

Docs: agent.<name>.steps
-no example
agent.<name>.disable

Set true to disable the agent.

boolean

Docs: agent.<name>.disable
-no example
agent.<name>.prompt

Custom system prompt file, relative to the config file.

string, e.g. {file:./prompts/build.txt}

Docs: agent.<name>.prompt
-no example
agent.<name>.model

Overrides the model for this agent in provider/model-id format.

string

Docs: agent.<name>.model
-no example
agent.<name>.tools

Deprecated per-agent tool toggles; true equals {"*": "allow"} and false equals {"*": "deny"}.

object

Docs: agent.<name>.tools
-no example
agent.<name>.permission

Per-agent permission overrides merged with global config.

object

Docs: agent.<name>.permission
-no example
agent.<name>.mode

How the agent can be used.

primary, subagent, or all; default all

Docs: agent.<name>.mode
-no example
agent.<name>.hidden

Hides a subagent from @ autocomplete; it can still be invoked via the Task tool.

boolean

Docs: agent.<name>.hidden
-no example
agent.<name>.permission.task

Glob rules controlling which subagents an agent can invoke via the Task tool; last matching rule wins.

object of glob -> allow/ask/deny

Docs: agent.<name>.permission.task
-no example
agent.<name>.color

Agent color in the UI.

hex color or primary, secondary, accent, success, warning, error, info

Docs: agent.<name>.color
-no example
agent.<name>.top_p

Response diversity, alternative to temperature.

number 0.0-1.0

Docs: agent.<name>.top_p
-no example
command.<name>.template

Prompt sent to the LLM when the command runs; supports $ARGUMENTS, $1..$n, !cmd and @file; required.

string

Docs: command.<name>.template
-no example
command.<name>.description

Description shown in the TUI.

string

Docs: command.<name>.description
-no example
command.<name>.agent

Agent that executes the command; a subagent triggers a subagent invocation by default.

string; defaults to current agent

Docs: command.<name>.agent
-no example
command.<name>.subtask

Forces the command to run as a subagent invocation.

boolean

Docs: command.<name>.subtask
-no example
command.<name>.model

Overrides the default model for this command.

string

Docs: command.<name>.model
-no example
permission.*

Catch-all permission rule.

allow, ask, deny

Docs: permission.*
-no example
permission.read

Reading a file (matches the file path); .env files denied by default.

allow, ask, deny or object; default allow

Docs: permission.read
-no example
permission.edit

All file modifications (edit, write, patch, apply_patch).

allow, ask, deny or object

Docs: permission.edit
-no example
permission.glob

File globbing (matches the glob pattern).

allow, ask, deny or object

Docs: permission.glob
-no example
permission.grep

Content search (matches the regex pattern).

allow, ask, deny or object

Docs: permission.grep
-no example
permission.list

Listing files.

allow, ask, deny or object

Docs: permission.list
-no example
permission.bash

Running shell commands (matches parsed commands).

allow, ask, deny or object

Docs: permission.bash
-no example
permission.task

Launching subagents (matches the subagent type).

allow, ask, deny or object

Docs: permission.task
-no example
permission.skill

Loading a skill (matches the skill name).

allow, ask, deny or object

Docs: permission.skill
-no example
permission.lsp

Running LSP queries (currently non-granular).

allow, ask, deny or object

Docs: permission.lsp
-no example
permission.question

Asking the user questions during execution.

allow, ask, deny

Docs: permission.question
-no example
permission.webfetch

Fetching a URL (matches the URL).

allow, ask, deny

Docs: permission.webfetch
-no example
permission.external_directory

Triggered when a tool touches paths outside the project working directory.

allow, ask, deny or object; default ask

Docs: permission.external_directory
-no example
permission.doom_loop

Triggered when the same tool call repeats 3 times with identical input.

allow, ask, deny; default ask

Docs: permission.doom_loop
-no example
lsp.<server>.disabled

Disables the LSP server.

boolean

Docs: lsp.<server>.disabled
-no example
lsp.<server>.command

Command to start the LSP server; required unless only disabling.

string[]

Docs: lsp.<server>.command
-no example
lsp.<server>.extensions

File extensions the LSP server handles.

string[]

Docs: lsp.<server>.extensions
-no example
lsp.<server>.env

Environment variables set when starting the server.

object

Docs: lsp.<server>.env
-no example
lsp.<server>.initialization

Initialization options sent in the LSP initialize request.

object

Docs: lsp.<server>.initialization
-no example
formatter.<name>.disabled

Disables the formatter.

boolean

Docs: formatter.<name>.disabled
-no example
formatter.<name>.command

Formatting command; $FILE is replaced with the file path. Required for custom formatters.

string[]

Docs: formatter.<name>.command
-no example
formatter.<name>.environment

Environment variables set when running the formatter.

object

Docs: formatter.<name>.environment
-no example
formatter.<name>.extensions

File extensions the formatter handles.

string[]

Docs: formatter.<name>.extensions
-no example
mcp.<name>.type

MCP connection type.

"local" or "remote"; required

Docs: mcp.<name>.type
-no example
mcp.<name>.command

Command and arguments to run a local MCP server.

array; required for local

Docs: mcp.<name>.command
-no example
mcp.<name>.cwd

Working directory for a local MCP server process; relative paths resolve from the workspace.

string

Docs: mcp.<name>.cwd
-no example
mcp.<name>.environment

Environment variables for a local MCP server.

object

Docs: mcp.<name>.environment
-no example
mcp.<name>.enabled

Enables or disables the MCP server on startup.

boolean

Docs: mcp.<name>.enabled
-no example
mcp.<name>.timeout

Timeout in ms for fetching tools from the MCP server.

number; default 5000

Docs: mcp.<name>.timeout
-no example
mcp.<name>.url

URL of a remote MCP server.

string; required for remote

Docs: mcp.<name>.url
-no example
mcp.<name>.headers

Headers sent to a remote MCP server.

object

Docs: mcp.<name>.headers
-no example
mcp.<name>.oauth

OAuth config for a remote server, or false to disable OAuth auto-detection.

object or false

Docs: mcp.<name>.oauth
-no example
mcp.<name>.oauth.clientId

OAuth client ID; dynamic client registration is attempted if omitted.

string

Docs: mcp.<name>.oauth.clientId
-no example
mcp.<name>.oauth.clientSecret

OAuth client secret, if required.

string

Docs: mcp.<name>.oauth.clientSecret
-no example
mcp.<name>.oauth.scope

OAuth scopes to request.

string

Docs: mcp.<name>.oauth.scope
-no example
theme

tui.json: Sets the UI theme.

string; default opencode

Docs: theme
-no example
keybinds

tui.json: Customizes keyboard shortcuts; merged with built-in defaults.

object

Docs: keybinds
-no example
leader_timeout

tui.json: How long OpenCode waits after the leader key, in ms.

number; default 2000

Docs: leader_timeout
-no example
scroll_acceleration.enabled

tui.json: macOS-style scroll acceleration; overrides scroll_speed when enabled.

boolean

Docs: scroll_acceleration.enabled
-no example
scroll_speed

tui.json: TUI scroll speed; ignored when scroll_acceleration is enabled.

number, minimum 0.001; default 3

Docs: scroll_speed
-no example
diff_style

tui.json: Diff rendering.

"auto" or "stacked"

Docs: diff_style
-no example
cursor.style

tui.json: Terminal cursor style in input fields; default restores the terminal cursor.

block, underline, line, default; default block

Docs: cursor.style
-no example
cursor.blinking

tui.json: Cursor blinking; no effect when style is default.

boolean; default true

Docs: cursor.blinking
-no example
mouse

tui.json: Mouse capture in the TUI.

boolean; default true

Docs: mouse
-no example
attention.enabled

tui.json: Enables all attention notifications and sounds.

boolean; default false

Docs: attention.enabled
-no example
attention.notifications

tui.json: Allows terminal-mediated desktop notifications.

boolean; default true

Docs: attention.notifications
-no example
attention.sound

tui.json: Allows attention sounds.

boolean; default true

Docs: attention.sound
-no example
attention.volume

tui.json: Default sound volume.

number 0-1; default 0.4

Docs: attention.volume
-no example
attention.sound_pack

tui.json: Sound pack ID.

string; default opencode.default

Docs: attention.sound_pack
-no example
attention.sounds

tui.json: Overrides sound files for default, question, permission, error, done, or subagent_done.

object of paths

Docs: attention.sounds
-no example
name

SKILL.md frontmatter: Skill name; 1-64 lowercase alphanumeric chars with single hyphens, matching the directory name. Required.

^[a-z0-9]+(-[a-z0-9]+)*$

Docs: name
-no example
description

SKILL.md frontmatter: Skill description; required.

1-1024 characters

Docs: description
-no example
license

SKILL.md frontmatter: Optional license field.

string

Docs: license
-no example
compatibility

SKILL.md frontmatter: Optional compatibility field.

string

Docs: compatibility
-no example
metadata

SKILL.md frontmatter: Optional string-to-string map for tool-specific behavior.

map

Docs: metadata
-no example
metadata.opencode/slash

SKILL.md frontmatter: Exposes the skill as a /name command in the TUI.

"true"

Docs: metadata.opencode/slash
-no example
metadata.opencode/autoinvoke

SKILL.md frontmatter: Set false to keep the skill out of model-facing auto-selection guidance.

"false"

Docs: metadata.opencode/autoinvoke
-no example
model

GitHub Action input: model in provider/model format; required.

string

Docs: model
-no example
agent

GitHub Action input: primary agent to use; falls back to default_agent or build.

string

Docs: agent
-no example
prompt

GitHub Action input: custom prompt overriding default behavior; required for issues, schedule and workflow_dispatch events.

string

Docs: prompt
-no example
mentions

GitHub Action input: comma-separated case-insensitive trigger phrases.

default /opencode,/oc

Docs: mentions
-no example
variant

GitHub Action input: model variant for provider-specific reasoning effort.

e.g. high, max, minimal

Docs: variant
-no example
oidc_base_url

GitHub Action input: base URL for the OIDC token exchange API, for custom GitHub App installs.

default https://api.opencode.ai

Docs: oidc_base_url
-no example
use_github_token

GitHub Action input: use a caller-provided GITHUB_TOKEN instead of an OIDC-exchanged app token.

boolean; default false

Docs: use_github_token
-no example
keybinds.<action> (object form)

Advanced keybind value: an object with key, event, preventDefault, or fallthrough; strings may hold comma-separated shortcuts and arrays hold alternatives.

string, array, or object

Docs: keybinds.<action> (object form)
"messages_copy": ["<leader>y", "ctrl+shift+c"]

The rest of the OpenCode reference

FAQ

How many settings keys does OpenCode have?

The official OpenCode docs list 147 settings keys, including $schema, model and small_model. All of them are in the table above, in the docs' order.

What does $schema do in OpenCode?

Schema URL for editor validation/autocomplete. Values: https://opencode.ai/config.json.

Where are OpenCode settings keys documented?

On 15 official docs pages at opencode.ai, last read on October 17, 2026. Every row in the table links the exact section it came from.

More on OpenCode

Sources

Last verified . Names and examples are copied verbatim from the 15 official pages below, and every row above links the exact section it came from.

Newsletter

Know when your tools change

One email per week. New coding agent releases, the flags and commands they add, and what they mean for how you work.