> ## Documentation Index
> Fetch the complete documentation index at: https://docs.requesty.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pi

> Requesty routing for the Pi Coding Agent

[Pi](https://pi.dev) is an AI coding agent that runs locally on your machine.

Using the Requesty integration, you can:

* Access **300+ 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](/features/fallback-policies), [load balancing](/features/load-balancing-policies), and [latency routing](/features/latency-routing) to keep your agent responsive.

## Prerequisites

* Pi installed on your machine. See [pi.dev](https://pi.dev) for installation instructions.
* A Requesty API key from the [API Keys page](https://app.requesty.ai/api-keys).

## Configuration

<Steps>
  <Step title="Install Pi">
    Follow the instructions at [pi.dev](https://pi.dev) to download and install Pi on your machine.
  </Step>

  <Step title="Configure the models file">
    Create or edit the models configuration file at `~/.pi/agent/models.json` and add Requesty as a provider:

    ```json theme={"dark"}
    {
      "providers": {
        "requesty": {
          "name": "Requesty",
          "baseUrl": "https://router.requesty.ai/v1",
          "api": "anthropic-messages",
          "apiKey": "rqsty-sk-....",
          "headers": {
            "HTTP-Referer": "https://pi.dev",
            "X-Title": "Pi"
          }
        }
      }
    }
    ```

    Replace `rqsty-sk-....` with your Requesty API key from the [API Keys page](https://app.requesty.ai/api-keys).

    <Info>
      The `HTTP-Referer: https://pi.dev` header is what enables Requesty's **automatic prompt caching** for Pi. When Requesty sees this referer on an Anthropic model, it automatically 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. Combined with `api: "anthropic-messages"` (the native Anthropic Messages format), this gives you the best caching behavior. See [Auto-Caching](/features/auto-caching) for details.
    </Info>
  </Step>

  <Step title="Install the Requesty extension">
    Install the Requesty extension for Pi by running:

    ```txt theme={"dark"}
    pi install git:github.com/requestyai/pi-requesty
    ```
  </Step>

  <Step title="Sync models">
    Run the following command inside Pi to sync the available Requesty models:

    ```txt theme={"dark"}
    /requesty-models-sync
    ```

    This pulls the latest model catalog from Requesty so you can select any approved model from your organization.
  </Step>

  <Step title="Reload the configuration">
    Reload Pi to pick up the new provider and models:

    ```txt theme={"dark"}
    /reload
    ```
  </Step>
</Steps>

## Selecting a model

After the sync completes, run the `/model` command inside Pi to choose a model from the list you synced.

You should be able to see both discrete models, e.g. `anthropic/claude-opus-4-7` and your custom policies, e.g. `policy/opus-europe`.

## Verifying the integration

Run a quick prompt inside Pi to confirm that requests are routed through Requesty. Then open the [Requesty analytics dashboard](https://app.requesty.ai/analytics) 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

* [Pi homepage](https://pi.dev)
* [Requesty Pi Extension](https://github.com/requestyai/pi-requesty)
* [Requesty API Keys](https://app.requesty.ai/api-keys)
* [Requesty Model Library](https://app.requesty.ai/model-list)
* [Requesty Approved Models](/features/approved-models)
* [Requesty Auto-Caching](/features/auto-caching)
