Pi
Terminal coding agent with custom providers in models.json. Step-by-step setup with Laras Router.
This guide connects Pi to Laras Router. Every step was checked against the Pi documentation.
You need an API key (lr_live_…) and a topped-up balance. New to Laras Router? Start with the Quickstart.
Set up
Install Pi
Install Pi with npm. The command is pi.
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
Set your API key
Put your key in an environment variable.
export LARAS_API_KEY="lr_live_your_key_here"
Add the provider
Create ~/.pi/agent/models.json. Pi reads that folder by default. Set PI_CODING_AGENT_DIR to use another folder.
{
"$schema": "https://pi.dev/schemas/models.schema.json",
"providers": {
"laras": {
"baseUrl": "https://api.larasrouter.com/v1",
"api": "openai-completions",
"apiKey": "$LARAS_API_KEY",
"models": [
{
"id": "deepseek-v4.1-flash",
"name": "DeepSeek V4.1 Flash",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 1000000,
"maxTokens": 8192
}
]
}
}
}
Pick the model
Export LARAS_API_KEY in the terminal where you start Pi. Pi lists a provider only when it has usable authentication. Start Pi with pi, run /model, and choose DeepSeek V4.1 Flash from the laras provider. Opening /model reloads models.json, so you can edit the file without restarting Pi.
Good to know
contextWindowstates the full 1,000,000-token window. Without it, Pi uses its own smaller default.maxTokensis the output cap Pi asks for on each request. The cap also sets how much balance a request must hold while it runs, so a larger value needs more balance. 8,192 is the default output cap.inputliststextandimage: deepseek-v4.1-flash reads images, such as the screenshots and image files Pi reads. Each image is billed as input tokens.- A request can be up to 16 MB, and images count toward it. Pi sends the whole conversation, every image included, on each turn, so a session with many screenshots reaches 16 MB long before it fills the context window. Laras Router then answers
413 request_too_large, and Pi compacts the conversation and retries. Run/compactsooner in a screenshot-heavy session. "$LARAS_API_KEY"reads the variable from your environment, so the key itself stays out of the file.- Create a separate API key for Pi with a monthly budget, so you can see and cap what it spends.
Settings and screens can change between versions. If something looks different, check the Pi documentation. For other tools, see all integrations.
Updated Nov 2026