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

# Pi

> Add AsterWise to Pi’s custom model catalog.

Before you start, install the tool and create an API key with prepaid balance in the [AsterWise app](https://app.asterwise.dev).

<Note>Based on the tool’s documented custom-provider setup. Live AsterWise compatibility has not yet been tested for this tool.</Note>

## Which API does this use?

This guide selects **Chat Completions** through `api: "openai-completions"`. The base URL is `https://api.asterwise.dev/v1`. The client builds the full endpoint: `https://api.asterwise.dev/v1/chat/completions`.

The model name chooses AsterCode or AsterWork, not the protocol. Use the base URL in the configuration below, rather than the full endpoint.

## 1. Set your API key

```bash theme={"dark"}
export ASTER_API_KEY='your AsterWise API key'
```

## 2. Add the provider

Create or edit `~/.pi/agent/models.json`. Merge this entry into `providers` if the file already contains other providers:

```json theme={"dark"}
{
  "providers": {
    "asterwise": {
      "baseUrl": "https://api.asterwise.dev/v1",
      "api": "openai-completions",
      "apiKey": "ASTER_API_KEY",
      "models": [
        {
          "id": "aster-code",
          "name": "AsterCode",
          "input": [
            "text"
          ]
        },
        {
          "id": "aster-work",
          "name": "AsterWork",
          "input": [
            "text"
          ]
        }
      ]
    }
  }
}
```

`apiKey` is the name of your environment variable, not the key itself. `openai-completions` selects Chat Completions.

## 3. Choose your model

Run `pi` in the same terminal, enter `/model`, and select `asterwise/aster-code`.

Before your first request, set `contextWindow` and `maxTokens` on each model using the app’s Setup recommendations. Pi’s defaults are not AsterWise’s limits.

## Check the connection

Ask “Reply with hello” first. Confirm a response appears and find the request in **Usage** in AsterWise. Then try a small coding task before a larger project.

For authentication errors, check the key and restart the tool from the terminal where you exported it. See [troubleshooting](/errors-fallback).

## Official reference

Configuration reviewed on September 16, 2026. [Pi custom models](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/models.md).
