pi-claude-directsdk
Claude as a Pi model provider through the unmodified Claude Code executable. Pi owns the transcript and tools; the CLI supplies subscription authentication as a model transport.
Package details
Install pi-claude-directsdk from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-claude-directsdk- Package
pi-claude-directsdk- Version
0.1.4- Published
- Oct 9, 2026
- Downloads
- 355/mo · 193/wk
- Author
- joaomj
- License
- MIT
- Types
- extension
- Size
- 132.1 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/claude-directsdk/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Pi Claude DirectSDK
Use Claude inside Pi through the unmodified Claude Code executable. Pi owns the transcript, tools, approvals, and retries. The CLI supplies subscription authentication as a model transport.
Capabilities:
- Run
sonnet,opus,haiku, and versioned routes as Pi models. - Execute Pi tools (
read,bash,edit,write,codemode) with Claude models. - Resume sessions with exact replay of signed thinking.
- Work in interactive, print (
-p), and resumed sessions.
Limits:
- One Pi model call spawns one request-scoped
claudeprocess. - One Pi model call produces at most one upstream Messages request.
- The provider never manages login, never reads credentials, and never falls back to another billing route.
- Required strict constrained decoding (
strict: "require") is rejected. See docs/architecture.md.
Requirements
- Node 20 or later.
- Claude Code in the qualified range
>=2.1.263 <2.2.0(seeQUALIFIED_CLI_RANGEinsrc/models.ts). - A Claude paid plan. The free plan excludes the CLI.
- A Claude Code login via
claude auth login.
Transport qualification uses Pi 1.0.2 and Claude Code 2.1.281. Startup and extension loading are also verified with Pi 1.1.0. Those startup checks make no paid requests.
Install
Install the qualified Claude Code version:
npm install -g --ignore-scripts=false @anthropic-ai/claude-code@2.1.281
Sign in through the official CLI login:
claude auth login
Install the extension, then restart Pi:
pi install git:github.com/joaomj/pi-claude-directsdk
Start Pi with a DirectSDK model:
pi --model claude-directsdk/haiku
DirectSDK uses the CLI login, not the Pi Anthropic login. The npm install flag enables the Claude Code installer for that command only.
The model catalog does not guarantee account entitlement. Start with haiku for a small request. Models that require usage credits can incur separate charges. To use only the included subscription allowance, disable additional paid usage in your Claude account.
Use
List models from a local checkout without installing it:
pi -e ./extensions/claude-directsdk/index.ts --list-models claude-directsdk
Run a prompt:
pi -e ./extensions/claude-directsdk/index.ts -p --model claude-directsdk/sonnet -- "Hello."
Cache-only initialization uses the pinned catalog without Claude CLI probes. The request transport loads on the first Claude request. See docs/startup.md for behavior, measurements, and limits.
Configuration
| Setting | Purpose |
|---|---|
CLAUDE_DIRECTSDK_COMMAND |
Override the claude executable path. |
CLAUDE_DIRECTSDK_CONFIG_DIR |
Point at a logged-in CLI config directory. |
CLAUDE_CODE_OAUTH_TOKEN |
Supply a token from claude setup-token in the environment Pi runs in. |
See docs/troubleshooting.md for login and environment errors.
Verify
npm test
This runs offline checks only and consumes no subscription allowance. Opt-in live suites are documented in docs/testing.md.
Costs
Per-model cost metadata is Anthropic list price. Pi reports it as an estimate, never as a subscription charge. Failed or interrupted requests are never reported as free.
Documentation
| Document | Contents |
|---|---|
| docs/architecture.md | Request lifecycle, model routing, tool transport, admission relay. |
| docs/startup.md | Cache-only initialization, lazy loading, and startup measurements. |
| docs/testing.md | Offline and opt-in test suites. |
| docs/troubleshooting.md | Missing CLI, logged-out CLI, conflicting environment. |
Acknowledgments
Behavioral reference: Hermes Claude Subscription DirectSDK (MIT). This project copies its behavior contract, not its code.
License
MIT. See LICENSE.