@pi-plugins/claude-cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -25
- package/dist/index.mjs +4971 -3484
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
# `@pi-plugins/claude-cli`
|
|
2
2
|
|
|
3
3
|
Use a Claude subscription in [pi](https://github.com/earendil-works/pi) through the
|
|
4
|
-
official Claude Code CLI.
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
official Claude Code CLI. Every request is made by Claude Code itself, so using your
|
|
5
|
+
subscription this way stays within Anthropic's terms of service.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
pi's built-in Anthropic provider builds each request and reads the response, just as
|
|
10
|
+
it does for the `anthropic` provider. Only sending the request is left to Claude
|
|
11
|
+
Code. Every request runs in its own `claude --print` process, which signs the request
|
|
12
|
+
and sends it with your subscription, so it counts against your plan's limits like
|
|
13
|
+
Claude Code's own requests. The process is stopped as soon as the response is
|
|
14
|
+
complete, so Claude Code never runs a tool or sends a request of its own.
|
|
15
|
+
|
|
16
|
+
Claude Code only signs you in, signs the request and sends it. Everything else stays
|
|
17
|
+
with pi:
|
|
18
|
+
|
|
19
|
+
- **Minimal system prompt.** The model gets pi's system prompt unchanged, after only
|
|
20
|
+
Claude Code's billing header and a one-line identity. Claude Code's own prompt,
|
|
21
|
+
project instructions, skills and environment details are left out.
|
|
22
|
+
- **pi's tools.** The model sees pi's tools under their own names, and pi runs them.
|
|
23
|
+
Claude Code's built-in tools and MCP servers stay off.
|
|
24
|
+
- **pi's session.** pi keeps the conversation, compaction, retries and thinking
|
|
25
|
+
level. The requests of a pi session share one Claude Code session ID, but Claude
|
|
26
|
+
Code stores nothing.
|
|
27
|
+
- **pi's prompt caching.** The conversation, tools, thinking settings and cache
|
|
28
|
+
breakpoints are those of pi's Anthropic provider, so each request reads the earlier
|
|
29
|
+
conversation from cache. On models that support it, a change to the system prompt
|
|
30
|
+
or the tools during a session is sent as a message, which keeps the cached
|
|
31
|
+
conversation valid.
|
|
32
|
+
- **No copied request details.** The plugin pins no headers, version numbers or
|
|
33
|
+
signing values from Claude Code. Claude Code builds and signs every request itself.
|
|
7
34
|
|
|
8
35
|
## Requirements
|
|
9
36
|
|
|
@@ -13,8 +40,6 @@ The `claude` CLI must be on your `PATH` and signed in to a Pro or Max plan:
|
|
|
13
40
|
claude auth login
|
|
14
41
|
```
|
|
15
42
|
|
|
16
|
-
Requests are billed to the account `claude` is signed in to, not to pi's `/login`.
|
|
17
|
-
|
|
18
43
|
Tested with pi 1.2.0 and Claude Code 2.1.299.
|
|
19
44
|
|
|
20
45
|
## Install
|
|
@@ -39,23 +64,18 @@ pi --model claude-cli/claude-sonnet-5-5
|
|
|
39
64
|
|
|
40
65
|
The provider offers the same Claude models as pi's built-in `anthropic` provider.
|
|
41
66
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
When another Claude Code process is refreshing the login, the request waits and tries
|
|
58
|
-
again for up to a minute.
|
|
59
|
-
|
|
60
|
-
The [`usage`](../usage) plugin reads Claude limits through pi's own Anthropic login.
|
|
61
|
-
To see them for this provider, sign in to the same account with `/login`.
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
- Requests are billed to the account `claude` is signed in to, not to pi's `/login`.
|
|
70
|
+
The [`usage`](../usage) plugin reads Claude limits through pi's login, so sign both
|
|
71
|
+
in to the same account to see the right limits.
|
|
72
|
+
- API keys in the environment, such as `ANTHROPIC_API_KEY`, are not passed on to
|
|
73
|
+
Claude Code, so requests always use the subscription.
|
|
74
|
+
- Cache retention follows pi's `PI_CACHE_RETENTION` setting. It is five minutes by
|
|
75
|
+
default and one hour with `long`.
|
|
76
|
+
- When another Claude Code process is refreshing the login, a request waits and tries
|
|
77
|
+
again for up to a minute.
|
|
78
|
+
- Starting Claude Code takes about a quarter of a second, so from its second request
|
|
79
|
+
on, each session keeps one process started ahead for its next request. An idle
|
|
80
|
+
process takes about 200 MiB. It is stopped after five idle minutes and when the
|
|
81
|
+
session ends.
|