Claude Code CLI

Use the Claude Code CLI as a Pi model provider, backed by your Claude Pro or Max subscription.

What it does

Pi-claude-cli registers a custom Pi provider named pi-claude-cli. When you select one of its Claude models in /model, Pi sends model requests through the local claude command instead of a direct Anthropic API key.

Each turn runs Claude Code CLI in stream-json mode and streams text, thinking, and activity back into Pi. Claude Code owns its built-in tool loop and session, while custom tools registered by Pi extensions return to Pi for execution through a schema-only MCP bridge.

Why it's included

Many Pi users already have Claude Code authenticated through a Claude Pro or Max subscription. Claude Code CLI makes that subscription usable as a Pi backend without setting up separate Anthropic API billing, while retaining Pi's UI, custom tools, and package ecosystem.

It fits LazyPi as a practical bridge: install the package, make sure Claude Code CLI is available and authenticated, then pick the Claude model provider from Pi's normal model selector.

Usage notes

StepWhat to do
Install Claude Code CLI npm install -g @anthropic-ai/claude-code
Authenticate Claude claude auth login
Select in Pi Open /model and choose a Claude model under the pi-claude-cli provider
Use only Pi-configured MCP servers Set PI_CLAUDE_CLI_STRICT_MCP=1 before launching Pi
Exclude Claude project and user settings Set PI_CLAUDE_CLI_HERMETIC=1 before launching Pi

The provider depends on claude being on your PATH. If Claude Code CLI is missing or not authenticated, the extension logs setup instructions and Pi can continue using your other configured providers.

Tool security: The provider automatically approves Claude-native file, shell, web, sub-agent, and user-configured MCP tool requests so Claude Code can own its tool loop. These calls run outside Pi tool-call hooks; configure Claude Code PreToolUse hooks when you need guards. Custom Pi tools still return to Pi for execution. Strict MCP mode excludes user and project MCP servers. Hermetic mode also excludes Claude settings, hooks, memory, and project instructions, so review that trade-off before enabling it.

Existing installations

npx @robzolkos/lazypi update migrates the original npm:pi-claude-cli source to the maintained fork. LazyPi currently uses the reviewed npm:@saccolabs/pi-claude-cli@0.6.1 release, installs it before removing the original source, and keeps an installed source available if migration cleanup fails.