Install
Install with PiG
pig install npm:@wierdbytes/pi-anthropicInstall with Pi
pi install npm:@wierdbytes/pi-anthropicPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.2.7 (README.md). PiG does not review it.
@wierdbytes/pi-anthropic
Claude Pro/Max OAuth extension for the pi coding agent.
Sign in with your Claude Pro or Max account and use it inside pi without an Anthropic API key.
Install
pi install npm:@wierdbytes/pi-anthropic
Usage
Start pi, then run:
/login anthropic
and pick Claude Pro/Max. Tokens are stored by pi's auth storage and refreshed automatically.
What it does
- Registers the
anthropicprovider with an OAuth login flow that targetsclaude.ai/platform.claude.com. - Reuses pi-ai's built-in Anthropic streamer, which already detects OAuth
tokens and applies Claude-Code-compatible headers / betas, the
"You are Claude Code, ..."identity block, Claude-Code tool-name mapping and adaptive thinking withoutput_config.effortfor Opus 4.6 / 4.7 and Sonnet 4.6. - Layers two Claude-Code-only tweaks on top via the
before_provider_requesthook: it rewrites Pi-branded paragraphs in the system prompt to Claude Code identity, and prepends thex-anthropic-billing-headersystem block so Pro/Max billing accepts the request. - Reuses pi's built-in Anthropic model registry — no custom model list is injected, so whatever models ship with your pi version are what you get.
- Creates a
~/.Claude Code→~/.pisymlink on first load when missing, so tools that look for the Claude Code config directory keep working.
Custom models
To expose an extra Anthropic model, declare it in ~/.pi/agent/models.json
the usual pi way. Requests will still authenticate through the OAuth token
obtained via /login anthropic.
Troubleshooting
- Re-run
/login anthropicif auth looks stale. - If the local callback never completes, paste the final callback URL (or
the
code#statefragment) when prompted. - File issues at https://github.com/wierdbytes/pi-wierd-stuff/issues with your pi version, this extension's version and the error output.
Caveats
Use at your own risk. Driving Claude Pro/Max through a non-official client may go against Anthropic's terms.
Credits
Originally based on
pi-anthropic-oauth by
Leo Henon. This package is an independent fork maintained inside the
pi-wierd-stuff monorepo; bugs here are ours, not the original author's.
License
MIT