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

# Use Poolside models in Pi

> Configure Pi to use Poolside models.

## Watch the setup video

<Frame>
  <iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/vVz4eYQVYZ4" title="Pi setup video - embed" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
</Frame>

## Prerequisites

* You have Pi installed. Run `pi --version` to confirm the installation. For other installation options, including `npm` and Windows, see the [Pi Quickstart](https://pi.dev/docs/latest/quickstart).
* You have one of the following:
  * A Poolside Platform API key. To create one, go to [platform.poolside.ai](https://platform.poolside.ai/).
  * The base URL for your self-managed model endpoint, and its API key if the endpoint requires one.
  * An OpenRouter API key with access to Poolside models. To create one, go to [OpenRouter API keys](https://openrouter.ai/keys).

## Steps

<Tabs>
  <Tab title="Poolside Platform">
    Pi finds custom providers in `~/.pi/agent/models.json`.

    1. Make your Poolside Platform API key available as an environment variable. Add it to your shell profile.

       ```bash theme={null}
       export POOLSIDE_API_KEY="<api-key>"
       ```

    2. Create or open `~/.pi/agent/models.json` and add Poolside as a provider.

       To find model IDs for your access method, see [List available models](/api/openai-api-examples#list-available-models).

       ```json title="~/.pi/agent/models.json" theme={null}
       {
         "providers": {
           "poolside": {
             "baseUrl": "https://inference.poolside.ai/v1",
             "api": "openai-completions",
             "apiKey": "$POOLSIDE_API_KEY",
             "models": [
               {
                 "id": "<poolside-model-id>",
                 "name": "Poolside model",
                 "reasoning": <supports-reasoning>,
                 "contextWindow": <context-window>,
                 "maxTokens": <max-tokens>
               }
             ]
           }
         }
       }
       ```

       Replace `<supports-reasoning>`, `<context-window>`, and `<max-tokens>` with the values for the model you selected. See [Supported models](/get-started/supported-models) and [Custom Models](https://pi.dev/docs/latest/models).

    3. In your terminal, run `pi`.

       ```bash theme={null}
       pi
       ```

    4. Run `/model`.

       ```text theme={null}
       /model
       ```

    5. Select the Poolside model you added.

    6. Send a codebase question to confirm Pi responds with the selected Poolside model.
  </Tab>

  <Tab title="Self-managed Poolside inference">
    <Note>
      If you run Poolside model inference on your own infrastructure, use the model's OpenAI-compatible endpoint at `https://<model-hostname>/v1`. Use the API key configured for the endpoint, if it requires one.
    </Note>

    Pi finds custom providers in `~/.pi/agent/models.json`.

    1. Make the API key for your model endpoint available as an environment variable in your shell profile. If the endpoint does not validate API keys, use any non-empty value, such as `local-test`.

       ```bash theme={null}
       export POOLSIDE_API_KEY="<api-key>"
       ```

    2. Create or open `~/.pi/agent/models.json` and add Poolside as a provider.

       To find model IDs for your access method, see [List available models](/api/openai-api-examples#list-available-models).

       ```json title="~/.pi/agent/models.json" theme={null}
       {
         "providers": {
           "poolside": {
             "baseUrl": "https://<model-hostname>/v1",
             "api": "openai-completions",
             "apiKey": "$POOLSIDE_API_KEY",
             "models": [
               {
                 "id": "<poolside-model-id>",
                 "name": "Poolside model",
                 "reasoning": <supports-reasoning>,
                 "contextWindow": <context-window>,
                 "maxTokens": <max-tokens>
               }
             ]
           }
         }
       }
       ```

       Replace `<supports-reasoning>`, `<context-window>`, and `<max-tokens>` with the values configured for your model. Reasoning support depends on the deployed model and serving configuration. See [Custom Models](https://pi.dev/docs/latest/models).

    3. In your terminal, run `pi`.

       ```bash theme={null}
       pi
       ```

    4. Run `/model`.

       ```text theme={null}
       /model
       ```

    5. Select the Poolside model you added.

    6. Send a codebase question to confirm Pi responds with the selected Poolside model.
  </Tab>

  <Tab title="OpenRouter">
    1. In your terminal, run `pi`.

       ```bash theme={null}
       pi
       ```

    2. Run `/login`.

       ```text theme={null}
       /login
       ```

    3. Select **OpenRouter**.

    4. Select **Sign in with OpenRouter**, then complete the OAuth authorization flow in your browser.

       This creates a user-controlled API key billed through your OpenRouter account. To use an existing API key instead, select **Use an API key** and paste the key.

    5. Run `/model`.

       ```text theme={null}
       /model
       ```

    6. Search for a Poolside model served through OpenRouter.

       OpenRouter may offer free and paid Poolside models. To see current availability, see [Poolside models on OpenRouter](https://openrouter.ai/poolside).

    7. Select the model you want to use.

       Pi ships with a generated model snapshot, so recently released models may not appear in `/model` on older Pi versions. To add a model yourself, see [Custom Models](https://pi.dev/docs/latest/models) in the Pi documentation.

    8. Send a codebase question to confirm Pi responds with the selected Poolside model.
  </Tab>
</Tabs>

## Related resources

* [Coding agents](/tools#coding-agents)
* [Poolside API](/api/overview)
* [Supported models](/get-started/supported-models)
* [OpenRouter API keys](https://openrouter.ai/keys)
* [Poolside models on OpenRouter](https://openrouter.ai/poolside)
* [Pi documentation](https://pi.dev)
