BeeRoute logoBeeRoute.

Home / Guides / Pi

Pi

Pi is a minimal, extensible coding agent for the terminal (project repository: earendil-works/pi). You can customize your workflow with extensions, skills, and prompt templates. Pi connects to custom APIs through models.json and supports the OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Google Gemini formats.

1. Get an API Key

Open the API Keys page, click Create API Key, set Group to default, and copy the key (it starts with sk-).

2. Install Pi

macOS / Linux:

curl -fsSL https://pi.dev/install.sh | sh

Windows:

powershell -c "irm https://pi.dev/install.ps1 | iex"

The install script installs Node.js automatically if needed. You can also install Pi with npm (requires Node.js 22.19 or later):

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

3. Set the API Key Environment Variable

macOS / Linux (add it to ~/.zshrc or ~/.bashrc, then reopen the terminal):

export BEEROUTE_API_KEY="sk-xxx"

Windows PowerShell (saves it as a user environment variable; takes effect after you reopen the terminal):

[Environment]::SetEnvironmentVariable("BEEROUTE_API_KEY", "sk-xxx", "User")

4. Edit models.json

Edit ~/.pi/agent/models.json (on Windows, %USERPROFILE%\.pi\agent\models.json), creating it if it does not exist:

{
  "$schema": "https://pi.dev/schemas/models.schema.json",
  "providers": {
    "beeroute": {
      "name": "BeeRoute",
      "baseUrl": "https://beeroute.ai/v1",
      "api": "openai-completions",
      "apiKey": "$BEEROUTE_API_KEY",
      "models": [
        {
          "id": "claude-sonnet-5-5",
          "name": "Claude Sonnet 5.5",
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 32000
        },
        {
          "id": "gpt-6.2-sol",
          "name": "GPT-6.2 Sol",
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 32000
        },
        {
          "id": "deepseek-flash",
          "name": "DeepSeek Flash",
          "contextWindow": 128000,
          "maxTokens": 16384
        }
      ]
    }
  }
}
FieldDescription
providers.beerouteProvider ID. You can choose any name
baseUrlMust include /v1 for the Chat Completions format
apiopenai-completions means the OpenAI Chat Completions format
apiKey$VAR_NAME or ${VAR_NAME} reads the key from an environment variable; you can also write the key directly
models[].idThe model ID on BeeRoute, case-sensitive (required)
inputInput types the model supports. For models that support images, use ["text", "image"]. The default is text only
contextWindow / maxTokensContext length and maximum output length. Defaults are 128000 and 16384; adjust them to match each model's actual capabilities

See the Pricing page for all model IDs. BeeRoute automatically converts Chat Completions requests for Claude, Gemini, and other models, so a single provider gives you access to all models.

For models that support thinking, add "reasoning": true. You can then use /thinking in Pi to adjust the thinking effort.

5. Launch and Verify

cd /path/to/your-project
pi
  1. Enter /model, then search for and select a model under BeeRoute (Pi reloads models.json each time you open /model).
  2. Press Ctrl+S on a model to make it the default for new sessions.
  3. Send a message. If you get a normal reply, the connection works.

6. Advanced: Use the Native Anthropic Format for Claude Models (Optional)

Add another provider under providers (alongside beeroute):

{
  "providers": {
    "beeroute-claude": {
      "name": "BeeRoute Claude",
      "baseUrl": "https://beeroute.ai",
      "api": "anthropic-messages",
      "apiKey": "$BEEROUTE_API_KEY",
      "models": [
        { "id": "claude-sonnet-5-5", "name": "Claude Sonnet 5.5", "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 32000 },
        { "id": "claude-opus-5-5", "name": "Claude Opus 5.5", "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 32000 }
      ]
    }
  }
}

For the Anthropic format, baseUrl is https://beeroute.ai without /v1.

7. FAQ

BeeRoute models do not appear in /model?

  • Check that the JSON in models.json is valid;
  • /model only shows providers that have a usable key. Make sure the BEEROUTE_API_KEY environment variable has taken effect (reopen the terminal after setting it).

Getting a 401 error?

The environment variable has not taken effect, or the key was not copied completely. To troubleshoot, you can temporarily write the key directly as the apiKey value.

Getting a 404 error?

For the Chat Completions format, baseUrl is missing /v1; or for the Anthropic format, it has an extra /v1.

For more settings, see the official Pi documentation: Models Configuration.

Last updated 2026-11-29 · Markdown source · llms.txt