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
Install OpenCode
Install the latest build via npm or brew, then create an API key in your SacredGPT account.
Terminalnpm i -g opencode-ai@latest # or: brew install anomalyco/tap/opencodeAdd 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.
Terminalexport SACREDGPT_API_KEY=sg_live_…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.
{
"$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.
