VS Code Language Model Chat Provider integration for Mario Zechner's open source Pi coding agent, making Pi models available in VS Code's model picker for use with GitHub Copilot Chat and any extension that consumes the vscode.lm.* APIs.
pi-vscode.mp4
- Universal Model Access: Use Pi with any VS Code extension that supports language models
- Dynamic Model Discovery: Automatically detects all configured models from Pi
- Tool Execution: Pi handles tools internally (file operations, bash commands, etc.)
- Streaming Responses: Real-time streaming of LLM responses
- Tool Transparency: Optional display of tool execution as text annotations
-
Pi CLI must be installed and available in your PATH:
npm install -g @mariozechner/pi-coding-agent
-
API Keys configured via Pi:
pi> /login
- Install the extension from the VS Code Marketplace (or build from source)
- Verify Pi is installed:
pi --version - Open VS Code and Pi models will appear in the model picker
Access settings via Ctrl/Cmd+, and search for "Pi":
| Setting | Description | Default |
|---|---|---|
pi.binaryPath |
Path to Pi CLI binary | pi |
pi.workingDirectory |
Working directory for Pi agent | Workspace root |
pi.autoRestart |
Auto-restart on crash | true |
pi.maxRestartAttempts |
Max restart attempts | 3 |
pi.additionalArgs |
Additional CLI arguments | [] |
pi.debug |
Enable debug logging | false |
- Open Copilot Chat (
Ctrl/Cmd+Shift+I) - Click the model picker
- Select a Pi model (e.g.,
pi:anthropic:claude-sonnet-4-20250514) - Start chatting!
Any extension using vscode.lm.* APIs can use Pi models:
const models = await vscode.lm.selectChatModels({ vendor: 'pi' });
const model = models[0];
const response = await model.sendRequest(messages, {}, token);- Process Isolation: Pi runs in a separate process for stability
- RPC Communication: Uses Pi's RPC mode over stdin/stdout
- Fresh Sessions: Each request starts a fresh session (MVP)
- Tool Handling: Pi executes tools internally, only final text reaches VS Code
Ensure Pi is installed and in your PATH:
which pi
# or
npm install -g @mariozechner/pi-coding-agentOpen the Output panel (Ctrl/Cmd+Shift+U) and select "Pi Agent" from the dropdown to view logs.
For detailed troubleshooting, enable debug mode:
- Open Settings (
Ctrl/Cmd+,) - Search for "Pi: Debug"
- Check the box to enable
Or add to settings.json:
{
"pi.debug": true
}# Clone and install
git clone <repo-url>
cd vscode-pi-model-chat-provider
npm install
# Compile
npm run compile
# Watch mode
npm run watch
# Package
npx @vscode/vsce packageMIT

