@openai-oauth/openai-client 2.0.0-beta.3 → 2.0.0-beta.4
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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Use OpenAI OAuth credentials with the OpenAI JavaScript SDK.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm i @openai-oauth/openai-client openai
|
|
8
|
+
npm i @openai-oauth/openai-client @openai-oauth/local openai
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Quickstart:
|
|
@@ -65,7 +65,7 @@ export async function POST(request: Request) {
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Use `@openai-oauth/react` to establish the browser credentials. See the [Sign in with ChatGPT setup](https://github.com/EvanZhouDev/openai-oauth#
|
|
68
|
+
Use `@openai-oauth/react` to establish the browser credentials. See the [Sign in with ChatGPT setup](https://github.com/EvanZhouDev/openai-oauth#react-component).
|
|
69
69
|
|
|
70
70
|
The default `apiKey` is the placeholder string `openai-oauth`. Authentication is handled by the custom `fetch` implementation.
|
|
71
71
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,KAAK,CAAA;IACnB,cAAc,CAAC,EAAE,WAAW,CAAA;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,WAAW,CAAA;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG,WAAW,CAAA;AAoBlE,eAAO,MAAM,mBAAmB,GAC/B,OAAO,iBAAiB,EACxB,UAAS,yBAA8B,KACrC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,KAAK,CAAA;IACnB,cAAc,CAAC,EAAE,WAAW,CAAA;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,WAAW,CAAA;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG,WAAW,CAAA;AAoBlE,eAAO,MAAM,mBAAmB,GAC/B,OAAO,iBAAiB,EACxB,UAAS,yBAA8B,KACrC,mBAYF,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,14 @@ const toTransport = (input) => {
|
|
|
15
15
|
};
|
|
16
16
|
export const createOpenAIOptions = (input, options = {}) => {
|
|
17
17
|
const transport = toTransport(input);
|
|
18
|
-
|
|
18
|
+
const clientOptions = {
|
|
19
19
|
apiKey: options.apiKey ?? "openai-oauth",
|
|
20
20
|
baseURL: options.baseURL ?? transport.baseURL,
|
|
21
21
|
fetch: transport.fetch,
|
|
22
22
|
defaultHeaders: options.defaultHeaders,
|
|
23
|
-
dangerouslyAllowBrowser: options.dangerouslyAllowBrowser ?? true,
|
|
24
23
|
};
|
|
24
|
+
if (options.dangerouslyAllowBrowser !== undefined) {
|
|
25
|
+
clientOptions.dangerouslyAllowBrowser = options.dangerouslyAllowBrowser;
|
|
26
|
+
}
|
|
27
|
+
return clientOptions;
|
|
25
28
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openai-oauth/openai-client",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "OpenAI JavaScript SDK adapter for openai-oauth auth handles.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openai",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"openai-client"
|
|
11
11
|
],
|
|
12
12
|
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
13
16
|
"sideEffects": false,
|
|
14
17
|
"main": "./dist/index.js",
|
|
15
18
|
"types": "./dist/index.d.ts",
|
|
@@ -26,7 +29,7 @@
|
|
|
26
29
|
"LICENSE"
|
|
27
30
|
],
|
|
28
31
|
"scripts": {
|
|
29
|
-
"build": "tsc -p tsconfig.build.json",
|
|
32
|
+
"build": "node ../../scripts/clean-dist.mjs && tsc -p tsconfig.build.json",
|
|
30
33
|
"prepublishOnly": "bun run build",
|
|
31
34
|
"typecheck": "tsc --noEmit",
|
|
32
35
|
"test": "vitest run",
|
|
@@ -36,12 +39,12 @@
|
|
|
36
39
|
"access": "public"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@openai-oauth/core": "2.0.0-beta.
|
|
42
|
+
"@openai-oauth/core": "2.0.0-beta.4"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"openai": "6.46.0",
|
|
43
|
-
"typescript": "
|
|
44
|
-
"vitest": "
|
|
46
|
+
"typescript": "5.9.2",
|
|
47
|
+
"vitest": "4.1.10"
|
|
45
48
|
},
|
|
46
49
|
"author": "EvanZhouDev",
|
|
47
50
|
"license": "AGPL-3.0-only",
|