## How to Remove a Provider from OpenCode CLI Provider Config
There are **two parts** to removing a provider in OpenCode:
### 1. Remove the provider from your config file (opencode.json)
OpenCode stores provider configuration in your `opencode.json` file. To remove a provider, simply **delete its entry** from the `"provider"` section. Config files can be in:
- **Global config**: `~/.config/opencode/opencode.json`
- **Project config**: `opencode.json` in your project directory
For example, if your config has:
```json
{
"provider": {
"anthropic": { ... },
"openai": { ... }
}
}
```
Remove the provider block you no longer want (e.g., delete `"openai": { ... }`).
### 2. Remove the provider's credentials (API keys)
Provider API keys are stored in `~/.local/share/opencode/auth.json`. Use the CLI command:
```bash
opencode auth logout
```
This will prompt you to select which provider to log out from. It clears that provider's credentials from the auth file.
### 3. Verify what's configured
To see which providers are currently authenticated:
```bash
opencode auth list
```
or
```bash
opencode auth ls
```
### Summary
| What to remove | How |
|---|---|
| Provider config settings | Edit `opencode.json` — delete the provider's block |
| Provider API keys/credentials | Run `opencode auth logout` and select the provider |
| Check current providers | Run `opencode auth list` |
1searchopencode cli remove provider config
2navigatehttps://opencode.ai/docs/cli/
3clickundefined
4clickundefined
5ddm--text --find logout
6navigatehttps://opencode.ai/docs/cli/