OpenCode / Agent Plan reference

OpenCode integration reference

Add the Agent Plan as a named OpenCode provider and keep the provider model registry aligned with the active model.

1 · Quick start

Connect OpenCode in three moves

Start with the matching configuration file, keep the key in the named secret location, and use one exact Model ID throughout the setup.

01

Open the OpenCode config

Create or edit ~/.config/opencode/opencode.json without removing existing providers, channels, or Skills.

02

Add one named provider

Use the /v3 OpenAI-compatible base URL in provider.options and reference ARK_API_KEY through the environment rather than hard-coding it.

03

Keep both model entries aligned

The top-level model and the provider.models registry must use the same exact Model ID that you want OpenCode to call.

The key is delivered to your Dashboard after payment. Replace the placeholder in the example, then keep the real value in your environment or local secret file.

2 · Configuration

Copy the provider blueprint

This is a safe starting point for the current Agent Plan route. Keep existing tool settings that are unrelated to the provider and replace only the placeholder key and Model ID values.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "volcengine/glm-5.2",
  "provider": {
    "volcengine": {
      "npm": "@ai-sdk/openai",
      "name": "Volcengine Ark Agent Plan",
      "options": {
        "baseURL": "https://ark.cn-beijing.volces.com/api/plan/v3",
        "apiKey": "{env:ARK_API_KEY}"
      },
      "models": {
        "glm-5.2": { "name": "Agent Plan default model" }
      }
    }
  }
}

The default Model ID shown here is the stocked plan's current default. If you choose another supported model, replace every model field required by OpenCode, not just the visible label.

Install / launch

Use the OpenCode installation already documented for your environment.

3 · Verify the route

Confirm the connection before a full project

Start OpenCode from a fresh terminal so the ARK_API_KEY environment variable is available.

Select the named provider and run a small prompt before enabling repository-wide edits.

If the model is missing, compare the provider name, model prefix, and registry key character by character.

Troubleshooting

Common configuration pitfalls

Merge the provider block into your existing file; do not overwrite unrelated channels or Skills.

OpenCode's visible provider/model label is not the API key. The key must remain in provider.options via the environment.