@viniciosrab/pi-claude-bridge

Use Claude in pi through your Claude Code subscription, with pi running every tool.

Packages

Package details

extension

Install @viniciosrab/pi-claude-bridge from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@viniciosrab/pi-claude-bridge
Package
@viniciosrab/pi-claude-bridge
Version
2.0.0
Published
Nov 22, 2026
Downloads
3,120/mo · 182/wk
Author
viniciosrab
License
MIT
Types
extension
Size
314.3 KB
Dependencies
4 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-claude-bridge

GitHub tag

Use Claude (Fable, Opus, Sonnet, Haiku) as a model in pi, through your Claude Code subscription. Every tool call runs in pi's TUI, as with any other model.

What it does for you:

  • Your Claude plan, pi's tools. Claude Code does the talking to Anthropic; pi runs every tool, skill and extension as usual.
  • The prompt cache survives the usual interruptions. An abort, an API error, /fork, /clone, or reopening a session in a new window usually continue Claude Code's own session instead of re-sending the whole conversation.
  • New models without a bridge release. Claude models pi knows about appear in /model after pi update, at 200K context until a bridge release adds their 1M.

Install

Install it straight from this repository:

pi install git:github.com/viniciosrab/pi-claude-bridge

This follows the default branch, and pi update --extensions pulls the latest commit. To stay on a release instead, pin its tag, e.g. pi install git:github.com/viniciosrab/pi-claude-bridge@v1.0.0.

Requires pi 1.5.1 or newer and a Claude Code login: install Claude Code, run claude and sign in with your Claude subscription when it asks (/login signs in again later). The bridge uses that login, so there is no API key to set.

Use

Pick a model with /model, e.g. claude-bridge/claude-opus-5-5 or claude-bridge/claude-haiku-5-5. New Claude models appear on their own after pi update.

Skills, AGENTS.md/CLAUDE.md and steering work as usual. Claude gets pi's whole system prompt as pi renders it, appended to Claude Code's own, or alone with systemPromptPreset: false; Claude Code's ~/.claude/CLAUDE.md, .claude/rules/ and output style do not apply.

What to expect

  • Usage counts against your Claude plan, the same as Claude Code.
  • pi runs the tools, not Claude Code. Claude Code's own tools are not used, nor, by default, the MCP servers from ~/.claude.json and .mcp.json (see strictMcpConfig); claude.ai's cloud MCP servers are always off. Claude sees pi's tools, skills and extensions.
  • /compact, tree navigation or an extension that edits past messages makes the next turn cost more. pi's history no longer matches Claude Code's session, so the bridge rebuilds it and the next request misses the prompt cache.
  • A change to pi's system prompt rebuilds the session at the next prompt. Claude Code keeps the prompt a session was created with, so when pi's system prompt or systemPromptPreset changes, the bridge rebuilds Claude Code's session from pi's history and that request re-caches the whole conversation once.

Configure

Optional. Global: ~/.pi/agent/claude-bridge.json, or the file the CLAUDE_BRIDGE_CONFIG environment variable names. A .pi/claude-bridge.json inside a project is ignored, so a cloned repository cannot change these options.

{
  "provider": {
    "plan": "max"
  }
}
provider option Default What it does
plan "pro" Set to "max" on Max, Team Premium or Enterprise to unlock 1M context on Opus 4.6.
longContextExtraUsage false Allow 1M-context models that bill Extra Usage (Sonnet 4.6; Opus 4.6 on Pro).
forceTwoHundredK [] Model ids to cap at 200K, if Claude Code refuses 1M for them on your plan.
strictMcpConfig true Ignore MCP servers from ~/.claude.json and .mcp.json.
autoMemoryEnabled false Turn on Claude Code's auto-memory.
pathToClaudeCodeExecutable bundled Path to your own claude binary (e.g. on Nix).
loadClaudeSettings "user" Claude Code settings (hooks, plugins, env, apiKeyHelper) to load: "user" for ~/.claude/settings.json only, "all" to add the repository's .claude/ settings (trusted repositories only), false for none.
rateLimitWarnings true Set false to hide the rate-limit warnings and reset-time notices.
systemPromptPreset true Claude Code's own system prompt goes first, with pi's whole prompt appended. false sends pi's prompt alone.

Context window: the current models (Fable 5 and newer, Opus 4.7 and newer, Sonnet 5 and newer, Haiku 5.5) run with 1M context. Opus 4.6 gets 1M with plan: "max" or longContextExtraUsage, and Sonnet 4.6 only with longContextExtraUsage. A model released after your bridge version runs at 200K until a bridge release adds its 1M context.

Plan access is separate: on Pro, Fable 5 needs Extra Usage (5.1 is assumed the same, not measured); Fable 5.2 answered without it when last measured (2026-11-09).

Troubleshooting

  • Every turn fails with an auth error. Unset any ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN you export: they redirect Claude Code away from your subscription.
  • Claude Code hooks add duplicate guidance. ~/.claude/settings.json hooks also fire in bridge turns. Have the hook skip them: [ -n "$PI_CODING_AGENT" ] && exit 0.

For bug reports, set CLAUDE_BRIDGE_DEBUG=1 and attach bridge.log plus the matching file in cc-cli-logs/, both in claude-bridge/logs/ inside pi's agent dir (~/.pi/agent/claude-bridge/logs/ by default), to a new issue.

Extension authors and contributors: see the reference.

Credits

This project started from pi-claude-bridge by Eli Dickinson, itself based on claude-agent-sdk-pi by Prateek Sunal. It has been developed on its own since 1.0.0. Thank you both.