Documentation Index
Fetch the complete documentation index at: https://mintlify.com/badlogic/pi-mono/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This guide walks through using the Pi coding agent CLI to interact with an LLM. You’ll:- Install the coding agent
- Authenticate with a provider
- Run your first interactive session
- Try file operations and bash commands
- Explore customization options
Time to Complete: 5 minutes
Prerequisites: Node.js 20+, API key or OAuth subscription
Prerequisites: Node.js 20+, API key or OAuth subscription
Installation
Install the coding agent globally:Authentication
Choose your authentication method:- API Key (Quick)
- OAuth (Subscriptions)
Set an environment variable for your provider:
Your First Session
Start Pi
Launch the interactive interface:You’ll see the Pi interface with:
- Header: Keyboard shortcuts and loaded configuration
- Messages area: Conversation history
- Editor: Where you type (bottom of screen)
- Footer: Working directory, session, tokens, cost, model

Send a Message
Type in the editor and press Enter:The model will respond with its capabilities. Watch the footer to see:
- Tokens used (input + output)
- Cost (accumulated for session)
- Context usage (how full the context window is)
Try File Operations
Pi has built-in tools: You’ll see:
read, write, edit, and bash. Try:- The model calls the
writetool - Tool execution creates
hello.py - Model responds confirming creation
Editor Features
The Pi editor has several helpful features:Multi-line Input
Multi-line Input
Press Shift+Enter (or Ctrl+Enter on Windows Terminal) for new lines:
File References
File References
Type The file content will be included in the message automatically.
@ to fuzzy-search and reference files:Image Attachments
Image Attachments
Paste images with Ctrl+V (or Alt+V on Windows) or drag onto terminal:
Only works with vision-capable models like GPT-4o, Claude Sonnet, or Gemini.
Bash Commands
Bash Commands
Execute commands directly from the editor:
!ls -la- Run and send output to model!!git status- Run without sending output
Essential Keyboard Shortcuts
Navigation
Ctrl+L- Switch modelShift+Tab- Cycle thinking levelCtrl+P/Shift+Ctrl+P- Cycle models
Control
Escape- Cancel/abortEscapetwice - Open session treeCtrl+C- Clear editorCtrl+Ctwice - Quit Pi
View
Ctrl+O- Toggle tool outputCtrl+T- Toggle thinking blocks
Session
/tree- Navigate session history/new- Start new session/resume- Load previous session
Commands
Type/ in the editor to see available commands:
Non-Interactive Usage
Run Pi without the interactive interface:Programmatic Usage (SDK)
For building custom applications:Next Steps
Interactive Mode Guide
Master keyboard shortcuts, commands, and the message queue
Sessions & Branching
Learn session management and the tree view for exploring conversation branches
Customization
Add extensions, skills, prompt templates, and themes
LLM Providers
Connect to 15+ providers and configure custom models
Building Extensions
Extend Pi with custom tools, commands, and UI
API Reference
Explore the complete programmatic API
Common Questions
How do I switch models?
How do I switch models?
Press Ctrl+L in the interactive mode, or use
/model.To cycle through favorite models, use Ctrl+P and Shift+Ctrl+P. Configure which models appear with /scoped-models.How do I save my session?
How do I save my session?
Sessions auto-save to
~/.pi/agent/sessions/ organized by working directory.Continue the most recent session with pi -c or browse all sessions with pi -r.How do I use multiple providers?
How do I use multiple providers?
Set API keys for multiple providers in your environment:Switch between them with Ctrl+L or
/model command.Can I customize the system prompt?
Can I customize the system prompt?
Yes, create
.pi/SYSTEM.md (project-specific) or ~/.pi/agent/SYSTEM.md (global).Or append without replacing via APPEND_SYSTEM.md.How do I add custom tools?
How do I add custom tools?
Create a TypeScript extension in See Building Extensions for details.
~/.pi/agent/extensions/ or .pi/extensions/:What's the difference between extensions and skills?
What's the difference between extensions and skills?
Extensions are TypeScript modules that add tools, commands, UI, and event handlers. They have full access to the Pi API.Skills are Markdown files that provide on-demand instructions to the model. They follow the Agent Skills standard.Use extensions for functionality, skills for guidance.
Troubleshooting
'pi: command not found'
'pi: command not found'
The global install path isn’t in your PATH. Either:
- Use npx:
npx @mariozechner/pi-coding-agent - Or fix npm global path:
API key not recognized
API key not recognized
Verify the environment variable:Or pass it explicitly:
Terminal rendering issues
Terminal rendering issues
Ensure your terminal supports 256 colors and Unicode:For Windows, use Windows Terminal instead of cmd.exe.See terminal setup guide.
Context overflow errors
Context overflow errors
Long sessions may exceed the model’s context window. Pi handles this with automatic compaction:
- Manual:
/compactor/compact <custom instructions> - Automatic: Enabled by default in
/settings
/new.Learn More
Core Concepts
Understand the architecture
LLM Tools
Function calling and validation
Agent Events
Event-driven agent architecture
SDK Guide
Build custom applications
Examples
Browse code examples
Community
Join the Discord