opencode-puter-auth 1.0.17 → 1.0.20

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
@@ -33,19 +33,7 @@ This means whether you have 1 or 1 million users, you pay $0 for AI infrastructu
33
33
 
34
34
  ## Installation
35
35
 
36
- ### Option A: Let an LLM do it (Easiest)
37
-
38
- Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
39
-
40
- ```
41
- Install the opencode-puter-auth plugin and configure Puter.com models
42
- in ~/.config/opencode/opencode.json by following:
43
- https://raw.githubusercontent.com/Mihai-Codes/opencode-puter-auth/main/README.md
44
- ```
45
-
46
- ### Option B: Manual Setup
47
-
48
- 1. **Add the plugin to your config** (`~/.config/opencode/opencode.json`):
36
+ 1. **Add plugin to config** (`~/.config/opencode/opencode.json`):
49
37
 
50
38
  ```json
51
39
  {
@@ -53,28 +41,20 @@ https://raw.githubusercontent.com/Mihai-Codes/opencode-puter-auth/main/README.md
53
41
  }
54
42
  ```
55
43
 
56
- 2. **Authenticate with Puter:**
44
+ 2. **Authenticate:**
57
45
 
58
46
  ```bash
59
- # Install plugin globally to get CLI tool
60
47
  npm install -g opencode-puter-auth
61
-
62
- # Run authentication
63
48
  puter-auth
64
-
65
- # Or from project directory
66
- cd ~/.config/opencode && npx opencode-puter-auth
67
49
  ```
68
50
 
69
- 3. **Add model definitions:**
51
+ 3. **Use Puter models:**
70
52
 
71
- ```json
72
- {
73
- "$schema": "https://opencode.ai/config.json",
74
- "plugin": ["opencode-puter-auth"],
75
- "provider": {
76
- "puter": {
77
- "models": {
53
+ ```bash
54
+ opencode run "Hello" --model=puter/claude-opus-4-5
55
+ ```
56
+
57
+ That's it! The plugin handles everything automatically.
78
58
  "claude-opus-4-5": {
79
59
  "name": "Claude Opus 4.5 (FREE via Puter)",
80
60
  "limit": { "context": 200000, "output": 64000 },
@@ -23,5 +23,6 @@
23
23
  */
24
24
  export { createPuter } from './puter-provider.js';
25
25
  export type { PuterProvider } from './puter-provider.js';
26
+ export { PuterChatLanguageModel } from './puter-chat-language-model.js';
26
27
  export type { PuterChatSettings, PuterProviderConfig, PuterChatConfig, } from './puter-chat-settings.js';
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai-provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai-provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAChB,MAAM,0BAA0B,CAAC"}
@@ -23,4 +23,6 @@
23
23
  */
24
24
  // Provider exports - only export factory functions, not default instances
25
25
  export { createPuter } from './puter-provider.js';
26
+ // Model exports
27
+ export { PuterChatLanguageModel } from './puter-chat-language-model.js';
26
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai-provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,0EAA0E;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai-provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,0EAA0E;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,gBAAgB;AAChB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * @author chindris-mihai-alexandru
8
8
  * @license MIT
9
9
  */
10
- export { PuterAuthPlugin } from './plugin-minimal.js';
11
- export { PuterAuthPlugin as default } from './plugin-minimal.js';
10
+ export { PuterAuthPlugin } from './plugin-simple.js';
11
+ export { PuterAuthPlugin as default } from './plugin-simple.js';
12
12
  export type { PuterConfig, PuterAccount, PuterChatOptions, PuterChatResponse, PuterChatMessage, PuterChatStreamChunk, PuterModelInfo } from './types.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAOjE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAOhE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  // IMPORTANT: Only export the plugin function, not classes!
12
12
  // OpenCode's plugin loader calls all exports as functions, so exporting
13
13
  // classes (PuterClient, PuterAuthManager) causes "cannot call class without new" errors.
14
- export { PuterAuthPlugin } from './plugin-minimal.js';
14
+ export { PuterAuthPlugin } from './plugin-simple.js';
15
15
  // Default export for OpenCode plugin loader
16
- export { PuterAuthPlugin as default } from './plugin-minimal.js';
16
+ export { PuterAuthPlugin as default } from './plugin-simple.js';
17
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kDAAkD;AAClD,2DAA2D;AAC3D,wEAAwE;AACxE,yFAAyF;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,4CAA4C;AAC5C,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kDAAkD;AAClD,2DAA2D;AAC3D,wEAAwE;AACxE,yFAAyF;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,4CAA4C;AAC5C,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Minimal OpenCode plugin for Puter.com
3
+ * Just provides auth loader - users authenticate via `puter-auth` CLI
4
+ */
5
+ export declare const PuterAuthPlugin: () => Promise<{
6
+ auth: {
7
+ provider: string;
8
+ loader: (_getAuth: any, _provider: any) => Promise<{
9
+ apiKey: string;
10
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
11
+ }>;
12
+ };
13
+ }>;
14
+ //# sourceMappingURL=plugin-simple.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-simple.d.ts","sourceRoot":"","sources":["../src/plugin-simple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,eAAO,MAAM,eAAe;;;2BAIG,GAAG,aAAa,GAAG;;yBAYrB,WAAW,GAAG,GAAG,SAAS,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;;;EAkBrF,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Minimal OpenCode plugin for Puter.com
3
+ * Just provides auth loader - users authenticate via `puter-auth` CLI
4
+ */
5
+ import { PuterAuthManager } from './auth.js';
6
+ import path from 'path';
7
+ import os from 'os';
8
+ function getConfigDir() {
9
+ return path.join(os.homedir(), '.config', 'opencode');
10
+ }
11
+ export const PuterAuthPlugin = async () => {
12
+ return {
13
+ auth: {
14
+ provider: 'puter',
15
+ loader: async (_getAuth, _provider) => {
16
+ const configDir = getConfigDir();
17
+ const authManager = new PuterAuthManager(configDir);
18
+ await authManager.init();
19
+ const activeAccount = authManager.getActiveAccount();
20
+ if (!activeAccount) {
21
+ throw new Error('Not authenticated with Puter. Run: puter-auth');
22
+ }
23
+ return {
24
+ apiKey: activeAccount.authToken,
25
+ async fetch(input, init) {
26
+ const url = typeof input === 'string' ? input : input instanceof URL ? input.toString() : input.url;
27
+ const headers = new Headers(init?.headers);
28
+ headers.set('Authorization', `Bearer ${activeAccount.authToken}`);
29
+ // Replace OpenAI API URL with Puter API URL
30
+ const puterUrl = url.replace(/^https:\/\/api\.openai\.com\/v1/, 'https://api.puter.com/drivers/call');
31
+ return fetch(puterUrl, { ...init, headers });
32
+ },
33
+ };
34
+ }
35
+ }
36
+ };
37
+ };
38
+ //# sourceMappingURL=plugin-simple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-simple.js","sourceRoot":"","sources":["../src/plugin-simple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,O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C;wBAEF,OAAO,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC/C,CAAC;iBACF,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-puter-auth",
3
- "version": "1.0.17",
3
+ "version": "1.0.20",
4
4
  "description": "Puter.com OAuth auth plugin for OpenCode - FREE UNLIMITED access to Claude Opus 4.5, Sonnet 4.5, GPT-5, Gemini, and 500+ AI models",
5
5
  "bin": {
6
6
  "puter-auth": "dist/cli.js"