magpie not working? 401 and 405 errors and fixes (Nov 2026)
As of 2026-11-10, magpie's official docs, release notes and repository issues give a cause and a fix for each of these common errors: if an agent still uses the old model after a switch, the running session keeps the model it started with, so start a new one (and restart the Codex app for Codex); a 401 in Docker or on a LAN means the request carried no enabled gateway key, so make one with magpie gateway-key add; for ZCode's 405, the author answered in issue #425 that magpie does not rewrite your prompts or pose as the official client. With QCode, the 400 on the chat and responses lines of provider test is expected, and if you see only the first 24 models, pick the ones you need with magpie provider models.
Updated 2026-11-10
Point this tool at the QCode endpoint — one key for Claude, GPT and Chinese models.
- Billed per token — live rates on /models
- Pay by card (Visa / Mastercard), Apple Pay, Google Pay or crypto
- Self-service: top up and activate instantly
The four most common errors
Start a new session after switching
The official FAQ answer: a running session keeps what it started with, so start a new one; for Codex, restart the Codex app too.
Requests need a gateway key
magpie's Docker docs: a request from the host or another machine is answered only with an enabled gateway key, and gets 401 without one. Make a key with magpie gateway-key add and a name (when magpie runs in Docker, put docker exec magpie in front).
ZCode: the principle the author gave
Issue #425 is closed (not planned). The author's principle: magpie does not rewrite your prompts and does not pose as the official client. Since v0.1.590 this error message says ZCode only accepts requests from its own app and suggests adding another provider to the group.
The 400 in provider test is expected
QCode docs: when the first model is a Claude model, the chat and responses lines show 400, because Claude is served only on the Anthropic Messages endpoint; a check mark on the anthropic line means Claude works.
Where do magpie errors come from?
As of 2026-11-10, most magpie errors come from one of three places: the agent's session, the local gateway, or the model endpoint behind it. magpie runs a gateway on your machine at 127.0.0.1:3425 and, for the agents it lists, writes the gateway's address and token into the agent's own config file. Agents read their config when they start, so a switch applies to sessions started afterwards; an agent cannot connect while the gateway is not running; and once the gateway runs in Docker or is shared on a LAN, requests from outside the container or from other machines need an enabled gateway key. Below, each error is listed by its text or symptom, with the cause and the command given in magpie's official docs, release notes and repository issues. Start with three diagnostic commands: magpie healthcheck, magpie provider test with your provider id, and magpie log. For WSL setups, see /magpie-wsl-windows-setup.
2026-11-10: v0.1.3518 fixes non-UTF-8 text
The official release notes say v0.1.3518, published 2026-11-10, fixed an issue where non-UTF-8 text in a request body reached the vendor as the replacement character � (U+FFFD). If the model received non-UTF-8 text you sent as �, check that magpie has updated to this version or later; an installed magpie updates itself.
Timeline
Issue #425 (ZCode returns 405) is closed with the author's reply; a release the same day rewords the error message.
The author answers a complaint about a messy model list on X: create a routing group and pick only that group in the agent.
Checked: official README, docs/start, docs/docker, reference and issues #425 and #4453; the release with the non-UTF-8 fix is published the same day.
What the official sources fix, and what they leave open
Documented by magpie
① A running session keeps the model it started with; start a new one, and restart the Codex app too for Codex. ② For a model through magpie, the gateway runs with the app; closing the window leaves it in the menu bar or tray, magpie serve runs the gateway alone, and magpie daemon install keeps it running as a service; magpie healthcheck exits 0 while the gateway answers. ③ On loopback any token works; once the gateway is on the network (0.0.0.0 in Docker, LAN sharing), remote requests need an enabled gateway key or get 401, and a WSL distro under NAT counts as remote. ④ The text of the Docker 401 is the second question in the FAQ below; the fix is to make a gateway key and put it in the agent's settings. ⑤ The browser page opened without its key is turned away (401); use the link from the log, and set MAGPIE_WEB_KEY to keep the key across restarts. ⑥ With MAGPIE_ALLOW_IPS set, a request from any other address is refused 403 before its key is looked at. ⑦ magpie provider test with a provider id sends one tiny request per API and shows the latency. ⑧ magpie log prints where the logs are, and magpie log -f follows them.
What the official sources leave open
As of 2026-11-10: ① Issue #4453, SSH remote sessions rejected, is still open: in an SSH session Claude Desktop refuses the loopback gateway address 127.0.0.1:3425 that magpie writes for it, saying remote sessions are not available with that gateway. The repository author had not replied when this was checked, so follow the official answer when it comes. ② Error wording changes between versions, for example ZCode's message was reworded once, so the errors here are organized by what they mean rather than by one exact phrasing. ③ magpie ships several releases a day; which version fixed your problem is in GitHub Releases.
One 401, two situations
Local loopback
The official reference: loopback requests are permissive, and any token works, including a stale or disabled gateway key; agents connect to 127.0.0.1:3425 by default.
Docker or LAN sharing
Once the gateway is on the network, remote requests need an enabled gateway key sent as Bearer, x-api-key, x-goog-api-key or ?key=, or they get 401. Docker port publishing (even the host's own requests arrive through the bridge) and a WSL distro under NAT both count as remote.
Check magpie in this order
① Check your version first: magpie ships several releases a day, and the QCode test for this page on 2026-11-10 used 0.1.3533; an installed magpie updates itself, or rerun the official installer curl -fsSL https://usemagpie.ai/install.sh | sh. ② Run magpie healthcheck; exit code 0 means the gateway answers. With no gateway running it reports no gateway at http://127.0.0.1:3425 (QCode test, 2026-11-10); then open the app, or run magpie serve for the gateway alone. ③ Run magpie provider test with your provider id (qcode if you added QCode as in its docs); it sends one tiny request per API, so you can see which line fails. ④ Run magpie log -n 200 for the latest log lines, and attach the path magpie log prints when you ask for help. ⑤ If a switch did not take effect, start a new session, and restart the Codex app for Codex. ⑥ For a 401 in Docker or on a LAN, make a key under Gateway → Gateway keys, or with magpie gateway-key add and a name (in Docker, put docker exec magpie in front). ⑦ For WSL, see /magpie-wsl-windows-setup.
Two QCode behaviors that are normal
As of 2026-11-10, QCode's docs describe two normal results: ① When the first model is a Claude model, magpie provider test on the qcode provider shows ✗ 400 on the chat and responses lines, saying the model is not available on this endpoint: Claude is served only on the Anthropic Messages endpoint, so a check mark on the anthropic line means Claude works; to check GPT, run magpie codex qcode/gpt-6.1-sol and send a real request. ② Without models= when adding the provider, magpie exposes only the first 24 models of the list; choose the ones to expose with magpie provider models followed by the provider id qcode and the model IDs, and see https://qcode.cc/models for the models on sale. One QCode key serves both Anthropic- and OpenAI-compatible interfaces; in magpie, enter https://api.qcode.cc/api for anthropic, https://api.qcode.cc/openai/v1 for chat and https://api.qcode.cc/openai for responses. Billing is per token, with per-model rates on /models. Three steps to start: register, top up, copy your key (it starts with cr_), then add it as on the magpie page at docs.qcode.cc. Want to try it for a few days first? Pay-as-you-go Packs start at $4 for a one-time quota you use within 7 days; see /pay-as-you-go.
Frequently asked questions
I switched models, but my agent still uses the old one.
A running session keeps the model it started with, as the official FAQ says. Start a new session, and for Codex restart the Codex app too. Agents read their config when they start, so the change applies to the next session. To put an agent back the way it was, pick one of its own models in the picker, or run magpie followed by the agent name and default, for example magpie claude default.
401: the API key sent is not an enabled magpie gateway key
This is the 401 text quoted in magpie's Docker docs: the key an agent sent from outside the container is not an enabled gateway key (with LAN sharing, requests from other machines need a gateway key as well). The docs name one case: after upgrading from an earlier image, an agent outside the container still sends magpie or another key that is not a gateway key. The fix: make a key under Gateway → Gateway keys, or with magpie gateway-key add and a name (in Docker, put docker exec magpie in front), which prints a new sk-magpie-key-…, and put it in the agent as its API key. On local loopback any token works.
ZCode: 405 Method Not Allowed
The title of issue #425 begins ZCode provider returns 405 Method Not Allowed, and the issue is closed (not planned). The author's reply on 2026-10-01 gave the principle that magpie does not rewrite your prompts and does not pose as the official client. Since v0.1.590 this error message says ZCode only accepts requests from its own app and suggests adding another provider to the group. If you follow it and add a provider that works with an API key, QCode offers GLM models such as glm-5.3 on both the Anthropic and the OpenAI Chat interface; see /models for each model.
The chat and responses lines in provider test show 400. Is my setup wrong?
No, as long as the anthropic line has a check mark. QCode serves Claude models only on the Anthropic Messages endpoint; when the first model is a Claude model, the test sends it to chat and responses as well and gets a 400 by design, reading Model 'claude-opus-5-5' is not available on this endpoint. To get a check mark on all three lines, put a GPT model such as gpt-6.1-terra first when you list models with magpie provider models, as QCode tested on 2026-11-10; you can also check GPT by running magpie codex qcode/gpt-6.1-sol and sending a real request.
Why do I only see some of the models in magpie, or why is the model list so messy?
In QCode's test, without models= when adding the provider, magpie exposes only the first 24 models. Writing the provider id and model IDs after magpie provider models replaces the whole list with yours; to expose just one more, the reference uses +model-id (and -model-id takes one out), leaving the rest as they are. For a messy list, the author's answer on X on 2026-11-05 is to create a routing group and pick only that group in the agent; the reference also describes an Only through routing groups switch on a provider that keeps the whole provider for routing groups.
The agent gets 502 or can't connect, and nothing shows in magpie's Routing tab?
The cause in the official FAQ: a proxy app (Surge, Clash, mihomo and the like, with system proxy, TUN or enhanced mode on) has taken the agent's request to http://127.0.0.1:3425 and sent it somewhere else, so it never reaches magpie. The official fix: add two rules that send local addresses direct, ahead of your other rules, IP-CIDR,127.0.0.0/8,DIRECT,no-resolve and IP-CIDR6,::1/128,DIRECT,no-resolve, then have the agent send a new request.
Sources
The magpie README, docs/start and docs/docker on usemagpie.ai (including the Chinese versions), docs/reference.md in the repository, the GitHub Releases for the versions named here, issues #425 and #4453 with their comments, and an archive of the author's X post of 2026-11-05, all read on 2026-11-10. QCode: qcode.cc/models, qcode.cc/pay-as-you-go, the magpie page on docs.qcode.cc and QCode's own test notes, all of 2026-11-10.
Use magpie with a QCode key
One QCode key goes into magpie's anthropic, chat and responses fields and serves both Anthropic- and OpenAI-compatible interfaces; billing is per token, with per-model rates on /models.
Related reading
Pay-as-you-go Packs
One-time quota packs valid for 7 days, no subscription; per-model rates are on /models.
magpie Claude Code setup: local gateway for Claude Code and Codex (2026-11)
magpie setup: install and uninstall commands, three ways to add a provider, picking models for Claude Code and Codex, and QCode's three addresses.
magpie WSL setup and magpie on Windows (2026-11)
Where to install magpie with WSL: the Windows app and magpie.exe, agents in WSL distros, status of the WSL issues, and the three QCode addresses.
Crypto payment guide
Nine coins, 56 networks, zero platform fee for AI coding API credits.
Statements on this page were checked on 2026-11-10 against magpie's official docs, release notes and repository issues; the official pages prevail. Error wording and menu names change with versions, so follow the version you install. QCode model availability follows /models.