BazaarLinkBazaarLink
Sign in
← All articles
Published 2026-12-02 · · Author:BazaarLink · Magpie · Claude Code · Codex · AI gateway · setup guide

Magpie Setup Guide: Fall Back to BazaarLink When Your Quota Runs Out

Magpie is an open-source AI gateway that lets Claude Code and Codex share your subscriptions. This guide adds BazaarLink as a pay-as-you-go provider so work continues when a quota runs out.

If you code with Claude Code or Codex, you know the problem: your subscription quota runs out before the work is done. Waiting five hours for a reset is slow, and buying another plan is wasteful. A popular open-source project on GitHub, Magpie, is built for exactly this. This guide explains what Magpie is and shows how to add BazaarLink so that when a quota runs out, requests switch to pay-as-you-go. Information as of 2026-12-02.

Read this first: Whether using a personal subscription (for example Claude, ChatGPT or Gemini) through a third-party tool complies with each provider's terms is for you to check. Magpie's own documentation also notes that some providers may suspend accounts used this way, and suggests not using an account you cannot afford to lose. This article covers only BazaarLink's half: a pay-as-you-go API with your own key, with no involvement of anyone's subscription account.

What is Magpie

Magpie (site: usemagpie.ai) is an AI gateway that runs on your own computer. It is open source under the MIT license and has more than 40,000 stars on GitHub. In one sentence: it gathers every plan you pay for and offers them to any AI tool, and when one runs out the next takes over.

Key points:

  • Gather subscriptions and keys: Claude, ChatGPT (Codex), GitHub Copilot, Gemini and others can act as providers for other tools.
  • Many supported tools: Claude Code, Claude Desktop, Codex, Gemini CLI, OpenCode, Cursor CLI, Cline, VS Code Chat, Zed and dozens more can point at Magpie.
  • Routing groups: combine several models into a group with a rule such as order (use the first, switch only when it cannot be used) or smart (prefer the subscription about to reset, to waste less).
  • API key providers: besides subscriptions you can add API keys, including built-in DeepSeek, Kimi and OpenRouter, and any OpenAI- or Anthropic-compatible URL.

That last point is where BazaarLink fits.

A subscription is a fixed monthly fee, and when the quota is gone you wait. Add BazaarLink as a Magpie provider and put it in a routing group with your other providers, and you get:

  • Your usual plan first, and when its quota runs out, requests switch to BazaarLink pay-as-you-go with no interruption.
  • One API key for Claude, GPT, Gemini, DeepSeek, Qwen, GLM and more, without opening an account with each.
  • Pay in NT$; eligible payment methods can receive a Taiwan invoice (see the payment page for details).

Setup steps

1. Install Magpie

Follow the official Magpie instructions. On macOS or Linux:

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

On Windows the official instructions say to download the app from usemagpie.ai; see the README for other install methods.

Sign up at BazaarLink and create an API key. Keep the key on your own machine and never commit it to version control.

BazaarLink offers both an OpenAI-compatible and an Anthropic-compatible URL. Magpie can take both, so each tool uses the format it prefers:

magpie provider add bazaarlink \
  url=https://api.bazaarlink.ai/v1 \
  anthropic=https://api.bazaarlink.ai \
  key=your-BazaarLink-API-key
  • url=: the OpenAI-compatible URL (with /v1).
  • anthropic=: the Anthropic-compatible URL (without /v1).

After this, Magpie fetches the model list from BazaarLink. You can also use the graphical interface: Providers → Add provider, choose a custom provider, and enter the same name, URL and key.

Check the list:

magpie provider models bazaarlink
magpie claude bazaarlink/claude-sonnet-5.5     # Claude Code uses BazaarLink's Claude Sonnet 5.5
magpie codex bazaarlink/gpt-6.2-sol            # Codex uses BazaarLink's GPT-6.2 Sol

Copy model IDs exactly from the BazaarLink model list or from https://api.bazaarlink.ai/v1/models.

Put your existing provider and BazaarLink in one group with the order rule: use the first, and switch to BazaarLink only when it cannot be used.

magpie group add "Opus anywhere" models=claude/claude-opus-5-5,bazaarlink/claude-opus-5.5 routing=order
magpie claude group/opus-anywhere

For the exact way to write group names and members, follow the real output of magpie group and the Magpie documentation. We have not tested this step in every environment, so confirm with a small request before relying on it.

You can also do the reverse: put a cheaper model first for routine questions, for example bazaarlink/deepseek-v4.1-flash-1017 or bazaarlink/qwen3.7-flash, and switch to a stronger model when needed to control cost.

6. Confirm requests arrive

Open a new Claude Code or Codex conversation, send a small request, and check BazaarLink's usage and logs page for the request and its cost. Magpie's Routing page also shows which provider each request used.

Troubleshooting

  • 401 error: the API key is wrong or was pasted into a different provider. Replace it with magpie provider key bazaarlink <new-key>.
  • Model not found (404): the model ID must match the BazaarLink list exactly.
  • Extra /v1 on the Anthropic URL: set anthropic= to https://api.bazaarlink.ai without /v1.
  • Thinking (reasoning) mode: some models need a reasoning parameter in the request to turn thinking on; see each model page.

Summary

Magpie solves "quota isn't enough" and "too many tools, scattered settings". BazaarLink adds "keep going after the quota runs out, pay per use, settle in NT$". Together they let you keep working without interruption while keeping spending in your own hands.

To try it, create an API key at BazaarLink and follow the steps above to add it to Magpie.

Try BazaarLink now

TWD billing · Taiwan invoices · leading AI models · OpenAI-compatible API

Sign up / Log in for freeEnterprise inquiries
Related posts
Claude Code · Claude Code update · changelog · mods · permission rules
Claude Code 2.1.289: 27 Changes, Permission-Rule Fixes and Mods Stability
Claude Code · Claude Code mods · plugins · TypeScript · AI coding tools
Claude Code Mods: Customize Behavior and UI with TypeScript
web search API · AI agent · LLM · OpenClaw
OpenClaw Web Search Setup: Point Tavily at BazaarLink
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.