Configure opencode with opencode.json
configuration
// what it does
opencode reads JSON/JSONC config, merging global (~/.config/opencode/opencode.json) with a per-project ./opencode.json where the project wins on conflicting keys. Add the $schema line for editor autocomplete. Common keys: model, small_model, theme, instructions, permission, agent, mcp.
// shell
$ ~/.config/opencode/opencode.json$ ./opencode.json$ { "$schema": "https://opencode.ai/config.json", "model": "anthropic/claude-sonnet-4-5" }// gotcha
Configs merge, they do not replace — a project file overrides only the keys it sets, so a stray key in the global file still applies. Precedence runs remote < global < OPENCODE_CONFIG < project < .opencode/ < OPENCODE_CONFIG_CONTENT.