# OpenCode Custom Provider: opencode.json Setup


**Short answer**: In OpenCode CLI on Windows or macOS, set the Anthropic base URL to `https://api.qcode.cc/claude/v1` and the OpenAI base URL to `https://api.qcode.cc/openai/v1` in `%USERPROFILE%\.config\opencode\opencode.json`, then run `/connect` and save your `cr_` key.

| Item | Fill in |
|---|---|
| Where the config lives | `%USERPROFILE%\.config\opencode\opencode.json` |
| Anthropic base URL | `https://api.qcode.cc/claude/v1` |
| OpenAI base URL | `https://api.qcode.cc/openai/v1` |
| Key command | `/connect` |
| Example model ID | `anthropic/claude-opus-5-5` |

`https://api.qcode.cc/api/v1` reaches the same Anthropic route, so either works; this guide uses `/claude/v1` to match the screenshots.

Checked on 2026-11-22 · OpenCode 2.3.2 · Windows 11


Follow the 16 screenshots below and you end up with OpenCode CLI running in Command Prompt, answering through QCode with `Claude Opus 5.5`, and both the Anthropic and OpenAI keys saved.


- **Applies to**: Windows 10 / 11 (64-bit) and macOS; the screenshots use Windows 11 and the English interface
- **Software version**: OpenCode CLI 2.3.2 (npm `@opencode/cli`) with Node.js 26.13.1 LTS
- **Screenshots updated**: 2026-11
- **Time needed**: about 15 minutes, including two downloads
- **You will need**: a QCode API key starting with `cr_`; about 100 MB of free disk space


> **On a Mac?** Run the same steps in Terminal. The screenshots show Windows PowerShell; on macOS, set a variable with `export NAME="value"` instead of `$env:NAME = "value"`, and read `%USERPROFILE%\` as `~/` in file paths.

Before the first screenshot, check that you have these:


- A Windows 10 or 11 PC (64-bit) or a Mac that can open websites and install software; Windows asks for permission once during the Node.js installation
- About 100 MB of free disk space for Node.js and OpenCode
- A QCode API key copied from your dashboard (`cr_xxxxxxxx`); this is the only item you cannot skip. No account yet? [Sign up](https://qcode.cc/en/auth/sign-up?utm_source=docs.qcode.cc&utm_medium=tut_before&utm_campaign=knowledge_base&src=docs-ide-opencode-before) first, pick a plan on the [pricing page](https://qcode.cc/en/pricing?utm_source=docs.qcode.cc&utm_medium=tut_before&utm_campaign=knowledge_base&src=docs-ide-opencode-before), then create the key in your [Dashboard](https://qcode.cc/en/dashboard).
- Command Prompt and Notepad, both built into Windows; no extra terminal app is needed
- The project folder you want OpenCode to work in; the screenshots use `%USERPROFILE%\projects\qcode-demo`


## Download and install

Node.js comes first, because OpenCode CLI is installed with npm. Pick the tab that matches your network:

**Other regions**

Open **nodejs.org/en/download** and download the Windows `.msi` from the LTS section. The official OpenCode page **opencode.ai** (terminal page **opencode.ai/terminal**) lists the same npm package, `@opencode/cli`; step 5 adds the flag npm 11 needs. GitHub Releases also carries a Windows zip, but this guide uses npm so it can check the version in one place.


**Mainland China**

Open **nodejs.org/en/download** and download the Windows `.msi` from the LTS section. If npm downloads stall, point npm at the mainland mirror with `npm config set registry https://registry.npmmirror.com` in the same Command Prompt, then run the install command in step 5. The OpenCode package itself is fetched by npm; the official product page is **opencode.ai**.




### Open the Node.js download page

Go to **nodejs.org/en/download**. ① is the current LTS line, `v26.13.1`; leave it selected. ② is the `Windows Installer (.msi)` button — click it. ③ is the architecture selector, which stays `x64` on a normal Intel or AMD PC.

![The nodejs.org download page with the v26.13.1 LTS selector, the Windows Installer (.msi) button and the x64 architecture selector](https://docs.qcode.cc/static/images/tut/opencode/202611/en/01-download-page.webp)


Done right you will see: your browser downloads a file whose name starts with `node-v26.13.1-x64` and ends in `.msi`, about 35 MB.




### Install Node.js with the default options

Double-click the `.msi`, accept the license, and keep clicking `Next` until `Custom Setup`. ① `Node.js runtime`, `npm package manager` and `Add to PATH` all show a green arrow, so leave them as they are; ② click `Next`. On the next page leave `Tools for Native Modules` unticked.

![The Node.js Custom Setup page with Node.js runtime, npm package manager and Add to PATH installed, and the Next button](https://docs.qcode.cc/static/images/tut/opencode/202611/en/02-installer-custom.webp)

**Stuck? The Next button is greyed out**

Go back one page and tick `I accept the terms in the License Agreement`. The wizard keeps `Next` disabled until that box is ticked.



Done right you will see: the `Custom Setup` tree lists all three items with green arrows and `Add to PATH` is not marked with a red X.




### Finish the Node.js installation

Click `Install` and approve the Windows permission prompt; the publisher is `OpenJS Foundation`. When the wizard says ① `Node.js has been successfully installed.`, click ② `Finish`.

![The final Node.js Setup page saying Node.js has been successfully installed, with the Finish button](https://docs.qcode.cc/static/images/tut/opencode/202611/en/03-installer-finish.webp)

**Stuck? No permission prompt appears**

Look on the taskbar: the Windows prompt may be behind the wizard. Do not close the wizard; approve the prompt and the installation continues.



Done right you will see: the wizard closes without an error window, and the Start menu now has a `Node.js` folder.




### Open Command Prompt in your project folder

Open the Start menu, type `Command Prompt`, and open it. ① the tab title is `cmd`, so this is Command Prompt and not PowerShell; ② the prompt ends in `projects\qcode-demo`, the folder OpenCode will work in. Create the folder if needed and change into it:

```bat
mkdir "%USERPROFILE%\projects\qcode-demo"
cd /d "%USERPROFILE%\projects\qcode-demo"
```

![A Command Prompt tab in Windows Terminal after cd into the projects\qcode-demo folder, with the cmd title and the folder prompt](https://docs.qcode.cc/static/images/tut/opencode/202611/en/04-terminal-window.webp)

**Stuck? PowerShell blocks .ps1 scripts**

New Windows 11 installations block PowerShell scripts by default, and npm creates an `opencode.ps1` wrapper. Use Command Prompt for every command in this guide. If you must stay in PowerShell, run `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` once, then open a new PowerShell window.



Done right you will see: the prompt shows `...\projects\qcode-demo>`, and the next command you type runs from that folder.




### Install the OpenCode CLI

In the same window, type the command at ① and press Enter:

```bat
npm install -g --allow-scripts=@opencode/cli @opencode/cli
```

When ② shows `added 3 packages`, the install finished. Use `@opencode/cli` for OpenCode 2; the old `opencode-ai` package still stops at v1.19.6.

![The npm install command for @opencode/cli and the added 3 packages line in Command Prompt](https://docs.qcode.cc/static/images/tut/opencode/202611/en/05-npm-install.webp)

**Stuck? npm prints yellow install-scripts warnings**

npm 11 blocks package install scripts unless they are allowed. The `--allow-scripts=@opencode/cli` part in the command above lets this package run its postinstall step and keeps the output clean. If you installed without the flag, the CLI can still work; run the same command with the flag to remove the warning.



Done right you will see: the last line is `added 3 packages`, with no red `ERR!` line above it.




### Check the OpenCode version

Run `opencode --version`. ① the output must be `opencode  v2.3.2` (the patch number may be newer). If it says `1.x`, the old package was installed; remove it and repeat step 5 with `@opencode/cli`.

![Command Prompt showing opencode --version printing opencode v2.3.2](https://docs.qcode.cc/static/images/tut/opencode/202611/en/06-opencode-version.webp)

**Stuck? opencode is not recognized**

Close Command Prompt and open a new one, so it picks up the global npm folder. If the command is still missing, check that `%APPDATA%\npm\opencode.cmd` exists, then run the install command again.



Done right you will see: a line starting with `opencode` and a version starting with `2.`.




### Create the OpenCode config file

Windows has no `~`, so the config lives under `%USERPROFILE%`. ① run `mkdir "%USERPROFILE%\.config\opencode" 2>nul` to create the folder; `2>nul` hides the message when it already exists. ② run `notepad "%USERPROFILE%\.config\opencode\opencode.json"` to open the file. If Notepad asks whether to create it, click `Yes`.

![Command Prompt with the mkdir command for the opencode config folder and the notepad command for opencode.json](https://docs.qcode.cc/static/images/tut/opencode/202611/en/07-config-path.webp)

**Stuck? Notepad says it cannot find the file**

Click `Yes` in the “Cannot find … file. Do you want to create a new file?” box. If the box only has `OK`, the folder path is wrong; check that `%USERPROFILE%\.config\opencode` exists.



Done right you will see: a Notepad window titled `opencode.json` with an empty document.




### Add both QCode base URLs

Paste this into Notepad, then save with `Ctrl+S`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "anthropic": {
      "settings": { "baseURL": "https://api.qcode.cc/claude/v1" }
    },
    "openai": {
      "settings": { "baseURL": "https://api.qcode.cc/openai/v1" }
    }
  },
  "model": "anthropic/claude-opus-5-5",
  "small_model": "anthropic/claude-haiku-5-5",
  "default_agent": "build"
}
```

① is the Anthropic base URL, which must include `/v1`; OpenCode's Anthropic client adds `/messages` but not `/v1`. ② is the OpenAI base URL, which also keeps `/v1`. Do not shorten either to `/api`.

![opencode.json in Notepad with the anthropic baseURL https://api.qcode.cc/claude/v1 and the openai baseURL https://api.qcode.cc/openai/v1](https://docs.qcode.cc/static/images/tut/opencode/202611/en/08-config-json.webp)

**Stuck? Requests return Not Found: Route /api/messages not found.**

The Anthropic base URL is missing `/v1`. Set it to `https://api.qcode.cc/claude/v1`, save the file, and restart OpenCode. If Notepad or an editor shows red underlines, check the commas and braces around the two `baseURL` lines.



Done right you will see: both addresses present, each ending in `/v1`, and the file saves without a warning.




### Start OpenCode

Still in the project folder, run `opencode`. ① the `opencode` wordmark means the TUI is running; ② the input box already shows `Build · Claude Opus 5.5 · Anthropic`, so `opencode.json` was read; ③ the bottom line lists `shift+tab agents` and `ctrl+p commands`.

![The OpenCode start screen with the opencode wordmark, an input box showing Build Claude Opus 5.5 Anthropic, and the shortcut hints at the bottom](https://docs.qcode.cc/static/images/tut/opencode/202611/en/09-first-screen.webp)

**Stuck? The model line shows a different model**

OpenCode did not read the file you edited. Run `opencode debug paths` in another Command Prompt and compare the `config` line with `%USERPROFILE%\.config\opencode\opencode.json`; a file named `opencode.json.txt` is a common accident in Notepad.



Done right you will see: the input box is ready and names `Claude Opus 5.5`, with no login or sign-in prompt.




### Open the integration list and choose Anthropic

Type `/connect` and press Enter. ① `Anthropic` and ② `OpenAI` are both under `Popular`; this guide saves both, starting with `Anthropic`. The list filters as you type, so typing `anthropic` is more reliable than clicking a row.

![The Connect an integration list with Anthropic and OpenAI under Popular](https://docs.qcode.cc/static/images/tut/opencode/202611/en/10-connect-list.webp)


Done right you will see: the list closes and a screen titled `Connect Anthropic` opens.




### Save the Anthropic key

The Anthropic screen goes straight to an API key field; there is no extra `Manually enter API Key` menu. Paste the `cr_` key from your dashboard and press Enter, or click ① `submit enter`. If `Ctrl+V` does nothing, right-click in the terminal or press `Ctrl+Shift+V`.

![The Connect Anthropic screen with a key field and the submit enter button](https://docs.qcode.cc/static/images/tut/opencode/202611/en/11-anthropic-key.webp)

**Need an API Key?**

If you do not have a QCode account yet, [Sign up](https://qcode.cc/en/auth/sign-up?utm_source=docs.qcode.cc&utm_medium=tut_key_step&utm_campaign=knowledge_base&src=docs-ide-opencode-key) first. If you prefer pay-as-you-go, buy a pack on the [pay-as-you-go page](https://qcode.cc/en/pay-as-you-go?utm_source=docs.qcode.cc&utm_medium=tut_key_step&utm_campaign=knowledge_base&src=docs-ide-opencode-key), then create the key in the [Dashboard](https://qcode.cc/en/dashboard). Copy the string that starts with `cr_`; you can pay by credit/debit card (Visa / Mastercard), Apple Pay / Google Pay, or cryptocurrency — see [Payment methods](/docs/reference/payment-methods).


**Stuck? The key field stays empty after pasting**

Click inside the key field first, then paste again. Windows Terminal accepts a right-click paste and `Ctrl+Shift+V`; plain `Ctrl+V` works only after the terminal has focus.



Done right you will see: the key window closes and a model list opens with `Claude Opus 5.5` marked. The key is stored in `%USERPROFILE%\.local\share\opencode\opencode.db`, not in `auth.json`.




### Connect OpenAI with the same key

Run `/connect` again, type `openai` to filter, and choose `OpenAI`. On the method screen, pick ① `API key`; the other three options sign in to a ChatGPT or Codex account, which this guide does not use. Paste the same `cr_` key and press Enter.

![The Connect OpenAI method list with Sign in with ChatGPT, the two Codex options and the API key option](https://docs.qcode.cc/static/images/tut/opencode/202611/en/12-openai-connect.webp)

**Stuck? Only sign-in options are visible**

Scroll the method list or type to filter it, then choose `API key` — it is the fourth item. Do not choose `Sign in with ChatGPT`; that route needs an OpenAI account, while QCode only needs the `cr_` key.



Done right you will see: the method list closes, a model list appears, and the dialog is gone.




### Exit and reopen OpenCode

Type `/exit` and press Enter, then run `opencode` again from the same folder. ① the input box is ready without asking for a key; ② the line under it still shows `Build · Claude Opus 5.5 · Anthropic`. That shows the key and the config both survived the restart.

![The OpenCode start screen after a restart, with the input box ready and Build Claude Opus 5.5 Anthropic below it](https://docs.qcode.cc/static/images/tut/opencode/202611/en/13-relaunch.webp)


Done right you will see: no `/connect` prompt and the same model line as before.




### Send your first message

Type `Hello, please introduce yourself in one sentence.` and press Enter. ① your message stays in the conversation; ② the model answers through QCode; ③ the status line shows `Build · Claude Opus 5.5` with the time and speed.

![OpenCode after sending a message: the user message, the Claude Opus 5.5 reply and the status line with time and speed](https://docs.qcode.cc/static/images/tut/opencode/202611/en/14-reply.webp)

**Stuck? The answer is an authentication error**

The key was rejected. Run `/connect` again, choose `Anthropic`, paste the whole `cr_` key with no leading or trailing space, then `/exit` and start `opencode` again.



Done right you will see: a short reply appears word by word within a few seconds, and the status line names the model.




### Switch to Plan mode

Press `Shift+Tab`. ① the bottom line changes from `Build` to `Plan · Claude Opus 5.5 · Anthropic`, and the border changes colour. `Plan` is read-only, for planning and analysis; press `Shift+Tab` again to return to `Build`.

![The OpenCode bottom bar after Shift+Tab, showing Plan Claude Opus 5.5 Anthropic and the command hint](https://docs.qcode.cc/static/images/tut/opencode/202611/en/15-plan-agent.webp)


Done right you will see: `Plan` replaces `Build` in the bottom line, and pressing `Shift+Tab` once more brings `Build` back.




### Confirm the request in probe

Open **probe.qcode.cc**, paste the same `cr_` key and click the query button. ① the newest row matches the time of your message and shows status `200`, total time and response size. The list has time, status, retry, first byte, total time, response size and output speed; it does not show model names or token counts. This is the proof that the request went through QCode.

![The probe.qcode.cc request list with the newest row showing status 200, total time and response size](https://docs.qcode.cc/static/images/tut/opencode/202611/en/16-probe-requests.webp)


Done right you will see: the top row has the same date and time as your message and a green `200` in the status column.




## Verify it works

Your setup is complete when all of these are true:

- `opencode --version` prints a version starting with `2.`.
- `%USERPROFILE%\.config\opencode\opencode.json` contains `https://api.qcode.cc/claude/v1` and `https://api.qcode.cc/openai/v1`.
- `opencode` starts without a login prompt and the input box shows `Build · Claude Opus 5.5 · Anthropic`.
- A message you type gets a normal answer, and `probe.qcode.cc` shows the request with status `200`.
- `Shift+Tab` changes the bottom line from `Build` to `Plan`.


### All done

You have OpenCode CLI answering through QCode on Windows, with both the Anthropic and OpenAI keys saved. From here you can:

- [Endpoints and API paths](/docs/getting-started/endpoints-and-api-paths) — all three QCode hosts and every path
- [Claude Code tutorial](/docs/getting-started/claude-code-tutorial) — the same QCode key in another terminal tool
- [Troubleshooting](/docs/reference/troubleshooting)
- Compare plans on the [pricing page](https://qcode.cc/en/pricing?utm_source=docs.qcode.cc&utm_medium=tut_done&utm_campaign=knowledge_base&src=docs-ide-opencode-done)
- Go back to your [Dashboard](https://qcode.cc/en/dashboard) to check usage and balance


## Common errors

| Error message | Why | What to do |
|---|---|---|
| `opencode.ps1 cannot be loaded because running scripts is disabled on this system.` | You ran `opencode` in PowerShell, where a new Windows 11 installation blocks `.ps1` wrapper scripts. | Open Command Prompt and run `opencode` there, or run `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` once in PowerShell and open a new window. |
| `Not Found: Route /api/messages not found.` | The Anthropic base URL is missing the version segment, so OpenCode called a route that QCode does not serve. | Set `baseURL` to `https://api.qcode.cc/claude/v1`, save `opencode.json`, and restart OpenCode. |
| `401 invalid_request_error: You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth` | No Anthropic key was saved for the provider, or the saved key was removed. | Run `/connect`, choose `Anthropic`, paste the `cr_` key, press Enter, then `/exit` and start `opencode` again. |
| `Error: Anthropic API key is missing. Pass it using the 'apiKey' parameter or the ANTHROPIC_API_KEY environment variable.` | `opencode.json` points the Anthropic provider at QCode, but no key has been connected yet. | Connect the Anthropic key through `/connect` before starting a chat; the config file holds the address, not the key. |
| `AI_APICallError: Incorrect API key provided` | The key reached QCode but was rejected: it is incomplete, has a space, or came from another service. | Copy the whole `cr_` key from the QCode Dashboard, paste it again with no leading or trailing space, and restart OpenCode. |

## FAQ

### Do I need an OpenCode account or an Anthropic subscription?

No. OpenCode runs without signing in to its own service, and QCode supplies the `cr_` key used in the steps. The only account involved is QCode.

### Why does this guide use Command Prompt instead of PowerShell?

New Windows 11 installations block `.ps1` scripts by default. npm and OpenCode create `.ps1` wrappers, so `opencode` in PowerShell stops with a security error. Command Prompt uses `.cmd` wrappers and is not affected. If you prefer PowerShell, run `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` once, then open a new window.

### Why must the Anthropic base URL end in `/claude/v1`?

OpenCode's Anthropic client adds `/messages` to the base URL but does not add `/v1`. With `https://api.qcode.cc/claude/v1`, the final request is `https://api.qcode.cc/claude/v1/messages`, which QCode serves. A shorter address calls an unrouted path.

### Where does OpenCode 2 store the key?

In the local database `%USERPROFILE%\.local\share\opencode\opencode.db`. The older `auth.json` file is not used for new keys in OpenCode 2; if you look for a key file and find none, this is why.

### What happens when my key expires?

It depends on what you bought. A key from a personal plan cannot be renewed: reopen the plan and create a new key, then connect it again. A key from a pay-as-you-go pack starts working again when you buy another pack; the same key keeps working.

### Can I use GPT models through QCode in OpenCode?

Yes. The `openai` provider in `opencode.json` points at `https://api.qcode.cc/openai/v1`, and `/connect` saves an OpenAI key. `claude-*` ids answer on the Anthropic endpoint, `gpt-*` ids on the OpenAI endpoint; keep each id with its own provider.

### Why do I see warnings during `npm install`?

npm 11 blocks install scripts unless the package is allowed. The command in step 5 includes `--allow-scripts=@opencode/cli`, so the postinstall step runs and the warning does not appear. If you installed without the flag, the CLI can still work; rerun the command with it to get clean output.

## About OpenCode

[OpenCode](https://github.com/anomalyco/opencode) is a 100% open-source terminal AI coding assistant, similar to Claude Code but with more flexibility and customization. It supports multi-model switching, a TUI interface, and is not tied to any specific AI provider.

- **100% open source** — MIT license, fully transparent
- **Multi-model support** — use Claude, OpenAI and other providers in one tool
- **TUI first** — built for terminal users, with keyboard-driven commands
- **Client/server architecture** — run the server locally and control it remotely
- **Dual built-in agents** — `build` (default, full access) and `plan` (read-only, for analysis and planning)

OpenCode 2 accepts and preserves `lsp` configuration, but it does not run language servers, expose LSP tools, or produce LSP diagnostics.

The repository is `anomalyco/opencode` (formerly `sst/opencode`; old URLs redirect). This page uses OpenCode 2.3.2, the version in the screenshots.

## OpenCode 2: install and compatibility

OpenCode 1 and OpenCode 2 are separate major versions, and both use the `opencode` command, so they cannot be installed side by side under that default command. Remove a package-managed V1 installation before installing V2; the V2 curl installer replaces the V1 binary. To upgrade an existing OpenCode 1 install, run `opencode upgrade --major`.

On Windows, the 16 steps above use the npm package `@opencode/cli`. On macOS or Linux, the V2 documentation lists these commands:

```bash
# OpenCode 2
curl -fsSL https://opencode.ai/v2/install | bash
npm install -g @opencode/cli
brew install anomalyco/tap/opencode-v2
bun install -g --trust @opencode/cli
pnpm add -g --allow-build=@opencode/cli @opencode/cli
yarn global add @opencode/cli
```

The older `https://opencode.ai/install` script installs OpenCode 1 only; use the `v2/install` script above or the npm package for OpenCode 2. Check `opencode --version` after installing.

### Your configuration works in both versions

OpenCode 2 reads existing system, global and project configuration from the same locations as V1, including `%USERPROFILE%\.config\opencode\opencode.json` on Windows and `~/.config/opencode/opencode.json` on macOS and Linux. Existing supported V1 configuration is intended to keep working; the V1 format remains supported, and the native V2 format is optional.

OpenCode 2 normalizes supported V1 and native V2 fields in memory without rewriting the source file. The V1 form below still works in 2.3.2:

```json
{
  "provider": {
    "anthropic": { "options": { "baseURL": "https://api.qcode.cc/claude/v1" } },
    "openai": { "options": { "baseURL": "https://api.qcode.cc/openai/v1" } }
  }
}
```

The native V2 form is what the 16 steps use:

```json
{
  "providers": {
    "anthropic": { "settings": { "baseURL": "https://api.qcode.cc/claude/v1" } },
    "openai": { "settings": { "baseURL": "https://api.qcode.cc/openai/v1" } }
  }
}
```

The migration guide advises not to point V1 at files after converting them to native V2-only shapes.

### Behavior differences that affect the configuration above

- **External directories**: V1 asks before accessing paths outside the project; V2 allows `external_directory` by default. The migration guide does not say how V2 applies V1-format `external_directory` rules, so check the effect in V2 yourself. To keep the V1 behavior in native V2, add an `external_directory` rule with effect `ask`.
- **Permission actions**: `lsp` and `doom_loop` are not current V2 Core permission actions.
- **Language servers**: OpenCode 2 accepts and preserves `lsp` configuration, but it does not run language servers, expose LSP tools, or produce LSP diagnostics.
- **Credentials**: saved API keys and OAuth tokens live in the local SQLite database at `%USERPROFILE%\.local\share\opencode\opencode.db` on Windows. V2 imports supported credentials from the legacy `auth.json` during its database migration; new and updated credentials are stored in SQLite rather than written back to that file.
- **Agent switching**: the default key for `agent.cycle` is `Shift+Tab`.
- **Plugins**: V1 plugin implementations do not run in V2; plugins use a new plugin API.
- **Legacy agent blocks**: the V1 `permission` block and the multi-agent `agent` block are still read, but some fields are legacy in V2 and may be ignored with a warning. The 16-step guide uses the smaller native V2 configuration above.

For the OpenCode 2 upgrade notes on qcode.cc, including the 1.19.1 session-sharing removal, see [OpenCode 2 upgrade and session sharing removed](https://qcode.cc/en/opencode-2-upgrade-and-session-sharing-removed).

## Full multi-agent configuration (V1 format, optional)

The full configuration below is the V1-style multi-agent setup. It still loads in OpenCode 2.3.2, but the `permission` actions `lsp` and `doom_loop` and the `agent` blocks are legacy in V2; expect some fields to be ignored. Use it only when you want the V1-style agent workflow. The 16 steps above do not depend on it, and you should use either this block or the small V2 block, not both.

Note: `"bash": "allow"` in these agent blocks lets the agent run any shell command without asking for approval.

```json
{
  "$schema": "https://opencode.ai/config.json",

  "provider": {
    "anthropic": {
      "options": {
        "baseURL": "https://api.qcode.cc/claude/v1"
      }
    },
    "openai": {
      "options": {
        "baseURL": "https://api.qcode.cc/openai/v1"
      }
    }
  },

  "model": "anthropic/claude-opus-5-5",
  "small_model": "anthropic/claude-haiku-5-5",
  "default_agent": "build",

  "permission": {
    "read": "allow",
    "list": "allow",
    "glob": "allow",
    "grep": "allow",
    "lsp": "allow",

    "edit": "ask",
    "bash": "ask",
    "webfetch": "ask",
    "websearch": "ask",

    "external_directory": "deny",
    "doom_loop": "ask"
  },

  "agent": {
    "plan": {
      "mode": "primary",
      "description": "Planning/decomposition/technical design (read-only, avoid accidental code changes)",
      "model": "anthropic/claude-opus-5-5",
      "prompt": "You are a senior technical lead. Goal: break down requirements into executable steps (with acceptance criteria/risks/rollback). Read-only by default, do not modify files or run commands; if execution is truly needed, explain the reason and suggest switching to build/codex.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "deny",
        "bash": "deny",
        "webfetch": "deny",
        "websearch": "deny",
        "external_directory": "deny",
        "doom_loop": "deny"
      }
    },

    "build": {
      "mode": "primary",
      "description": "Main development (end-to-end implementation/debugging/fixing tests) - Claude Opus 5.5",
      "model": "anthropic/claude-opus-5-5",
      "prompt": "You are the main software engineering agent. Priorities: minimal viable changes, readability, testability. Before making changes, briefly explain the approach; after changes, always provide: key diff points, how to verify locally (commands), potential edge cases.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "allow",
        "bash": "allow",
        "webfetch": "ask",
        "websearch": "ask",
        "external_directory": "deny",
        "doom_loop": "ask"
      }
    },

    "codex": {
      "mode": "primary",
      "description": "Refactoring/migration/major changes (Codex) - GPT-6.2 Sol",
      "model": "openai/gpt-6.2-sol",
      "prompt": "You are a Codex-style engineering agent, skilled in large-scale refactoring, migration, code review, and complex toolchain collaboration. Priority: keep the project runnable: step-by-step commits, each step verifiable; when uncertain, add safeguards and tests first.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "allow",
        "bash": "allow",
        "webfetch": "ask",
        "websearch": "ask",
        "external_directory": "deny",
        "doom_loop": "ask"
      }
    },

    "review": {
      "mode": "subagent",
      "description": "Code review/second brain (read-only) - GPT-6.2 Sol",
      "model": "openai/gpt-6.2-sol",
      "prompt": "You are a strict code reviewer. Output: 1) Key risks (bugs/security/concurrency/edge cases) 2) Maintainability suggestions 3) Minimal modification suggestions (can use pseudo diff) 4) Necessary test points. Read-only by default, do not modify files/run commands.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "deny",
        "bash": "deny",
        "webfetch": "deny",
        "websearch": "deny",
        "external_directory": "deny",
        "doom_loop": "deny"
      }
    },

    "explore": {
      "mode": "subagent",
      "description": "Quick code scan/file location/context summary (read-only) - Claude Haiku 5.5",
      "model": "anthropic/claude-haiku-5-5",
      "prompt": "You are a quick exploration subagent: locate relevant files/functions/call chains with minimal steps, provide clear paths and summaries. Read-only by default, do not modify files/run commands.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "deny",
        "bash": "deny",
        "webfetch": "deny",
        "websearch": "deny",
        "external_directory": "deny",
        "doom_loop": "deny"
      }
    },

    "general": {
      "mode": "subagent",
      "description": "General research/documentation/comparing approaches (medium cost) - Claude Sonnet 5.5",
      "model": "anthropic/claude-sonnet-5-5",
      "prompt": "You are a general analysis subagent: focus on explanation, trade-offs, documentation, and approach comparison; read-only by default, try not to modify code.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "deny",
        "bash": "deny",
        "webfetch": "ask",
        "websearch": "ask",
        "external_directory": "deny",
        "doom_loop": "deny"
      }
    },

    "think": {
      "mode": "subagent",
      "description": "Assist thinking/edge case reasoning (read-only) - GPT-6.2 Astra",
      "model": "openai/gpt-6.2-astra",
      "prompt": "You are a reasoning and edge case analysis subagent: provide structured analysis and suggestions for design, exception paths, concurrency/consistency, performance bottlenecks. Read-only by default.",
      "permission": {
        "read": "allow",
        "list": "allow",
        "glob": "allow",
        "grep": "allow",
        "lsp": "allow",
        "edit": "deny",
        "bash": "deny",
        "webfetch": "deny",
        "websearch": "deny",
        "external_directory": "deny",
        "doom_loop": "deny"
      }
    }
  }
}
```

### API endpoint selection

If the default host is slow or unreachable from your network, change only the domain and keep the rest of the address as it is:

| Entry point | Anthropic (Claude) | OpenAI (Codex) | Use case |
|---|---|---|---|
| **Global entry** (recommended) | `https://api.qcode.cc/claude/v1` | `https://api.qcode.cc/openai/v1` | Global users |
| **Asia** | `https://asia.qcode.cc/claude/v1` | `https://asia.qcode.cc/openai/v1` | Mainland China and Asia |
| **North America / Europe** | `https://us.qcode.cc/claude/v1` | `https://us.qcode.cc/openai/v1` | North America and Europe |

### Available models

QCode currently supports these popular models; the full list and rates are on [qcode.cc/models](https://qcode.cc/en/models).

**Claude series** (path: `/claude/v1`):

- `claude-opus-5-5` — current main flagship (`claude-fable-5-2` and `claude-opus-4-8` can still be called)
- `claude-sonnet-5-5` — daily default (`claude-sonnet-4-6` can still be called)
- `claude-haiku-5-5` — Haiku 5.5, ultra-fast response

**OpenAI / Codex series** (path: `/openai/v1`):

- `gpt-6.2-sol` — flagship workhorse (2026-11-17), 1.05M context / 128K output (recommended)
- `gpt-6.2-astra` — top-tier flagship (2026-11-17), 1.05M context / 128K output
- `gpt-6-sol` — proven flagship, 1.05M context

QCode does not currently offer the Gemini series, nor `gpt-6-luna` / `gpt-5.6-luna`.

### Configuration overview

The full configuration above includes a multi-agent workflow:

| Agent | Model | Mode | Purpose |
|---|---|---|---|
| **plan** | Claude Opus 5.5 | primary | Planning/decomposition/technical design (read-only) |
| **build** | Claude Opus 5.5 | primary | Main development, end-to-end implementation |
| **codex** | GPT-6.2 Sol | primary | Refactoring/migration/major changes |
| **review** | GPT-6.2 Sol | subagent | Code review (read-only) |
| **explore** | Claude Haiku 5.5 | subagent | Quick code scan/file location (read-only) |
| **general** | Claude Sonnet 5.5 | subagent | General research/documentation (read-only) |
| **think** | GPT-6.2 Astra | subagent | Assist thinking/edge case reasoning (read-only) |

You can customize each agent's `model`, `prompt` and `permission` settings according to your preferences. In OpenCode 2, treat the agent and permission fields as legacy and verify the behavior before relying on them.

## Custom providers for Chinese models

OpenCode's built-in `openai` provider (`@ai-sdk/openai`) uses the Responses interface, and QCode's Responses interface does not serve Chinese models. For them, create a separate `@ai-sdk/openai-compatible` provider, which uses chat/completions with baseURL `https://api.qcode.cc/openai/v1`; model ids are in [China-family models](/docs/usage/cn-models).

The OpenCode providers documentation says to use `@ai-sdk/openai` for `/v1/responses` and `@ai-sdk/openai-compatible` for `/v1/chat/completions`. A custom provider needs a `models` map, for example:

```json
{
  "provider": {
    "qcode-chat": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.qcode.cc/openai/v1"
      },
      "models": {
        "<model-id>": {}
      }
    }
  }
}
```

Replace `<model-id>` with an id from the China-family models page. The built-in `openai` provider remains the right choice for `gpt-*` models.

## oh-my-opencode and OmO

[oh-my-opencode](https://github.com/code-yeongyu/oh-my-openagent) is a third-party enhancement plugin for OpenCode. Its repository was renamed to `code-yeongyu/oh-my-openagent`, and the README now calls the project **OmO**, with a standalone `omo` command as the main entry point. The earlier OpenCode version is called the "OpenCode edition" in the README, and `omo setup` migrates from it. The README still describes the `ultrawork` keyword.

The OpenCode configuration in this page does not depend on oh-my-opencode. If you need it, follow the official README for the current install and migration steps.

## Usage tips

### ultrawork mode

The older oh-my-opencode (the OpenCode edition) lets you add `ultrawork` or `ulw` to a prompt to enable parallel multi-model orchestration; the newer OmO is a standalone `omo` command, so follow its README. Example for the older version:

```text
ultrawork Help me refactor the authentication module of this project
```

### Shift+Tab to switch agents

Press `Shift+Tab` to switch between the `build` and `plan` agents:

- **build** — full permissions, for development work
- **plan** — read-only mode, for analysis and planning

In OpenCode 2, the default key for switching agents is `Shift+Tab`; `Tab` alone is the older behavior.

## Related docs

- [Endpoints and API paths](/docs/getting-started/endpoints-and-api-paths) — every ingress domain and its paths
- [Claude Code tutorial](/docs/getting-started/claude-code-tutorial) — full CLI feature reference
- [China-family models](/docs/usage/cn-models) — model ids for custom providers
- [Troubleshooting](/docs/reference/troubleshooting)
- [Billing](/docs/reference/billing) — shared quota rules
- [VS Code integration](/docs/ide/vscode) — the same idea in an editor
- [Codex integration](/docs/ide/codex) — use OpenAI Codex models
- [CLI tips](/docs/usage/cli-tips) — terminal shortcuts and workflows
- [OpenCode official site](https://opencode.ai)
- [OpenCode GitHub](https://github.com/anomalyco/opencode)
- [OpenCode official documentation](https://opencode.ai/docs)