Docs · Guide
Qwen Code on any model
Qwen Code, the qwen coding agent from the Qwen team, takes models of your own in its settings. magpie adds its models there, so qwen can run on any model you have in magpie, not only Qwen: DeepSeek, Kimi, GLM, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, with no key pasted into qwen.
Qwen Code keeps its settings in ~/.qwen/settings.json (under $QWEN_HOME if set). magpie appends one entry per model to modelProviders.openai there, each with the gateway’s address, the model’s id, its name as qwen’s /model shows it, and its context window. Then it points model at your pick. The gateway translates each request for the model’s provider, tool calls and reasoning included. A Qwen Code in WSL is set up the same way.
Qwen Code 1.x reads models of your own from a top-level providers object instead. For it magpie writes one provider there, magpie, with the gateway’s address, a key that names Qwen Code, your pick as its model and every model of magpie’s in models, and points model.name at magpie/<model>. magpie tells the two apart by the version of the installed qwen, and when you update Qwen Code from 0.x it moves its own entries to the new shape, your pick kept.
Connect Qwen Code
- Add providers in magpieIn the Providers tab, add an API key or sign in to a subscription.
- Pick a model on Qwen Code’s rowIn the Agents tab, choose a model under magpie.
- Start a new qwen sessionQwen Code reads a session’s model when it starts, so start a new session, or pick the model again with
/model, where magpie’s models are listed too.
magpie qwen deepseek/deepseek-v4-pro # Qwen Code on DeepSeek magpie qwen # what Qwen Code runs on now
The key and /auth
Every magpie entry takes its key from MAGPIE_QWEN_API_KEY, which magpie sets in the settings’ env object. The name is Qwen Code’s own, so a variable you exported in your shell or in ~/.qwen/.env is unlikely to shadow it. magpie also sets security.auth.selectedType to openai, so qwen starts without asking /auth.
On Qwen Code 1.x the key is written in the provider itself, as apiKey: 1.x refuses a provider whose key is a variable it can’t read.
Your own models
Your own modelProviders entries stay as they were, in front of magpie’s, so their ids don’t move, and they are listed on Qwen Code’s row beside magpie’s. When you pick a model of magpie’s, the model and auth type you had, with their address, are kept aside to be put back.
Switch back
Pick one of your own models on the row, take the row off magpie, or run magpie qwen default. magpie puts back the model and auth type you had before, and removes its entries and its key once no model of magpie’s is in use.
FAQ
Can Qwen Code run on models other than Qwen?
Yes. Any model you have in magpie is in qwen’s list: DeepSeek, Kimi, GLM, GPT, Claude and more.
Can Qwen Code use my ChatGPT subscription?
Yes. Sign in to ChatGPT in magpie and pick a GPT model under magpie on Qwen Code’s row. qwen sends its requests to magpie, which uses the subscription.
Why doesn’t a running session change model?
Qwen Code reads a session’s model when the session starts. Start a new one, or pick the model with /model.
I updated to Qwen Code 1.x and /model lists none of magpie’s models
Update magpie. It moves its entries to 1.x’s providers the next time it starts or the models change, or at once when you pick a model on Qwen Code’s row.
Does it work with Qwen Code in WSL?
Yes. magpie sets up a Qwen Code in a WSL distro too.
More agents on the same models: Models in OpenCode, Models in Claude Code, Copilot CLI on any model and Kimi Code on any model. Something fails? See Fixing common errors, or ask on Discord.