OpenCode

Install and configure OpenCode CLI, Desktop, and Web.

Prerequisites

You need Node.js (npm is included).

1. Install

Install OpenCode CLI on Windows, macOS, or Linux:

npm install --global opencode-ai

For a standalone graphical client, install the Windows, macOS, or Linux desktop build from the official OpenCode download page. The CLI can also start a local Web interface with opencode web.

2. Configure in Desktop

Open OpenCode Desktop and go to Settings → Providers → Add provider → Custom provider, then enter:

  • Provider ID: getrun
  • Display name: GetRun
  • Base URL: https://api.get-apikey.com/v1
  • API key: your actual Key
  • Models: enter the actual model ID on the left and its display name on the right; both values may be the same

Scroll down and save. Add more model rows when you need more than one model.

Windows

The OpenCode custom-provider page on Windows with lowercase getrun as the Provider ID, GetRun as the display name, api.get-apikey.com/v1 as the Base URL, and a placeholder API Key.

macOS

The OpenCode custom-provider page on macOS with lowercase getrun as the Provider ID, api.get-apikey.com/v1 as the Base URL, and a placeholder API Key.

3. Configure with a file

OpenCode CLI, Desktop, and Web can also share the same opencode.json:

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "getrun": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "GetRun",
      "options": {
        "baseURL": "https://api.get-apikey.com/v1",
        "apiKey": "sk-xxxxx-xxx"
      },
      "models": {
        "YOUR_MODEL": {
          "name": "YOUR_MODEL"
        }
      }
    }
  },
  "model": "getrun/YOUR_MODEL"
}

Replace sk-xxxxx-xxx and both YOUR_MODEL values. If a configuration already exists, merge provider.getrun and model.

Windows

$openCodeDir = Join-Path $HOME ".config\opencode"
New-Item -ItemType Directory -Force -Path $openCodeDir | Out-Null
notepad (Join-Path $openCodeDir "opencode.json")

macOS / Linux

OPENCODE_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opencode"
mkdir -p "$OPENCODE_DIR"
${EDITOR:-vi} "$OPENCODE_DIR/opencode.json"

4. Use and confirm a reply

Run from the CLI:

opencode run --model getrun/YOUR_MODEL "Reply only with OK"

Start the Web interface when needed:

opencode web

In Desktop or Web, create a session, select YOUR_MODEL, and send “Reply only with OK”. The setup is complete when the reply is OK.

On this page