# magpie Setup with QCode: Claude Code & Codex

> **Last verified**: 2026-10-27 · 📄 Per official docs (magpie v0.1.1680, released 2026-10-27) · QCode access tested with magpie 0.1.1677 (✅ Claude Code 2.1.311, Codex CLI 0.164.0)

## At a glance

| Item | Details |
|---|---|
| Models you can use | Claude ✅ through the `anthropic` address · GPT ✅ through `chat` / `responses` · Chinese models ✅ through `anthropic` / `chat` · Gemini ❌: QCode does not offer the Gemini series; use Claude, GPT or a Chinese model |
| Three addresses | `anthropic`: `https://api.qcode.cc/api` · `chat`: `https://api.qcode.cc/openai/v1` · `responses`: `https://api.qcode.cc/openai` |
| Where to configure | Import link (desktop app / web link) · one `magpie provider add` command · the app's Providers → Add provider |
| Official docs | [usemagpie.ai](https://usemagpie.ai) · [Docs](https://usemagpie.ai/docs) · [Import links](https://usemagpie.ai/docs/import) |

## What magpie is, and how it differs from CC Switch

magpie runs a gateway on your machine (`127.0.0.1:3425`). It speaks the OpenAI, Anthropic and Gemini APIs and translates between them, streaming and tool calls included. When you pick a model for an agent in magpie, magpie writes that model into the agent's own config file. Claude Code and Codex therefore connect to the local gateway; your QCode key stays in magpie, and the gateway forwards each request to QCode.

The structural difference from [CC Switch](/docs/ide/cc-switch) is one sentence: CC Switch writes the endpoint and key into each client's own config, and the client connects to the provider directly; magpie points the client at a local gateway, which forwards the requests.

## Which protocol

| magpie field | What it means in magpie | QCode value |
|---|---|---|
| `anthropic` | Anthropic Messages base URL, the root without `/v1` | `https://api.qcode.cc/api` |
| `chat` (called `url` in the CLI) | OpenAI Chat Completions base URL, ending in `/v1` | `https://api.qcode.cc/openai/v1` |
| `responses` | OpenAI Responses base URL | `https://api.qcode.cc/openai` |

**Claude goes only through `/api`; the OpenAI-compatible addresses do not serve Claude.** Send a `claude-*` id to chat or responses and QCode returns `model_not_available_on_endpoint`; that check runs before authentication. GPT uses both OpenAI paths, and Chinese models work on both chat and anthropic.

To use the Asia or North America access point, replace the domain with `asia.qcode.cc` or `us.qcode.cc`; the paths stay the same. All three domains have the same capabilities and differ only in network routing.

magpie's official description of `responses` is a base URL ending in `/v1`. For QCode, enter `https://api.qcode.cc/openai` (the same as the base_url in QCode's Codex configuration); this was tested with magpie 0.1.1677 on 2026-10-27.

## Install

The official installer:

```bash
curl -fsSL https://usemagpie.ai/install.sh | sh
```

The installer puts the `magpie` command in `~/.local/bin` and the app where it belongs: `/Applications` on a Mac, your app menu on Linux. On Windows, `magpie.exe` takes the same commands; `magpie-cli-windows-amd64.exe` from the latest release is the terminal-only build. magpie runs on macOS, Windows and Linux as a menu bar app, a window, a TUI, a web UI and a CLI.

## Add QCode

**Option A: import link (desktop app and web)**

magpie asks for every value to be URL-encoded. Here is the link for QCode, without a key:

```
magpie://import?name=QCode&anthropic=https%3A%2F%2Fapi.qcode.cc%2Fapi&chat=https%3A%2F%2Fapi.qcode.cc%2Fopenai%2Fv1&responses=https%3A%2F%2Fapi.qcode.cc%2Fopenai&models=claude-opus-5-5%2Cclaude-sonnet-5-5%2Cclaude-haiku-5-5%2Cgpt-6.1-sol%2Cgpt-5.6-sol&website=https%3A%2F%2Fqcode.cc&keys=https%3A%2F%2Fqcode.cc%2Fdashboard
```

On the web, use the clickable form with the same parameters after `#` (browsers never send the fragment to a server, and the link offers the download when magpie is not installed):

```
https://usemagpie.ai/import#name=QCode&anthropic=https%3A%2F%2Fapi.qcode.cc%2Fapi&chat=https%3A%2F%2Fapi.qcode.cc%2Fopenai%2Fv1&responses=https%3A%2F%2Fapi.qcode.cc%2Fopenai&models=claude-opus-5-5%2Cclaude-sonnet-5-5%2Cclaude-haiku-5-5%2Cgpt-6.1-sol%2Cgpt-5.6-sol&website=https%3A%2F%2Fqcode.cc&keys=https%3A%2F%2Fqcode.cc%2Fdashboard
```

Without a key in the link, the user pastes the key into magpie's dialog, as the official docs say; nothing is saved until Add is pressed. In a terminal, `magpie import` without a key only shows what would be added and saves nothing (tested on 2026-10-27), so terminal users should use option B. To replace the key of a saved provider, run `magpie provider key qcode cr_xxx`.

**Option B: one command in the terminal (tested)**

```bash
magpie provider add QCode anthropic=https://api.qcode.cc/api url=https://api.qcode.cc/openai/v1 responses=https://api.qcode.cc/openai key=cr_xxx
```

**Option C: the app**

Open the Providers tab, press ＋ Add provider, choose Custom (official label: `Custom · any compatible URL`), enter a Name, an OpenAI-compatible base URL (ending in `/v1`) and/or an Anthropic-compatible base (the root), then the key, and save.

## Pick models

```bash
magpie claude qcode/claude-sonnet-5-5        # main model
magpie claude opus qcode/claude-opus-5-5     # the opus slot in Claude Code
magpie codex qcode/gpt-6.1-sol               # Codex
magpie claude default                        # restore the previous Claude Code setup
magpie codex default                         # restore the previous Codex setup
```

magpie writes the local gateway address into `~/.claude/settings.json` (`ANTHROPIC_BASE_URL` is `http://127.0.0.1:3425`) plus the token `magpie`; the QCode key stays in magpie and is not written into Claude Code's config. Setting only the main model also sets the opus slot to the same model; to put Opus in the opus slot, run `magpie claude opus qcode/claude-opus-5-5` separately. magpie sets the haiku slot to `qcode/claude-haiku-5-5` automatically.

Without `models=` when adding the provider, magpie exposes only the first 24 models of the list (the tested output was `24 of 29 models`). Choose the models to expose with `magpie provider models qcode <id> <id> …`, for example:

```bash
magpie provider models qcode claude-opus-5-5 claude-sonnet-5-5 claude-haiku-5-5 gpt-6.1-sol gpt-5.6-sol
```

Recommended ids: `claude-opus-5-5`, `claude-sonnet-5-5`, `claude-haiku-5-5`, `gpt-6.1-sol` and `gpt-5.6-sol`. The models on sale are listed at https://qcode.cc/models. Billing is per token, and each model's price is listed at https://qcode.cc/models.

## Verify

```bash
magpie healthcheck
magpie provider test qcode
```

`magpie healthcheck` exits 0 while the gateway answers. `magpie provider test qcode` sends one tiny request to chat, responses and anthropic and shows the latency.

When the first model is a Claude model, the chat and responses lines show `✗ 400 · Model 'claude-opus-5-5' is not available on this endpoint.` This is QCode behaving as designed: Claude is served only on the Anthropic Messages endpoint, so an anthropic line with ✓ means Claude works. To check GPT, run `magpie codex qcode/gpt-6.1-sol` and send a real request.

Then send “ping” in Claude Code and ask Codex to read a file. As tested on 2026-10-27, Claude requests through magpie match a direct QCode connection, prompt caching works as usual, and Codex uses the Responses API.

## FAQ

### Claude Code cannot connect when the gateway is not running

Run `magpie healthcheck` first; exit code 0 means the gateway answers. The gateway runs with the app, and closing the window leaves it in the menu bar or tray. You can also run `magpie serve` for the gateway alone, or `magpie daemon install` to keep it as a service (systemd on Linux, launchd on macOS).

### Do the 400 lines for chat and responses in `magpie provider test qcode` mean a wrong setup?

No, as long as the anthropic line is ✓. QCode serves Claude models only on the Anthropic Messages endpoint, so the test's Claude model is refused on chat and responses by design. Check GPT by running `magpie codex qcode/gpt-6.1-sol` and sending a request.

### Why do I see only some of the models?

Without `models=` at add time, magpie exposes only the first 24. Pick the ids you need with `magpie provider models qcode …`; the list of models on sale is at https://qcode.cc/models.

### How do I restore my previous Claude Code setup?

Run `magpie claude default`, or pick one of the agent's own models in the picker. magpie removes what it wrote and restores the values it replaced.

### How do I change Codex's reasoning effort?

Use `magpie codex effort <level>`, for example `magpie codex effort high`; `magpie codex effort` shows the current value. A bare level also works, for example `magpie codex xhigh`.

### What is privacy masking, and is it on by default?

It is off by default; turn it on in Settings → Privacy. API keys, private keys, tokens, emails, and card and ID numbers whose checksum adds up become placeholders such as `{{API_KEY_k3v9x2mq}}` before a request leaves your machine, and are put back in the reply; values are held in memory only.

### How do I turn off the anonymous usage count?

Turn off Count me as a user in Settings → Privacy, or set `DO_NOT_TRACK=1` / `MAGPIE_NO_STATS=1`. Once a day a released magpie sends one anonymous batch with a random id made up on your computer, its version and system, and the built-in ids of the agents, providers and models it is used with.

## Related

- [CC Switch](/docs/ide/cc-switch): a desktop tool that writes the endpoint and key into each client's config
- [Codex](/docs/ide/codex): the Responses form in `~/.codex/config.toml`
- [Endpoints & API paths](/docs/getting-started/endpoints-and-api-paths): the three protocols and three access domains
- [Environment variables](/docs/getting-started/environment): how `ANTHROPIC_BASE_URL` and similar variables are used