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 to Pi's models file
Pi reads ~/.pi/agent/models.json:
{
"$schema": "https://pi.dev/schemas/models.schema.json",
"providers": {
"datagram": {
"name": "Datagram",
"baseUrl": "https://api.datagram.net/v1",
"api": "openai-completions",
"apiKey": "$DATAGRAM_API_KEY",
"models": [
{ "id": "qwen3-coder:30b-64k", "name": "Qwen3-Coder 30B (Datagram)", "contextWindow": 65536, "maxTokens": 8192 }
]
}
}
}
Then export DATAGRAM_API_KEY=dgk_your_key_here.
2. Pick it and try it
Start pi, run /model and choose Qwen3-Coder 30B (Datagram); Ctrl+S in the picker makes it the default. Pi rereads models.json each time you open the picker, so no restart is needed. The first answer can take 10 to 20 seconds while the model loads.
Using oh-my-pi?
oh-my-pi (omp) is a fork of Pi with its own config folder and YAML instead of JSON. Put this in ~/.omp/agent/models.yml:
providers:
datagram:
baseUrl: https://api.datagram.net/v1
api: openai-completions
apiKey: dgk_your_key_here
models:
- id: qwen3-coder:30b-64k
name: Qwen3-Coder 30B (Datagram)
contextWindow: 65536
maxTokens: 8192
Check it with omp models datagram, and set the default in ~/.omp/agent/config.yml:
modelRoles:
default: datagram/qwen3-coder:30b-64k
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 and good tool use. 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 set where the tool reads it (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 model doesn't appear in /model
Pi hides custom models until it can find their key. Check DATAGRAM_API_KEY is set in the shell you started Pi from.
Poolside's documentation also uses Pi as the way to run its models in a third-party agent; the same setup works with Datagram.
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.
Does this work for Poolside users?
Poolside's own agent uses Poolside's models; its docs suggest Pi for third-party setups, and Pi works with Datagram as shown here.
Is it private?
Yes. Requests run on our own Macs in our datacenter, and we never store prompts or answers, only counts for billing.