Use Qwen Code with Datagram

Run Qwen's terminal coding agent on Qwen3-Coder hosted on our own Apple Silicon.

Works with Datagram AI

All guides · API quickstart · Last checked: Settings from the app's official documentation, November 2026; requests use our standard OpenAI-compatible API

  1. 1. Create an accountSign up in a minute and get $5 of free credit. Already a customer? Sign in.
  2. 2. Make an API keyIn your account, open AI API and press Create key. Keys start with dgk_. Keep yours secret.
  3. 3. Follow the steps belowCopy each block, paste your key where it says dgk_your_key_here.

1. Add Datagram to Qwen Code's settings

Edit ~/.qwen/settings.json:

{
  "modelProviders": {
    "openai": [
      {
        "id": "qwen3-coder:30b-64k",
        "name": "Qwen3-Coder 30B (Datagram)",
        "envKey": "DATAGRAM_API_KEY",
        "baseUrl": "https://api.datagram.net/v1",
        "generationConfig": { "contextWindowSize": 65536, "samplingParams": { "max_tokens": 8192 } }
      }
    ]
  },
  "security": { "auth": { "selectedType": "openai" } },
  "model": { "name": "qwen3-coder:30b-64k" }
}

Put your key in ~/.qwen/.env:

DATAGRAM_API_KEY=dgk_your_key_here

envKey is the name of the variable, not the key itself. A project's own .qwen/settings.json replaces this provider list completely, so add the entry there too if a project has one.

2. Try it

Run qwen in a project. /model shows the models from your settings. 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 and good tool use. Our other models have 8,192 tokens, which is too small for agent work.

It's from the same Qwen family Qwen Code is built for, so tool calls and thinking settings work as intended.

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.

It still asks me to sign in to Qwen

Check "security": { "auth": { "selectedType": "openai" } } is in the settings, or run /auth and choose the OpenAI-compatible custom provider.

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.

Create an account Get an API key More guides →