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

OpenCode CLI reference - Environment variables

OpenCode environment variables

OpenCode documents 48 environment variables, including OPENCODE_GIT_BASH_PATH, OPENCODE_CONFIG and OPENCODE_TUI_CONFIG. OpenCode reads these from your shell environment. Each row gives the docs' description, accepted values and an example where one is documented.

Last verified 6 official pagesFull OpenCode reference

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

The rest of the OpenCode reference

FAQ

How many environment variables does OpenCode have?

The official OpenCode docs list 48 environment variables, including OPENCODE_GIT_BASH_PATH, OPENCODE_CONFIG and OPENCODE_TUI_CONFIG. All of them are in the table above, in the docs' order.

What does OPENCODE_GIT_BASH_PATH do in OpenCode?

Path to Git Bash executable on Windows. Values: string.

Where are OpenCode environment variables documented?

On 6 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 6 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.