Course · Pi · Getting started
Bring your own key to Pi
Pi has no bundled plan, no free tier, and no subscription of its own to sell you. Every session runs against a model you pay for directly - bring-your-own-key, in the fullest sense. That’s a deliberate consequence of the same minimalism from the last lesson: Pi doesn’t want to be in the business of managing your billing relationship with a model provider, any more than it wants to carry a system prompt reportedly running to many thousands of tokens you didn’t ask for.
The two ways in
Section titled “The two ways in”Inside the running prompt, /login walks you through the options:
> /loginYou’ve got two shapes of authentication, and they’re not interchangeable:
- An API key, exported as an environment variable before you launch Pi -
ANTHROPIC_API_KEY,OPENAI_API_KEY, and so on, depending on the provider. You pay that provider per token, directly, at their published rate. - OAuth into a subscription you already have -
/loginsupports signing in against a handful of subscription-based providers this way, including OpenAI’s ChatGPT plans and GitHub Copilot.
Here’s what “per token” actually means for the fix you’re about to hand Pi two lessons from now. That transcript closes in five tool calls - two reads of app/worker/extract.py and tests/test_extract.py, two edits to the same two files, one pytest run - and every one of those five is a fresh round trip that resends the whole growing conversation back to whichever provider you picked. Under API-key billing, all five round trips are metered, token for token, at that provider’s own published rate - check it before you rely on a long session, because it compounds with every read you ask for. stash itself doesn’t care which path you choose: pytest still runs locally, for free, on your own machine, either way. What changes is only what you pay to have the model read the files, propose the diff, and re-check its own work.
For stash, either path gets you to a working session. What matters is which provider you pick, and how:
| Path | Who pays | Billing unit | Predictability |
|---|---|---|---|
| API key (Anthropic, OpenAI, OpenRouter) | You, directly to the provider | Per token, at that provider’s published rate | Fully metered - cost scales exactly with what you send and receive |
| OAuth into Claude Pro/Max | You, through your existing subscription | Per token, from “extra usage” - Pi’s own provider docs describe third-party harness calls as billed this way, not against your plan’s included usage | Same metering as an API key, despite the subscription login - verify against Anthropic’s current terms before you count on it |
| OAuth into ChatGPT or Copilot plans | You, through your existing subscription | Provider-specific and not detailed in Pi’s docs | Unknown until you read that provider’s current terms yourself |
| Local model via Ollama | Nobody, per call | None - your own compute | Free, with trade-offs you’ll weigh properly in a later module |
| Aggregator (OpenRouter) | You, via the aggregator | Full per-token API rate, no subscription cushion underneath | Same as a direct API key, plus one extra hop |
What this means for today
Section titled “What this means for today”None of this blocks you from working on stash right now. Any row in that table gets you a working session - pick the one whose terms you’re already comfortable with, not the one this page recommends by default.
Pick whichever path gets a model responding, and confirm it landed:
> what model am I talking to right now?You’re authenticated, and Pi has a model to call. Before you hand it the actual bug, spend two minutes watching how a single request through Pi actually behaves - because the shape of that loop is the one piece of trust you need before the real fix. Next: understand one turn of the loop.