Skip to main content

Pi

Pi is a minimal, extensible coding agent for the terminal. Pi reads extra providers from a models.json file, and this guide adds Entrim to it.

Prerequisites​

To follow this guide, you need:


Set up Pi​

1. Install Pi​

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

This installs the pi command. The Pi docs list other ways to install it.

2. Add Entrim to models.json​

Create ~/.pi/agent/models.json with the entrim provider below. If the file already exists, add entrim to its providers object.

~/.pi/agent/models.json
{
"providers": {
"entrim": {
"baseUrl": "https://api.entrim.ai/v1",
"api": "openai-completions",
"apiKey": "$ENTRIM_API_KEY",
"models": [
{
"id": "zai-org/GLM-5.3-Flash",
"name": "GLM-5.3-Flash",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1048576,
"maxTokens": 131072
}
]
}
}
}

"apiKey": "$ENTRIM_API_KEY" tells Pi to read the key from the ENTRIM_API_KEY environment variable each time it sends a request, so the key itself stays out of the file.

FieldMeaning
apiopenai-completions makes Pi use the chat completions API
reasoningThe model reasons before it answers, so Pi offers thinking levels for it
inputThe model accepts text and images
contextWindow, maxTokensThe model's limits, from max_input_tokens and max_output_tokens in GET /v1/models

3. Set your API key​

Export the key in your shell profile, such as ~/.zshrc or ~/.bashrc, so it's set in every terminal:

export ENTRIM_API_KEY="<your-entrim-api-key>"

Open a new terminal, or run source ~/.zshrc, before you start Pi.

4. Select the model​

Start pi, run /model and choose GLM-5.3-Flash from the entrim provider. Press Ctrl+S on it to make it the default for new sessions. Use /thinking to change how much the model reasons.

You can also pick the model when you start Pi:

pi --model entrim/zai-org/GLM-5.3-Flash

Check that it works​

List the Entrim models Pi found, then send a one-off prompt:

pi --list-models entrim
pi -p --model entrim/zai-org/GLM-5.3-Flash "Reply with the word pong"

The first command shows the model with its context size and capabilities. The second prints the model's reply and exits.

Add more models​

To use another Entrim model, add another object to the models array. Take its id from GET /v1/models, set contextWindow and maxTokens from max_input_tokens and max_output_tokens, and set reasoning and input to match what the model supports. Its page in the model library lists its capabilities. Pi reloads models.json every time you open /model.

Troubleshooting​

ProblemFix
The Entrim model doesn't appear in /modelPi hides models it has no key for. Check that ENTRIM_API_KEY is exported in the terminal you started Pi from.
401 errorsENTRIM_API_KEY holds an invalid key. Copy it again from the dashboard.
400 "Invalid model name"The model id doesn't match an Entrim model ID. Compare it with GET /v1/models, including upper and lower case.