WindowsmacOSLinux

Where Does OpenCode Store Config?

OpenCode global config and auth files plus per-project opencode.json.

Last updated

OpenCode reads a global JSON config from your home config folder for providers, themes and agents, with per-project opencode.json files overriding it locally. Auth credentials sit beside the config in a separate auth file.

Version the project file, never the global auth file. One leaked provider key costs more than any model call saves.

Where OpenCode stores this, by platform

Windows
%USERPROFILE%\.config\opencode

Global opencode.json plus auth.json with provider keys in this folder. Per-project opencode.json in the repo root overrides globals. Keep auth.json out of dotfiles repos.

macOS
~/.config/opencode

Same global config and auth layout as Windows. Project-local opencode.json files layer on top per directory.

Linux
~/.config/opencode

XDG config home for globals plus auth.json. Respect XDG_CONFIG_HOME if set; the folder moves with it.

Frequently asked questions

Global or project config for OpenCode?

Globals in the folder above set defaults; opencode.json in each repo customizes agents and permissions per project. Project wins conflicts.

Where are OpenCode provider keys?

In auth.json next to opencode.json above. Back it up privately and never commit it.

Notice an outdated path? Let us know.