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

# Connect with Pi

> Set up the Pi agent harness to use Modular Cloud models

This page explains how to run models from Modular Cloud on
[Pi](https://pi.dev/).

## Before you begin

Make sure you have:

* A Modular Cloud [account](https://console.modular.com/signup).
* A Modular Cloud [API key](/administration/api-keys).
* [Pi](https://pi.dev/) installed.

## Configure a Pi provider

To register Modular Cloud as a provider in Pi:

1. Open (or create) the `~/.pi/agent/models.json` configuration file.
2. Choose the model that you want from our list of [shared endpoints](/models)
   or use a dedicated endpoint if applicable.
3. Add Modular Cloud as a provider:

   ```json models.json theme={null}
   {
     "providers": {
       "modular": {
         "baseUrl": "https://api.modular.com/v1",
         "api": "openai-completions",
         "apiKey": "$MODULAR_API_KEY",
         "models": [
           {
             "id": "minimax/minimax-m3",
             "name": "MiniMax M3"
           }
         ]
       }
     }
   }
   ```

The `api` value depends on the API you're using:

* For the [chat completions API](/api/inference/create-chat-completion), use
  `openai-completions`.
* For the [responses API](/api/inference/create-response), use
  `openai-responses`.

Once you save your `models.json` file, run `/model` in Pi and select the Modular
Cloud model to use.

<Note>
  The example above demonstrates a basic provider and model configuration. To see
  the complete list of configuration options, see the Pi documentation on [Custom
  Models](https://pi.dev/docs/latest/models).
</Note>
