Skip to main content
Pi is a minimal, extensible CLI coding agent. A single ~/.pi/agent/models.json file registers Orq.ai as a custom provider, so one session can mix models from any provider in the AI Gateway catalog, all routed through the AI Gateway for unified tracing, cost tracking, and access controls.

Prerequisites

Install Pi

Confirm the install with pi --version.

Setup

1

Register Orq.ai in models.json

Create ~/.pi/agent/models.json and register Orq.ai as a custom provider:
Replace <ORQ_API_KEY> with a key from Workspace Settings → API Keys. To avoid storing the key in plain text, use "apiKey": "$ORQ_API_KEY" and export the variable in the shell that launches Pi.~/.pi/agent/models.json is global, so the provider is available in every project without per-project configuration.
2

Start Pi and select a model

Use /model to switch between registered models. The status bar shows the active provider and model, for example (orq) google/gemini-3.6-flash.
Pi ships built-in catalogs for Anthropic, OpenAI, and Google. When a credential such as OPENAI_API_KEY exists in the environment or in auth.json, those models are listed alongside the Orq.ai ones, and requests sent to them bypass the AI Gateway. The same model can appear in both lists. Check the provider column in pi --list-models: entries under orq route through the AI Gateway, entries under openai, anthropic, or google do not. The status bar shows (orq) while a routed model is active.

Configuration reference

Registering more models

The models in the example above are a starting point, not a fixed list. Any model enabled in the workspace can be registered, from any provider in the supported models catalog. Pi only sees models listed under models, so add one entry per model:
Pi reloads models.json each time /model opens, so models can be added mid-session without restarting.

Model fields

contextWindow and maxTokens fall back to Pi defaults that are smaller than the real limits of most routed models, which causes sessions to compact earlier than necessary and caps output length. Set both explicitly per model using the values in supported models.

Troubleshooting

Pi loads models.json regardless of credentials, then hides models that have no usable key. Confirm the apiKey value resolves: a literal key must be present in the file, and $ORQ_API_KEY must exist in the shell that launches Pi. Credentials resolve in this order: the --api-key flag, then auth.json, then environment variables, then the apiKey value in models.json.
A built-in Pi provider served the request. Run pi --list-models and confirm the target model is listed under the orq provider rather than openai, anthropic, or google. Unset the conflicting shell credentials and remove the matching entries from ~/.pi/agent/auth.json:
Confirm baseUrl is https://api.orq.ai/v3/router, api is openai-completions, and the status bar shows (orq) with the active model. Traces are recorded against the workspace and project that own the API key, not the workspace currently open in the UI. Traces are also ingested asynchronously, so reload the view before treating an empty result as a failure.
Reopen /model after saving, which reloads the file. A malformed file prevents the whole provider from loading, so validate it with jq . ~/.pi/agent/models.json.
Confirm the key is a valid Orq.ai API key rather than an upstream provider key, and that it carries the permissions for the models in use.

Verification

Start a Pi session, select a registered model with /model, and send a prompt. The response appears in the session, the status bar shows (orq) with the active model, and the trace appears in Orq.ai Traces with the model identifier, for example anthropic/claude-sonnet-5.