{"id":50232829,"url":"https://github.com/leohenon/pi-anthropic-oauth","last_synced_at":"2026-08-09T09:30:19.907Z","repository":{"id":350267141,"uuid":"1205855855","full_name":"leohenon/pi-anthropic-oauth","owner":"leohenon","description":"Pi extension for Anthropic OAuth with Claude Pro/Max.","archived":false,"fork":false,"pushed_at":"2026-08-04T10:21:25.000Z","size":201,"stargazers_count":75,"open_issues_count":0,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-08-07T08:20:02.742Z","etag":null,"topics":["anthropic","claude","pi","pi-agent","pi-extensions"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leohenon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-09T10:49:09.000Z","updated_at":"2026-08-04T16:16:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leohenon/pi-anthropic-oauth","commit_stats":null,"previous_names":["leohenon/pi-anthropic-oauth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leohenon/pi-anthropic-oauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohenon%2Fpi-anthropic-oauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohenon%2Fpi-anthropic-oauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohenon%2Fpi-anthropic-oauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohenon%2Fpi-anthropic-oauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leohenon","download_url":"https://codeload.github.com/leohenon/pi-anthropic-oauth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohenon%2Fpi-anthropic-oauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36443650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"online","status_checked_at":"2026-08-09T02:00:06.528Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","claude","pi","pi-agent","pi-extensions"],"created_at":"2026-05-26T19:00:32.254Z","updated_at":"2026-08-09T09:30:19.868Z","avatar_url":"https://github.com/leohenon.png","language":"TypeScript","funding_links":[],"categories":["Extensions"],"sub_categories":[],"readme":"# pi-anthropic-oauth\n\n[![npm](https://img.shields.io/npm/v/pi-anthropic-oauth?style=flat-square\u0026logo=npm\u0026logoColor=white\u0026label=npm\u0026color=7c3aed)](https://www.npmjs.com/package/pi-anthropic-oauth)\n\nUse Claude Pro/Max in Pi with browser OAuth.\n\n\u003e [!IMPORTANT]\n\u003e This extension supports Pi 0.80.8 or later.\n\n## Features\n\n- Claude Pro/Max login from `/login`\n- Automatic token refresh\n- Claude Code-compatible OAuth headers and prompt shaping\n- No Anthropic API key needed\n- Uses the Anthropic models available in Pi's built-in model registry\n- Auto-creates `~/.Claude Code` → `~/.pi` symlink when missing\n\n## Quick start\n\n```bash\npi install npm:pi-anthropic-oauth\n```\n\nStart Pi, then run Pi's login command:\n\n```text\n/login\n```\n\nChoose:\n\n```text\nClaude Pro/Max\n```\n\nComplete the browser login. After login, select an Anthropic model in Pi.\n\nWhen the extension is active, `/login` includes `Claude Pro/Max` and Anthropic models show `(sub)` after OAuth login.\n\nUpdate with:\n\n```bash\npi update npm:pi-anthropic-oauth\n```\n\n\u003e [!NOTE]\n\u003e Anthropic auth changes are closely monitored for quick compatibility updates.\n\n## System prompt rewriting\n\nWhen using Claude Pro/Max OAuth, the extension prepends Claude Code identity text and rewrites standalone `Pi` / `pi` references in Pi's system prompt to `Claude Code`. The rewrite mode defaults to `aggressive`:\n\n```bash\nPI_ANTHROPIC_OAUTH_REWRITE_MODE=aggressive\n```\n\nOther modes are opt-in and avoid rewriting some technical strings such as paths, package names, or repository names. If OAuth starts failing, switch back to `aggressive`.\n\nAvailable modes:\n\n| Mode             | Behavior                                                                                                    |\n| ---------------- | ----------------------------------------------------------------------------------------------------------- |\n| `aggressive`     | Default. Replaces standalone `Pi` / `pi` wherever the word-boundary pattern matches.                        |\n| `path-safe`      | Avoids replacing `Pi` / `pi` immediately after `/` or `\\`, preserving path segments like `/srv/dev/pi-foo`. |\n| `technical-safe` | Avoids replacing `Pi` / `pi` next to common technical-token separators: `/`, `\\`, `.`, `@`, `:`, `_`, `-`.  |\n| `custom`         | Uses `PI_ANTHROPIC_OAUTH_REWRITE_PATTERN` as the replacement regex.                                         |\n\nCustom patterns can be a regex source or a JavaScript-style regex literal. The `g` flag is added automatically when omitted:\n\n```bash\nPI_ANTHROPIC_OAUTH_REWRITE_MODE=custom\nPI_ANTHROPIC_OAUTH_REWRITE_PATTERN='(?\u003c![/\\\\])\\b[Pp]i\\b'\n# or\nPI_ANTHROPIC_OAUTH_REWRITE_PATTERN='/\\bpi\\b/gi'\n```\n\nThere is no separate off mode. If you need to disable rewriting entirely, use a custom pattern that never matches, such as `(?!)`. Disabling or weakening the rewrite may affect OAuth compatibility.\n\n## Extra models\n\nTo add another Anthropic model, create `~/.pi/agent/models.json`:\n\n```json\n{\n  \"providers\": {\n    \"anthropic\": {\n      \"baseUrl\": \"https://api.anthropic.com\",\n      \"apiKey\": \"unused\",\n      \"api\": \"anthropic-messages\",\n      \"models\": [\n        {\n          \"id\": \"your-model-id\",\n          \"name\": \"Your Model Name\"\n        }\n      ]\n    }\n  }\n}\n```\n\n\u003e [!NOTE]\n\u003e Opus 5 and Fable 5 are included in Pi's built-in Anthropic model catalog as `claude-opus-5` and `claude-fable-5`.\n\u003e\n\u003e Pi requires `baseUrl`, `apiKey`, and `api` when defining custom models in `models.json`. With this extension, requests normally authenticate through Claude Pro/Max OAuth after `/login`, so `apiKey` is only a placeholder to satisfy Pi's config requirements and does not need to be a valid Anthropic API key.\n\u003e\n\u003e Do not use a fake `sk-ant-oat...` value as the placeholder. If OAuth login has not completed, Pi may try to use that fake token and Anthropic will return `401 Invalid bearer token`. Use a harmless placeholder such as `\"unused\"`, then run `/login` and choose `Claude Pro/Max`.\n\n## Troubleshooting\n\n- Run `/login` with no arguments, then choose `Claude Pro/Max`.\n- If local callback login does not complete, paste the final callback URL or `code#state` when prompted\n- If you see `401 Invalid bearer token`, remove any fake `sk-ant-oat...` placeholder from `~/.pi/agent/models.json` and log in again\n- If something breaks, please open an issue with your Pi version, extension version, and error output\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleohenon%2Fpi-anthropic-oauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleohenon%2Fpi-anthropic-oauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleohenon%2Fpi-anthropic-oauth/lists"}