Skip to content

tintinweb/vscode-pi-model-chat-provider

Repository files navigation

Pi Banner

Pi Coding Agent - Language Model Provider for VS Code

Visual Studio Marketplace Version

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 Banner

pi-vscode.mp4

Features

  • 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

Prerequisites

  1. Pi CLI must be installed and available in your PATH:

    npm install -g @mariozechner/pi-coding-agent
  2. API Keys configured via Pi:

    pi> /login

Installation

  1. Install the extension from the VS Code Marketplace (or build from source)
  2. Verify Pi is installed: pi --version
  3. Open VS Code and Pi models will appear in the model picker

Configuration

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

Usage

With GitHub Copilot Chat

  1. Open Copilot Chat (Ctrl/Cmd+Shift+I)
  2. Click the model picker
  3. Select a Pi model (e.g., pi:anthropic:claude-sonnet-4-20250514)
  4. Start chatting!

With Other Extensions

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);

Architecture

  • 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

Troubleshooting

"Pi CLI not found"

Ensure Pi is installed and in your PATH:

which pi
# or
npm install -g @mariozechner/pi-coding-agent

Check Logs

Open the Output panel (Ctrl/Cmd+Shift+U) and select "Pi Agent" from the dropdown to view logs.

Enable Debug Logging

For detailed troubleshooting, enable debug mode:

  1. Open Settings (Ctrl/Cmd+,)
  2. Search for "Pi: Debug"
  3. Check the box to enable

Or add to settings.json:

{
  "pi.debug": true
}

Development

# 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 package

License

MIT

Links

About

VSCode Language Model Chat Provider integration for 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.

Topics

Resources

License

Stars

Watchers

Forks

Contributors