# pi-quotas

Quota and rate-limit monitoring for [Pi](https://github.com/mariozechner/pi). Shows remaining usage and reset times directly in your Pi footer and via the `/quotas` command.

## Supported Providers

| Provider | Method | Tracked Windows |
|---|---|---|
| **Antigravity** (Google) | Cloud Code Assist RPC | Gemini 5-Hour/Weekly & Claude 5-Hour/Weekly |
| **OpenAI Codex** | ChatGPT backend API | 5-Hour & Weekly limits, reset countdowns |
| **DeepSeek** | Balance API | Account balance (CNY) |
| **Kimi Code** | Usages API | 5-Hour rolling & Weekly quota |
| **OpenCode Go** | Zen API | 5-Hour rolling, Weekly & Monthly usage |
| **OpenRouter** | Key Auth API | Spending limit & Monthly usage |
| **xAI / Grok** | Billing API | Weekly credit quota |

## Install

```bash
pi install npm:pi-quotas
```

From source:

```bash
git clone https://github.com/xifan2333/pi-quotas.git
pi install ./pi-quotas
```

## Features

- **Context-Aware Footer**: Automatically detects your active model in Pi and displays its exact quota headroom (green → amber → red) with reset countdowns (e.g. `↺ 4h 15m`).
- **`/quotas` Command**: View comprehensive quota status and meters across all configured providers.
- **Standalone CLI**: Run `pi-quotas` or `pi-quotas --json` to inspect live quotas and local token statistics.
- **Local Session Auditing**: Tracks rolling 7-day token consumption and per-model usage across all session logs.

## Credentials

Reads automatically from Pi's built-in auth (`~/.pi/agent/auth.json`). No additional configuration needed — if Pi can talk to the model provider, `pi-quotas` can monitor its quotas.

## License

MIT © xifan
