# OpenCode

# Step 1: Install OpenCode

macOS / Linux:

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

Alternatives: brew install anomalyco/tap/opencode or npm install -g opencode-ai

Windows: WSL recommended (then proceed as above). Alternatives: choco install opencode or npm install -g opencode-ai

Desktop app: https://opencode.ai/download

VS Code: open Extensions (Cmd+Shift+X on macOS, Ctrl+Shift+X on Windows), search for "OpenCode", install.

Important (curl install only): the install script places the binary in ~/.opencode/bin, which is not on your PATH by default. If opencode returns "command not found", add it to your PATH:

export PATH=$HOME/.opencode/bin:$PATH

Run this in your terminal to fix the current session. To make it permanent, append the same line to ~/.zshrc (macOS default) or ~/.bashrc (most Linux), then restart your shell. The npm and brew install methods add the binary to PATH for you, so this step does not apply to them.

# Step 2: Set the API key

macOS / Linux (~/.zshrc or ~/.bashrc):

export PHOENIQS_API_KEY="your-api-key"

Windows PowerShell:

[Environment]::SetEnvironmentVariable("PHOENIQS_API_KEY", "your-api-key", "User")

The three parameters mean:

  1. "PHOENIQS_API_KEY", the environment variable name. Keep this exactly as written.
  2. "your-api-key", replace with your MaaS API key.
  3. "User", keep this exactly as written. It tells Windows to store the variable for your user account (it is not your Windows username).

Open a new terminal afterward so the variable is loaded.

# Step 3: Create the configuration file

The file is not created automatically. Create the directory first:

mkdir -p ~/.config/opencode

Location: ~/.config/opencode/opencode.json Windows: C:\Users\<Username>\.config\opencode\opencode.json

File contents:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "phoeniqs": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Phoeniqs",
      "options": {
        "baseURL": "https://maas.phoeniqs.com/v1",
        "apiKey": "{env:PHOENIQS_API_KEY}"
      },
      "models": {
        "inference-glm5": {
          "name": "GLM-5",
          "limit": { "context": 131072, "output": 16384 }
        },
        "inference-deepseek-v32": {
          "name": "DeepSeek V3.2",
          "limit": { "context": 128000, "output": 16384 }
        },
        "inference-qwen3-vl-235b": {
          "name": "Qwen3 VL 235B",
          "limit": { "context": 128000, "output": 16384 }
        },
        "inference-glm45-air-110b": {
          "name": "GLM4.5 Air 110B",
          "limit": { "context": 128000, "output": 16384 }
        },
        "inference-apertus-70b": {
          "name": "Apertus 70B",
          "limit": { "context": 65536, "output": 8192 }
        },
        "inference-qwq-32b": {
          "name": "QwQ 32B",
          "limit": { "context": 65536, "output": 16384 }
        },
        "inference-qwen3-8b": {
          "name": "Qwen3 8B",
          "limit": { "context": 32768, "output": 8192 }
        }
      }
    }
  },
  "model": "phoeniqs/inference-glm5",
  "small_model": "phoeniqs/inference-qwen3-8b",
  "disabled_providers": []
}

# Step 4: Start

cd /path/to/project
opencode

On first launch in a project, run /init to initialize the project structure.

Switch model mid-session:

/model phoeniqs/inference-deepseek-v32

# Troubleshooting

  • command not found: opencode: PATH is not set. See the note under Step 1.
  • Auth or 401 errors: the PHOENIQS_API_KEY variable is not loaded in the current shell. Open a new terminal, or confirm with echo $PHOENIQS_API_KEY.
  • Model not found: check that the model ID in /model matches an entry in opencode.json exactly, prefixed with phoeniqs/.