# Pi

[Pi](https://pi.dev/) is an extensible terminal coding harness. Register Aurora
as a custom provider in Pi's model configuration.

> Available Inference endpoint: `https://ai.aur.lu/v1` (Aurora).

## Install and prepare

Install the coding agent using the [Pi installation instructions](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent#quick-start).
With Node.js and npm installed, the current package is:

```bash
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
export AURORA_API_TOKEN="<your-token>"
```

Create the token using [Getting started](https://docs.aur.lu/docs/inference/getting-started). Check the
[catalog](https://docs.aur.lu/docs/inference/integrations#discover-models-and-verify-authentication) before choosing a model.

## Configure Aurora

Create `~/.pi/agent/models.json`, or merge `aurora` into its existing `providers`:

```json
{
  "providers": {
    "aurora": {
      "baseUrl": "https://ai.aur.lu/v1",
      "api": "openai-completions",
      "apiKey": "$AURORA_API_TOKEN",
      "authHeader": true,
      "models": [
        {
          "id": "deepseek/deepseek-v4-flash",
          "name": "DeepSeek V4 Flash (Aurora)",
          "input": ["text"]
        }
      ]
    }
  }
}
```

In Pi, `openai-completions` means **Chat Completions**, not the legacy text
Completions endpoint. `baseUrl` already ends in `/v1`.
`$AURORA_API_TOKEN` resolves the environment variable; the bare string
`AURORA_API_TOKEN` is a literal in current Pi versions.

The minimal model entry uses Pi's default token budgets. For longer sessions,
set `contextWindow` and `maxTokens` to the selected model's verified limits.
Only enable reasoning or image capabilities after checking model support.
Omitted local cost metadata does not mean Aurora requests are free.

## Start and verify

Run from a project directory:

```bash
pi --provider aurora --model deepseek/deepseek-v4-flash
```

Ask:

```text
Read README.md and summarize the project in three bullets. Do not edit files.
```

Expect a read-tool result followed by a streamed summary. Substitute an existing
text file if needed. Use `/model` to select another configured model; Pi reloads
`models.json` when opening the picker.

For a one-shot text check:

```bash
pi --provider aurora --model deepseek/deepseek-v4-flash -p "Say hello in one sentence."
```

## Troubleshooting

- **Model absent:** Verify valid JSON and that the exported token is visible to
  Pi. Custom models without resolved authentication can remain unavailable.
- **Requests go to `/responses`:** Change `api` to `openai-completions`.
- **An optional parameter is rejected:** Pi exposes per-provider/model `compat`
  settings. Adjust only the field identified by the error, using the upstream
  reference; do not copy another provider's reasoning options blindly.
- **Summary succeeds but tools fail:** Check model tool support and the tool
  result itself; authentication alone does not verify an agent's full tool loop.

See [shared troubleshooting](https://docs.aur.lu/docs/inference/integrations#troubleshooting) and Pi's
[custom models reference](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/models.md).
