Integrations

Pi

Terminal coding agent with custom providers in models.json. Step-by-step setup with Laras Router.

On this page

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.

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

Set your API key

Put your key in an environment variable.

Shell
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.

~/.pi/agent/models.json
{
  "$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-flash",
          "name": "DeepSeek-V4.1-Flash",
          "reasoning": true,
          "input": ["text"],
          "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

  • contextWindow states the full 1,000,000-token window. Without it, Pi uses its own smaller default.
  • maxTokens is 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.
  • input lists text only. deepseek-flash does not accept image input, so do not send images to this model.
  • "$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.