pricetoken 0.5.0 → 0.6.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/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +49 -5
- package/dist/index.mjs +49 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -57,11 +57,15 @@ interface PriceTokenError {
|
|
|
57
57
|
interface ClientOptions {
|
|
58
58
|
baseUrl?: string;
|
|
59
59
|
apiKey?: string;
|
|
60
|
+
telemetry?: boolean;
|
|
60
61
|
}
|
|
61
62
|
declare class PriceTokenClient {
|
|
62
63
|
private readonly baseUrl;
|
|
63
64
|
private readonly apiKey?;
|
|
65
|
+
private readonly telemetryEnabled;
|
|
66
|
+
private telemetrySent;
|
|
64
67
|
constructor(options?: ClientOptions);
|
|
68
|
+
private sendTelemetry;
|
|
65
69
|
private request;
|
|
66
70
|
getPricing(opts?: {
|
|
67
71
|
provider?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -57,11 +57,15 @@ interface PriceTokenError {
|
|
|
57
57
|
interface ClientOptions {
|
|
58
58
|
baseUrl?: string;
|
|
59
59
|
apiKey?: string;
|
|
60
|
+
telemetry?: boolean;
|
|
60
61
|
}
|
|
61
62
|
declare class PriceTokenClient {
|
|
62
63
|
private readonly baseUrl;
|
|
63
64
|
private readonly apiKey?;
|
|
65
|
+
private readonly telemetryEnabled;
|
|
66
|
+
private telemetrySent;
|
|
64
67
|
constructor(options?: ClientOptions);
|
|
68
|
+
private sendTelemetry;
|
|
65
69
|
private request;
|
|
66
70
|
getPricing(opts?: {
|
|
67
71
|
provider?: string;
|
package/dist/index.js
CHANGED
|
@@ -28,14 +28,30 @@ __export(index_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
30
|
// src/client.ts
|
|
31
|
+
var SDK_VERSION = "0.6.0";
|
|
31
32
|
var PriceTokenClient = class {
|
|
32
33
|
baseUrl;
|
|
33
34
|
apiKey;
|
|
35
|
+
telemetryEnabled;
|
|
36
|
+
telemetrySent = false;
|
|
34
37
|
constructor(options) {
|
|
35
38
|
this.baseUrl = (options?.baseUrl ?? "https://pricetoken.ai").replace(/\/$/, "");
|
|
36
39
|
this.apiKey = options?.apiKey;
|
|
40
|
+
this.telemetryEnabled = options?.telemetry ?? false;
|
|
41
|
+
}
|
|
42
|
+
sendTelemetry() {
|
|
43
|
+
if (!this.telemetryEnabled || this.telemetrySent) return;
|
|
44
|
+
this.telemetrySent = true;
|
|
45
|
+
const runtime = typeof globalThis.process !== "undefined" ? `node-${globalThis.process.version?.replace("v", "") ?? "unknown"}` : "browser";
|
|
46
|
+
fetch(`${this.baseUrl}/api/v1/telemetry`, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: { "Content-Type": "application/json" },
|
|
49
|
+
body: JSON.stringify({ sdk: "js", version: SDK_VERSION, runtime })
|
|
50
|
+
}).catch(() => {
|
|
51
|
+
});
|
|
37
52
|
}
|
|
38
53
|
async request(path) {
|
|
54
|
+
this.sendTelemetry();
|
|
39
55
|
const headers = {
|
|
40
56
|
"Content-Type": "application/json"
|
|
41
57
|
};
|
|
@@ -433,7 +449,7 @@ var STATIC_PRICING = [
|
|
|
433
449
|
status: "active",
|
|
434
450
|
confidence: "high",
|
|
435
451
|
lastUpdated: null,
|
|
436
|
-
launchDate:
|
|
452
|
+
launchDate: "2025-07-22"
|
|
437
453
|
},
|
|
438
454
|
{
|
|
439
455
|
modelId: "gemini-3.1-pro-preview",
|
|
@@ -447,7 +463,35 @@ var STATIC_PRICING = [
|
|
|
447
463
|
status: "preview",
|
|
448
464
|
confidence: "high",
|
|
449
465
|
lastUpdated: null,
|
|
450
|
-
launchDate:
|
|
466
|
+
launchDate: "2026-02-19"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
modelId: "gemini-3.1-flash-lite-preview",
|
|
470
|
+
provider: "google",
|
|
471
|
+
displayName: "Gemini 3.1 Flash-Lite Preview",
|
|
472
|
+
inputPerMTok: 0.25,
|
|
473
|
+
outputPerMTok: 1.5,
|
|
474
|
+
contextWindow: 1048576,
|
|
475
|
+
maxOutputTokens: 65536,
|
|
476
|
+
source: "seed",
|
|
477
|
+
status: "preview",
|
|
478
|
+
confidence: "high",
|
|
479
|
+
lastUpdated: null,
|
|
480
|
+
launchDate: "2026-03-03"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
modelId: "gemini-3-pro-preview",
|
|
484
|
+
provider: "google",
|
|
485
|
+
displayName: "Gemini 3 Pro Preview",
|
|
486
|
+
inputPerMTok: 2,
|
|
487
|
+
outputPerMTok: 12,
|
|
488
|
+
contextWindow: 1048576,
|
|
489
|
+
maxOutputTokens: 65536,
|
|
490
|
+
source: "seed",
|
|
491
|
+
status: "preview",
|
|
492
|
+
confidence: "high",
|
|
493
|
+
lastUpdated: null,
|
|
494
|
+
launchDate: "2025-11-20"
|
|
451
495
|
},
|
|
452
496
|
{
|
|
453
497
|
modelId: "gemini-3-flash-preview",
|
|
@@ -461,7 +505,7 @@ var STATIC_PRICING = [
|
|
|
461
505
|
status: "preview",
|
|
462
506
|
confidence: "high",
|
|
463
507
|
lastUpdated: null,
|
|
464
|
-
launchDate:
|
|
508
|
+
launchDate: "2025-12-17"
|
|
465
509
|
},
|
|
466
510
|
// DeepSeek
|
|
467
511
|
{
|
|
@@ -505,7 +549,7 @@ var STATIC_PRICING = [
|
|
|
505
549
|
status: "active",
|
|
506
550
|
confidence: "high",
|
|
507
551
|
lastUpdated: null,
|
|
508
|
-
launchDate:
|
|
552
|
+
launchDate: "2025-07-09"
|
|
509
553
|
},
|
|
510
554
|
{
|
|
511
555
|
modelId: "grok-4.1-fast",
|
|
@@ -519,7 +563,7 @@ var STATIC_PRICING = [
|
|
|
519
563
|
status: "active",
|
|
520
564
|
confidence: "high",
|
|
521
565
|
lastUpdated: null,
|
|
522
|
-
launchDate:
|
|
566
|
+
launchDate: "2025-11-19"
|
|
523
567
|
},
|
|
524
568
|
{
|
|
525
569
|
modelId: "grok-3",
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
// src/client.ts
|
|
2
|
+
var SDK_VERSION = "0.6.0";
|
|
2
3
|
var PriceTokenClient = class {
|
|
3
4
|
baseUrl;
|
|
4
5
|
apiKey;
|
|
6
|
+
telemetryEnabled;
|
|
7
|
+
telemetrySent = false;
|
|
5
8
|
constructor(options) {
|
|
6
9
|
this.baseUrl = (options?.baseUrl ?? "https://pricetoken.ai").replace(/\/$/, "");
|
|
7
10
|
this.apiKey = options?.apiKey;
|
|
11
|
+
this.telemetryEnabled = options?.telemetry ?? false;
|
|
12
|
+
}
|
|
13
|
+
sendTelemetry() {
|
|
14
|
+
if (!this.telemetryEnabled || this.telemetrySent) return;
|
|
15
|
+
this.telemetrySent = true;
|
|
16
|
+
const runtime = typeof globalThis.process !== "undefined" ? `node-${globalThis.process.version?.replace("v", "") ?? "unknown"}` : "browser";
|
|
17
|
+
fetch(`${this.baseUrl}/api/v1/telemetry`, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
headers: { "Content-Type": "application/json" },
|
|
20
|
+
body: JSON.stringify({ sdk: "js", version: SDK_VERSION, runtime })
|
|
21
|
+
}).catch(() => {
|
|
22
|
+
});
|
|
8
23
|
}
|
|
9
24
|
async request(path) {
|
|
25
|
+
this.sendTelemetry();
|
|
10
26
|
const headers = {
|
|
11
27
|
"Content-Type": "application/json"
|
|
12
28
|
};
|
|
@@ -404,7 +420,7 @@ var STATIC_PRICING = [
|
|
|
404
420
|
status: "active",
|
|
405
421
|
confidence: "high",
|
|
406
422
|
lastUpdated: null,
|
|
407
|
-
launchDate:
|
|
423
|
+
launchDate: "2025-07-22"
|
|
408
424
|
},
|
|
409
425
|
{
|
|
410
426
|
modelId: "gemini-3.1-pro-preview",
|
|
@@ -418,7 +434,35 @@ var STATIC_PRICING = [
|
|
|
418
434
|
status: "preview",
|
|
419
435
|
confidence: "high",
|
|
420
436
|
lastUpdated: null,
|
|
421
|
-
launchDate:
|
|
437
|
+
launchDate: "2026-02-19"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
modelId: "gemini-3.1-flash-lite-preview",
|
|
441
|
+
provider: "google",
|
|
442
|
+
displayName: "Gemini 3.1 Flash-Lite Preview",
|
|
443
|
+
inputPerMTok: 0.25,
|
|
444
|
+
outputPerMTok: 1.5,
|
|
445
|
+
contextWindow: 1048576,
|
|
446
|
+
maxOutputTokens: 65536,
|
|
447
|
+
source: "seed",
|
|
448
|
+
status: "preview",
|
|
449
|
+
confidence: "high",
|
|
450
|
+
lastUpdated: null,
|
|
451
|
+
launchDate: "2026-03-03"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
modelId: "gemini-3-pro-preview",
|
|
455
|
+
provider: "google",
|
|
456
|
+
displayName: "Gemini 3 Pro Preview",
|
|
457
|
+
inputPerMTok: 2,
|
|
458
|
+
outputPerMTok: 12,
|
|
459
|
+
contextWindow: 1048576,
|
|
460
|
+
maxOutputTokens: 65536,
|
|
461
|
+
source: "seed",
|
|
462
|
+
status: "preview",
|
|
463
|
+
confidence: "high",
|
|
464
|
+
lastUpdated: null,
|
|
465
|
+
launchDate: "2025-11-20"
|
|
422
466
|
},
|
|
423
467
|
{
|
|
424
468
|
modelId: "gemini-3-flash-preview",
|
|
@@ -432,7 +476,7 @@ var STATIC_PRICING = [
|
|
|
432
476
|
status: "preview",
|
|
433
477
|
confidence: "high",
|
|
434
478
|
lastUpdated: null,
|
|
435
|
-
launchDate:
|
|
479
|
+
launchDate: "2025-12-17"
|
|
436
480
|
},
|
|
437
481
|
// DeepSeek
|
|
438
482
|
{
|
|
@@ -476,7 +520,7 @@ var STATIC_PRICING = [
|
|
|
476
520
|
status: "active",
|
|
477
521
|
confidence: "high",
|
|
478
522
|
lastUpdated: null,
|
|
479
|
-
launchDate:
|
|
523
|
+
launchDate: "2025-07-09"
|
|
480
524
|
},
|
|
481
525
|
{
|
|
482
526
|
modelId: "grok-4.1-fast",
|
|
@@ -490,7 +534,7 @@ var STATIC_PRICING = [
|
|
|
490
534
|
status: "active",
|
|
491
535
|
confidence: "high",
|
|
492
536
|
lastUpdated: null,
|
|
493
|
-
launchDate:
|
|
537
|
+
launchDate: "2025-11-19"
|
|
494
538
|
},
|
|
495
539
|
{
|
|
496
540
|
modelId: "grok-3",
|