Docs / Tool setup / OpenCode
Use clawcu with OpenCode
OpenCode connects to custom providers over the OpenAI-compatible protocol. Add a clawcu provider to its config and switch between the models with /models.
| Protocol | OpenAI-compatible (/v1/chat/completions) |
|---|---|
| Base URL | https://token.clawcu.ai/v1 |
| Config file | ~/.config/opencode/opencode.json |
Models: kimi-k3 (strongest for coding, used on this page), glm-5.3, deepseek-flash (cheapest and fastest). See the Models page in the console or GET /v1/models for the full list and prices.
Before you start
Create a key on the API Keys page of the console (the plaintext is shown once), then put it in the CLAWCU_LLM_KEY environment variable — every step below reads it from there:
export CLAWCU_LLM_KEY=sk-your-key
Windows (PowerShell)
$env:CLAWCU_LLM_KEY="sk-your-key"
To keep it, add the line to ~/.zshrc / ~/.bashrc; on Windows run setx CLAWCU_LLM_KEY sk-… and open a new terminal.
Install
npm install -g opencode-ai
Configure
Write the config (the key is referenced as {env:CLAWCU_LLM_KEY} and read at runtime, never written to disk):
mkdir -p ~/.config/opencode
cat > ~/.config/opencode/opencode.json <<'EOF'
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"clawcu": {
"npm": "@ai-sdk/openai-compatible",
"name": "clawcu",
"options": { "baseURL": "https://token.clawcu.ai/v1", "apiKey": "{env:CLAWCU_LLM_KEY}" },
"models": {
"kimi-k3": { "name": "Kimi K3" },
"glm-5.3": { "name": "GLM-5.3" },
"deepseek-flash": { "name": "DeepSeek V4.1 Flash" }
}
}
},
"model": "clawcu/kimi-k3"
}
EOF
On Windows the file is %USERPROFILE%\.config\opencode\opencode.json with the same JSON (between cat … EOF). If you already have a config, merge in provider.clawcu.
Verify
If it replies OK, you are connected to clawcu:
opencode run "Reply with exactly: OK"
Everyday use
Run opencode in your project; type /models to pick clawcu/glm-5.3 or another model.
opencode models clawcu
FAQ
Slow on the first run?
OpenCode downloads the @ai-sdk/openai-compatible adapter the first time; later runs are fast.
It can't find the key?
Make sure CLAWCU_LLM_KEY is set in the terminal that starts OpenCode (echo $CLAWCU_LLM_KEY shows it).
Other tools:Claude Code · Codex CLI · OpenClaw · Hermes Agent