Install Pi
Pi is distributed as an npm package and requires Node.js 20 or later.Set up authentication
Choose one of two authentication methods:
- API Key (Simple)
- Subscription (OAuth)
Set an environment variable for your preferred provider:Supported providers:
ANTHROPIC_API_KEY- AnthropicOPENAI_API_KEY- OpenAIGEMINI_API_KEY- Google GeminiGROQ_API_KEY- GroqMISTRAL_API_KEY- Mistral- And many more
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:
| Command | Description |
|---|---|
/model | Switch between LLM models |
/settings | Adjust thinking level, theme, and more |
/tree | Navigate session history and branches |
/copy | Copy last assistant message to clipboard |
/hotkeys | Show all keyboard shortcuts |
/quit | Exit Pi |
Essential Keyboard Shortcuts
| Key | Action |
|---|---|
Ctrl+L | Open model selector |
Ctrl+P / Shift+Ctrl+P | Cycle through models |
Shift+Tab | Cycle thinking level (off → minimal → low → medium → high → xhigh) |
Escape | Cancel current operation |
Escape twice | Open session tree view |
Ctrl+C | Clear editor (press twice to quit) |
Ctrl+O | Collapse/expand tool output |
@ | Fuzzy-search and reference files |
File References
Include files in your messages using the@ symbol:
@ 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:
!! to run without sending output:
Session Management
Continue Previous Session
Continue Previous Session
Browse All Sessions
Browse All Sessions
Branch from History
Branch from History
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
/forkto create a new session file from that branch
Export or Share
Export or Share
Switching Models
Pi supports 20+ LLM providers. Switch models at any time: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
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
Pi command not found
Pi command not found
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:
Authentication errors
Authentication errors
If you see authentication errors:
-
Verify your API key is set correctly:
- Check the key format matches your provider’s requirements
-
For OAuth providers, try logging out and back in:
Windows: bash not found
Windows: bash not found
Pi requires bash on Windows. Install Git for Windows which includes Git Bash.See the Windows setup guide for details.
Node.js version errors
Node.js version errors
Pi requires Node.js 20 or later. Check your version:If needed, install a newer version from nodejs.org or use nvm: