opencode
Terminal coding agent, speaks the OpenAI-compatible protocol.
On this page
Before you start
Prepare a dcld-sk- API key and verify group, model permissions and spendable balance. Coding agents need confirmed tool support. Address fields differ by client; follow the matching guide.
Write the config
Either the global ~/.config/opencode/opencode.json or an opencode.json in your project root. They merge, project wins.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"decloud": {
"npm": "@ai-sdk/openai-compatible",
"name": "deCloud",
"options": {
"baseURL": "https://macdecloud.com/v1",
"apiKey": "{env:DECLOUD_API_KEY}"
},
"models": {
"moonshotai/kimi-k3": {
"name": "Kimi K3",
"limit": { "context": 1048576, "output": 65536 }
}
}
}
}
}Three things people get wrong
This example uses @ai-sdk/openai-compatible for Chat Completions. Include /v1, but not /chat/completions, in baseURL. Set context/output limits from model details. For another client version or protocol, follow its matching documentation.
Set the key and go
Keep the key out of the config file — a project-level opencode.json usually ends up in git.
export DECLOUD_API_KEY='dcld-sk-...'
opencode
# Or name the model directly:
opencode run -m decloud/moonshotai/kimi-k3 "reverse a string in Go"Official reference: OpenCode ↗