Skip to content

OpenCode

Recommended: use cc-switch for setup: https://github.com/farion1231/cc-switch/releases

Prerequisites

OpenCode provides an official installer script plus npm, bun, and brew install options.

  • If you use the official installer script, you usually do not need to prepare npm manually first
  • If you use the npm install path, install Node.js and npm first
  • If you use the bun install path, install bun first

For the npm path, install Node.js from: https://nodejs.org/en/download

  • macOS / Windows: install the LTS release from that page
  • Linux: use the distro-specific method listed there

On macOS, if you already use Homebrew, you can also run:

bash
brew install node

This installs both Node.js and npm.

Then verify:

bash
node -v
npm -v

For Windows CLI workflows, the official docs currently recommend WSL.

Install

Official install page: https://opencode.ai/

Recommended install command from the official site:

bash
curl -fsSL https://opencode.ai/install | bash

The official site also provides npm, bun, and brew install options.

Configure

If you do not use cc-switch, configure a custom provider with the Responses API:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "codex_proxy": {
      "npm": "@ai-sdk/openai",
      "name": "Codex Proxy",
      "options": {
        "baseURL": "https://okapi.pockgo.com/v1",
        "apiKey": "{env:OPENAI_API_KEY}"
      },
      "models": {
        "gpt-5-codex-mini": {
          "name": "gpt-5-codex-mini"
        }
      }
    }
  },
  "model": "codex_proxy/gpt-5-codex-mini"
}

You can also use opencode auth login or /connect instead of inventing a project-specific environment variable.

OpenAI-compatible gateway integration docs