opencode-puter-auth 1.0.15 → 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 +10 -24
- package/dist/ai-provider/index.d.ts +1 -0
- package/dist/ai-provider/index.d.ts.map +1 -1
- package/dist/ai-provider/index.js +2 -0
- package/dist/ai-provider/index.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +17 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/plugin-simple.d.ts +14 -0
- package/dist/plugin-simple.d.ts.map +1 -0
- package/dist/plugin-simple.js +38 -0
- package/dist/plugin-simple.js.map +1 -0
- package/package.json +4 -1
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
|
-
|
|
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,22 +41,20 @@ https://raw.githubusercontent.com/Mihai-Codes/opencode-puter-auth/main/README.md
|
|
|
53
41
|
}
|
|
54
42
|
```
|
|
55
43
|
|
|
56
|
-
2. **Authenticate
|
|
44
|
+
2. **Authenticate:**
|
|
57
45
|
|
|
58
46
|
```bash
|
|
59
|
-
opencode
|
|
60
|
-
|
|
47
|
+
npm install -g opencode-puter-auth
|
|
48
|
+
puter-auth
|
|
61
49
|
```
|
|
62
50
|
|
|
63
|
-
3. **
|
|
51
|
+
3. **Use Puter models:**
|
|
64
52
|
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"puter": {
|
|
71
|
-
"models": {
|
|
53
|
+
```bash
|
|
54
|
+
opencode run "Hello" --model=puter/claude-opus-4-5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
That's it! The plugin handles everything automatically.
|
|
72
58
|
"claude-opus-4-5": {
|
|
73
59
|
"name": "Claude Opus 4.5 (FREE via Puter)",
|
|
74
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/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { PuterAuthManager } from './auth.js';
|
|
3
|
+
import { homedir } from 'os';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
const configDir = join(homedir(), '.config', 'opencode');
|
|
6
|
+
const authManager = new PuterAuthManager(configDir);
|
|
7
|
+
await authManager.init();
|
|
8
|
+
const result = await authManager.login();
|
|
9
|
+
if (result.success) {
|
|
10
|
+
console.log('✅ Authentication successful!');
|
|
11
|
+
console.log('Account:', result.account?.username);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
console.error('❌ Authentication failed:', result.error);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACzD,MAAM,WAAW,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEpD,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;AACzB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC;AAEzC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,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-
|
|
11
|
-
export { PuterAuthPlugin as default } from './plugin-
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
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-
|
|
14
|
+
export { PuterAuthPlugin } from './plugin-simple.js';
|
|
15
15
|
// Default export for OpenCode plugin loader
|
|
16
|
-
export { PuterAuthPlugin as default } from './plugin-
|
|
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,
|
|
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,OAA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AC,OAAO,CAC1B,iCAAiC,EACjC,oCAAoC,CACrC,CAAC;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,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-puter-auth",
|
|
3
|
-
"version": "1.0.
|
|
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
|
+
"bin": {
|
|
6
|
+
"puter-auth": "dist/cli.js"
|
|
7
|
+
},
|
|
5
8
|
"main": "./dist/index.js",
|
|
6
9
|
"types": "./dist/index.d.ts",
|
|
7
10
|
"type": "module",
|