Use CoralBricks with OpenCode
Run OpenCode's coding agent on CoralBricks open-model inference — GLM and Kimi with up to 1M context, one JSON stanza to set up.
OpenCode is an open-source terminal coding agent with
first-class support for custom OpenAI-compatible providers. CoralBricks plugs
in with a single config block — chat, agent mode, and tool calling all route
through the Coral gateway.
Coral Inference is currently a design-partner program. To get access,
contact us at hello@coralbricks.ai.
1. Get an API key
Create a key from your API keys page (format ak_...), then
export it where OpenCode can see it:
export CORAL_API_KEY="ak_..."
Add the export to your shell profile (~/.zshrc / ~/.bashrc) so it
persists.
2. Add the provider
Merge this into ~/.config/opencode/opencode.json (create the file if it
doesn't exist):
{
"$schema": "https://opencode.ai/config.json",
"model": "coral-bricks/glm-5.2-fp4",
"provider": {
"coral-bricks": {
"name": "Coral Bricks",
"api": "openai",
"options": {
"baseURL": "https://inference.coralbricks.ai/v1",
"apiKey": "{env:CORAL_API_KEY}"
},
"models": {
"glm-5.2-fp4": {
"name": "GLM 5.2",
"tool_call": true,
"reasoning": true,
"limit": { "context": 1048576, "output": 32768 }
},
"kimi-k3": {
"name": "Kimi K3",
"tool_call": true,
"reasoning": true,
"attachment": true,
"limit": { "context": 1048576, "output": 32768 }
},
"kimi-k2.6": {
"name": "Kimi K2.6",
"tool_call": true,
"reasoning": true,
"limit": { "context": 262144, "output": 32768 }
},
"gpt-oss-120b": {
"name": "GPT-OSS 120B",
"tool_call": true,
"reasoning": true,
"limit": { "context": 131072, "output": 32768 }
}
}
}
}
}
3. Run it
opencode # interactive TUI, GLM 5.2 by default
opencode run "explain this repo" # one-shot
opencode run "fix the failing test" -m coral-bricks/kimi-k3
Switch models any time inside the TUI with /models.
Available models
| Model |
Slug |
Context |
Input $/M |
Output $/M |
| GLM 5.2 |
glm-5.2-fp4 |
1M |
$1.40 |
$4.40 |
| Kimi K3 |
kimi-k3 |
1M |
$3.00 |
$15.00 |
| Kimi K2.6 |
kimi-k2.6 |
256K |
$0.76 |
$4.00 |
| GPT-OSS 120B |
gpt-oss-120b |
128K |
$0.15 |
$0.60 |
Full pricing and the live catalog are on the pricing page.
Notes
- Tool calling and agent mode work out of the box — the gateway emits
OpenAI-exact streaming tool calls; OpenCode's file edits, shell commands,
and multi-step agent loops run unmodified.
- Reasoning control: models think by default. Disable per request with
"reasoning": {"enabled": false} if you call the API directly; OpenCode
manages this itself.
- Long context is the point — GLM 5.2 and Kimi K3 take up to 1M tokens,
so whole-repo context and long agent sessions fit without pruning.
- The API is OpenAI wire-format at
https://inference.coralbricks.ai/v1 —
the same config shape works in any tool that speaks OpenAI-compatible
providers (Cline, Roo Code, Continue, aider). See the
API reference for the full surface.