@codetunezstudios/token-kit 0.1.0-beta.1 → 0.1.0-beta.3

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
@@ -15,7 +15,7 @@ token-kit enables developers to integrate LLM features into their applications u
15
15
 
16
16
  - **Simple API** — Intuitive methods for chat completions
17
17
  - **TypeScript First** — Full type safety and IntelliSense support
18
- - **Multiple Models** — Support for GPT-3.5, GPT-4, GPT-4 Turbo (more coming)
18
+ - **Multiple Models** — Support for Claude, GPT-4o, Amazon Nova (more coming)
19
19
  - **Token Management** — Built-in balance checking and validation
20
20
  - **Error Handling** — Comprehensive typed error classes
21
21
  - **Lightweight** — Single runtime dependency (axios)
@@ -79,7 +79,7 @@ const res = await tk.chat('user_token', [
79
79
  TokenKit.system('You are a helpful assistant.'),
80
80
  TokenKit.user('Explain quantum computing simply.'),
81
81
  ], {
82
- model: 'gpt-4',
82
+ model: 'gpt-4o',
83
83
  maxTokens: 200,
84
84
  temperature: 0.8,
85
85
  });
@@ -89,7 +89,7 @@ const res = await tk.chat('user_token', [
89
89
 
90
90
  | Option | Type | Default | Description |
91
91
  |--------|------|---------|-------------|
92
- | `model` | `string` | `gpt-3.5-turbo` | LLM model to use |
92
+ | `model` | `string` | `gpt-4o-mini` | LLM model to use |
93
93
  | `maxTokens` | `number` | `500` | Max tokens in response |
94
94
  | `temperature` | `number` | `0.7` | Randomness (0–2) |
95
95
 
@@ -144,7 +144,7 @@ List available LLM models.
144
144
 
145
145
  ```typescript
146
146
  const models = await tk.getModels();
147
- // ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo']
147
+ // ['gpt-4o-mini', 'gpt-4o', 'claude-3.5-haiku', 'claude-sonnet-4', 'nova-micro', 'nova-lite']
148
148
  ```
149
149
 
150
150
  ### Helper Methods
@@ -213,9 +213,12 @@ Different models consume tokens at different rates:
213
213
 
214
214
  | Model | Rate | 1,000 TK tokens = |
215
215
  |-------|------|-------------------|
216
- | GPT-3.5 Turbo | 1.0x | 1,000 LLM tokens |
217
- | GPT-4 Turbo | 2.0x | 500 LLM tokens |
218
- | GPT-4 | 3.0x | 333 LLM tokens |
216
+ | GPT-4o Mini | 1.0x | 1,000 LLM tokens |
217
+ | Claude 3.5 Haiku | 1.0x | 1,000 LLM tokens |
218
+ | Amazon Nova Micro | 1.0x | 1,000 LLM tokens |
219
+ | Amazon Nova Lite | 1.0x | 1,000 LLM tokens |
220
+ | GPT-4o | 2.0x | 500 LLM tokens |
221
+ | Claude Sonnet 4 | 3.0x | 333 LLM tokens |
219
222
 
220
223
  See [token-kit.com](https://token-kit.com) for current package pricing and details.
221
224
 
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ interface Message {
8
8
  content: string;
9
9
  }
10
10
  interface ChatOptions {
11
- /** LLM model to use (default: 'gpt-3.5-turbo') */
11
+ /** LLM model to use (default: 'gpt-4o-mini') */
12
12
  model?: string;
13
13
  /** Maximum tokens in response (default: 500) */
14
14
  maxTokens?: number;
@@ -86,10 +86,28 @@ declare class TokenKitAPIError extends Error implements TokenKitError {
86
86
  details?: unknown;
87
87
  constructor(message: string, code: string, statusCode?: number, details?: unknown);
88
88
  }
89
+ /**
90
+ * Named deployment environments.
91
+ * Maps to the canonical API Gateway URLs for each environment.
92
+ * Use `baseUrl` to override for self-hosted or custom deployments.
93
+ */
94
+ type TokenKitEnvironment = 'production' | 'staging' | 'development';
95
+ /** Canonical base URLs per environment — exported for reference */
96
+ declare const ENVIRONMENT_URLS: Record<TokenKitEnvironment, string>;
89
97
  interface TokenKitConfig {
90
98
  /** Developer API key */
91
99
  apiKey: string;
92
- /** API Gateway base URL (default: https://api.token-kit.com) */
100
+ /**
101
+ * Named environment shorthand. Resolves to the canonical API URL.
102
+ * Ignored when `baseUrl` is also provided (baseUrl takes precedence).
103
+ * Defaults to `'production'` when neither is set.
104
+ */
105
+ environment?: TokenKitEnvironment;
106
+ /**
107
+ * Explicit API Gateway base URL.
108
+ * Use this for self-hosted deployments or local development.
109
+ * Takes precedence over `environment`.
110
+ */
93
111
  baseUrl?: string;
94
112
  /** Request timeout in milliseconds (default: 60000) */
95
113
  timeout?: number;
@@ -122,7 +140,11 @@ declare class TokenKit {
122
140
  *
123
141
  * @param config - Configuration options
124
142
  * @param config.apiKey - Your developer API key
125
- * @param config.baseUrl - API base URL (optional, defaults to production)
143
+ * @param config.environment - Target environment: 'production' | 'staging' | 'development'
144
+ * Resolves to the canonical API URL for that environment.
145
+ * Defaults to 'production'. Ignored when `baseUrl` is also set.
146
+ * @param config.baseUrl - Explicit API base URL — overrides `environment`.
147
+ * Use for self-hosted deployments or local tunnels.
126
148
  * @param config.timeout - Request timeout in ms (optional, defaults to 60000)
127
149
  */
128
150
  constructor(config: TokenKitConfig);
@@ -159,7 +181,7 @@ declare class TokenKit {
159
181
  * { role: 'system', content: 'You are a helpful assistant.' },
160
182
  * { role: 'user', content: 'Hello!' }
161
183
  * ], {
162
- * model: 'gpt-4',
184
+ * model: 'gpt-4o',
163
185
  * maxTokens: 200,
164
186
  * temperature: 0.8
165
187
  * });
@@ -200,9 +222,9 @@ declare class TokenKit {
200
222
  *
201
223
  * @example
202
224
  * ```typescript
203
- * const models = await tokenKit.getModels();
225
+ * const response = await tokenKit.getModels();
204
226
  * console.log('Available models:', models);
205
- * // ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo']
227
+ * // ['claude-3.5-haiku', 'claude-sonnet-4', 'nova-micro', 'nova-lite', 'gpt-4o', 'gpt-4o-mini']
206
228
  * ```
207
229
  */
208
230
  getModels(): Promise<string[]>;
@@ -229,4 +251,4 @@ declare class TokenKit {
229
251
  static assistant(content: string): Message;
230
252
  }
231
253
 
232
- export { type ChatOptions, type ChatResponse, type Message, type MessageRole, type ModelInfo, type ModelsResponse, TokenKit, TokenKitAPIError, type TokenKitConfig, type TokenValidationResponse, TokenKit as default };
254
+ export { type ChatOptions, type ChatResponse, ENVIRONMENT_URLS, type Message, type MessageRole, type ModelInfo, type ModelsResponse, TokenKit, TokenKitAPIError, type TokenKitConfig, type TokenKitEnvironment, type TokenValidationResponse, TokenKit as default };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ interface Message {
8
8
  content: string;
9
9
  }
10
10
  interface ChatOptions {
11
- /** LLM model to use (default: 'gpt-3.5-turbo') */
11
+ /** LLM model to use (default: 'gpt-4o-mini') */
12
12
  model?: string;
13
13
  /** Maximum tokens in response (default: 500) */
14
14
  maxTokens?: number;
@@ -86,10 +86,28 @@ declare class TokenKitAPIError extends Error implements TokenKitError {
86
86
  details?: unknown;
87
87
  constructor(message: string, code: string, statusCode?: number, details?: unknown);
88
88
  }
89
+ /**
90
+ * Named deployment environments.
91
+ * Maps to the canonical API Gateway URLs for each environment.
92
+ * Use `baseUrl` to override for self-hosted or custom deployments.
93
+ */
94
+ type TokenKitEnvironment = 'production' | 'staging' | 'development';
95
+ /** Canonical base URLs per environment — exported for reference */
96
+ declare const ENVIRONMENT_URLS: Record<TokenKitEnvironment, string>;
89
97
  interface TokenKitConfig {
90
98
  /** Developer API key */
91
99
  apiKey: string;
92
- /** API Gateway base URL (default: https://api.token-kit.com) */
100
+ /**
101
+ * Named environment shorthand. Resolves to the canonical API URL.
102
+ * Ignored when `baseUrl` is also provided (baseUrl takes precedence).
103
+ * Defaults to `'production'` when neither is set.
104
+ */
105
+ environment?: TokenKitEnvironment;
106
+ /**
107
+ * Explicit API Gateway base URL.
108
+ * Use this for self-hosted deployments or local development.
109
+ * Takes precedence over `environment`.
110
+ */
93
111
  baseUrl?: string;
94
112
  /** Request timeout in milliseconds (default: 60000) */
95
113
  timeout?: number;
@@ -122,7 +140,11 @@ declare class TokenKit {
122
140
  *
123
141
  * @param config - Configuration options
124
142
  * @param config.apiKey - Your developer API key
125
- * @param config.baseUrl - API base URL (optional, defaults to production)
143
+ * @param config.environment - Target environment: 'production' | 'staging' | 'development'
144
+ * Resolves to the canonical API URL for that environment.
145
+ * Defaults to 'production'. Ignored when `baseUrl` is also set.
146
+ * @param config.baseUrl - Explicit API base URL — overrides `environment`.
147
+ * Use for self-hosted deployments or local tunnels.
126
148
  * @param config.timeout - Request timeout in ms (optional, defaults to 60000)
127
149
  */
128
150
  constructor(config: TokenKitConfig);
@@ -159,7 +181,7 @@ declare class TokenKit {
159
181
  * { role: 'system', content: 'You are a helpful assistant.' },
160
182
  * { role: 'user', content: 'Hello!' }
161
183
  * ], {
162
- * model: 'gpt-4',
184
+ * model: 'gpt-4o',
163
185
  * maxTokens: 200,
164
186
  * temperature: 0.8
165
187
  * });
@@ -200,9 +222,9 @@ declare class TokenKit {
200
222
  *
201
223
  * @example
202
224
  * ```typescript
203
- * const models = await tokenKit.getModels();
225
+ * const response = await tokenKit.getModels();
204
226
  * console.log('Available models:', models);
205
- * // ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo']
227
+ * // ['claude-3.5-haiku', 'claude-sonnet-4', 'nova-micro', 'nova-lite', 'gpt-4o', 'gpt-4o-mini']
206
228
  * ```
207
229
  */
208
230
  getModels(): Promise<string[]>;
@@ -229,4 +251,4 @@ declare class TokenKit {
229
251
  static assistant(content: string): Message;
230
252
  }
231
253
 
232
- export { type ChatOptions, type ChatResponse, type Message, type MessageRole, type ModelInfo, type ModelsResponse, TokenKit, TokenKitAPIError, type TokenKitConfig, type TokenValidationResponse, TokenKit as default };
254
+ export { type ChatOptions, type ChatResponse, ENVIRONMENT_URLS, type Message, type MessageRole, type ModelInfo, type ModelsResponse, TokenKit, TokenKitAPIError, type TokenKitConfig, type TokenKitEnvironment, type TokenValidationResponse, TokenKit as default };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ ENVIRONMENT_URLS: () => ENVIRONMENT_URLS,
33
34
  TokenKit: () => TokenKit,
34
35
  TokenKitAPIError: () => TokenKitAPIError,
35
36
  default: () => index_default
@@ -50,6 +51,11 @@ var TokenKitAPIError = class extends Error {
50
51
  Error.captureStackTrace?.(this, this.constructor);
51
52
  }
52
53
  };
54
+ var ENVIRONMENT_URLS = {
55
+ production: "https://api.token-kit.com/v1",
56
+ staging: "https://api-staging.token-kit.com/v1",
57
+ development: "https://api-dev.token-kit.com/v1"
58
+ };
53
59
 
54
60
  // src/client.ts
55
61
  var TokenKitClient = class {
@@ -58,8 +64,9 @@ var TokenKitClient = class {
58
64
  throw new Error("API key is required");
59
65
  }
60
66
  this.apiKey = config.apiKey;
67
+ const baseURL = config.baseUrl ?? ENVIRONMENT_URLS[config.environment ?? "production"];
61
68
  this.client = import_axios.default.create({
62
- baseURL: config.baseUrl || "https://api.token-kit.com/api/v1",
69
+ baseURL,
63
70
  timeout: config.timeout || 6e4,
64
71
  headers: {
65
72
  "Content-Type": "application/json",
@@ -203,7 +210,11 @@ var TokenKit = class {
203
210
  *
204
211
  * @param config - Configuration options
205
212
  * @param config.apiKey - Your developer API key
206
- * @param config.baseUrl - API base URL (optional, defaults to production)
213
+ * @param config.environment - Target environment: 'production' | 'staging' | 'development'
214
+ * Resolves to the canonical API URL for that environment.
215
+ * Defaults to 'production'. Ignored when `baseUrl` is also set.
216
+ * @param config.baseUrl - Explicit API base URL — overrides `environment`.
217
+ * Use for self-hosted deployments or local tunnels.
207
218
  * @param config.timeout - Request timeout in ms (optional, defaults to 60000)
208
219
  */
209
220
  constructor(config) {
@@ -245,7 +256,7 @@ var TokenKit = class {
245
256
  * { role: 'system', content: 'You are a helpful assistant.' },
246
257
  * { role: 'user', content: 'Hello!' }
247
258
  * ], {
248
- * model: 'gpt-4',
259
+ * model: 'gpt-4o',
249
260
  * maxTokens: 200,
250
261
  * temperature: 0.8
251
262
  * });
@@ -315,9 +326,9 @@ var TokenKit = class {
315
326
  *
316
327
  * @example
317
328
  * ```typescript
318
- * const models = await tokenKit.getModels();
329
+ * const response = await tokenKit.getModels();
319
330
  * console.log('Available models:', models);
320
- * // ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo']
331
+ * // ['claude-3.5-haiku', 'claude-sonnet-4', 'nova-micro', 'nova-lite', 'gpt-4o', 'gpt-4o-mini']
321
332
  * ```
322
333
  */
323
334
  async getModels() {
@@ -354,6 +365,7 @@ var TokenKit = class {
354
365
  var index_default = TokenKit;
355
366
  // Annotate the CommonJS export names for ESM import in node:
356
367
  0 && (module.exports = {
368
+ ENVIRONMENT_URLS,
357
369
  TokenKit,
358
370
  TokenKitAPIError
359
371
  });
package/dist/index.mjs CHANGED
@@ -12,6 +12,11 @@ var TokenKitAPIError = class extends Error {
12
12
  Error.captureStackTrace?.(this, this.constructor);
13
13
  }
14
14
  };
15
+ var ENVIRONMENT_URLS = {
16
+ production: "https://api.token-kit.com/v1",
17
+ staging: "https://api-staging.token-kit.com/v1",
18
+ development: "https://api-dev.token-kit.com/v1"
19
+ };
15
20
 
16
21
  // src/client.ts
17
22
  var TokenKitClient = class {
@@ -20,8 +25,9 @@ var TokenKitClient = class {
20
25
  throw new Error("API key is required");
21
26
  }
22
27
  this.apiKey = config.apiKey;
28
+ const baseURL = config.baseUrl ?? ENVIRONMENT_URLS[config.environment ?? "production"];
23
29
  this.client = axios.create({
24
- baseURL: config.baseUrl || "https://api.token-kit.com/api/v1",
30
+ baseURL,
25
31
  timeout: config.timeout || 6e4,
26
32
  headers: {
27
33
  "Content-Type": "application/json",
@@ -165,7 +171,11 @@ var TokenKit = class {
165
171
  *
166
172
  * @param config - Configuration options
167
173
  * @param config.apiKey - Your developer API key
168
- * @param config.baseUrl - API base URL (optional, defaults to production)
174
+ * @param config.environment - Target environment: 'production' | 'staging' | 'development'
175
+ * Resolves to the canonical API URL for that environment.
176
+ * Defaults to 'production'. Ignored when `baseUrl` is also set.
177
+ * @param config.baseUrl - Explicit API base URL — overrides `environment`.
178
+ * Use for self-hosted deployments or local tunnels.
169
179
  * @param config.timeout - Request timeout in ms (optional, defaults to 60000)
170
180
  */
171
181
  constructor(config) {
@@ -207,7 +217,7 @@ var TokenKit = class {
207
217
  * { role: 'system', content: 'You are a helpful assistant.' },
208
218
  * { role: 'user', content: 'Hello!' }
209
219
  * ], {
210
- * model: 'gpt-4',
220
+ * model: 'gpt-4o',
211
221
  * maxTokens: 200,
212
222
  * temperature: 0.8
213
223
  * });
@@ -277,9 +287,9 @@ var TokenKit = class {
277
287
  *
278
288
  * @example
279
289
  * ```typescript
280
- * const models = await tokenKit.getModels();
290
+ * const response = await tokenKit.getModels();
281
291
  * console.log('Available models:', models);
282
- * // ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo']
292
+ * // ['claude-3.5-haiku', 'claude-sonnet-4', 'nova-micro', 'nova-lite', 'gpt-4o', 'gpt-4o-mini']
283
293
  * ```
284
294
  */
285
295
  async getModels() {
@@ -315,6 +325,7 @@ var TokenKit = class {
315
325
  };
316
326
  var index_default = TokenKit;
317
327
  export {
328
+ ENVIRONMENT_URLS,
318
329
  TokenKit,
319
330
  TokenKitAPIError,
320
331
  index_default as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codetunezstudios/token-kit",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Official TypeScript SDK for token-kit - AI token infrastructure for developers",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,7 +33,8 @@
33
33
  "openai",
34
34
  "gpt",
35
35
  "claude",
36
- "gemini",
36
+ "bedrock",
37
+ "amazon-nova",
37
38
  "tokens",
38
39
  "sdk",
39
40
  "typescript",