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

# Pi

> Use a Valkyrie model in the Pi coding agent, over the OpenAI or Anthropic protocol.

Pi (the `@earendil-works/pi-coding-agent` CLI) configures models through a JSON file
and can talk to a Valkyrie deployment over either the OpenAI-compatible or the
Anthropic-compatible API.

## Install

```bash theme={null}
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
```

## Configure a provider

Add Valkyrie to `~/.pi/agent/models.json`:

```json theme={null}
{
  "$schema": "https://pi.dev/schema/models.json",
  "providers": {
    "valkyrie": {
      "baseUrl": "https://valkyrie-back.azumo.com/{deployment_slug}/v1",
      "api": "openai-completions",
      "apiKey": "$VALKYRIE_API_KEY",
      "authHeader": true,
      "models": [
        {
          "id": "your-model-id",
          "name": "Valkyrie model",
          "contextWindow": 131072,
          "maxTokens": 16384
        }
      ]
    }
  }
}
```

Then run Pi against it:

```bash theme={null}
export VALKYRIE_API_KEY="vk_dep_your_deployment_key"
pi --provider valkyrie --model your-model-id
```

## OpenAI or Anthropic

Pi picks the protocol from the `api` field:

* `"api": "openai-completions"` uses the OpenAI-compatible route (`baseUrl` ends in `/v1`).
* `"api": "anthropic-messages"` uses the Anthropic-compatible route (set `baseUrl`
  to the deployment base **without** `/v1`; Pi appends `/v1/messages`).

<Note>
  `$VALKYRIE_API_KEY` reads the key from your environment. Use your deployment slug
  (`deployment-{id}`) or an [alias](/guides/aliases) in the URL, and set the model id
  to what your deployment serves (for the shared Qwen deployment that's
  `RadixArk/Qwen3.8-27B-NVFP4` with `baseUrl` `https://valkyrie-back.azumo.com/qwen/v1`).
</Note>
