---
title: "@henryqw/pi-magpie"
seo:
  description: "Show Magpie provider quota in Pi."
---

<div class="not-prose my-6 flex flex-wrap items-center gap-3"><a href="https://www.npmjs.com/package/@henryqw/pi-magpie" aria-label="View @henryqw/pi-magpie version v0.2.0 on npm"><img alt="Version v0.2.0" height="20" src="https://img.shields.io/static/v1?cacheSeconds=7200&amp;color=1d4ed8&amp;label=version&amp;labelColor=6a7282&amp;style=flat-square&amp;message=v0.2.0" width="96"></a><div class="ml-auto flex flex-wrap items-center justify-end gap-3"><a href="https://www.npmjs.com/package/@henryqw/pi-magpie" aria-label="View @henryqw/pi-magpie on npm"><img alt="Monthly npm downloads" height="20" src="https://img.shields.io/npm/dm/%40henryqw%2Fpi-magpie?cacheSeconds=7200&amp;color=1d4ed8&amp;label=downloads&amp;labelColor=6a7282&amp;style=flat-square" width="144"></a><a href="https://github.com/HenryQW/pi-harness/blob/main/extensions/pi-magpie/LICENSE" aria-label="View the MIT license for @henryqw/pi-magpie"><img alt="MIT license" height="20" src="https://img.shields.io/npm/l/%40henryqw%2Fpi-magpie?cacheSeconds=7200&amp;color=1d4ed8&amp;label=license&amp;labelColor=6a7282&amp;style=flat-square" width="78"></a></div></div>

See the current Magpie route, served account, and quota in the Pi footer. Use `/magpie-quota` for full details.

## Install

```bash
pi install npm:@henryqw/pi-magpie
```

Requires Pi 1.5.0 or later. Install Magpie and make `magpie` available on your path. Sign in to providers in Magpie. Keep the Magpie gateway running for cached reports.

## Use

For a Magpie model, the footer shows up to two account cards. Each card shows its lowest known remaining percentage and the minutes to reset. Card numbers match `/magpie-quota`. The served model and fallback count use a separate status. A matching account uses its card number; otherwise the account is unknown. With `pi-footer`, the cards appear above the served model.

The extension warns once when a fresh quota window falls below 25 percent. It can warn again after a fresh reading rises to 25 percent or more. Stale and unknown readings do not cause warnings. A narrow terminal can truncate the status; use `/magpie-quota` for the full route, account, and all quota windows.

| Surface | Type | Purpose |
| --- | --- | --- |
| `/magpie-quota` | command | Show all cards, windows, balances, and reading times. |
| `/magpie-quota refresh` | command | Ask Magpie for a new quota report and show it. |

Pi reads Magpie's cached report at session start and every five minutes. It reads the session route after a provider response and at the end of a turn. It checks again while a route is active and briefly after it ends. It sends a process-specific session identifier in `X-Magpie-Session` for Magpie requests. It reads the usage log by route to identify the account; it does not use global last-served data. These reads do not ask providers for quota.

A manual refresh asks Magpie for a new report; Magpie can return a cached reading. A card is stale when its reading is at least ten minutes old or has no reading time. A failed request keeps the last report and marks it stale.

## Limits and recovery

The extension reads the local gateway reported by `magpie status`. A Magpie model that uses another gateway has an unknown route and account. Gateway permissions, missing usage records, older Magpie versions, or a route that does not match the selected model can also leave them unknown. Account lookup scans at most 1,000 records for the route. A provider name that differs from its subscription name can prevent a quota card match.

Magpie decides which providers and accounts report quota. Text-only windows and balances are not percentages. If Magpie cannot provide a reading, the footer shows `unknown` or `unavailable`. Check Magpie and run `/magpie-quota refresh`. The extension does not show raw command errors, which can contain secrets. It does not run Magpie's per-account refresh command, which can have provider-specific effects.
