@adeildo/pi-providers 5.0.0 → 5.1.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 +33 -30
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@adeildo/pi-providers)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Two features for the providers [Pi](https://pi.dev) talks to. `subscription` bills Anthropic requests to your Claude plan. `accounts` keeps several logins per provider and moves to the next one when a limit hits.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pi install npm:@adeildo/pi-providers
|
|
@@ -12,34 +12,25 @@ It also comes in [`@adeildo/pi-harness`](../harness), with the rest of the piece
|
|
|
12
12
|
|
|
13
13
|
## subscription
|
|
14
14
|
|
|
15
|
-
With a Claude Pro or Max
|
|
15
|
+
With a Claude Pro or Max plan connected through `/login anthropic`, Pi's requests count as paid extra usage. With `subscription` they come out of the plan, the way Claude Code's do.
|
|
16
16
|
|
|
17
17
|
> [!WARNING]
|
|
18
|
-
> This makes Pi introduce itself to Anthropic as Claude Code. Using your subscription from anything other than Claude Code may break Anthropic's terms. It is on once the package is installed, so decide whether you
|
|
18
|
+
> This makes Pi introduce itself to Anthropic as Claude Code. Using your subscription from anything other than Claude Code may break Anthropic's terms. It is on once the package is installed, so decide whether you accept that risk. To turn it off, switch the extension off in `pi config`, or set `"features": { "subscription": { "enabled": false } }` in the settings file below.
|
|
19
19
|
|
|
20
|
-
Pi already sends Claude Code's identity with an OAuth token. Anthropic checks two more things before it bills a request to the plan
|
|
20
|
+
Pi already sends Claude Code's identity with an OAuth token. Anthropic checks two more things before it bills a request to the plan:
|
|
21
21
|
|
|
22
|
-
1. The user agent
|
|
23
|
-
2. The `system`
|
|
22
|
+
1. The user agent has to read `claude-cli/<version> (external, cli)`.
|
|
23
|
+
2. The first `system` block has to be a billing attribution line, with nothing Claude Code would not send. So pi's own prompt moves to the start of the first user message, wrapped in `<system-instructions>`. The model still reads it there and follows it.
|
|
24
24
|
|
|
25
|
-
It acts on any provider that
|
|
25
|
+
It acts on any provider that speaks the Anthropic Messages API with an OAuth token, not only the one named `anthropic`, so a second account registered under another name is billed to its own plan. Requests with an API key go out untouched.
|
|
26
26
|
|
|
27
|
-
Pi warns about extra usage on every Anthropic OAuth session.
|
|
27
|
+
Pi warns about extra usage on every Anthropic OAuth session. Once the plan pays, turn the warning off in `~/.pi/agent/settings.json`:
|
|
28
28
|
|
|
29
29
|
```json
|
|
30
30
|
{ "warnings": { "anthropicExtraUsage": false } }
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
In `~/.pi/agent/extensions/pi-harness/settings.json`:
|
|
36
|
-
|
|
37
|
-
| Key | Default | Does |
|
|
38
|
-
| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------- |
|
|
39
|
-
| `subscription.claudeCodeVersion` | `"2.1.280"` | The Claude Code version Pi reports. Anthropic won't serve newer models to versions it considers too old |
|
|
40
|
-
| `accounts.onLimit` | `"ask"` | What a quota or rate limit does when another account exists: `"ask"`, `"switch"`, or `"stop"` |
|
|
41
|
-
|
|
42
|
-
When a request comes back with `400 claude_code_version_too_old`, raise the version:
|
|
33
|
+
When a request comes back with `400 claude_code_version_too_old`, raise the version Pi reports:
|
|
43
34
|
|
|
44
35
|
```json
|
|
45
36
|
{ "subscription": { "claudeCodeVersion": "2.1.280" } }
|
|
@@ -47,28 +38,40 @@ When a request comes back with `400 claude_code_version_too_old`, raise the vers
|
|
|
47
38
|
|
|
48
39
|
## accounts
|
|
49
40
|
|
|
50
|
-
Pi keeps one credential per provider
|
|
41
|
+
Pi keeps one credential per provider, the one `/login` wrote. `accounts` keeps more. The credential of `/login` stays as `pi default`, and every other account is an extra credential with a name.
|
|
51
42
|
|
|
52
|
-
```
|
|
43
|
+
```text
|
|
53
44
|
/accounts anthropic
|
|
54
45
|
```
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
It picks the provider and its login method, asks for a name, and runs the login Pi already has, so no OAuth lives in this package. Each account shows its kind:
|
|
48
|
+
|
|
49
|
+
| Kind | Is |
|
|
50
|
+
| ------- | --------------------------------------------------------------------- |
|
|
51
|
+
| `login` | The credential of `/login`, which cannot be copied out of `auth.json` |
|
|
52
|
+
| `oauth` | A subscription token, billed to its own plan |
|
|
53
|
+
| `key` | An API key |
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
- `oauth` is a subscription token, billed to its own plan.
|
|
60
|
-
- `key` is an API key.
|
|
55
|
+
`alt+a` switches the account of the current model's provider, and the Providers tab of `Alt+S` lists the accounts to choose, rename or remove. The account in use shows next to the model. The session remembers its choice, so a resume or a fork comes back with the same one.
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
When a request is refused for a quota or a rate limit and another account of that provider exists, `accounts.onLimit` decides what happens:
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
| Value | Does |
|
|
60
|
+
| -------- | -------------------------------------------------------------------------- |
|
|
61
|
+
| `ask` | Opens a dialog, with the option to always switch from then on. The default |
|
|
62
|
+
| `switch` | Moves to the next account on its own |
|
|
63
|
+
| `stop` | Leaves the error in front of you |
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
Only a limit that arrives before anything was shown switches, so the retry never repeats output you already saw. Only the chat streams move: image generation, classifier calls and deferred responses still use pi's own credential.
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
## Settings
|
|
68
|
+
|
|
69
|
+
In `~/.pi/agent/extensions/pi-harness/settings.json`:
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
| Key | Default | Does |
|
|
72
|
+
| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------ |
|
|
73
|
+
| `subscription.claudeCodeVersion` | `"2.1.280"` | The Claude Code version Pi reports. Anthropic will not serve newer models to versions it considers old |
|
|
74
|
+
| `accounts.onLimit` | `"ask"` | What a quota or rate limit does when another account exists: `"ask"`, `"switch"` or `"stop"` |
|
|
72
75
|
|
|
73
76
|
## Credit
|
|
74
77
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adeildo/pi-providers",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Provider features for Pi. Bills Anthropic OAuth requests to the Claude Pro or Max plan instead of extra usage.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anthropic",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@adeildo/pi-kit": "5.
|
|
40
|
+
"@adeildo/pi-kit": "5.1.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@earendil-works/pi-ai": "*",
|