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

CLI reference - 477 items

OpenCode CLI reference

OpenCode documents 15 slash commands, 82 CLI flags, 36 subcommands, 118 keyboard shortcuts, 147 settings keys, 48 environment variables and 31 config files. This page lists all 477 with what each one does, the values it accepts and a working example where the docs give one.

Last verified 24 official pagesRun as opencode

OpenCode slash commands
CommandDescriptionExample
/connect

Adds a provider to OpenCode by selecting from available providers and adding their API keys.

Docs: /connect
/connect
/compact

Compacts the current session.

Alias: /summarize. Keybind: ctrl+x c

Docs: /compact
/compact
/details

Toggles tool execution details.

Docs: /details
/details
/editor

Opens an external editor (from EDITOR) for composing messages.

Keybind: ctrl+x e

Docs: /editor
/editor
/exit

Exits OpenCode.

Aliases: /quit, /q. Keybind: ctrl+x q

Docs: /exit
/exit
/export

Exports the current conversation to Markdown and opens it in the editor set in EDITOR.

Keybind: ctrl+x x

Docs: /export
/export
/help

Shows the help dialog.

Docs: /help
/help
/init

Guided setup for creating or updating AGENTS.md; scans the repo and may ask targeted questions.

Docs: /init
/init
/models

Lists available models.

Keybind: ctrl+x m

Docs: /models
/models
/new

Starts a new session.

Alias: /clear. Keybind: ctrl+x n

Docs: /new
/new
/redo

Redoes a previously undone message, restoring file changes; only available after /undo and requires a Git repository.

Keybind: ctrl+x r

Docs: /redo
/redo
/sessions

Lists and switches between sessions.

Aliases: /resume, /continue. Keybind: ctrl+x l

Docs: /sessions
/sessions
/themes

Lists available themes.

Keybind: ctrl+x t

Docs: /themes
/themes
/thinking

Toggles visibility of thinking/reasoning blocks; does not change the model's reasoning (use ctrl+t to cycle variants).

Docs: /thinking
/thinking
/undo

Undoes the last message, removing the latest user message, subsequent responses and file changes; requires a Git repository.

Keybind: ctrl+x u

Docs: /undo
/undo
OpenCode CLI flags
FlagDescriptionExample
--continue

Continue the last session (opencode tui).

Short: -c.

Docs: --continue
-no example
--session

Session ID to continue (opencode tui).

Short: -s.

Docs: --session
-no example
--fork

Fork the session when continuing (use with --continue or --session) (opencode tui).

Docs: --fork
-no example
--prompt

Prompt to use (opencode tui).

Docs: --prompt
-no example
--model

Model to use in the form of provider/model (opencode tui).

Short: -m.

Docs: --model
-no example
--agent

Agent to use (opencode tui).

Docs: --agent
-no example
--auto

Auto-approve permissions that are not explicitly denied (opencode tui).

Docs: --auto
opencode --auto
--port

Port to listen on (opencode tui).

Docs: --port
-no example
--hostname

Hostname to listen on (opencode tui).

Docs: --hostname
-no example
--mdns

Enable mDNS discovery (opencode tui).

Docs: --mdns
-no example
--mdns-domain

Custom mDNS domain name (opencode tui).

Docs: --mdns-domain
-no example
--cors

Additional browser origin(s) to allow CORS (opencode tui).

Docs: --cors
-no example
--path

Directory to write the agent file to (opencode agent create).

Defaults to global or .opencode/agent based on the prompt.

Docs: --path
-no example
--description

What the agent should do (opencode agent create).

Docs: --description
-no example
--mode

Agent mode (opencode agent create).

all, primary, or subagent

Docs: --mode
-no example
--permissions

Comma-separated list of tool permissions to allow; anything omitted is denied (opencode agent create).

Default: all. Includes bash, read, edit, glob, grep, task, lsp, skill and others. Alias: --tools

Docs: --permissions
-no example
--model

Model to use, in provider/model format (opencode agent create).

Short: -m.

Docs: --model
-no example
--dir

Working directory to start TUI in (opencode attach).

Docs: --dir
-no example
--continue

Continue the last session (opencode attach).

Short: -c.

Docs: --continue
-no example
--session

Session ID to continue (opencode attach).

Short: -s.

Docs: --session
-no example
--fork

Fork the session when continuing (use with --continue or --session) (opencode attach).

Docs: --fork
-no example
--password

Basic auth password (opencode attach).

Short: -p. Defaults to OPENCODE_SERVER_PASSWORD

Docs: --password
-no example
--username

Basic auth username (opencode attach).

Short: -u. Defaults to OPENCODE_SERVER_USERNAME or opencode

Docs: --username
-no example
--provider

Provider ID or name to log in to (opencode auth login).

Short: -p.

Docs: --provider
-no example
--method

Login method label to use, skipping method selection (opencode auth login).

Short: -m.

Docs: --method
-no example
--event

GitHub mock event to run the agent for (opencode github run).

Docs: --event
-no example
--token

GitHub personal access token (opencode github run).

Docs: --token
-no example
--refresh

Refresh the models cache from models.dev (opencode models).

Docs: --refresh
opencode models --refresh
--verbose

Use more verbose model output (includes metadata like costs) (opencode models).

Docs: --verbose
-no example
--command

The command to run, use message for args (opencode run).

Docs: --command
-no example
--continue

Continue the last session (opencode run).

Short: -c.

Docs: --continue
-no example
--session

Session ID to continue (opencode run).

Short: -s.

Docs: --session
-no example
--fork

Fork the session when continuing (use with --continue or --session) (opencode run).

Docs: --fork
-no example
--model

Model to use in the form of provider/model (opencode run).

Short: -m.

Docs: --model
-no example
--agent

Agent to use (opencode run).

Docs: --agent
-no example
--file

File(s) to attach to message (opencode run).

Short: -f.

Docs: --file
-no example
--format

Output format (opencode run).

default (formatted) or json (raw JSON events)

Docs: --format
-no example
--title

Title for the session (opencode run).

Uses truncated prompt if no value provided

Docs: --title
-no example
--attach

Attach to a running opencode server (e.g., http://localhost:4096) (opencode run).

Docs: --attach
opencode run --attach http://localhost:4096 "Explain async/await in JavaScript"
--password

Basic auth password (opencode run).

Short: -p. Defaults to OPENCODE_SERVER_PASSWORD

Docs: --password
-no example
--username

Basic auth username (opencode run).

Short: -u. Defaults to OPENCODE_SERVER_USERNAME or opencode

Docs: --username
-no example
--dir

Directory to run in, or path on the remote server when attaching (opencode run).

Docs: --dir
-no example
--port

Port for the local server (opencode run).

Defaults to random port

Docs: --port
-no example
--variant

Model variant (provider-specific reasoning effort) (opencode run).

Docs: --variant
-no example
--thinking

Show thinking blocks (opencode run).

Docs: --thinking
-no example
--auto

Auto-approve permissions that are not explicitly denied (opencode run).

Docs: --auto
opencode run --auto "Refactor this module"
--port

Port to listen on (opencode serve).

Default: 4096 (server docs)

Docs: --port
-no example
--hostname

Hostname to listen on (opencode serve).

Default: 127.0.0.1 (server docs)

Docs: --hostname
-no example
--mdns

Enable mDNS discovery (opencode serve).

Default: false (server docs)

Docs: --mdns
-no example
--mdns-domain

Custom mDNS domain name (opencode serve).

Default: opencode.local (server docs)

Docs: --mdns-domain
-no example
--cors

Additional browser origin(s) to allow CORS (opencode serve).

Default: [] ; can be passed multiple times (server docs)

Docs: --cors
opencode serve --cors http://localhost:5173 --cors https://app.example.com
--port

Port to listen on (opencode web).

Docs: --port
opencode web --port 4096
--hostname

Hostname to listen on (opencode web).

Docs: --hostname
opencode web --hostname 0.0.0.0
--mdns

Enable mDNS discovery (opencode web).

Docs: --mdns
opencode web --mdns
--mdns-domain

Custom mDNS domain name (opencode web).

Docs: --mdns-domain
opencode web --mdns --mdns-domain myproject.local
--cors

Additional browser origin(s) to allow CORS (opencode web).

Docs: --cors
opencode web --cors https://example.com
--cwd

Working directory (opencode acp).

Docs: --cwd
-no example
--port

Port to listen on (opencode acp).

Docs: --port
-no example
--hostname

Hostname to listen on (opencode acp).

Docs: --hostname
-no example
--mdns

Enable mDNS discovery (opencode acp).

Docs: --mdns
-no example
--mdns-domain

Custom mDNS domain name (opencode acp).

Docs: --mdns-domain
-no example
--cors

Additional browser origin(s) to allow CORS (opencode acp).

Docs: --cors
-no example
--max-count

Limit to N most recent sessions (opencode session list).

Short: -n.

Docs: --max-count
-no example
--format

Output format (opencode session list).

table or json (default table)

Docs: --format
-no example
--days

Show stats for the last N days (opencode stats).

Default: all time

Docs: --days
-no example
--tools

Number of tools to show (opencode stats).

Default: all

Docs: --tools
-no example
--models

Show model usage breakdown (hidden by default); pass a number to show top N (opencode stats).

Docs: --models
-no example
--project

Filter by project (opencode stats).

Default: all projects; empty string: current project

Docs: --project
-no example
--sanitize

Redact sensitive transcript/file data (opencode export).

Docs: --sanitize
-no example
--global

Install in global config (opencode plugin).

Short: -g.

Docs: --global
-no example
--force

Replace existing plugin version (opencode plugin).

Short: -f.

Docs: --force
-no example
--format

Output format (opencode db).

json or tsv

Docs: --format
-no example
--keep-config

Keep configuration files (opencode uninstall).

Short: -c.

Docs: --keep-config
-no example
--keep-data

Keep session data and snapshots (opencode uninstall).

Short: -d.

Docs: --keep-data
-no example
--dry-run

Show what would be removed without removing (opencode uninstall).

Docs: --dry-run
-no example
--force

Skip confirmation prompts (opencode uninstall).

Short: -f.

Docs: --force
-no example
--method

The installation method that was used (opencode upgrade).

Short: -m. curl, npm, pnpm, bun, brew

Docs: --method
-no example
--help

Global flag: Display help.

Short: -h.

Docs: --help
-no example
--version

Global flag: Print version number.

Short: -v.

Docs: --version
-no example
--print-logs

Global flag: Print logs to stderr.

Docs: --print-logs
-no example
--log-level

Global flag: Log level.

DEBUG, INFO, WARN, ERROR

Docs: --log-level
opencode --log-level DEBUG
--pure

Global flag: Run without external plugins.

Docs: --pure
-no example
OpenCode subcommands
CommandDescriptionExample
opencode [project]

Starts the OpenCode terminal user interface (TUI), optionally for a given project directory; this is the default when run with no arguments.

Docs: opencode [project]
opencode /path/to/project
agent

Manage agents for OpenCode.

Docs: agent
opencode agent [command]
agent create

Creates a new agent with a custom system prompt and permission configuration; anything not allowed is denied in the generated agent frontmatter. Passing all of --path, --description, --mode and --permissions runs it non-interactively.

Docs: agent create
opencode agent create
agent list

Lists all available agents.

Docs: agent list
opencode agent list
attach

Attaches a terminal TUI to an already running OpenCode backend server started via serve or web.

Docs: attach
opencode attach http://10.20.30.40:4096
auth

Manages credentials and login for providers.

Docs: auth
opencode auth [command]
auth login

Configures API keys for any provider from Models.dev; credentials are stored in ~/.local/share/opencode/auth.json.

Docs: auth login
opencode auth login
auth list

Lists all authenticated providers stored in the credentials file. Alias: auth ls.

Docs: auth list
opencode auth ls
auth logout

Logs out of a provider by clearing it from the credentials file.

Docs: auth logout
opencode auth logout
github

Manages the GitHub agent for repository automation.

Docs: github
opencode github [command]
github install

Installs the GitHub agent in a repository, setting up the GitHub Actions workflow and guiding configuration.

Docs: github install
opencode github install
github run

Runs the GitHub agent; typically used in GitHub Actions.

Docs: github run
opencode github run
mcp

Manages Model Context Protocol servers.

Docs: mcp
opencode mcp [command]
mcp add

Interactively adds a local or remote MCP server to the configuration.

Docs: mcp add
opencode mcp add
mcp list

Lists configured MCP servers and their connection status. Alias: mcp ls.

Docs: mcp list
opencode mcp ls
mcp auth

Authenticates with an OAuth-enabled MCP server; prompts for a server if no name is given. mcp auth list (or ls) lists OAuth-capable servers and their auth status.

Docs: mcp auth
opencode mcp auth list
mcp logout

Removes OAuth credentials for an MCP server.

Docs: mcp logout
opencode mcp logout [name]
mcp debug

Debugs OAuth connection issues for an MCP server: shows auth status, tests HTTP connectivity and attempts OAuth discovery.

Docs: mcp debug
opencode mcp debug <name>
models

Lists all models available from configured providers in provider/model format, optionally filtered by provider ID.

Docs: models
opencode models anthropic
run

Runs OpenCode non-interactively by passing a prompt directly; useful for scripting and automation, and can attach to a running serve instance.

Docs: run
opencode run Explain the use of context in Go
serve

Starts a headless OpenCode HTTP server for API access without the TUI. Set OPENCODE_SERVER_PASSWORD to enable HTTP basic auth.

Docs: serve
opencode serve
session

Manages OpenCode sessions.

Docs: session
opencode session [command]
session list

Lists all OpenCode sessions.

Docs: session list
opencode session list
session delete

Deletes an OpenCode session.

Docs: session delete
opencode session delete <sessionID>
stats

Shows token usage and cost statistics for OpenCode sessions.

Docs: stats
opencode stats
export

Exports session data as JSON; prompts for a session if no ID is given.

Docs: export
opencode export [sessionID]
import

Imports session data from a JSON file.

Docs: import
opencode import session.json
web

Starts a headless OpenCode server with a web interface and opens a browser. Set OPENCODE_SERVER_PASSWORD to enable HTTP basic auth.

Docs: web
opencode web
acp

Starts an ACP (Agent Client Protocol) server that communicates via stdin/stdout using nd-JSON.

Docs: acp
opencode acp
plugin

Installs a plugin and updates your config. Alias: plug.

Docs: plugin
opencode plug <module>
pr

Fetches and checks out a GitHub PR branch, then runs OpenCode.

Docs: pr
opencode pr <number>
db

Database tools; optionally runs a query.

Docs: db
opencode db [query]
db path

Prints the database path.

Docs: db path
opencode db path
debug

Debugging and troubleshooting tools. opencode debug config shows the resolved config, including managed preference keys.

Docs: debug
opencode debug [command]
uninstall

Uninstalls OpenCode and removes all related files.

Docs: uninstall
opencode uninstall
upgrade

Updates opencode to the latest version or a specific version.

Docs: upgrade
opencode upgrade v0.1.48
OpenCode keyboard shortcuts
ShortcutDescriptionExample
leader

Leader key used by many keybinds (press it, then the shortcut).

Default: ctrl+x

Docs: leader
-no example
app_exit

Exit the application.

Default: ctrl+c,ctrl+d,<leader>q

Docs: app_exit
-no example
command_list

List available commands.

Default: ctrl+p

Docs: command_list
-no example
editor_open

Open external editor.

Default: <leader>e

Docs: editor_open
-no example
theme_list

List available themes.

Default: <leader>t

Docs: theme_list
-no example
sidebar_toggle

Toggle sidebar.

Default: <leader>b

Docs: sidebar_toggle
-no example
status_view

View status.

Default: <leader>s

Docs: status_view
-no example
session_export

Export session to editor.

Default: <leader>x

Docs: session_export
-no example
session_new

Create a new session.

Default: <leader>n

Docs: session_new
-no example
session_list

List all sessions.

Default: <leader>l

Docs: session_list
-no example
session_timeline

Show session timeline.

Default: <leader>g

Docs: session_timeline
-no example
session_rename

Rename session.

Default: ctrl+r

Docs: session_rename
-no example
session_delete

Delete session.

Default: ctrl+d

Docs: session_delete
-no example
session_interrupt

Interrupt current session.

Default: escape

Docs: session_interrupt
-no example
session_compact

Compact the session.

Default: <leader>c

Docs: session_compact
-no example
session_child_first

Enter the first child session from the parent when subagents create child sessions.

Default: <leader>down

Docs: session_child_first
-no example
session_child_cycle

Cycle to the next child session.

Default: right

Docs: session_child_cycle
-no example
session_child_cycle_reverse

Cycle to the previous child session.

Default: left

Docs: session_child_cycle_reverse
-no example
session_parent

Return to the parent session.

Default: up

Docs: session_parent
-no example
stash_delete

Delete stash entry.

Default: ctrl+d

Docs: stash_delete
-no example
model_provider_list

Open provider list from model dialog.

Default: ctrl+a

Docs: model_provider_list
-no example
model_favorite_toggle

Toggle model favorite status.

Default: ctrl+f

Docs: model_favorite_toggle
-no example
model_list

List available models.

Default: <leader>m

Docs: model_list
-no example
model_cycle_recent

Next recently used model.

Default: f2

Docs: model_cycle_recent
-no example
model_cycle_recent_reverse

Previous recently used model.

Default: shift+f2

Docs: model_cycle_recent_reverse
-no example
agent_list

List agents.

Default: <leader>a

Docs: agent_list
-no example
agent_cycle

Next agent.

Default: tab

Docs: agent_cycle
-no example
agent_cycle_reverse

Previous agent.

Default: shift+tab

Docs: agent_cycle_reverse
-no example
variant_cycle

Cycle model variants.

Default: ctrl+t

Docs: variant_cycle
-no example
messages_page_up

Scroll messages up by one page.

Default: pageup,ctrl+alt+b

Docs: messages_page_up
-no example
messages_page_down

Scroll messages down by one page.

Default: pagedown,ctrl+alt+f

Docs: messages_page_down
-no example
messages_line_up

Scroll messages up by one line.

Default: ctrl+alt+y

Docs: messages_line_up
-no example
messages_line_down

Scroll messages down by one line.

Default: ctrl+alt+e

Docs: messages_line_down
-no example
messages_half_page_up

Scroll messages up by half page.

Default: ctrl+alt+u

Docs: messages_half_page_up
-no example
messages_half_page_down

Scroll messages down by half page.

Default: ctrl+alt+d

Docs: messages_half_page_down
-no example
messages_first

Navigate to first message.

Default: ctrl+g,home

Docs: messages_first
-no example
messages_last

Navigate to last message.

Default: ctrl+alt+g,end

Docs: messages_last
-no example
messages_copy

Copy message.

Default: <leader>y

Docs: messages_copy
-no example
messages_undo

Undo message.

Default: <leader>u

Docs: messages_undo
-no example
messages_redo

Redo message.

Default: <leader>r

Docs: messages_redo
-no example
messages_toggle_conceal

Keybind for: messages toggle conceal.

Default: <leader>h

Docs: messages_toggle_conceal
-no example
input_clear

Clear input field.

Default: ctrl+c

Docs: input_clear
-no example
input_paste

Paste from clipboard.

Default: ctrl+v (preventDefault: false)

Docs: input_paste
-no example
input_submit

Submit input.

Default: return

Docs: input_submit
-no example
input_newline

Insert newline in input.

Default: shift+return,ctrl+return,alt+return,ctrl+j

Docs: input_newline
-no example
input_move_left

Move cursor left in input.

Default: left,ctrl+b

Docs: input_move_left
-no example
input_move_right

Move cursor right in input.

Default: right,ctrl+f

Docs: input_move_right
-no example
input_move_up

Move cursor up in input.

Default: up

Docs: input_move_up
-no example
input_move_down

Move cursor down in input.

Default: down

Docs: input_move_down
-no example
input_select_left

Select left in input.

Default: shift+left

Docs: input_select_left
-no example
input_select_right

Select right in input.

Default: shift+right

Docs: input_select_right
-no example
input_select_up

Select up in input.

Default: shift+up

Docs: input_select_up
-no example
input_select_down

Select down in input.

Default: shift+down

Docs: input_select_down
-no example
input_line_home

Move to start of line in input.

Default: ctrl+a

Docs: input_line_home
-no example
input_line_end

Move to end of line in input.

Default: ctrl+e

Docs: input_line_end
-no example
input_select_line_home

Select to start of line in input.

Default: ctrl+shift+a

Docs: input_select_line_home
-no example
input_select_line_end

Select to end of line in input.

Default: ctrl+shift+e

Docs: input_select_line_end
-no example
input_visual_line_home

Move to start of visual line in input.

Default: alt+a

Docs: input_visual_line_home
-no example
input_visual_line_end

Move to end of visual line in input.

Default: alt+e

Docs: input_visual_line_end
-no example
input_select_visual_line_home

Select to start of visual line in input.

Default: alt+shift+a

Docs: input_select_visual_line_home
-no example
input_select_visual_line_end

Select to end of visual line in input.

Default: alt+shift+e

Docs: input_select_visual_line_end
-no example
input_buffer_home

Move to start of buffer in input.

Default: home

Docs: input_buffer_home
-no example
input_buffer_end

Move to end of buffer in input.

Default: end

Docs: input_buffer_end
-no example
input_select_buffer_home

Select to start of buffer in input.

Default: shift+home

Docs: input_select_buffer_home
-no example
input_select_buffer_end

Select to end of buffer in input.

Default: shift+end

Docs: input_select_buffer_end
-no example
input_delete_line

Delete line in input.

Default: ctrl+shift+d

Docs: input_delete_line
-no example
input_delete_to_line_end

Delete to end of line in input.

Default: ctrl+k

Docs: input_delete_to_line_end
-no example
input_delete_to_line_start

Delete to start of line in input.

Default: ctrl+u

Docs: input_delete_to_line_start
-no example
input_backspace

Backspace in input.

Default: backspace,shift+backspace

Docs: input_backspace
-no example
input_delete

Delete character in input.

Default: ctrl+d,delete,shift+delete

Docs: input_delete
-no example
input_undo

Undo in input.

Default: ctrl+-,super+z; on Windows defaults to ctrl+z,ctrl+-,super+z

Docs: input_undo
-no example
input_redo

Redo in input.

Default: ctrl+.,super+shift+z

Docs: input_redo
-no example
input_word_forward

Move word forward in input.

Default: alt+f,alt+right,ctrl+right

Docs: input_word_forward
-no example
input_word_backward

Move word backward in input.

Default: alt+b,alt+left,ctrl+left

Docs: input_word_backward
-no example
input_select_word_forward

Select word forward in input.

Default: alt+shift+f,alt+shift+right

Docs: input_select_word_forward
-no example
input_select_word_backward

Select word backward in input.

Default: alt+shift+b,alt+shift+left

Docs: input_select_word_backward
-no example
input_delete_word_forward

Delete word forward in input.

Default: alt+d,alt+delete,ctrl+delete

Docs: input_delete_word_forward
-no example
input_delete_word_backward

Delete word backward in input.

Default: ctrl+w,ctrl+backspace,alt+backspace

Docs: input_delete_word_backward
-no example
input_select_all

Select all in input.

Default: super+a

Docs: input_select_all
-no example
history_previous

Previous history item.

Default: up

Docs: history_previous
-no example
history_next

Next history item.

Default: down

Docs: history_next
-no example
dialog.select.prev

Move to previous dialog item.

Default: up,ctrl+p

Docs: dialog.select.prev
-no example
dialog.select.next

Move to next dialog item.

Default: down,ctrl+n

Docs: dialog.select.next
-no example
dialog.select.page_up

Move up one page in dialog.

Default: pageup

Docs: dialog.select.page_up
-no example
dialog.select.page_down

Move down one page in dialog.

Default: pagedown

Docs: dialog.select.page_down
-no example
dialog.select.home

Move to first dialog item.

Default: home

Docs: dialog.select.home
-no example
dialog.select.end

Move to last dialog item.

Default: end

Docs: dialog.select.end
-no example
dialog.select.submit

Submit selected dialog item.

Default: return

Docs: dialog.select.submit
-no example
dialog.prompt.submit

Submit dialog prompt.

Default: return

Docs: dialog.prompt.submit
-no example
dialog.mcp.toggle

Toggle MCP server.

Default: space

Docs: dialog.mcp.toggle
-no example
prompt.autocomplete.prev

Move to previous autocomplete item.

Default: up,ctrl+p

Docs: prompt.autocomplete.prev
-no example
prompt.autocomplete.next

Move to next autocomplete item.

Default: down,ctrl+n

Docs: prompt.autocomplete.next
-no example
prompt.autocomplete.hide

Hide autocomplete.

Default: escape

Docs: prompt.autocomplete.hide
-no example
prompt.autocomplete.select

Select autocomplete item.

Default: return

Docs: prompt.autocomplete.select
-no example
prompt.autocomplete.complete

Complete autocomplete item.

Default: tab

Docs: prompt.autocomplete.complete
-no example
permission.prompt.fullscreen

Toggle permission prompt fullscreen.

Default: ctrl+f

Docs: permission.prompt.fullscreen
-no example
plugins.toggle

Toggle plugin.

Default: space

Docs: plugins.toggle
-no example
dialog.plugins.install

Keybind for: dialog plugins install.

Default: shift+i

Docs: dialog.plugins.install
-no example
terminal_suspend

Suspend terminal.

Default: ctrl+z; forced to none on Windows

Docs: terminal_suspend
-no example
which_key_toggle

Toggle which-key panel.

Default: ctrl+alt+k

Docs: which_key_toggle
-no example
which_key_layout_toggle

Switch which-key layout.

Default: ctrl+alt+shift+k

Docs: which_key_layout_toggle
-no example
which_key_pending_toggle

Toggle which-key pending preview.

Default: ctrl+alt+shift+p

Docs: which_key_pending_toggle
-no example
which_key_group_previous

Previous which-key group.

Default: ctrl+alt+left,ctrl+alt+[

Docs: which_key_group_previous
-no example
which_key_group_next

Next which-key group.

Default: ctrl+alt+right,ctrl+alt+]

Docs: which_key_group_next
-no example
which_key_scroll_up

Scroll which-key up.

Default: ctrl+alt+up,ctrl+alt+p

Docs: which_key_scroll_up
-no example
which_key_scroll_down

Scroll which-key down.

Default: ctrl+alt+down,ctrl+alt+n

Docs: which_key_scroll_down
-no example
which_key_page_up

Page which-key up.

Default: ctrl+alt+pageup

Docs: which_key_page_up
-no example
which_key_page_down

Page which-key down.

Default: ctrl+alt+pagedown

Docs: which_key_page_down
-no example
which_key_home

Jump to first which-key binding.

Default: ctrl+alt+home

Docs: which_key_home
-no example
which_key_end

Jump to last which-key binding.

Default: ctrl+alt+end

Docs: which_key_end
-no example
tab

Cycles through primary agents during a session (agent_cycle).

Default for agent_cycle

Docs: tab
-no example
ctrl+t

Cycles through model variants (actual reasoning effort), unlike /thinking which only toggles display.

Default for variant_cycle

Docs: ctrl+t
-no example
@

References files in a message via fuzzy file search; configured references also appear (@alias, @alias/).

Docs: @
How is auth handled in @packages/functions/src/api/index.ts?
!

Starting a message with ! runs a shell command; output is added to the conversation as a tool result.

Docs: !
!ls -la
ctrl+p

Opens the command palette, used for TUI customizations like username display and auto-approve permissions.

Default for command_list

Docs: ctrl+p
-no example
Cmd+Esc / Ctrl+Esc

IDE extension quick launch: opens OpenCode in a split terminal view or focuses an existing session (Mac / Windows-Linux).

Docs: Cmd+Esc / Ctrl+Esc
-no example
Cmd+Shift+Esc / Ctrl+Shift+Esc

IDE extension: starts a new OpenCode terminal session even if one is open.

Docs: Cmd+Shift+Esc / Ctrl+Shift+Esc
-no example
Cmd+Option+K / Alt+Ctrl+K

IDE extension: inserts file references such as @File#L37-42.

Docs: Cmd+Option+K / Alt+Ctrl+K
-no example
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"]
OpenCode environment variables
VariableDescriptionExample
OPENCODE_GIT_BASH_PATH

Path to Git Bash executable on Windows.

string

Docs: OPENCODE_GIT_BASH_PATH
-no example
OPENCODE_CONFIG

Path to config file; loaded between global and project configs.

string

Docs: OPENCODE_CONFIG
export OPENCODE_CONFIG=/path/to/my/custom-config.json
OPENCODE_TUI_CONFIG

Path to TUI config file.

string

Docs: OPENCODE_TUI_CONFIG
-no example
OPENCODE_CONFIG_DIR

Path to a config directory searched for agents, commands, modes and plugins like a .opencode directory.

string

Docs: OPENCODE_CONFIG_DIR
export OPENCODE_CONFIG_DIR=/path/to/my/config-directory
OPENCODE_CONFIG_CONTENT

Inline JSON config content, applied as runtime overrides.

string

Docs: OPENCODE_CONFIG_CONTENT
-no example
OPENCODE_DISABLE_AUTOUPDATE

Disable automatic update checks.

boolean

Docs: OPENCODE_DISABLE_AUTOUPDATE
-no example
OPENCODE_DISABLE_PRUNE

Disable pruning of old data.

boolean

Docs: OPENCODE_DISABLE_PRUNE
-no example
OPENCODE_DISABLE_TERMINAL_TITLE

Disable automatic terminal title updates.

boolean

Docs: OPENCODE_DISABLE_TERMINAL_TITLE
-no example
OPENCODE_PERMISSION

Inlined JSON permissions config.

string

Docs: OPENCODE_PERMISSION
-no example
OPENCODE_DISABLE_DEFAULT_PLUGINS

Disable default plugins.

boolean

Docs: OPENCODE_DISABLE_DEFAULT_PLUGINS
-no example
OPENCODE_DISABLE_LSP_DOWNLOAD

Disable automatic LSP server downloads.

boolean

Docs: OPENCODE_DISABLE_LSP_DOWNLOAD
-no example
OPENCODE_ENABLE_EXPERIMENTAL_MODELS

Enable experimental models.

boolean

Docs: OPENCODE_ENABLE_EXPERIMENTAL_MODELS
-no example
OPENCODE_DISABLE_AUTOCOMPACT

Disable automatic context compaction.

boolean

Docs: OPENCODE_DISABLE_AUTOCOMPACT
-no example
OPENCODE_DISABLE_CLAUDE_CODE

Disable reading from .claude (prompt + skills).

boolean

Docs: OPENCODE_DISABLE_CLAUDE_CODE
export OPENCODE_DISABLE_CLAUDE_CODE=1
OPENCODE_DISABLE_CLAUDE_CODE_PROMPT

Disable reading ~/.claude/CLAUDE.md.

boolean

Docs: OPENCODE_DISABLE_CLAUDE_CODE_PROMPT
export OPENCODE_DISABLE_CLAUDE_CODE_PROMPT=1
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS

Disable loading .claude/skills.

boolean

Docs: OPENCODE_DISABLE_CLAUDE_CODE_SKILLS
export OPENCODE_DISABLE_CLAUDE_CODE_SKILLS=1
OPENCODE_DISABLE_MODELS_FETCH

Disable fetching models from remote sources.

boolean

Docs: OPENCODE_DISABLE_MODELS_FETCH
-no example
OPENCODE_DISABLE_MOUSE

Disable mouse capture in the TUI.

boolean

Docs: OPENCODE_DISABLE_MOUSE
-no example
OPENCODE_FAKE_VCS

Fake VCS provider for testing purposes.

string

Docs: OPENCODE_FAKE_VCS
-no example
OPENCODE_CLIENT

Client identifier.

string. Default: cli

Docs: OPENCODE_CLIENT
-no example
OPENCODE_SERVER_PASSWORD

Enable HTTP basic auth for serve/web.

string

Docs: OPENCODE_SERVER_PASSWORD
OPENCODE_SERVER_PASSWORD=your-password opencode serve
OPENCODE_SERVER_USERNAME

Override basic auth username.

string. Default: opencode

Docs: OPENCODE_SERVER_USERNAME
-no example
OPENCODE_MODELS_URL

Custom URL for fetching models configuration.

string

Docs: OPENCODE_MODELS_URL
-no example
OPENCODE_EXPERIMENTAL

Experimental (may change or be removed): Enable the experimental umbrella flag.

boolean

Docs: OPENCODE_EXPERIMENTAL
-no example
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY

Experimental (may change or be removed): Enable icon discovery.

boolean

Docs: OPENCODE_EXPERIMENTAL_ICON_DISCOVERY
-no example
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT

Experimental (may change or be removed): Disable copy on select in TUI.

boolean

Docs: OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT
-no example
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS

Experimental (may change or be removed): Default timeout for bash commands in ms.

number

Docs: OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS
-no example
OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX

Experimental (may change or be removed): Max output tokens for LLM responses.

number

Docs: OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX
-no example
OPENCODE_EXPERIMENTAL_FILEWATCHER

Experimental (may change or be removed): Enable file watcher for entire dir.

boolean

Docs: OPENCODE_EXPERIMENTAL_FILEWATCHER
-no example
OPENCODE_EXPERIMENTAL_OXFMT

Experimental (may change or be removed): Enable oxfmt formatter.

boolean

Docs: OPENCODE_EXPERIMENTAL_OXFMT
-no example
OPENCODE_EXPERIMENTAL_LSP_TOOL

Experimental (may change or be removed): Enable experimental LSP tool.

boolean

Docs: OPENCODE_EXPERIMENTAL_LSP_TOOL
-no example
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER

Experimental (may change or be removed): Disable file watcher.

boolean

Docs: OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER
-no example
OPENCODE_EXPERIMENTAL_LSP_TY

Experimental (may change or be removed): Enable TY LSP for python files.

boolean

Docs: OPENCODE_EXPERIMENTAL_LSP_TY
-no example
OPENCODE_EXPERIMENTAL_PLAN_MODE

Experimental (may change or be removed): Enable plan mode.

boolean

Docs: OPENCODE_EXPERIMENTAL_PLAN_MODE
-no example
OPENCODE_EXPERIMENTAL_EVENT_SYSTEM

Experimental (may change or be removed): Enable experimental event system.

boolean

Docs: OPENCODE_EXPERIMENTAL_EVENT_SYSTEM
-no example
OPENCODE_EXPERIMENTAL_NATIVE_LLM

Experimental (may change or be removed): Enable native LLM request path.

boolean

Docs: OPENCODE_EXPERIMENTAL_NATIVE_LLM
-no example
OPENCODE_EXPERIMENTAL_SCOUT

Experimental (may change or be removed): Enable Scout subagent.

boolean

Docs: OPENCODE_EXPERIMENTAL_SCOUT
-no example
OPENCODE_EXPERIMENTAL_WORKSPACES

Experimental (may change or be removed): Enable workspace support.

boolean

Docs: OPENCODE_EXPERIMENTAL_WORKSPACES
-no example
EDITOR

Editor used by the /editor and /export TUI commands; GUI editors such as VS Code need --wait.

string

Docs: EDITOR
export EDITOR="code --wait"
HTTPS_PROXY

Standard HTTPS proxy variable respected by OpenCode (recommended); basic auth credentials can be included in the URL.

URL

Docs: HTTPS_PROXY
export HTTPS_PROXY=https://proxy.example.com:8080
HTTP_PROXY

Standard HTTP proxy variable respected by OpenCode, used if HTTPS is not available.

URL

Docs: HTTP_PROXY
export HTTP_PROXY=http://proxy.example.com:8080
NO_PROXY

Bypass list for the proxy; required for localhost because the TUI talks to a local HTTP server.

comma-separated hosts

Docs: NO_PROXY
export NO_PROXY=localhost,127.0.0.1
NODE_EXTRA_CA_CERTS

Path to a custom CA certificate for enterprise HTTPS; works for proxy connections and direct API access.

path to PEM

Docs: NODE_EXTRA_CA_CERTS
export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem
OPENCODE_PORT

If set, OpenCode Desktop tries to use this port for its local server; unset it or pick a free port to fix connection issues.

number

Docs: OPENCODE_PORT
-no example
OC_ALLOW_WAYLAND

Launch OpenCode Desktop with this set to 1 to work around blank windows or crashes on some Linux Wayland setups.

1

Docs: OC_ALLOW_WAYLAND
-no example
COLORTERM

Set to truecolor to enable 24-bit color so themes display their full palette.

truecolor or 24bit

Docs: COLORTERM
-no example
XDG_CONFIG_HOME

When set, user themes are also read from $XDG_CONFIG_HOME/opencode/themes/*.json.

path

Docs: XDG_CONFIG_HOME
-no example
ANTHROPIC_API_KEY

Anthropic API key; can be referenced in config via {env:ANTHROPIC_API_KEY} or set in the GitHub Action env.

string

Docs: ANTHROPIC_API_KEY
-no example
OpenCode config files
PathDescription
opencode.json

Project config file in the project root (JSON or JSONC); OpenCode looks in the current directory then traverses up to the nearest Git directory.

Docs: opencode.json
opencode.jsonc

JSONC (JSON with Comments) form of the OpenCode config file.

Docs: opencode.jsonc
~/.config/opencode/opencode.json

Global config for user-wide server/runtime preferences like providers, models and permissions.

Docs: ~/.config/opencode/opencode.json
~/.config/opencode/tui.json

Global TUI-specific settings file (also tui.jsonc); project tui.json can sit alongside opencode.json.

Docs: ~/.config/opencode/tui.json
tui.json

TUI config file (or tui.jsonc) for theme, keybinds, scrolling, cursor, mouse and attention settings, separate from opencode.json.

Docs: tui.json
.well-known/opencode

Remote organizational config endpoint fetched when authenticating with a supporting provider; loaded first as the base layer.

Docs: .well-known/opencode
/Library/Application Support/opencode/

macOS managed config directory for an admin-controlled opencode.json or opencode.jsonc at highest priority.

Docs: /Library/Application Support/opencode/
/etc/opencode/

Linux managed config directory for admin-controlled opencode.json or opencode.jsonc.

Docs: /etc/opencode/
%ProgramData%\opencode

Windows managed config directory for admin-controlled opencode.json or opencode.jsonc.

Docs: %ProgramData%\opencode
/Library/Managed Preferences/<user>/ai.opencode.managed.plist

macOS per-user managed preferences (ai.opencode.managed domain via MDM .mobileconfig); plist keys map to opencode.json fields.

Docs: /Library/Managed Preferences/<user>/ai.opencode.managed.plist
/Library/Managed Preferences/ai.opencode.managed.plist

macOS machine-wide managed preferences for the ai.opencode.managed domain.

Docs: /Library/Managed Preferences/ai.opencode.managed.plist
.opencode/

Project directory for agents/, commands/, modes/, plugins/, skills/, tools/ and themes/ (plural names; singular also supported).

Docs: .opencode/
~/.local/share/opencode/auth.json

Credentials file for provider API keys and OAuth tokens added via /connect or opencode auth login.

Docs: ~/.local/share/opencode/auth.json
~/.local/share/opencode/mcp-auth.json

Where OAuth tokens for MCP servers are stored after opencode mcp auth.

Docs: ~/.local/share/opencode/mcp-auth.json
~/.local/share/opencode/

Application data directory (sessions, auth.json, log/, project/). Windows: %USERPROFILE%\.local\share\opencode.

Docs: ~/.local/share/opencode/
~/.local/share/opencode/log/

Log directory; files are timestamped and the most recent 10 are kept.

Docs: ~/.local/share/opencode/log/
~/.cache/opencode

Cache directory including provider packages and npm plugins (node_modules); can be deleted to force reinstall.

Docs: ~/.cache/opencode
AGENTS.md

Project rules file with custom instructions included in the LLM context; created or updated by /init.

Docs: AGENTS.md
~/.config/opencode/AGENTS.md

Global rules applied across all opencode sessions.

Docs: ~/.config/opencode/AGENTS.md
CLAUDE.md

Claude Code compatible project rules fallback, used if no AGENTS.md exists.

Docs: CLAUDE.md
~/.claude/CLAUDE.md

Claude Code compatible global rules fallback, used if no ~/.config/opencode/AGENTS.md exists.

Docs: ~/.claude/CLAUDE.md
.opencode/agents/

Per-project markdown agent definitions; file name becomes the agent name. Global: ~/.config/opencode/agents/.

Docs: .opencode/agents/
.opencode/commands/

Per-project markdown custom commands; file name becomes the command name. Global: ~/.config/opencode/commands/.

Docs: .opencode/commands/
.opencode/skills/<name>/SKILL.md

Project skill location; also ~/.config/opencode/skills, .claude/skills, ~/.claude/skills, .agents/skills and ~/.agents/skills.

Docs: .opencode/skills/<name>/SKILL.md
.opencode/plugins/

Project-level plugin directory; global plugins live in ~/.config/opencode/plugins/.

Docs: .opencode/plugins/
.opencode/package.json

Declares npm dependencies for local plugins and custom tools; OpenCode runs bun install at startup.

Docs: .opencode/package.json
.opencode/tools/

Project custom tool definitions; global custom tools go in ~/.config/opencode/tools/.

Docs: .opencode/tools/
~/.config/opencode/themes/*.json

User custom theme directory; project themes go in .opencode/themes/*.json.

Docs: ~/.config/opencode/themes/*.json
.ignore

File in the project root that re-includes paths ignored by .gitignore for ripgrep-based tools like grep and glob.

Docs: .ignore
.github/workflows/opencode.yml

GitHub Actions workflow file for the OpenCode GitHub agent.

Docs: .github/workflows/opencode.yml
$HOME/intelephense/license.txt

File containing only a PHP Intelephense license key for premium features (Windows: %USERPROFILE%/intelephense/license.txt).

Docs: $HOME/intelephense/license.txt

More on OpenCode

FAQ

How many commands and options does OpenCode have?

The official OpenCode docs list 477 items: 15 slash commands, 82 CLI flags, 36 subcommands, 118 keyboard shortcuts, 147 settings keys, 48 environment variables and 31 config files. The largest group is settings keys, with 147.

Where does OpenCode keep its configuration?

OpenCode documents 31 config files and locations, including opencode.json, opencode.jsonc and ~/.config/opencode/opencode.json. The docs describe opencode.json as: Project config file in the project root (JSON or JSONC); OpenCode looks in the current directory then traverses up to the nearest Git directory.

Which environment variables does OpenCode read?

The docs list 48 environment variables, such as OPENCODE_GIT_BASH_PATH, OPENCODE_CONFIG, OPENCODE_TUI_CONFIG and OPENCODE_CONFIG_DIR. Each one is in the environment variables table above with what it controls.

Sources

Last verified . Names and examples are copied verbatim from the 24 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.