In the previous post, we looked at why pi is worth considering when coding agents feel too heavy. In this post, we will install pi and open the first session.
The goal is simple: install pi, connect a model, run it in a project folder, and send a first request.
What this post covers
- Install pi with npm
- Connect a model through login or an API key
- Run pi inside a project folder
- Reference files and run shell commands
- Learn the first interactive commands to remember
Before you start
You only need a few things.
- Node.js and npm
- A terminal app
- An LLM provider account or API key
- A project folder to test pi in
On macOS, if Node.js is not installed, you can install it with Homebrew.
brew install node
If it is already installed, just check the versions.
node --version
npm --version
If version numbers appear, you are ready.
Step 1: Install pi
pi can be installed with npm. The official install command is:
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
--ignore-scripts prevents npm lifecycle scripts from running during installation. This gives you a more controlled install path by avoiding unexpected install scripts. pi does not rely on install scripts for a normal npm install, so this option is safe to use here.
After installation, check the version.
pi --version
If you see a version number, installation is complete.
Step 2: There is also an installer script
You can also use the installer script.
curl -fsSL https://pi.dev/install.sh | sh
However, curl | sh runs a remote script directly. Use it only when you trust the source or have checked the script. For a first install, the npm command is more explicit.
Step 3: Connect a model
To use pi, you need to connect a model provider. There are two common ways.
The first is using an API key. For example, with an Anthropic API key:
export ANTHROPIC_API_KEY=sk-ant-...
pi
The second is logging in with an existing subscription account. Run pi and then type /login.
pi
/login
According to the official docs, pi supports subscription login for Claude Pro/Max, ChatGPT Plus/Pro, and GitHub Copilot. With API keys, it supports providers such as Anthropic, OpenAI, Google Gemini, OpenRouter, and Amazon Bedrock.
At first, connect only one subscription or API key that you already have. Trying to organize many models from the start makes the setup heavier than necessary.
Step 4: Run pi inside a project folder
Move to the project folder where you want to use pi.
cd ~/my-project
pi
Then ask a normal question.
Read the structure of this project briefly and explain which folders are most important.
For the first request, start with light exploration instead of a large task. “Explain the project structure first” is safer than “refactor the whole project.”
Step 5: Reference files directly
One convenient feature in pi is @ file references. Type @ in the editor to fuzzy-search project files.
For example:
@src/lib/content/posts.server.ts Explain how this file loads Markdown posts.
When you explicitly name the file, the model is less likely to guess the wrong location. In a large project, “read this file first” is usually faster and more stable than “find the loader somewhere.”
Step 6: Run shell commands
To run a terminal command and send its output to the model, prefix it with !.
!npm run check
The command output becomes part of the conversation, so the model can inspect failure logs and suggest the next fix.
If you want to run a command without sending the output to the model, use !!.
!!git status --short
At first, !npm run check, !git status --short, and !ls are enough.
Step 7: Write multi-line requests
Use Shift+Enter to add line breaks in longer requests.
Review this post with the following criteria.
1. Are there terms that beginners may not understand?
2. Are the paragraphs connected naturally?
3. Are command explanations clear enough?
Short prompts are fine, but when you have review criteria, writing them in one structured request is usually more reliable.
Common interactive commands
In pi, commands start with /. You do not need to memorize everything at first. The following are enough to begin.
| Command | Purpose |
|---|---|
/login |
Log in to a provider |
/model |
Change the model |
/settings |
Change thinking level, theme, message delivery, and more |
/resume |
Select a previous session |
/new |
Start a new session |
/session |
Show current session info |
/hotkeys |
Show keyboard shortcuts |
/quit |
Quit pi |
Use /model to choose a model, or Ctrl+L as a shortcut.
If you switch between multiple models often, also look at /scoped-models. It controls which models are included when cycling with Ctrl+P.
Summary
| Step | Action |
|---|---|
| 1 | Install with npm install -g --ignore-scripts @earendil-works/pi-coding-agent |
| 2 | Check installation with pi --version |
| 3 | Connect a provider with an API key or /login |
| 4 | Run pi inside a project folder |
| 5 | Reference files with @path |
| 6 | Send command output with !command |
In the next post, we will look at session management, context files, AGENTS.md, /tree, /fork, and /compact.
💬 댓글
이 글에 대한 의견을 남겨주세요