Pi CLI Cheatsheet - earendil Terminal Multi-Model Coding Agent
All Pi terminal coding-agent commands in one place — from install & auth to interactive/headless mode, session management to model switching — organized by scenario. Copy and go.
Install & Auth 5
npm install -g @earendil-works/pi-coding-agentpiexport ANTHROPIC_API_KEY=sk-ant-.../login/logoutInteractive Sessions 4
pi @README.md "Summarize this"pi @src/app.ts @src/app.test.ts "Review these together"!npm run lint/newHeadless Mode & Scripts 7
pi -p "Summarize this codebase"cat README.md | pi -p "Summarize this text"pi -p @screenshot.png "What is in this image?"pi --mode jsonpi --mode rpcpi --name "my task"pi --session <id>Sessions & Models 7
pi -cpi -r/model/compact [prompt]/fork/clone/reloadTips
- Pi is multi-model: switch anytime with `/model` or Ctrl+L — use a cheap fast model for exploration and a stronger one for final implementation without losing session context.
- `pi -p` headless mode with `--mode json` emits structured events, the de-facto standard for wiring into scripts and CI.
- `@`-referencing files is more accurate and cheaper than pasting contents into the prompt; run `/compact` before big changes to free tokens.
FAQ
Which model providers does Pi support?
Pi normalizes OpenAI, Anthropic, and Google behind one API layer. It supports subscription login for Claude Pro/Max, ChatGPT Plus/Pro (Codex), and GitHub Copilot, and also connects directly via ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, and similar keys.
What is the difference between pi -p and the interactive session?
`-p` is a non-interactive one-shot run: it executes once, prints the result, and exits — ideal for scripts and pipelines. The interactive `pi` suits exploratory development with multi-turn conversation and file edits.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Aug 26, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact UsEdit this page on GitHub
Edit the source file directly and open a PR to improve this cheatsheet.