{"id":51818595,"url":"https://github.com/gotgenes/pi-anthropic-auth","last_synced_at":"2026-07-22T03:00:50.710Z","repository":{"id":352995039,"uuid":"1217538236","full_name":"gotgenes/pi-anthropic-auth","owner":"gotgenes","description":"Pi extension package for Anthropic OAuth compatibility","archived":false,"fork":false,"pushed_at":"2026-07-22T01:24:55.000Z","size":575,"stargazers_count":110,"open_issues_count":1,"forks_count":13,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-22T03:00:13.975Z","etag":null,"topics":["authentication","oauth","pi","pi-package"],"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/gotgenes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-22T01:40:29.000Z","updated_at":"2026-07-22T01:55:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gotgenes/pi-anthropic-auth","commit_stats":null,"previous_names":["gotgenes/pi-anthropic-auth"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/gotgenes/pi-anthropic-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotgenes%2Fpi-anthropic-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotgenes%2Fpi-anthropic-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotgenes%2Fpi-anthropic-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotgenes%2Fpi-anthropic-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gotgenes","download_url":"https://codeload.github.com/gotgenes/pi-anthropic-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotgenes%2Fpi-anthropic-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35744650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"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":["authentication","oauth","pi","pi-package"],"created_at":"2026-07-22T03:00:22.587Z","updated_at":"2026-07-22T03:00:50.703Z","avatar_url":"https://github.com/gotgenes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pi-anthropic-auth\n\n[![npm version](https://img.shields.io/npm/v/@gotgenes/pi-anthropic-auth?style=flat\u0026logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/@gotgenes/pi-anthropic-auth)\n[![CI](https://img.shields.io/github/actions/workflow/status/gotgenes/pi-anthropic-auth/ci.yml?style=flat\u0026logo=github\u0026label=CI)](https://github.com/gotgenes/pi-anthropic-auth/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?style=flat\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n[![pnpm](https://img.shields.io/badge/pnpm-%3E%3D10-F69220?style=flat\u0026logo=pnpm\u0026logoColor=white)](https://pnpm.io/)\n[![Pi Package](https://img.shields.io/badge/Pi-Package-6366F1?style=flat)](https://pi.mariozechner.at/)\n\nA [Pi](https://pi.mariozechner.at/) extension that improves compatibility with Anthropic Claude Pro/Max OAuth (i.e., your Claude subscription) while preserving Pi's normal Anthropic behavior.\n\n## What It Does\n\nPi works great with Anthropic API keys out of the box.\nThis extension fills in the gaps for users who want to use their **Claude Pro or Max subscription** via OAuth instead.\n\nIt 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.\n\nRequests 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`).\n\nShaping runs in a thin transport wrapper around Pi's own Anthropic transport, so it applies to every OAuth call path — the interactive loop, compaction, and any background-agent work — not just the main turn.\nSee [docs/architecture.md](docs/architecture.md) for how this works.\n\n## Install\n\n```bash\npi install npm:@gotgenes/pi-anthropic-auth\n```\n\nTo try it without permanently installing:\n\n```bash\npi -e npm:@gotgenes/pi-anthropic-auth\n```\n\n## Usage\n\n1. Run `/login anthropic` as usual — Pi's native Anthropic login flow is preserved.\n2. Select a Claude Pro/Max model and start chatting. The extension handles compatibility transparently.\n3. API-key behavior is unaffected; the extension's changes apply only to OAuth sessions.\n\n## Troubleshooting\n\n### Verify the extension is loaded\n\nRun `/anthropic-auth:status` in Pi to print a diagnostics report:\n\n```text\npi-anthropic-auth diagnostics\n  version: 0.6.5\n  module:  /root/.pi/agent/.../src/index.ts\n  built-in Anthropic transport: resolved\n```\n\nThe `module` line shows which copy of the extension loaded.\nIf the command is not found, the extension is not loaded at all.\n\n### `ANTHROPIC_API_KEY` is ignored when OAuth credentials exist\n\nPi's auth resolver gives stored credentials priority over environment variables.\nIf 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.\n\nTo use the API key instead, run `/logout anthropic` inside Pi to remove the stored credentials, or delete `auth.json` before starting the session.\n\n### Docker: extension missing after volume mount\n\nIf 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.\nDocker seeds a named volume with the image directory only on its first creation.\nIf the volume already exists from a previous image, the extension directory inside it may be empty or out of date.\n\nTo fix this, either:\n\n- Remove the volume and let Docker re-seed it: `docker volume rm \u003cvolume-name\u003e`.\n- Or install the extension at container startup rather than at image build time, after the volume is mounted.\n\n## Development\n\n### Requirements\n\n- `pnpm`\n- a local `pi` installation\n- Anthropic OAuth credentials configured through Pi\n\n### Commands\n\n```bash\npnpm install      # install dependencies\npnpm run check    # typecheck\npnpm test         # run tests\npnpm run build    # compile\n```\n\n### Load a Local Build\n\n```bash\npi -e /absolute/path/to/pi-anthropic-auth/dist/index.js\n```\n\n### Debug Logging\n\nSet `PI_ANTHROPIC_AUTH_DEBUG` to enable structured debug logs from the OAuth shaping layer.\n\nModes:\n\n- `PI_ANTHROPIC_AUTH_DEBUG=all` — log all Anthropic OAuth shaping events\n- `PI_ANTHROPIC_AUTH_DEBUG=tool-use` — log only requests that include `tool_use`\n\nExample:\n\n```bash\nPI_ANTHROPIC_AUTH_DEBUG=tool-use \\\npi \\\n  --model anthropic/claude-haiku-4-5 \\\n  --no-session \\\n  --tools read,grep,find,ls \\\n  -e /absolute/path/to/pi-anthropic-auth/src/index.ts \\\n  -p \"How many lines are in @AGENTS.md ?\"\n```\n\n## Similar Projects\n\n- [opencode-anthropic-auth](https://github.com/ex-machina-co/opencode-anthropic-auth/) — Anthropic OAuth compatibility work for [OpenCode](https://opencode.ai/).\n- [pi-anthropic-oauth](https://github.com/leohenon/pi-anthropic-oauth) — a Pi extension that takes a fuller provider-override approach.\n\nFor notes on how this project compares to similar work, see [docs/comparison-to-similar-projects.md](docs/comparison-to-similar-projects.md).\n\n## Acknowledgments\n\nThis project was inspired by [opencode-anthropic-auth](https://github.com/ex-machina-co/opencode-anthropic-auth/), which solved the same Anthropic OAuth compatibility problem for [OpenCode](https://opencode.ai/).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotgenes%2Fpi-anthropic-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgotgenes%2Fpi-anthropic-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotgenes%2Fpi-anthropic-auth/lists"}