Skip to main content

Install Pi

Pi is distributed as an npm package and requires Node.js 20 or later.
1

Install Pi globally

This makes the pi command available system-wide.
2

Set up authentication

Choose one of two authentication methods:
Set an environment variable for your preferred provider:
Add this to your ~/.bashrc or ~/.zshrc to make it permanent.
Supported providers:
  • ANTHROPIC_API_KEY - Anthropic
  • OPENAI_API_KEY - OpenAI
  • GEMINI_API_KEY - Google Gemini
  • GROQ_API_KEY - Groq
  • MISTRAL_API_KEY - Mistral
  • And many more
3

Launch Pi

You’ll see the interactive terminal interface with an editor at the bottom.
4

Start coding

Type your request and press Enter:
Pi will use the built-in tools (read, write, edit, bash) to fulfill your request.

Your First Session

Let’s walk through a typical Pi session:
Sessions auto-save to ~/.pi/agent/sessions/ organized by working directory. Use pi -c to continue your most recent session.

Essential Commands

Type / in the editor to see all commands. Here are the most useful:

Essential Keyboard Shortcuts

Use Shift+Enter (or Ctrl+Enter on Windows Terminal) for multi-line input.

File References

Include files in your messages using the @ symbol:
Type @ and start typing to get fuzzy-search suggestions. You can reference multiple files:

Running Bash Commands

Prefix commands with ! to run them and send output to the LLM:
Use !! to run without sending output:

Session Management

Resumes the most recent session for the current directory.
Opens an interactive picker to select from past sessions.
Inside Pi, press Escape twice to open the session tree. Navigate to any point in history, then:
  • Press Enter to continue from that point
  • Type /fork to create a new session file from that branch
Creates a standalone HTML file with your session.
Uploads your session as a private GitHub gist with a shareable HTML link.

Switching Models

Pi supports 20+ LLM providers. Switch models at any time:
1

Open model selector

Press Ctrl+L or type /model
2

Choose your model

Use arrow keys and search to find your model. The list shows:
  • Model name and provider
  • Context window size
  • Pricing (input/output tokens)
  • Whether it supports vision and reasoning
3

Continue conversation

Your session continues with the new model. Pi handles cross-provider compatibility automatically.
Use pi --models "claude-*,gpt-4o" to limit Ctrl+P cycling to specific model patterns.

Next Steps

Now that you have Pi running, explore these key areas:

Installation Details

Platform-specific setup, API keys, and advanced configuration

Interactive Mode

Master the terminal UI, editor features, and message queue

Providers & Models

Set up multiple providers and understand model selection

Customization

Extend Pi with skills, extensions, and prompt templates

Troubleshooting

After installing globally, you may need to restart your terminal or reload your shell:
If that doesn’t work, check your npm global bin directory is in PATH:
If you see authentication errors:
  1. Verify your API key is set correctly:
  2. Check the key format matches your provider’s requirements
  3. For OAuth providers, try logging out and back in:
Pi requires bash on Windows. Install Git for Windows which includes Git Bash.See the Windows setup guide for details.
Pi requires Node.js 20 or later. Check your version:
If needed, install a newer version from nodejs.org or use nvm:
For more help, join the Discord community or check the GitHub issues.