Skip to main content
Back to Resources

CAIL Pi

Pi is an open-source coding agent that runs in your terminal. CAIL Pi installs it for you and connects it to CUNY AI Lab models with your personal API key.

What it is

Pi works a lot like Claude Code, but it's open source and can talk to any model provider. CAIL Pi points it at the Lab's gateway and saves your CAIL API key, so whatever you do in Pi comes out of your monthly allowance. You don't have to keep a model list up to date: Pi asks the gateway what's available every time it starts.

The code is on GitHub and the package is on npm.

Before you start

  • Your personal CAIL API key. Once your Lab application is approved, create one in your dashboard. The API key guide walks you through it.
  • Node.js 22.19 or newer. Type node --version to check. On Windows you can install it with winget install OpenJS.NodeJS.LTS; afterward, close PowerShell and open a new window so it can find Node. On macOS, use the installer from nodejs.org, Homebrew, or nvm. On Linux, use your package manager, nvm, or the official binaries.

Install

Open a terminal and run the command for your system.

npx @cuny-ai-lab/cail-pi
npx.cmd @cuny-ai-lab/cail-pi

Here's what the installer does:

  1. Checks that you have Node.js 22.19 or newer and npm.
  2. Runs LazyPi, a community installer by Rob Zolkos, which installs Pi and a set of Pi packages. If you already have a Pi older than 1.0, the installer updates it.
  3. Adds the CUNY AI Lab provider to Pi, and removes the older pi-workshop package if you have it.
  4. On Windows, turns on Pi's PowerShell tool in Pi's settings file. It backs the file up first. If you've already picked which tools Pi uses, it adds PowerShell to your list and leaves the rest alone.
  5. Asks for your CAIL API key and checks it with the Lab's gateway. The check looks up your quota instead of calling a model, so it costs nothing. The key is then saved in Pi's credential store on your computer.
  6. Starts Pi once in the background to load the list of CUNY AI Lab models.

No key handy? Press Enter at the prompt and setup finishes anyway. Later, run /login inside Pi and choose CUNY AI Lab.

Start Pi and pick a model

Go to the folder you want to work in and start Pi. On Windows, use a new PowerShell window so it has the updated PATH.

pi
pi.cmd

Inside Pi, type /model and pick a CUNY AI Lab model. Every request counts against your monthly allowance, and your dashboard shows how much is left.

Updating Pi

Pi 1.0 came out on October 1, 2026, and CAIL Pi now requires it. If you installed Pi before then, you need to update once. Close any window where Pi is running, then run:

pi update --all
pi.cmd update --all

That updates Pi and all of your Pi packages, CAIL Pi included. Your key, settings, and old sessions stay as they are. To check that it worked, look at the version number, which should be 1.0.0 or higher, and then run the health check under Troubleshooting.

pi --version       # macOS / Linux
pi.cmd --version   # Windows

Running the installer again works too. It updates Pi if it's older than 1.0, updates CAIL Pi, and asks whether you want to keep your saved key.

Pi takes over the whole terminal window
That's new in 1.0. If you'd rather keep your terminal's normal scrollback, add "tuiMode": "regular" to Pi's settings file (~/.pi/agent/settings.json, or %USERPROFILE%\.pi\agent\settings.json on Windows), or start Pi with pi --tui-mode regular.
Pi prints warnings about other extensions when it starts
Some of the community packages LazyPi installs haven't caught up with Pi 1.0. You may see "Host-provided extension packages must be declared in peerDependencies", or a note that Pi switched off its built-in MCP support because pi-mcp-adapter is installed. Neither comes from CAIL Pi, and Pi still works.
"cannot self-update this installation"
Pi couldn't work out how it was installed, so update it with npm: npm install -g @earendil-works/pi-coding-agent@latest (npm.cmd on Windows). Then run pi update --extensions (pi.cmd update --extensions on Windows) to update your packages.

Troubleshooting

Start with the health check. It looks at Node, npm, your Pi version, the CUNY AI Lab extension, your saved key, whether the gateway answers and accepts the key, and how many models you can use. On Windows it also checks that Pi's PowerShell tool is on. It never prints your key.

npx @cuny-ai-lab/cail-pi --doctor       # macOS / Linux
npx.cmd @cuny-ai-lab/cail-pi --doctor   # Windows
"requires Node.js 22.19.0 or newer"
The message names the node that ran. If you have more than one (nvm, Homebrew, conda, and winget can each install their own), switch to a recent one and run the installer again.
"That API key was not accepted"
Look for missing or extra characters and paste it again. Keys are personal, so make sure it's the one issued to you.
"The CUNY AI Lab service could not be reached"
Your key wasn't saved. Check your connection (a VPN, a Wi-Fi sign-in page, or a firewall can all get in the way) and choose Retry.
No CUNY AI Lab models in /model
Pi loads the model list when it starts. If the list stays empty, run the health check. If it says no credential is configured, run /login inside Pi and choose CUNY AI Lab.
PowerShell says scripts are disabled
Add .cmd to the command: npx.cmd, npm.cmd, pi.cmd. You don't need to change the execution policy.
Windows: "pi is not recognized" after install
Close the window, open a new PowerShell window, and run pi.cmd.
You installed the earlier pi-workshop package
Run the installer once. It swaps pi-workshop for CAIL Pi so the provider isn't loaded twice, and it keeps your saved key.

Other commands

To update CAIL Pi by itself, without touching Pi or your other packages:

pi update npm:@cuny-ai-lab/cail-pi

To remove CAIL Pi but keep your saved key:

pi remove npm:@cuny-ai-lab/cail-pi

On Windows, type pi.cmd instead of pi. To delete the key as well, run the installer with --uninstall, which asks before it deletes anything, or type /logout inside Pi.

The installer takes a few more options: --skip-lazypi if Pi is already installed, --replace-key to enter a new key, --skip-auth to set up without a key, and --no-windows-settings to leave Pi's PowerShell setting alone on Windows.

Privacy and security

You type your key at a hidden prompt. The installer never takes it as a command-line argument, so it can't end up in your shell history. The key goes to two places: the Lab's gateway, which checks it, and Pi's credential store on your computer. It is never written to settings files, shell profiles, logs, or error messages, and the health check never shows it. CAIL Pi sends no telemetry.

Keep your key to yourself. If it leaks, the Lab can revoke it and issue you a new one.

If you prefer, you can set the AILAB_API_KEY environment variable instead. The provider only uses it when Pi has no saved key.