pi-anthropic-auth: Skill for Claude Code

.pi/skills/anthropic/SKILL.md

anthropic is a skill for Claude Code, Codex from gotgenes/pi-anthropic-auth. It costs 49 tokens per session (3,559 once invoked), scanned A, original, MIT.

A repository-specific workflow for making Anthropic Claude OAuth requests work with this project. OAuth is a login method that lets the project use an account without storing its password.

In plain words
What is it for?
Use it when Anthropic OAuth login succeeds but requests fail, especially while comparing request hooks, transport handling, and provider-specific fixes.
Why use it?
It helps diagnose request failures that can appear as usage-limit messages even when the underlying problem is how the request is shaped or sent.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code; mentions AGENTS.md; mentions OpenCode.

This is gotgenes/pi-anthropic-auth's own configuration. It tells Claude Code and Codex how to work on pi-anthropic-auth itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything pi-anthropic-auth configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/chris/development/pi/pi-anthropic-auth/src/index.ts.

Reuse

Borrowing it

Nothing to install: this file belongs to gotgenes/pi-anthropic-auth. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/gotgenes/pi-anthropic-auth/main/.pi/skills/anthropic/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/gotgenes/pi-anthropic-auth

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for anthropic

README.md
[![agentmods](https://agentmods.dev/badge/skills/gotgenes/pi-anthropic-auth/anthropic/github.svg)](https://agentmods.dev/skills/gotgenes/pi-anthropic-auth/anthropic)
Your own site
<a href="https://agentmods.dev/skills/gotgenes/pi-anthropic-auth/anthropic"><img src="https://agentmods.dev/badge/skills/gotgenes/pi-anthropic-auth/anthropic/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for anthropic

Your own site · 80×15
<a href="https://agentmods.dev/skills/gotgenes/pi-anthropic-auth/anthropic"><img src="https://agentmods.dev/badge/skills/gotgenes/pi-anthropic-auth/anthropic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,559 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.03559
Opus 5.5 $0.00020 $0.01424
Sonnet 5.5 $0.00010 $0.00712
Haiku 4.5 $0.00005 $0.00356

Measured 13d ago against content hash 1011ee0de685, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

anthropic scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.pi/skills/anthropic/SKILL.md · 194 lines

How it starts

The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Anthropic OAuth Compatibility

Use When

  • Anthropic OAuth requests fail with You're out of extra usage.
  • Pi Anthropic OAuth works for login but fails for actual requests.
  • You need to compare Pi, OpenCode, and opencode-anthropic-auth behavior.
  • You need to decide whether a fix belongs in before_provider_request, the streamSimple transport wrapper, or a deeper override.

Core Lessons

  1. Treat Anthropic's You're out of extra usage. error as a possible disguised request rejection, not only a billing problem.
  2. Prefer the thinnest fix that works.
  3. Preserve Pi's built-in Anthropic behavior by default.
  4. Prefer request shaping before prompt rewriting.
  5. A refusal blamed on request content needs an organic-data control before it becomes a diagnosis (Issue #65).
  6. Avoid streamSimple unless hooks are clearly insufficient — they are insufficient for compaction and background-agent calls, which is why this repo wraps the transport (Issue #18).

Repo-Specific Findings

Confirmed Pi upstream behavior

  • Pi already handles Claude Code OAuth headers, Claude Code identity injection, native Anthropic OAuth login, and tool-name normalization.
  • Pi auth storage already refreshes OAuth tokens under a lock.

Confirmed local fixes

  • OAuth Anthropic payload shaping prepends an x-anthropic-billing-header system block.
  • The billing block must not add cache_control, or Anthropic can reject the request for exceeding the cache-control block limit.
  • Content-less role: "system" messages carrying output_config must survive system-message shaping: on managed-effort models (those pi-ai flags compat.supportsMidConvoEffort, which test/managed-effort-drift.test.ts enumerates from the installed catalog) they are the only carrier of the requested effort, since Pi pins the top-level effort to "high". Dropping them errors nowhere and silently runs every request at "high"; Anthropic accepts them with content: [] (verified live on pi 0.87.1, PR #79).
  • Assistant block ordering must not be normalized: measured 2026-09-20, Anthropic returns 200 for [tool_use..., text] and [text, tool_use, text, tool_use] on sonnet-4-5, haiku-4-5, sonnet-5, fable-5, and opus-4-8. The split that used to rewrite those turns corrupted signed thinking blocks and was removed (Issue #66).
  • Pi's default system prompt can act as an Anthropic fingerprint and trigger disguised rejection errors.
  • Shaping runs in a thin streamSimple transport wrapper (delegating to Pi's built-in Anthropic transport, resolved from the installed pi-ai layout), gated on the sk-ant-oat token.
  • The billing header's cc_version is a floor, not a fixed value: the wrapper injects an options.fetch that reads pi's own user-agent: claude-cli/<version> off the built request and rebuilds the header at pi's version when pi reports a higher one (Issue #74). An explicit PI_ANTHROPIC_AUTH_CLAUDE_CODE_VERSION override is absolute and is never raised. Measured live on pi 0.87.1 against claude-opus-5-5: with the pin forced to 2.1.260 the request succeeds; with the same value set through the env override it is rejected as claude_code_version_too_old.
  • When Anthropic raises a floor above both pi and the pin, the same fetch retries once at the floor the 400 names, and remembers it for the wrapper's lifetime (Issue #75). Unrecovered rejections (override set, floor unnamed, body not rebuildable, retry rejected) reach the user with a [pi-anthropic-auth] hint appended to error.message. On pi 0.87.1 the retry is unreachable live without a patch, because pi's own 2.1.280 already meets every current floor; the live check forces the pin to 2.1.260 and disables the pi-version read in the working tree, then looks for the claude-code-version-recovery debug line.
  • The wrapper covers the main loop and compaction — everything that dispatches through modelRuntime.
  • It covers only the provider names this extension registers: anthropic, plus any the user names in extensions/pi-anthropic-auth/config.json (global, or a trusted project's .pi/). An Anthropic OAuth subscription another extension registers under its own name (pi-multi-pass's anthropic-2) is otherwise unshaped and fails real prompts with the extra-usage 400 (Issue #70). Reproduced live on 2026-09-24 with a second login of the same account: 400 without the config, 200 with it. Short prompts pass either way, so check /anthropic-auth:status's shaped providers line before debugging anything else.
  • Background agents that pass ctx.modelRegistry.streamSimple() as their stream function (pi >=0.86.0) route through modelRuntime and are shaped; pi-observational-memory 3.1.x does this (measured live, Issue #53).
  • On pi >=0.80.8, callers that dispatch through pi-ai's compat.streamSimple (passed explicitly, or reached through the setDefaultStreamFn fallback when streamFn is omitted) are confirmed uncovered, and cannot be covered from this extension (Issue #46); see docs/architecture.md for why, and for the supported path for extension authors.

Read the full file on GitHub · 194 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago Changed 1011ee0de685
  2. 29d ago Changed · +1 lines 5697b5d7c97e
  3. 1mo ago Changed · +9 lines ceed0aac394d
  4. 1mo ago Changed · +4 lines cee43f3eaf6c
  5. 1mo ago Changed · +8 lines b0a724439e21
  6. 1mo ago Changed · +4 lines 9eb05f855342
  7. 1mo ago Changed · +17 lines 7aef3b680a5a
  8. 1mo ago Changed · +4 lines 214df5baeb17
  9. 2mo ago First seen · 147 lines · 49 tokens per session scan A b6f22c5f324d

Subscribe to this mod's changes

anthropic is a skill published in the GitHub repository gotgenes/pi-anthropic-auth (426 stars, last pushed 13d ago), licensed MIT. It adds 49 tokens to every session and 3,559 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.