Skip to main content
Pi is an AI coding agent that runs locally on your machine. Using the Requesty integration, you can:
  • Access 600+ models from OpenAI, Anthropic, Google, Mistral, and many other providers through one API key.
  • Get automatic prompt caching on Anthropic models, reducing cost significantly on multi-turn conversations.
  • Track and manage your spend in a single location.
  • Apply fallback policies, load balancing, and latency routing to keep your agent responsive.
The Requesty CLI writes this configuration for you: run requesty, select Pi, pick a model, and it backs up your existing config before writing.

Prerequisites

  • Pi installed on your machine. See pi.dev for installation instructions.
  • A Requesty API key from the API Keys page.

Configuration

1

Install Pi

Follow the instructions at pi.dev to download and install Pi on your machine.
2

Install the Requesty extension

To update it later, run pi update --extensions and restart Pi.
3

Add your API key

Store the key in Pi’s credentials file, ~/.pi/agent/auth.json. The key value can point at an environment variable, run a command that prints the key, or be the key itself:
Get a key from the API Keys page. With the environment variable option, export REQUESTY_API_KEY in the shell that starts Pi. A !command runs in your shell and can be any password manager CLI; it runs twice when Pi starts, so some password managers ask twice.
Keys in ~/.pi/agent/models.json (providers.requesty.apiKey) still work. When both files hold a key, auth.json wins. If you set PI_CODING_AGENT_DIR, both files are read from that folder instead of ~/.pi/agent.
4

Start Pi

At startup the extension loads the models your key can use from Requesty, so there is nothing to sync.

Selecting a model

Run /model inside Pi and type requesty to filter the list to Requesty models. You can also pick one when starting Pi:
The list follows your key’s approved models and includes:
  • Discrete models, e.g. anthropic/claude-opus-4-7.
  • Your organization’s policies, e.g. policy/opus-europe.
  • Managed models, e.g. gpt-6.1-terra, including @eu variants.
The extension sends HTTP-Referer: https://pi.dev and X-Title: Pi with every request. The referer is what enables Requesty’s automatic prompt caching for Pi: on Anthropic models Requesty injects cache-control breakpoints so Pi’s large system prompt and tool definitions are reused across turns, cutting cost by up to 90% on long conversations. See Auto-Caching for details.

Optional settings

To change the provider settings, add a requesty entry to ~/.pi/agent/models.json. Every field is optional; these are the defaults:
Keep the /v1 suffix on baseUrl. The extension loads the model list from <baseUrl>/models, so https://router.requesty.ai without /v1 fails with HTTP 404 Not Found. If you switch to api: "anthropic-messages", Pi appends /v1/messages itself, so that format needs https://router.requesty.ai without /v1 and a manual models list.
To save the model list into models.json, for example to keep it when Requesty can’t be reached, run /requesty-models-sync inside Pi and then /reload. The command keeps the file private to your user and never copies a key from auth.json into it.

Troubleshooting

  • startup discovery failed: HTTP 403 Forbidden: the key is wrong or revoked. Pi still starts, but without the Requesty model list.
  • No Requesty models in /model: the extension found no key. Check that auth.json is in ~/.pi/agent (or in PI_CODING_AGENT_DIR), and that REQUESTY_API_KEY is exported if you used $REQUESTY_API_KEY.

Verifying the integration

Run a quick prompt inside Pi to confirm that requests are routed through Requesty. Then open the Requesty analytics dashboard to verify the request was logged. Spend, latency, and token counts should appear within seconds. For caching, send a couple of follow-up messages in the same session on an Anthropic model, then check the request in the dashboard. After the first turn you should see cached tokens greater than zero, confirming the prompt prefix is being reused.

References

Last modified on October 27, 2026