Skip to content

Installation

✓ Fresh · 2026-02-24

Complete guide to installing Pi Coding Agent, configuring LLM providers, and managing API keys.

Prerequisites

  • Node.js 18+ (LTS recommended)
  • npm 9+ (comes with Node.js)
  • A shell environment (bash, zsh, PowerShell, etc.)

Install Pi

bash
npm install -g @mariozechner/pi-coding-agent

After installation, launch Pi by typing:

bash
pi

Authentication: Two Paths

Pi supports two authentication methods: OAuth subscriptions and API keys.

OAuth Subscriptions

Use your existing subscription to a provider:

bash
pi
/login   # select a provider from the interactive list

Supported OAuth providers:

ProviderSubscription Tier
AnthropicClaude Pro / Claude Max
OpenAIChatGPT Plus / ChatGPT Pro
GitHubCopilot
GoogleGemini CLI
GoogleAntigravity

API Keys

Set environment variables before launching Pi:

bash
# Anthropic
export ANTHROPIC_API_KEY=sk-ant-...

# OpenAI
export OPENAI_API_KEY=sk-...

# Google Gemini
export GEMINI_API_KEY=AIza...

# OpenRouter
export OPENROUTER_API_KEY=sk-or-...

# Then launch
pi

Full list of API key providers:

ProviderEnvironment Variable
AnthropicANTHROPIC_API_KEY
OpenAIOPENAI_API_KEY
Azure OpenAIAZURE_OPENAI_API_KEY
Google GeminiGEMINI_API_KEY
Google VertexGOOGLE_VERTEX_*
Amazon BedrockAWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
MistralMISTRAL_API_KEY
GroqGROQ_API_KEY
CerebrasCEREBRAS_API_KEY
xAIXAI_API_KEY
OpenRouterOPENROUTER_API_KEY
Vercel AI GatewayVERCEL_AI_GATEWAY_*
ZAIZAI_API_KEY
OpenCode ZenOPENCODE_ZEN_API_KEY
Hugging FaceHUGGINGFACE_API_KEY
KimiKIMI_API_KEY
MiniMaxMINIMAX_API_KEY

.env File Handling

IMPORTANT

Pi does NOT auto-load .env files. API keys must be in the shell environment before launching Pi.

Three approaches to manage this:

1. Manual Source

bash
source .env && pi

2. Shell Alias

Add to your ~/.bashrc or ~/.zshrc:

bash
alias pi='source $(pwd)/.env && pi'

3. Just Task Runner

If you use just, it auto-loads .env files:

just
# justfile
default:
    pi

ext name:
    pi -e extensions/{{name}}.ts
bash
just        # launches pi with .env loaded
just ext minimal   # loads extension with .env

Platform Notes

Windows

  • Use PowerShell or Git Bash
  • Set environment variables with $env:ANTHROPIC_API_KEY = "sk-ant-..."
  • Or use a .env file with the alias approach above in Git Bash

macOS / Linux

  • Works natively in any terminal
  • For persistent keys, add exports to ~/.bashrc, ~/.zshrc, or ~/.profile

Docker / Containers

Pass API keys via -e flags:

bash
docker run -it -e ANTHROPIC_API_KEY=sk-ant-... pi-image

Verify Installation

bash
pi --version

Launch and confirm you can interact:

bash
pi
# Type: What files are in the current directory?

If Pi responds with a file listing, installation is complete.

Updating

bash
npm update -g @mariozechner/pi-coding-agent

Uninstalling

bash
npm uninstall -g @mariozechner/pi-coding-agent

To remove all configuration:

bash
rm -rf ~/.pi

Pi Coding Agent SOP Documentation