pi-anthropic-oauth 0.1.4 → 0.1.7

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 CHANGED
@@ -1,11 +1,12 @@
1
1
  # Pi Anthropic OAuth
2
2
 
3
- [![npm](https://img.shields.io/npm/v/pi-anthropic-oauth?style=flat-square&logo=npm&logoColor=white&label=npm&color=7c3aed)](https://www.npmjs.com/package/pi-anthropic-oauth) [![node](https://img.shields.io/badge/node-%3E%3D18-7c3aed?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org)
3
+ [![npm](https://img.shields.io/npm/v/pi-anthropic-oauth?style=flat-square&logo=npm&logoColor=white&label=npm&color=7c3aed)](https://www.npmjs.com/package/pi-anthropic-oauth) [![downloads](https://img.shields.io/npm/dm/pi-anthropic-oauth?style=flat-square&logo=npm&logoColor=white&label=downloads&color=7c3aed)](https://www.npmjs.com/package/pi-anthropic-oauth) [![node](https://img.shields.io/badge/node-%3E%3D18-7c3aed?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org)
4
4
 
5
5
  Claude Pro/Max OAuth extension for Pi.
6
6
 
7
7
  > [!WARNING]
8
8
  > Use this at your own risk. This may go against Anthropic's terms.
9
+ > I do not recommend using this with gsd2 or any extensions that will cause heavy token usage.
9
10
 
10
11
  ## Install
11
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-anthropic-oauth",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "Claude Pro/Max OAuth extension for Pi",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -13,7 +13,7 @@ const MODELS = [
13
13
  reasoning: true,
14
14
  input: ["text", "image"] as ("text" | "image")[],
15
15
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
16
- contextWindow: 200000,
16
+ contextWindow: 1000000,
17
17
  maxTokens: 128000,
18
18
  },
19
19
  {
@@ -22,7 +22,7 @@ const MODELS = [
22
22
  reasoning: true,
23
23
  input: ["text", "image"] as ("text" | "image")[],
24
24
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
25
- contextWindow: 200000,
25
+ contextWindow: 1000000,
26
26
  maxTokens: 64000,
27
27
  },
28
28
  {
package/src/stream.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  type SimpleStreamOptions,
12
12
  type StopReason,
13
13
  } from "@mariozechner/pi-ai";
14
- import { USER_AGENT, isClaudeOAuthAccessToken } from "./auth.js";
14
+ import { USER_AGENT } from "./auth.js";
15
15
  import {
16
16
  convertPiMessagesToAnthropic,
17
17
  convertPiToolsToAnthropic,
@@ -98,15 +98,15 @@ export function streamAnthropicOAuth(
98
98
 
99
99
  try {
100
100
  const apiKey = options?.apiKey ?? "";
101
- const isOAuth = isClaudeOAuthAccessToken(apiKey);
101
+ const isOAuth = true;
102
102
  const defaultHeaders = makeDefaultHeaders(isOAuth, options);
103
103
 
104
104
  if (isOAuth) defaultHeaders.authorization = `Bearer ${apiKey}`;
105
105
 
106
106
  const client = new Anthropic({
107
107
  baseURL: model.baseUrl,
108
- apiKey: isOAuth ? undefined : apiKey,
109
- authToken: isOAuth ? apiKey : undefined,
108
+ apiKey: isOAuth ? null : apiKey,
109
+ authToken: isOAuth ? apiKey : null,
110
110
  defaultHeaders,
111
111
  dangerouslyAllowBrowser: true,
112
112
  });