30 lines
971 B
Markdown
30 lines
971 B
Markdown
---
|
|
title: Config
|
|
---
|
|
|
|
You can configure opencode using a JSON config file that can be placed in:
|
|
|
|
- Globally under `~/.config/opencode/config.json`.
|
|
- Your project root under `opencode.json`. This is safe to checked into Git and uses the same schema as the global one.
|
|
|
|
```json
|
|
{
|
|
"$schema": "https://opencode.ai/config.json",
|
|
"theme": "opencode",
|
|
"model": "anthropic/claude-sonnet-4-20250514",
|
|
"autoshare": false,
|
|
"autoupdate": true
|
|
}
|
|
```
|
|
|
|
In most cases, you'll want to use the global config for things like themes, providers, or keybinds. Having a config per project is useful if you are using different providers for your company.
|
|
|
|
When opencode starts up, it looks for a config file in the current directory or traverse up to the nearest Git directory.
|
|
|
|
|
|
## Schema
|
|
|
|
The config file has a schema that's defined in [**`opencode.ai/config.json`**](https://opencode.ai/config.json).
|
|
|
|
Your editor should be able to validate and autocomplete based on the schema.
|