Connect Pi

In short

Use the Pi coding agent as a Granular chat engine. Install it in one click, then reuse a provider you added in Granular or connect OpenRouter, Anthropic, OpenAI or xAI with /login.

Updated 2026-10-20

Pi is a free, open-source AI coding agent that works with many AI providers. Granular can use it as the engine behind a chat. If you've already signed in to OpenRouter or added a provider key in Granular, Pi uses that automatically. Otherwise you connect a provider inside Pi once.

Before you start

  • One of these:
    • An OpenRouter sign-in or a provider key you've already added in Granular (see Sign in with OpenRouter), or
    • An account or API key with a provider Pi supports, for example OpenRouter, Anthropic, OpenAI or xAI (for Grok).

Set it up

  1. In the row of controls under the message box, click the button that shows your current connection's name.
  2. Click Add your AI agent.
  3. Under Coding agents, click Pi. Its tag says Install, Sign in or Ready, and its price tag says Free + model (Pi is free; you pay for the AI model you connect).
  4. If Pi isn't installed yet, a panel says "Pi needs a one-time install". Click Install for me. The install runs in the chat's Terminal tool. It may ask a couple of questions, for example whether to add Pi to your PATH; press Enter to accept.
  5. If Pi still needs a provider, it opens in the Terminal tool with the panel Connect a provider to Pi. Type /login, pick a provider, then sign in or paste its key.
  6. When Pi says you're connected, type /quit to close it and free the terminal.
  7. A Pi row appears in your Accounts list and the chat switches to it.

If the tag already says Ready, Pi is using an account you added in Granular. Point at the row to see which one.

What you'll see

  • The Pi row names the providers Pi can use.
  • The model button under the message box lists the models Pi can reach. You can search it and pin favourites. See Pick and pin models.
  • Each Granular chat keeps its own Pi conversation, so a chat picks up where it left off.
  • Commands the agent runs show in the chat's Terminal tool, and file changes show in the chat.

Change or undo it

  • Connect another provider: start Pi in a terminal, type /login and pick the provider.
  • Stop using it in a chat: pick another account from the connection button.
  • Hide it: open Settings → AI accounts and click Hide from picker on Pi's card. Pi stays set up; Granular just stops showing and using it. See Manage your AI accounts.

Limits

  • Pi's own command and file-editing tools are off. The agent uses Granular's terminal and file tools, so you see every command and change. Pi can still read and search files, but only in the chat's folders.
  • Your own Pi extensions don't load in Granular chats. They still work when you run Pi yourself.
  • Costs depend on the provider Pi uses.
  • A key Granular lends Pi is passed to Pi for each reply only. It isn't written into Pi's settings.

Troubleshooting

If Pi says there's no API key
The provider you picked isn't connected. Type /login in Pi and connect it, or sign in to OpenRouter in Granular.

If the install finished but Granular can't see Pi
Click I've installed it - check again in the install panel. If that doesn't find it, quit Granular completely and open it again.

If the terminal still shows Pi after connecting
Type /quit to close it.

Questions

Can I use the Pi coding agent in Granular?
Yes. Open Add your AI agent, click Pi under Coding agents, install it if needed, and connect a provider.
Do I have to type /login?
Not if you've already signed in to OpenRouter or added a provider key in Granular. Pi uses that automatically.
Can I use Grok through Pi?
Yes, with an xAI or OpenRouter key connected in Pi.
Does each chat share one Pi conversation?
No. Each Granular chat keeps its own.
Why can't Pi run commands by itself?
Granular keeps every command in your visible terminal, for every engine.

Related