pi-anthropic-oauth 0.1.16 → 0.1.17

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/index.ts +30 -14
package/README.md CHANGED
@@ -11,7 +11,7 @@ Use Claude Pro/Max in Pi with browser OAuth.
11
11
  - Claude Code-compatible OAuth headers and prompt shaping
12
12
  - No Anthropic API key needed
13
13
  - Uses Pi's Anthropic model registry
14
- - Adds Claude Opus 4.8 by default
14
+ - Adds Claude Opus 4.8 and Claude Fable 5 by default
15
15
  - Auto-creates `~/.Claude Code` → `~/.pi` symlink when missing
16
16
 
17
17
  ## Quick start
@@ -96,7 +96,7 @@ To add another Anthropic model, create `~/.pi/agent/models.json`:
96
96
  ```
97
97
 
98
98
  > [!NOTE]
99
- > Custom models are not needed for Claude Opus 4.8; this extension registers `claude-opus-4-8` automatically.
99
+ > Opus 4.8 and Fable 5 are registered automatically. Fable 5 works on Pro/Max through July 7, 2026; after that Anthropic says continued use requires extra usage credits unless extended.
100
100
  >
101
101
  > Pi requires `baseUrl`, `apiKey`, and `api` when defining custom models in `models.json`. With this extension, requests normally authenticate through Claude Pro/Max OAuth after `/login`, so `apiKey` is only a placeholder to satisfy Pi's config requirements and does not need to be a valid Anthropic API key.
102
102
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-anthropic-oauth",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Claude Pro/Max OAuth extension for Pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -11,18 +11,32 @@ import type { OAuthCredentials } from "@earendil-works/pi-ai";
11
11
  import { loginAnthropic, refreshAnthropicToken } from "./auth.js";
12
12
  import { streamAnthropicOAuth } from "./stream.js";
13
13
 
14
- const DEFAULT_OPUS_4_8: NonNullable<ProviderConfig["models"]>[number] = {
15
- id: "claude-opus-4-8",
16
- name: "Claude Opus 4.8",
17
- api: "anthropic-messages",
18
- reasoning: true,
19
- thinkingLevelMap: { xhigh: "xhigh" },
20
- input: ["text", "image"],
21
- cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
22
- contextWindow: 1000000,
23
- maxTokens: 128000,
24
- compat: undefined,
25
- };
14
+ const DEFAULT_MODELS: NonNullable<ProviderConfig["models"]> = [
15
+ {
16
+ id: "claude-opus-4-8",
17
+ name: "Claude Opus 4.8",
18
+ api: "anthropic-messages",
19
+ reasoning: true,
20
+ thinkingLevelMap: { xhigh: "xhigh" },
21
+ input: ["text", "image"],
22
+ cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
23
+ contextWindow: 1000000,
24
+ maxTokens: 128000,
25
+ compat: undefined,
26
+ },
27
+ {
28
+ id: "claude-fable-5",
29
+ name: "Claude Fable 5",
30
+ api: "anthropic-messages",
31
+ reasoning: true,
32
+ thinkingLevelMap: { xhigh: "xhigh" },
33
+ input: ["text", "image"],
34
+ cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
35
+ contextWindow: 1000000,
36
+ maxTokens: 128000,
37
+ compat: undefined,
38
+ },
39
+ ];
26
40
 
27
41
  function ensureClaudeCodeSymlink() {
28
42
  const target = join(homedir(), ".pi");
@@ -47,8 +61,10 @@ function getAnthropicModels(): NonNullable<ProviderConfig["models"]> {
47
61
  api: model.api ?? "anthropic-messages",
48
62
  }));
49
63
 
50
- if (!models.some((model) => model.id === DEFAULT_OPUS_4_8.id)) {
51
- models.push(DEFAULT_OPUS_4_8);
64
+ for (const defaultModel of DEFAULT_MODELS) {
65
+ if (!models.some((model) => model.id === defaultModel.id)) {
66
+ models.push(defaultModel);
67
+ }
52
68
  }
53
69
 
54
70
  return models;