Skip to main content
OpenCode is a terminal-based AI coding assistant that supports 75+ LLM providers through the AI SDK. Connect it to ClearMaas by configuring a custom provider in your JSON config file.

Prerequisites

  • OpenCode installed (npm install -g opencode or via installer)
  • A ClearMaas API key starting with sk-

Config file locations

OpenCode merges configuration from multiple sources (later overrides earlier):
  1. Remote config (.well-known/opencode) �?organizational defaults
  2. Global config (~/.config/opencode/opencode.json) �?user preferences
  3. OPENCODE_CONFIG env var �?custom overrides
  4. Project config (opencode.json in project root) �?project-specific
  5. OPENCODE_CONFIG_CONTENT env var �?runtime overrides

Setup via global config

Add to ~/.config/opencode/opencode.json:

Setup via environment variable

For temporary or CI usage, use OPENCODE_CONFIG_CONTENT:

Using environment variables in config

Reference API keys via env vars to avoid hardcoding:

Choosing models

Set the default model in config:
Override with the /models command in the TUI:

Using a separate small model

OpenCode can use a cheaper model for lightweight tasks (title generation, etc.):

Verifying the setup

Check your ClearMaas dashboard to confirm requests are being routed.

Config example with all options

Available provider options:
  • timeout �?Request timeout in milliseconds (default: 300000)
  • setCacheKey �?Always set a cache key for designated provider
  • baseURL �?Override the default API endpoint

See also