What is Qwen Code?
Qwen Code is an open-source agentic command-line coding tool (adapted from Gemini CLI) by the Qwen team. It reads your repo, edits files, runs commands and iterates — and although it ships tuned for Qwen models, it speaks the OpenAI protocol, so any OpenAI-compatible endpoint works.
- A terminal coding agent: explore, edit, run and iterate over your project.
- Declares models in
~/.qwen/settings.jsonundermodelProviders, keyed by API protocol (openai,anthropic, …). - Reads API keys from an
envKeyreference (or.env/ shell export, which take priority). - Open source and model-agnostic via the
openaiprotocol.
Why route Qwen Code through Tokonomix?
Qwen Code already speaks the OpenAI protocol, so Tokonomix slots in as one more openai provider — except this one unlocks 130+ models and a consensus option, not just one vendor.
- One
openaiprovider entry, 130+ models — switch by changingmodel.name. - Use
tokonomix-consensusfor the hard reasoning turns, a fast slug for routine edits. - Per-call spend caps keep an agentic CLI within budget.
- Pin by
hosting_region/origin_countryfor regulated code.
Connect Tokonomix in settings.json
Add a Tokonomix entry under modelProviders.openai with the Tokonomix baseUrl and an envKey, then point model.name at the slug you want.
{
"modelProviders": {
"openai": [
{
"id": "tokonomix-consensus",
"name": "Tokonomix Consensus",
"baseUrl": "https://tokonomix.ai/api/v1",
"envKey": "TOKONOMIX_API_KEY"
}
]
},
"env": { "TOKONOMIX_API_KEY": "tok_live_your-key" },
"security": { "auth": { "selectedType": "openai" } },
"model": { "name": "tokonomix-consensus" }
}Per the docs, the env block is the lowest-priority fallback — a shell export TOKONOMIX_API_KEY=… or a .env file overrides it, which is the safer place for the secret.
Verify it works
- Save
~/.qwen/settings.jsonand start Qwen Code in a scratch repo. - Run a small edit and confirm the model used is your Tokonomix slug.
- Check the call and token usage in your Tokonomix dashboard.

