@gotgenes/pi-anthropic-auth
Pi extension package for Anthropic OAuth compatibility
Package details
Install @gotgenes/pi-anthropic-auth from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@gotgenes/pi-anthropic-auth- Package
@gotgenes/pi-anthropic-auth- Version
0.4.2- Published
- May 2, 2026
- Downloads
- 895/mo · 566/wk
- Author
- gotgenes
- License
- MIT
- Types
- extension
- Size
- 32.5 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./dist/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-anthropic-auth
A Pi extension that improves compatibility with Anthropic Claude Pro/Max OAuth (i.e., your Claude subscription) while preserving Pi's normal Anthropic behavior.
What It Does
Pi works great with Anthropic API keys out of the box. This extension fills in the gaps for users who want to use their Claude Pro or Max subscription via OAuth instead.
It keeps everything you'd expect — the built-in anthropic provider, the full model list, API-key behavior, and the native /login anthropic flow — and layers on the compatibility fixes needed to make OAuth subscriptions work reliably.
Install
pi install npm:@gotgenes/pi-anthropic-auth
To try it without permanently installing:
pi -e npm:@gotgenes/pi-anthropic-auth
Usage
- Run
/login anthropicas usual — Pi's native Anthropic login flow is preserved. - Select a Claude Pro/Max model and start chatting. The extension handles compatibility transparently.
- API-key behavior is unaffected; the extension's changes apply only to OAuth sessions.
Development
Requirements
pnpm- a local
piinstallation - Anthropic OAuth credentials configured through Pi
Commands
pnpm install # install dependencies
pnpm run check # typecheck
pnpm test # run tests
pnpm run build # compile
Load a Local Build
pi -e /absolute/path/to/pi-anthropic-auth/dist/index.js
Debug Logging
Set PI_ANTHROPIC_AUTH_DEBUG to enable structured debug logs from the OAuth shaping layer.
Modes:
PI_ANTHROPIC_AUTH_DEBUG=all— log all Anthropic OAuth shaping eventsPI_ANTHROPIC_AUTH_DEBUG=tool-use— log only requests that includetool_use
Example:
PI_ANTHROPIC_AUTH_DEBUG=tool-use \
pi \
--model anthropic/claude-haiku-4-5 \
--no-session \
--tools read,grep,find,ls \
-e /absolute/path/to/pi-anthropic-auth/src/index.ts \
-p "How many lines are in @AGENTS.md ?"
Similar Projects
- opencode-anthropic-auth — Anthropic OAuth compatibility work for OpenCode.
- pi-anthropic-oauth — a Pi extension that takes a fuller provider-override approach.
For notes on how this project compares to similar work, see docs/comparison-to-similar-projects.md.
Acknowledgments
This project was inspired by opencode-anthropic-auth, which solved the same Anthropic OAuth compatibility problem for OpenCode.
License
MIT