Pi
Earendil's coding agent on the Messages API
Pi is a terminal coding agent. For tool calling it should use
Anthropic Messages (api: "anthropic-messages"), not Chat Completions — otherwise tool results
come back as role: "tool" and the API returns 400.
| Base URL | https://api.orientx.ai |
| Auth | ORIENTX_API_KEY plus authHeader: true |
| Config | ~/.pi/agent/models.json |
| Official docs | Custom models |
Add a provider
{
"providers": {
"orientx": {
"name": "orientx",
"baseUrl": "https://api.orientx.ai",
"apiKey": "$ORIENTX_API_KEY",
"authHeader": true,
"api": "anthropic-messages",
"models": [
{
"id": "<MODEL_ID>",
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}baseUrl is the host root — Pi appends /v1/messages. Adding /v1 yourself produces
POST /v1/v1/messages and a 404. authHeader: true sends Authorization: Bearer; without it Pi
only sets x-api-key and some setups 401.
Export the key if you used "$ORIENTX_API_KEY":
export ORIENTX_API_KEY="sk-..."Do not set api to openai-completions for agent work. Chat Completions will reject Pi's tool
turns with Unexpected role "tool".