@AISuperDomain: Pi can now directly use Claude Pro/Max subscriptions. pi-anthropic-auth specifically addresses Pi's compatibility gap with Anthropic OAuth. It's not rewriting the provider, but adding a thin wrapper on Pi's native Anthropic transport.
Summary
pi-anthropic-auth is a Pi extension that resolves Pi's compatibility issues with Anthropic OAuth, allowing users to directly use Claude Pro/Max subscriptions.
View Cached Full Text
Cached at: 08/27/26, 03:38 PM
Pi can now directly use Claude Pro/Max subscriptions. pi-anthropic-auth specifically addresses Pi’s compatibility gap with Anthropic OAuth. It doesn’t rewrite the provider but adds a thin wrapper layer on Pi’s native Anthropic transport: • Preserves the native /login anthropic command • Retains the complete model list • API Key requests and other providers remain completely unaffected • Activates only when an sk-ant-oat OAuth token is detected • Covers both interactive turns and compaction
Install with one line:
pi install npm:@gotgenes/pi-anthropic-auth
Then proceed as usual with /login anthropic. The project currently has 181 stars, with the latest release at v2.0.6.
Note: Background agents that run their own agent loop in Pi 0.80.8 and later are a known exception, requiring workarounds as documented in the project’s documentation.
If you want to reuse your existing Claude Pro/Max subscription in Pi, this extension is worth bookmarking.
gotgenes/pi-anthropic-auth
Source: https://github.com/gotgenes/pi-anthropic-auth
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.
Requests to non-Anthropic providers and plain API-key Anthropic requests pass through completely untouched — the extension only activates when it detects an Anthropic OAuth access token (sk-ant-oat). Shaping runs in a thin transport wrapper around Pi’s own Anthropic transport, so it applies to interactive turns and to compaction — not just the main turn.
Background agents that run their own agent loop are a known exception on Pi 0.80.8 and later. See docs/architecture.md for how this works, and for the workaround if you write such an extension.
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.
Troubleshooting
Verify the extension is loaded
Run /anthropic-auth:status in Pi to print a diagnostics report:
pi-anthropic-auth diagnostics
version: 0.6.5
module: /root/.pi/agent/.../src/index.ts
built-in Anthropic transport: resolved
The module line shows which copy of the extension loaded. If the command is not found, the extension is not loaded at all.
ANTHROPIC_API_KEY is ignored when OAuth credentials exist
Pi’s auth resolver gives stored credentials priority over environment variables. If you have previously run /login anthropic and credentials are stored in ~/.pi/agent/auth.json, Pi uses the stored OAuth token on every request — even when ANTHROPIC_API_KEY is also set.
To use the API key instead, run /logout anthropic inside Pi to remove the stored credentials, or delete auth.json before starting the session.
Docker: extension missing after volume mount
If you install the extension at image build time with RUN pi install npm:@gotgenes/pi-anthropic-auth and then mount a persistent volume over ~/.pi/agent at runtime, Docker may mask the build-time install. Docker seeds a named volume with the image directory only on its first creation. If the volume already exists from a previous image, the extension directory inside it may be empty or out of date.
To fix this, either:
- Remove the volume and let Docker re-seed it:
docker volume rm <volume_name>. - Or install the extension at container startup rather than at image build time, after the volume is mounted.
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
Similar Articles
@ai_super_niko: https://x.com/ai_super_niko/status/2077612167634030853
CLIProxyAPI is a 42k-star open-source tool that converts AI subscriptions like Claude and ChatGPT into local API endpoints via OAuth login. It allows tools that only support API keys (such as ByteDance Trae, Tencent WorkBuddy) to share the same subscription, solving the pain point of reusing subscriptions across multiple tools.
@binghe: I've recently become a heavy user of Pi Agent... The more I use it, the more I like it. Pi can chain multiple skills to complete complex tasks, and the local Agent has more practical value! Pi Agent's system prompt is less than 1500 characters, only about 1/13 of Claude Code's...
The user shares their in-depth experience with Pi Agent, noting that its prompts are short, responses fast, and token consumption low, outperforming Claude Code.
@yibie: oh-my-pi: Someone turned Pi into the most powerful terminal coding agent --- Pi is a terminal coding agent made by Armin Ronacher (author of Flask). Someone forked it and created oh-my-pi. 4,796 stars...
oh-my-pi is an enhanced terminal coding agent based on Pi, supporting hash-anchored edits, dual engines, LSP integration, and more. It's open-source and highly customizable.
@9hills: After several weeks of exploration and various attempts, the configuration of pi agent is basically stable. I posted a list before without explanation, which wasn't very friendly. This time I'm posting a full version with comments. Warning: If you need an out-of-box Coding Agent, don't use Pi; Claude Code/Codex is more suitable…
The author shares the stable configuration of pi agent (full version with comments), and warns that if you need an out-of-box Coding Agent, Claude Code/Codex is more suitable.
@geekbb: 卧槽,兄弟们,CLIProxyAP 上大分,官方认证了属于是,快安装起来吧~ https://github.com/router-for-me/CLIProxyAPI…
CLIProxyAPI 是一个为 CLI 提供兼容 OpenAI/Gemini/Claude/Codex/Grok API 接口的代理服务器,现已支持 OpenAI Codex 和 Claude Code 的 OAuth 访问,方便开发者使用本地或多账户进行 CLI 访问。