Terminal / Desktop Agent

Connect OpenCode

The most popular open-source agent for the terminal and desktop. Add SacredGPT as a provider in opencode.json.

Verified on OpenCode v1.18.13+ (opencode.json → provider → @ai-sdk/openai-compatible).

Step by step

  1. Install OpenCode

    Install the latest build via npm or brew, then create an API key in your SacredGPT account.

    Terminal
    npm i -g opencode-ai@latest
    # or: brew install anomalyco/tap/opencode
  2. Add the SacredGPT provider

    Paste the ready-made settings below into opencode.json in the project root or ~/.config/opencode/. OpenCode reads the key from an environment variable.

    Terminal
    export SACREDGPT_API_KEY=sg_live_…
  3. Pick a model

    Run opencode, open the model list with /models, and choose SacredAI Heretic.

Ready-made settings

Replace sg_live_… with your key. For free SacredAI, use the sacredgpt-auto model.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "sacredgpt": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "SacredGPT",
      "options": {
        "baseURL": "https://sacredgpt.pro/v1",
        "apiKey": "{env:SACREDGPT_API_KEY}"
      },
      "models": {
        "sacredai-heretic": { "name": "SacredAI Heretic" },
        "sacredgpt-auto": { "name": "SacredAI" }
      }
    }
  }
}

If it doesn't work

Provider missing from the list

Make sure the file is named opencode.json and sits in the project root or ~/.config/opencode/, then restart OpenCode.

401 Unauthorized

Set SACREDGPT_API_KEY in the same terminal you start OpenCode from, or put the key into apiKey directly.

No API key yet?

The API is included in your chat plan. SacredAI and 10 Heretic requests are free.

Create a key
Direct line

Found a bug? Show us.

Tell us what happened and what you expected. The page address and browser details help us reproduce it faster.