<!-- Generated from public website sources; do not edit this file. -->

# OpenCode
Connect OpenCode to an OpenAI-compatible provider.

## Before you start
Install OpenCode and obtain your plan API key, the provider's base URL, and the exact model name. The following example requires an OpenAI-compatible Chat Completions endpoint. Compatibility for this independent service has not yet been verified.

## Add your key
Check your installation first:

```sh
opencode --version
```

If it is not installed, use the [OpenCode download page](https://opencode.ai/download). Update an older client before troubleshooting provider settings.

Start OpenCode in your project and enter `/connect`. Choose `Other`, enter `coding-plan` as the provider ID, and enter your API key. OpenCode stores this credential locally; do not put the key in your project configuration.

## Add the provider
Create or update `opencode.json` in your project. Replace the URL and model identifier with the actual values supplied by the service. If the file already exists, merge these fields into the existing JSON instead of overwriting it.

```json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "coding-plan": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Coding Plan",
      "options": {
        "baseURL": "https://your-service-base-url"
      },
      "models": {
        "your-model-name": { "name": "Your model" }
      }
    }
  }
}
```

The provider ID in the file must match the ID used with `/connect`. The base URL must include any version prefix required by the service.

## Select and test the model
Restart OpenCode if needed, enter `/models`, and select your configured model. Send a small test request. If it fails, verify the model ID, URL, key, API format, and remaining allowance.

## Common configuration mistakes
| Symptom | What to check |
| --- | --- |
| Provider is missing | JSON syntax and the location of `opencode.json` |
| Authentication fails | `/connect` provider ID matches `coding-plan` exactly |
| Model is not found | The key inside `models` is the API model ID, not a display name |
| Endpoint is not found | The base URL includes the required version prefix exactly once |

To switch back, select your previous provider with `/models`. Remove only the custom provider entry if you no longer need it, preserving the rest of your configuration.

## Official reference
See [OpenCode custom providers](https://opencode.ai/docs/providers/) and [DeepSeek's OpenCode guide](https://api-docs.deepseek.com/quick_start/agent_integrations/opencode/). The built-in DeepSeek provider uses official DeepSeek credentials and may not accept credentials from this service.

---

HTML source: [OpenCode — DeepSeek Subscription Tutorials](https://deepseeksub.com/docs/opencode/)
