Skip to main content

Config Reference

Quick reference for all configuration options in opencode.json and tui.json.

opencode.json — Core Configuration

Model Settings

{
"model": "anthropic/claude-sonnet-4",
"small_model": "anthropic/claude-haiku-3-5",
"default_agent": "build"
}
OptionTypeDefaultDescription
modelstring"anthropic/claude-sonnet-4"Primary model in provider/model format
small_modelstring"anthropic/claude-haiku-3-5"Lightweight model for compaction and subtasks
default_agentstring"build"Default agent used on startup

Provider Configuration

{
"provider": {
"ollama": {
"baseURL": "http://localhost:11434/api",
"timeout": 60000,
"headers": {
"X-Custom": "value"
},
"models": ["llama3", "codellama"]
}
}
}
OptionTypeDescription
baseURLstringAPI endpoint URL for the provider
timeoutnumberRequest timeout in milliseconds
headersobjectCustom HTTP headers for all requests
modelsstring[]Whitelist of specific model names to use

Tool Permissions

{
"permission": {
"read_file": "allow",
"write_file": "allow",
"run_command": "ask",
"glob": "allow",
"grep": "allow",
"edit": "allow",
"terminal": "deny",
"search": "allow",
"web_fetch": "ask"
}
}

Permission levels:

LevelDescription
"allow"Tool executes automatically without confirmation
"ask"Prompt user for approval before execution
"deny"Tool cannot be used

Granular pattern-based permissions:

{
"permission": {
"write_file": {
"allow": ["src/**/*.ts", "*.md"],
"deny": ["*.env", "node_modules/**"]
},
"run_command": {
"allow": ["npm test", "npm run build"],
"ask": ["git *"],
"deny": ["rm -rf *"]
}
}
}

Agent Definitions

{
"agent": {
"build": {
"mode": "full",
"model": "anthropic/claude-sonnet-4",
"system": "You are a skilled software engineer.",
"permission": {
"run_command": "deny"
},
"temperature": 0.3,
"steps": 50
},
"plan": {
"mode": "plan",
"model": "anthropic/claude-sonnet-4",
"temperature": 0.1,
"steps": 30
}
}
}
AttributeTypeDescription
mode"full" | "plan"Agent operating mode
modelstringModel override for this agent
systemstringSystem prompt override
permissionobjectTool permission overrides
temperaturenumberModel temperature (0.0 - 1.0)
stepsnumberMaximum tool call steps per response

Custom Commands

{
"command": {
"test": {
"template": "Run the tests for this project and report results",
"description": "Run project tests",
"agent": "build",
"model": "anthropic/claude-haiku-3-5"
},
"review": {
"template": "Review the latest git changes for bugs, security issues, and style problems",
"description": "Review latest changes"
}
}
}

Formatter Configuration

{
"formatter": true
}

Or per-language:

{
"formatter": {
"typescript": "prettier",
"python": "black",
"rust": "rustfmt",
"go": "gofmt"
}
}

LSP Configuration

{
"lsp": true
}

Or per-language:

{
"lsp": {
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"]
},
"python": true
}
}

MCP Servers

{
"mcp": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"],
"enabled": true
},
"github": {
"type": "url",
"url": "https://mcp.github.com/sse",
"enabled": false
}
}
}

Plugins

{
"plugin": [
"opencode-helicone-session",
"@my-org/custom-plugin",
"./.opencode/plugins/internal.mjs"
]
}

Instructions (Rules)

{
"instructions": [
"./AGENTS.md",
"./.opencode/rules/*.md"
]
}

Update Behavior

{
"autoupdate": true
}
ValueBehavior
trueAuto-download and install updates
falseNever check for updates
"notify"Check and notify, but do not auto-install

Snapshots (Undo/Redo)

{
"snapshot": true
}

When enabled, OpenCode creates git-style snapshots for each AI change, supporting /undo and /redo commands.

Server Configuration

{
"server": {
"port": 4096,
"hostname": "0.0.0.0",
"mdns": true,
"mdnsDomain": "myproject.local",
"cors": ["http://localhost:5173"]
}
}

Sharing

{
"share": "manual"
}
ValueDescription
"manual"Share only on explicit /share command
"auto"Auto-share all new conversations
"disabled"Disable sharing entirely

Provider Filtering

{
"disabled_providers": ["openai", "google"],
"enabled_providers": ["anthropic", "ollama"]
}

Only one of disabled_providers or enabled_providers should be used.

Shell

{
"shell": "pwsh"
}

Override the default shell used for command execution.

tui.json — UI Configuration

Theme

{
"theme": "catppuccin-mocha"
}

Built-in themes include default, dark, light, catppuccin-latte, catppuccin-mocha, nord, dracula, monokai, solarized-dark, solarized-light.

Keybindings

{
"keybinds": [
{
"keys": ["ctrl+x", "c"],
"action": "compact"
}
]
}

See Keyboard Shortcuts for the full action reference.

Other UI Settings

{
"scroll_speed": 3,
"mouse": true,
"diff_style": "auto"
}
OptionTypeDefaultDescription
scroll_speednumber3Lines per scroll tick
mousebooleantrueEnable mouse capture for scrolling and clicking
diff_style"auto" | "stacked""auto"Diff display mode

Attention (Notifications)

{
"attention": {
"sound": true,
"notifications": true
}
}

Environment Variables

VariableDescription
ANTHROPIC_API_KEYAPI key for Anthropic Claude models
OPENAI_API_KEYAPI key for OpenAI models
GOOGLE_GENERATIVE_AI_API_KEYAPI key for Google Gemini models
GROQ_API_KEYAPI key for Groq models
TOGETHER_API_KEYAPI key for Together AI models
MISTRAL_API_KEYAPI key for Mistral models
COHERE_API_KEYAPI key for Cohere models
FIREWORKS_API_KEYAPI key for Fireworks AI models
AZURE_OPENAI_KEYAPI key for Azure OpenAI
OPENCODE_SERVER_PASSWORDHTTP Basic auth password for server mode
OPENCODE_GIT_BASH_PATHPath to Git Bash executable (Windows)
HTTP_PROXY / HTTPS_PROXYProxy server URL for outbound connections
NO_PROXYHosts to exclude from proxy routing
NODE_TLS_REJECT_UNAUTHORIZEDSet to 0 to disable TLS verification (not recommended)