@gatectr/sdk 0.1.0 → 0.2.1
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/LICENSE +21 -21
- package/README.md +199 -199
- package/package.json +85 -88
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 GateCtr
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 GateCtr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,199 +1,199 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img src="https://raw.githubusercontent.com/GateCtr/.github/main/profile/logo.svg" width="56" height="56" alt="GateCtr" />
|
|
4
|
-
|
|
5
|
-
# @gatectr/sdk
|
|
6
|
-
|
|
7
|
-
**Node.js SDK for GateCtr — One gateway. Every LLM.**
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/@gatectr/sdk)
|
|
10
|
-
[](https://github.com/GateCtr/sdk-node/actions/workflows/ci.yml)
|
|
11
|
-
[](LICENSE)
|
|
12
|
-
[](https://nodejs.org)
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Install
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install @gatectr/sdk
|
|
22
|
-
pnpm add @gatectr/sdk
|
|
23
|
-
yarn add @gatectr/sdk
|
|
24
|
-
bun add @gatectr/sdk
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Quick start
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import { GateCtr } from "@gatectr/sdk";
|
|
31
|
-
|
|
32
|
-
const client = new GateCtr({ apiKey: process.env.GATECTR_API_KEY });
|
|
33
|
-
|
|
34
|
-
const response = await client.complete({
|
|
35
|
-
model: "gpt-4o",
|
|
36
|
-
messages: [{ role: "user", content: "Hello" }],
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
console.log(response.choices[0]?.text);
|
|
40
|
-
console.log(response.gatectr.tokensSaved); // tokens saved by the optimizer
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
One endpoint swap. Your existing code works as-is.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## What GateCtr adds automatically
|
|
48
|
-
|
|
49
|
-
- **-40% tokens** — Context Optimizer compresses prompts before they hit the LLM
|
|
50
|
-
- **Budget Firewall** — Hard caps per project. Requests blocked when limit is reached.
|
|
51
|
-
- **Model Router** — Let GateCtr pick the right model for each request
|
|
52
|
-
- **Analytics** — Every token, every cost tracked in your dashboard
|
|
53
|
-
- **Webhooks** — Budget alerts pushed to Slack, Teams, or any URL
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Usage
|
|
58
|
-
|
|
59
|
-
### Completion
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
const response = await client.complete({
|
|
63
|
-
model: "gpt-4o",
|
|
64
|
-
messages: [
|
|
65
|
-
{ role: "system", content: "You are a helpful assistant." },
|
|
66
|
-
{ role: "user", content: "Summarize this document." },
|
|
67
|
-
],
|
|
68
|
-
max_tokens: 512,
|
|
69
|
-
temperature: 0.7,
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Chat
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
const response = await client.chat({
|
|
77
|
-
model: "gpt-4o",
|
|
78
|
-
messages: [{ role: "user", content: "Hello" }],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
console.log(response.choices[0]?.message.content);
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Streaming
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
for await (const chunk of client.stream({
|
|
88
|
-
model: "gpt-4o",
|
|
89
|
-
messages: [{ role: "user", content: "Hello" }],
|
|
90
|
-
})) {
|
|
91
|
-
process.stdout.write(chunk.delta ?? "");
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Models & usage
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
const { models } = await client.models();
|
|
99
|
-
// [{ modelId: "gpt-4o", provider: "openai", ... }, ...]
|
|
100
|
-
|
|
101
|
-
const usage = await client.usage({ from: "2025-01-01", to: "2025-01-31" });
|
|
102
|
-
// { totalTokens: 150000, savedTokens: 45000, ... }
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Per-request options
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
const response = await client.complete({
|
|
109
|
-
model: "gpt-4o",
|
|
110
|
-
messages,
|
|
111
|
-
gatectr: {
|
|
112
|
-
budgetId: "proj_123", // enforce a specific budget
|
|
113
|
-
optimize: true, // override client-level setting
|
|
114
|
-
route: false, // disable model router for this call
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Configuration
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
const client = new GateCtr({
|
|
125
|
-
apiKey: "gct_...", // or set GATECTR_API_KEY env var
|
|
126
|
-
baseUrl: "https://api.gatectr.com/v1", // default
|
|
127
|
-
timeout: 30_000, // ms, default 30s
|
|
128
|
-
maxRetries: 3, // default 3
|
|
129
|
-
optimize: true, // enable context optimizer globally
|
|
130
|
-
route: false, // disable model router globally
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
| Option | Type | Default | Description |
|
|
135
|
-
| ------------ | --------- | ---------------------------- | --------------------------------- |
|
|
136
|
-
| `apiKey` | `string` | `GATECTR_API_KEY` env var | Your GateCtr API key |
|
|
137
|
-
| `baseUrl` | `string` | `https://api.gatectr.com/v1` | API base URL |
|
|
138
|
-
| `timeout` | `number` | `30000` | Request timeout in ms |
|
|
139
|
-
| `maxRetries` | `number` | `3` | Retries on 429/5xx |
|
|
140
|
-
| `optimize` | `boolean` | `true` | Enable context optimizer globally |
|
|
141
|
-
| `route` | `boolean` | `false` | Enable model router globally |
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Error handling
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
import { GateCtrApiError, GateCtrTimeoutError, GateCtrNetworkError } from "@gatectr/sdk";
|
|
149
|
-
|
|
150
|
-
try {
|
|
151
|
-
await client.complete({ model: "gpt-4o", messages });
|
|
152
|
-
} catch (err) {
|
|
153
|
-
if (err instanceof GateCtrApiError) {
|
|
154
|
-
console.error(err.status, err.code, err.requestId);
|
|
155
|
-
} else if (err instanceof GateCtrTimeoutError) {
|
|
156
|
-
console.error(`Timed out after ${err.timeoutMs}ms`);
|
|
157
|
-
} else if (err instanceof GateCtrNetworkError) {
|
|
158
|
-
console.error("Network error", err.cause);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
| Error class | When |
|
|
164
|
-
| --------------------- | ----------------------------------------- |
|
|
165
|
-
| `GateCtrConfigError` | Invalid `apiKey` or `baseUrl` at init |
|
|
166
|
-
| `GateCtrApiError` | Non-2xx response from the API |
|
|
167
|
-
| `GateCtrTimeoutError` | Request exceeded `timeout` |
|
|
168
|
-
| `GateCtrNetworkError` | Network failure (DNS, connection refused) |
|
|
169
|
-
| `GateCtrStreamError` | SSE stream parse or connection error |
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Drop-in for OpenAI SDK
|
|
174
|
-
|
|
175
|
-
Already using the OpenAI SDK? Swap the base URL:
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
import OpenAI from "openai";
|
|
179
|
-
|
|
180
|
-
const openai = new OpenAI({
|
|
181
|
-
apiKey: process.env.GATECTR_API_KEY,
|
|
182
|
-
baseURL: "https://api.gatectr.com/v1",
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// Everything else stays the same
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## Requirements
|
|
191
|
-
|
|
192
|
-
- Node.js 22+
|
|
193
|
-
- TypeScript 5+ (optional but recommended)
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## Links
|
|
198
|
-
|
|
199
|
-
[Dashboard](https://gatectr.com) · [Docs](https://docs.gatectr.com) · [Status](https://status.gatectr.com) · [npm](https://www.npmjs.com/package/@gatectr/sdk)
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/GateCtr/.github/main/profile/logo.svg" width="56" height="56" alt="GateCtr" />
|
|
4
|
+
|
|
5
|
+
# @gatectr/sdk
|
|
6
|
+
|
|
7
|
+
**Node.js SDK for GateCtr — One gateway. Every LLM.**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@gatectr/sdk)
|
|
10
|
+
[](https://github.com/GateCtr/sdk-node/actions/workflows/ci.yml)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://nodejs.org)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @gatectr/sdk
|
|
22
|
+
pnpm add @gatectr/sdk
|
|
23
|
+
yarn add @gatectr/sdk
|
|
24
|
+
bun add @gatectr/sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { GateCtr } from "@gatectr/sdk";
|
|
31
|
+
|
|
32
|
+
const client = new GateCtr({ apiKey: process.env.GATECTR_API_KEY });
|
|
33
|
+
|
|
34
|
+
const response = await client.complete({
|
|
35
|
+
model: "gpt-4o",
|
|
36
|
+
messages: [{ role: "user", content: "Hello" }],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
console.log(response.choices[0]?.text);
|
|
40
|
+
console.log(response.gatectr.tokensSaved); // tokens saved by the optimizer
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
One endpoint swap. Your existing code works as-is.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## What GateCtr adds automatically
|
|
48
|
+
|
|
49
|
+
- **-40% tokens** — Context Optimizer compresses prompts before they hit the LLM
|
|
50
|
+
- **Budget Firewall** — Hard caps per project. Requests blocked when limit is reached.
|
|
51
|
+
- **Model Router** — Let GateCtr pick the right model for each request
|
|
52
|
+
- **Analytics** — Every token, every cost tracked in your dashboard
|
|
53
|
+
- **Webhooks** — Budget alerts pushed to Slack, Teams, or any URL
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Completion
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const response = await client.complete({
|
|
63
|
+
model: "gpt-4o",
|
|
64
|
+
messages: [
|
|
65
|
+
{ role: "system", content: "You are a helpful assistant." },
|
|
66
|
+
{ role: "user", content: "Summarize this document." },
|
|
67
|
+
],
|
|
68
|
+
max_tokens: 512,
|
|
69
|
+
temperature: 0.7,
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Chat
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
const response = await client.chat({
|
|
77
|
+
model: "gpt-4o",
|
|
78
|
+
messages: [{ role: "user", content: "Hello" }],
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
console.log(response.choices[0]?.message.content);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Streaming
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
for await (const chunk of client.stream({
|
|
88
|
+
model: "gpt-4o",
|
|
89
|
+
messages: [{ role: "user", content: "Hello" }],
|
|
90
|
+
})) {
|
|
91
|
+
process.stdout.write(chunk.delta ?? "");
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Models & usage
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const { models } = await client.models();
|
|
99
|
+
// [{ modelId: "gpt-4o", provider: "openai", ... }, ...]
|
|
100
|
+
|
|
101
|
+
const usage = await client.usage({ from: "2025-01-01", to: "2025-01-31" });
|
|
102
|
+
// { totalTokens: 150000, savedTokens: 45000, ... }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Per-request options
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
const response = await client.complete({
|
|
109
|
+
model: "gpt-4o",
|
|
110
|
+
messages,
|
|
111
|
+
gatectr: {
|
|
112
|
+
budgetId: "proj_123", // enforce a specific budget
|
|
113
|
+
optimize: true, // override client-level setting
|
|
114
|
+
route: false, // disable model router for this call
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Configuration
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
const client = new GateCtr({
|
|
125
|
+
apiKey: "gct_...", // or set GATECTR_API_KEY env var
|
|
126
|
+
baseUrl: "https://api.gatectr.com/v1", // default
|
|
127
|
+
timeout: 30_000, // ms, default 30s
|
|
128
|
+
maxRetries: 3, // default 3
|
|
129
|
+
optimize: true, // enable context optimizer globally
|
|
130
|
+
route: false, // disable model router globally
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
| Option | Type | Default | Description |
|
|
135
|
+
| ------------ | --------- | ---------------------------- | --------------------------------- |
|
|
136
|
+
| `apiKey` | `string` | `GATECTR_API_KEY` env var | Your GateCtr API key |
|
|
137
|
+
| `baseUrl` | `string` | `https://api.gatectr.com/v1` | API base URL |
|
|
138
|
+
| `timeout` | `number` | `30000` | Request timeout in ms |
|
|
139
|
+
| `maxRetries` | `number` | `3` | Retries on 429/5xx |
|
|
140
|
+
| `optimize` | `boolean` | `true` | Enable context optimizer globally |
|
|
141
|
+
| `route` | `boolean` | `false` | Enable model router globally |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Error handling
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { GateCtrApiError, GateCtrTimeoutError, GateCtrNetworkError } from "@gatectr/sdk";
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
await client.complete({ model: "gpt-4o", messages });
|
|
152
|
+
} catch (err) {
|
|
153
|
+
if (err instanceof GateCtrApiError) {
|
|
154
|
+
console.error(err.status, err.code, err.requestId);
|
|
155
|
+
} else if (err instanceof GateCtrTimeoutError) {
|
|
156
|
+
console.error(`Timed out after ${err.timeoutMs}ms`);
|
|
157
|
+
} else if (err instanceof GateCtrNetworkError) {
|
|
158
|
+
console.error("Network error", err.cause);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
| Error class | When |
|
|
164
|
+
| --------------------- | ----------------------------------------- |
|
|
165
|
+
| `GateCtrConfigError` | Invalid `apiKey` or `baseUrl` at init |
|
|
166
|
+
| `GateCtrApiError` | Non-2xx response from the API |
|
|
167
|
+
| `GateCtrTimeoutError` | Request exceeded `timeout` |
|
|
168
|
+
| `GateCtrNetworkError` | Network failure (DNS, connection refused) |
|
|
169
|
+
| `GateCtrStreamError` | SSE stream parse or connection error |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Drop-in for OpenAI SDK
|
|
174
|
+
|
|
175
|
+
Already using the OpenAI SDK? Swap the base URL:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import OpenAI from "openai";
|
|
179
|
+
|
|
180
|
+
const openai = new OpenAI({
|
|
181
|
+
apiKey: process.env.GATECTR_API_KEY,
|
|
182
|
+
baseURL: "https://api.gatectr.com/v1",
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Everything else stays the same
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Requirements
|
|
191
|
+
|
|
192
|
+
- Node.js 22+
|
|
193
|
+
- TypeScript 5+ (optional but recommended)
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Links
|
|
198
|
+
|
|
199
|
+
[Dashboard](https://gatectr.com) · [Docs](https://docs.gatectr.com) · [Status](https://status.gatectr.com) · [npm](https://www.npmjs.com/package/@gatectr/sdk)
|
package/package.json
CHANGED
|
@@ -1,88 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@gatectr/sdk",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "Node.js SDK for GateCtr — One gateway. Every LLM.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "GateCtr",
|
|
7
|
-
"homepage": "https://gatectr.com",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/GateCtr/sdk-node.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/GateCtr/sdk-node/issues"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"llm",
|
|
17
|
-
"openai",
|
|
18
|
-
"anthropic",
|
|
19
|
-
"gateway",
|
|
20
|
-
"ai",
|
|
21
|
-
"sdk"
|
|
22
|
-
],
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=22"
|
|
25
|
-
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@gatectr/sdk",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Node.js SDK for GateCtr — One gateway. Every LLM.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "GateCtr",
|
|
7
|
+
"homepage": "https://gatectr.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/GateCtr/sdk-node.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/GateCtr/sdk-node/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"llm",
|
|
17
|
+
"openai",
|
|
18
|
+
"anthropic",
|
|
19
|
+
"gateway",
|
|
20
|
+
"ai",
|
|
21
|
+
"sdk"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/cjs/index.js",
|
|
28
|
+
"module": "./dist/esm/index.js",
|
|
29
|
+
"types": "./dist/esm/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/esm/index.d.ts",
|
|
34
|
+
"default": "./dist/esm/index.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/cjs/index.d.ts",
|
|
38
|
+
"default": "./dist/cjs/index.js"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist/",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@changesets/cli": "^2.30.0",
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"@commitlint/cli": "^19.0.0",
|
|
50
|
+
"@commitlint/config-conventional": "^19.0.0",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
53
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
54
|
+
"eslint": "^9.0.0",
|
|
55
|
+
"fast-check": "^3.0.0",
|
|
56
|
+
"husky": "^9.0.0",
|
|
57
|
+
"lint-staged": "^15.0.0",
|
|
58
|
+
"msw": "^2.12.11",
|
|
59
|
+
"prettier": "^3.0.0",
|
|
60
|
+
"typescript": "^5.0.0",
|
|
61
|
+
"vitest": "^2.0.0"
|
|
62
|
+
},
|
|
63
|
+
"lint-staged": {
|
|
64
|
+
"src/**/*.ts": [
|
|
65
|
+
"eslint --fix",
|
|
66
|
+
"prettier --write"
|
|
67
|
+
],
|
|
68
|
+
"tests/**/*.ts": [
|
|
69
|
+
"eslint --fix",
|
|
70
|
+
"prettier --write"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "pnpm clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/postbuild.mjs",
|
|
75
|
+
"clean": "node scripts/clean.mjs",
|
|
76
|
+
"lint": "eslint src/ tests/",
|
|
77
|
+
"format": "prettier --write .",
|
|
78
|
+
"test": "vitest run",
|
|
79
|
+
"test:coverage": "vitest run --coverage",
|
|
80
|
+
"typecheck": "tsc --noEmit",
|
|
81
|
+
"changeset": "changeset",
|
|
82
|
+
"version": "changeset version",
|
|
83
|
+
"release": "pnpm build && changeset publish"
|
|
84
|
+
}
|
|
85
|
+
}
|