Skip to content

Pi Coding Agent

Pi is an open-source, terminal-first AI coding agent from Earendil Works. It runs directly in your project directory, understands the repository, edits files, executes commands, and lets you review changes before they are applied.

Pi is model-agnostic and supports custom OpenAI-compatible endpoints. Connected to our Swiss-hosted Everyware AI API, your prompts, source code, and responses stay within our Swiss GPU infrastructure.


Key Features

  • Terminal-first TUI: Work interactively in the terminal without leaving your project directory.
  • Custom providers: Register any OpenAI-compatible endpoint via models.json.
  • Thinking levels: Switch reasoning effort per model with /thinking or the :level model suffix.
  • Session control: Branch, rewind, and resume sessions without losing previous context.
  • Full data sovereignty: All model requests go through our Swiss Everyware AI API.

Installation

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

Requires Node.js 22.19 or newer:

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

Verify the installation:

pi --version

Configuration

1. Save API Key

Export your virtual API key as an environment variable:

export EW_AI_API_KEY="sk-bf-..."

Add the line to your shell profile (~/.bashrc, ~/.zshrc) to make it persistent.

2. Register the Gateway

Create or edit ~/.pi/agent/models.json:

{
  "$schema": "https://pi.dev/schemas/models.schema.json",
  "providers": {
    "ew": {
      "name": "Everyware AI API",
      "baseUrl": "https://ai.ewcs.ch/v1",
      "api": "openai-completions",
      "apiKey": "$EW_AI_API_KEY",
      "models": [
        {
          "id": "flagship",
          "name": "Everyware Flagship",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1048576,
          "maxTokens": 131072
        },
        {
          "id": "balanced",
          "name": "Everyware Balanced",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 1000000,
          "maxTokens": 131072
        },
        {
          "id": "fast",
          "name": "Everyware Fast",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 262144,
          "maxTokens": 131072
        }
      ]
    }
  }
}

The provider ID ew combined with the model IDs produces the selectors ew/flagship, ew/balanced, and ew/fast.

Custom provider credentials

Pi's /login command only covers built-in providers. Custom models appear in /model as soon as apiKey resolves — in this example from the EW_AI_API_KEY environment variable.

3. Start Pi

cd /path/to/project
pi --model ew/flagship

To verify that the gateway and its models are registered:

pi --list-models ew
pi auth check --provider ew

Typical Commands and Workflows

  • Start interactively:
    pi
    
  • Select a model:
    pi --model ew/balanced
    
  • Set the thinking level:
    pi --model ew/flagship:high
    
  • In the TUI:
    • /model – open the model picker (reloads models.json)
    • /thinking – change the reasoning level
    • /settings – edit common preferences
    • Ctrl+L – switch models
  • One-shot prompt:
    pi -p "Explain the architecture of this repository."