All guides · API quickstart · Last checked: Settings from the app's official documentation, November 2026; requests use our standard OpenAI-compatible API
- 1. Create an accountSign up in a minute and get $5 of free credit. Already a customer? Sign in.
- 2. Make an API keyIn your account, open AI API and press Create key. Keys start with
dgk_. Keep yours secret. - 3. Follow the steps belowCopy each block, paste your key where it says
dgk_your_key_here.
1. Add Datagram as a provider
OpenCode reads ~/.config/opencode/opencode.json (or opencode.jsonc; a project can also have its own). Add:
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"datagram": {
"name": "Datagram",
"env": ["DATAGRAM_API_KEY"],
"package": "@opencode/ai/providers/openai-compatible",
"settings": { "baseURL": "https://api.datagram.net/v1" },
"models": {
"qwen3-coder:30b-64k": { "name": "Qwen3-Coder 30B (64K)", "limit": { "context": 65536, "output": 8192 } }
}
}
},
"model": "datagram/qwen3-coder:30b-64k"
}
Then set your key in the shell you run OpenCode from:
export DATAGRAM_API_KEY=dgk_your_key_here
2. Try it
Run opencode in a project folder. /models shows and switches models. The first answer can take 10 to 20 seconds while the model loads.
Which model?
qwen3-coder:30b-64k: a coding agent sends long instructions and calls tools on every step, so it needs the 65,536-token window. Our other models have 8,192 tokens, which is too small for agent work.
If something goes wrong
401 "Missing API key" or "Invalid or revoked API key"
Check the key is pasted in full (it starts with dgk_) and hasn't been revoked in your account under AI API.
402 "credit has run out"
Add credit in your account under AI API. Credit never expires.
The answer stops or the agent forgets what it was doing
Check "limit": { "context": 65536 } is set on the model, so OpenCode knows when to compact the conversation.
Questions
Which model should I use?
qwen3-coder:30b-64k. Coding agents send long instructions and call tools, so they need its 65,536-token window. Our other models have 8,192 tokens.
Is it private?
Yes. Requests run on our own Macs in our datacenter, and we never store prompts or answers, only counts for billing.