pi-claude-request-compat0.2.1
An OAuth-only Claude Compat selection for Pi with validated Claude Code-style requests.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-claude-request-compat
Use Anthropic OAuth in Pi through an explicit Claude Compat model selection. Keep Pi's tools and workflow—no Claude Code installation needed.
Why this exists
A valid login is only part of the story: Claude Code's OAuth requests also carry specific headers, billing information, session metadata, and tool names. This extension adds those details using Pi's Anthropic transport. The dedicated provider rejects API keys, custom endpoints, redirects, and invalid request envelopes before sending a Messages request. Errors never retry through the ordinary Anthropic provider.
The idea and request behavior came from oh-my-pi (omp)—credit where it's due (NOTICE). This project builds on that work as a small extension for stock Pi, with automatic setup, a bundled compatibility profile that doesn't depend on your installed Claude version, and tests through the real Pi SDK. A separate comparison tool checks captured Claude requests and reports differences rather than assuming they match.
Get started
pi install npm:pi-claude-request-compat
Requires Pi 0.87.1 and Node 22.19+. Run /login claude-compat in Pi, then use /model to choose a [Compat] model. Pi manages this separate OAuth login and token refresh using its built-in Anthropic login flow.
Upgrading from 0.1.3: ordinary anthropic models are no longer patched. Select Claude Compat and log in once; existing Anthropic credentials are not copied.
Setup is automatic, including migration of older profiles. The credential-free profile lives at ~/.pi/agent/claude-request-compat/profile.json (or under PI_CODING_AGENT_DIR).
The footer shows Compat active, the profile, and the last local validation state. If Anthropic rejects a Compat Messages request with HTTP 4xx, Pi immediately shows an error notification with the status and keeps failed in the footer—even if the transport later retries. Local validation and other provider errors also trigger an error notification. Review the failure before retrying; /claude-compat-status repeats the last reason. User cancellations do not trigger this alert. pi-claude-request-compat doctor checks the local profile.
Prevent missing-plugin fallback
Pi can fall back to another provider when a saved model disappears. For a startup that fails if Compat is unavailable, use explicit selection:
pi --provider claude-compat --model claude-opus-4-8
# Equivalent convenience launcher (CLI must be on PATH):
pi-claude-request-compat run
pi-claude-request-compat run --model claude-opus-4-8 -- --continue
This pins the startup model, including resumed sessions. Starting plain pi with only a saved default does not provide missing-plugin protection. You can still deliberately select another provider during a session. Requests still consume subscription usage; this is not a spending cap.
Developer checks
npm ci
npm test
# Compare with a specific Claude executable:
npm run compat:check -- --claude-version 2.1.282 --claude /path/to/claude
See the comparison guide for offline replay and capture details. The checked-in Claude 2.1.156 reference currently reports DIFF; passing unit tests does not mean matching Claude requests.
Security and transparency
- CodeQL, weekly dependency audits, signature checks, and Dependabot update PRs.
- Commit-pinned workflow actions and npm releases with signed provenance.
- Pi manages your login. The extension uses your token in memory for Anthropic requests and account lookup; it stores no credentials in its profile and has no telemetry endpoint of its own.
Security policy · Report a vulnerability privately. Badges show check results, not a security certification.
Limits
The bundled profile (oauth-wire-v1, reference 2.1.282) follows request behavior studied from omp. It is not proven 1:1 Claude Code compatibility. Tests use the real Pi SDK, but Claude captures use synthetic credentials and a local gateway—not live Anthropic acceptance.
Pi keeps its own prompts and agent behavior. If Anthropic rejects the bundled version, the extension needs an update. Subscription use remains subject to Anthropic's terms.