Skip to content
External

OpenCode Setup Guide

About third-party compatibility

Any third-party client involves many compatibility differences when integrating with an official API. This guide only demonstrates the basic setup — it cannot guarantee that every model / agent runs flawlessly with zero errors. If a particular model or feature turns out to be incompatible, that's normal; try switching models or adjust per the official docs.

We recommend using each model in its own official product when possible.

1. Open the config directory

OpenCode's config directory is .config/opencode in your home directory, and the config file is opencode.json. Open it according to your OS:

text
Press Win + R, enter the following and hit Enter:

%userprofile%\.config\opencode
bash
open ~/.config/opencode
bash
cd ~/.config/opencode

You'll see the directory contents. If there's no opencode.json, create it manually and open it.

2. Edit opencode.json

Write the following into opencode.json:

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "cctq-codex": {
      "models": {
        "gpt-5.6-sol": {
          "name": "gpt-5.6-sol",
          "options": {
            "reasoningEffort": "xhigh"
          }
        }
      },
      "npm": "@ai-sdk/openai",
      "options": {
        "apiKey": "sk-***",
        "baseURL": "https://www.cctq.ai/v1",
        "setCacheKey": true
      }
    }
  }
}
  • cctq-codex: the provider ID — customizable (lowercase letters, digits, hyphens only).
  • baseURL: the relay request URL — set it to https://www.cctq.ai/v1 (must end with /v1).
  • apiKey: your token — replace sk-*** with your actual key.
  • models: the models to use — the key is the model ID, name is the display name.
  • reasoningEffort: reasoning effort (thinking depth) — one of low / medium / high / xhigh. Higher values make the model think more thoroughly and usually give better results, but respond slower and cost more; xhigh is the highest.
  • setCacheKey: enables caching — keep it true.

Save, reopen the terminal, and run opencode to start.