@redonvn/event-ws-cliproxyapi-sdk 0.2.3 → 1.0.0
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 +7 -24
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -256,12 +256,10 @@ import {
|
|
|
256
256
|
```ts
|
|
257
257
|
import { CliproxyWSProvider } from 'event-ws-cliproxyapi-sdk';
|
|
258
258
|
|
|
259
|
-
const provider = new CliproxyWSProvider({
|
|
260
|
-
baseUrl: 'http://127.0.0.1:8317',
|
|
261
|
-
accessKey: 'andev'
|
|
262
|
-
|
|
263
|
-
authViaQuery: false
|
|
264
|
-
});
|
|
259
|
+
const provider = new CliproxyWSProvider({
|
|
260
|
+
baseUrl: 'http://127.0.0.1:8317',
|
|
261
|
+
accessKey: 'andev'
|
|
262
|
+
});
|
|
265
263
|
|
|
266
264
|
await provider.connect({
|
|
267
265
|
onEvent: (ev) => {
|
|
@@ -280,16 +278,8 @@ await provider.connect({
|
|
|
280
278
|
}
|
|
281
279
|
});
|
|
282
280
|
|
|
283
|
-
provider.close();
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
Update credentials at runtime:
|
|
287
|
-
```ts
|
|
288
|
-
provider.setCredentials('api_new', 'mgmt_new');
|
|
289
|
-
await provider.reconnect();
|
|
290
|
-
// or:
|
|
291
|
-
await provider.setCredentialsAndReconnect('api_new', 'mgmt_new');
|
|
292
|
-
```
|
|
281
|
+
provider.close();
|
|
282
|
+
```
|
|
293
283
|
|
|
294
284
|
## Usage (HTTP Client)
|
|
295
285
|
|
|
@@ -433,13 +423,6 @@ await openai.postChatCompletions({
|
|
|
433
423
|
|
|
434
424
|
## Notes
|
|
435
425
|
|
|
436
|
-
- For WS relay, if `ws-auth: true`,
|
|
437
|
-
- SDK handshake sends:
|
|
438
|
-
- `Authorization: Bearer <accessKey>` (backward compatible)
|
|
439
|
-
- `X-Access-Key: <accessKey>`
|
|
440
|
-
- `X-Management-Key: <managementKey>` (if provided)
|
|
441
|
-
- Optional query fallback (`authViaQuery: true`):
|
|
442
|
-
- `key=<accessKey>` + `auth_token=<accessKey>`
|
|
443
|
-
- `management_key=<managementKey>` + `mgmt_key=<managementKey>`
|
|
426
|
+
- For WS relay, if `ws-auth: true`, pass `accessKey` as `Authorization: Bearer ...`.
|
|
444
427
|
- Management APIs require `managementKey` (or local password for `/keep-alive` if enabled).
|
|
445
428
|
- HTTP client returns `Response` for streaming endpoints; parse SSE or chunks based on your client.
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redonvn/event-ws-cliproxyapi-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "TypeScript SDK for CLIProxyAPI WebSocket relay (provider-side).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
9
|
+
"files": ["dist"],
|
|
12
10
|
"scripts": {
|
|
13
11
|
"build": "tsc -p tsconfig.json",
|
|
14
12
|
"dev": "tsc -p tsconfig.json --watch",
|
|
@@ -22,4 +20,4 @@
|
|
|
22
20
|
"typescript": "^5.7.3",
|
|
23
21
|
"@types/ws": "^8.5.12"
|
|
24
22
|
}
|
|
25
|
-
}
|
|
23
|
+
}
|