pricetoken 0.12.0 → 0.13.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/dist/index.d.mts CHANGED
@@ -264,6 +264,47 @@ interface SttProviderSummary {
264
264
  modelCount: number;
265
265
  cheapestCostPerMinute: number;
266
266
  }
267
+ interface MusicModelPricing {
268
+ modelId: string;
269
+ provider: string;
270
+ displayName: string;
271
+ costPerMinute: number;
272
+ maxDuration: number | null;
273
+ outputFormat: string | null;
274
+ vocals: boolean | null;
275
+ official: boolean;
276
+ pricingNote: string | null;
277
+ source: 'fetched' | 'seed' | 'admin' | 'verified' | 'carried';
278
+ status: ModelStatus | null;
279
+ confidence: DataConfidence;
280
+ confidenceScore: number;
281
+ confidenceLevel: ConfidenceLevel;
282
+ freshness: FreshnessInfo;
283
+ lastUpdated: string | null;
284
+ launchDate: string | null;
285
+ }
286
+ interface MusicCostEstimate {
287
+ modelId: string;
288
+ durationSeconds: number;
289
+ costPerMinute: number;
290
+ totalCost: number;
291
+ }
292
+ interface MusicPriceHistoryPoint {
293
+ date: string;
294
+ costPerMinute: number;
295
+ }
296
+ interface MusicModelHistory {
297
+ modelId: string;
298
+ provider: string;
299
+ displayName: string;
300
+ history: MusicPriceHistoryPoint[];
301
+ }
302
+ interface MusicProviderSummary {
303
+ id: string;
304
+ displayName: string;
305
+ modelCount: number;
306
+ cheapestCostPerMinute: number;
307
+ }
267
308
 
268
309
  interface ClientOptions {
269
310
  baseUrl?: string;
@@ -422,6 +463,30 @@ declare class PriceTokenClient {
422
463
  after?: string;
423
464
  before?: string;
424
465
  }): Promise<SttModelPricing>;
466
+ getMusicPricing(opts?: {
467
+ provider?: string;
468
+ currency?: string;
469
+ after?: string;
470
+ before?: string;
471
+ }): Promise<MusicModelPricing[]>;
472
+ getMusicModel(modelId: string, opts?: {
473
+ currency?: string;
474
+ }): Promise<MusicModelPricing>;
475
+ getMusicHistory(opts?: {
476
+ days?: number;
477
+ modelId?: string;
478
+ provider?: string;
479
+ }): Promise<MusicModelHistory[]>;
480
+ getMusicProviders(): Promise<MusicProviderSummary[]>;
481
+ compareMusicModels(modelIds: string[], opts?: {
482
+ currency?: string;
483
+ }): Promise<MusicModelPricing[]>;
484
+ getCheapestMusicModel(opts?: {
485
+ provider?: string;
486
+ currency?: string;
487
+ after?: string;
488
+ before?: string;
489
+ }): Promise<MusicModelPricing>;
425
490
  }
426
491
 
427
492
  declare function calculateCost(modelId: string, inputPerMTok: number, outputPerMTok: number, inputTokens: number, outputTokens: number): CostEstimate;
@@ -442,6 +507,9 @@ declare function calculateTtsModelCost(modelId: string, characters: number, pric
442
507
  declare function calculateSttCost(modelId: string, costPerMinute: number, durationSeconds: number): SttCostEstimate;
443
508
  declare function calculateSttModelCost(modelId: string, durationSeconds: number, pricing?: SttModelPricing[]): SttCostEstimate;
444
509
 
510
+ declare function calculateMusicCost(modelId: string, costPerMinute: number, durationSeconds: number): MusicCostEstimate;
511
+ declare function calculateMusicModelCost(modelId: string, durationSeconds: number, pricing?: MusicModelPricing[]): MusicCostEstimate;
512
+
445
513
  declare const STATIC_PRICING: ModelPricing[];
446
514
 
447
515
  declare const STATIC_IMAGE_PRICING: ImageModelPricing[];
@@ -454,4 +522,6 @@ declare const STATIC_TTS_PRICING: TtsModelPricing[];
454
522
 
455
523
  declare const STATIC_STT_PRICING: SttModelPricing[];
456
524
 
457
- export { type AvatarCostEstimate, type AvatarModelHistory, type AvatarModelPricing, type AvatarPriceHistoryPoint, type AvatarProviderSummary, type ClientOptions, type ConfidenceLevel, type CostEstimate, type DataConfidence, type FreshnessInfo, type ImageCostEstimate, type ImageModelHistory, type ImageModelPricing, type ImagePriceHistoryPoint, type ImageProviderSummary, type ImageQualityTier, type ModelHistory, type ModelPricing, type ModelStatus, type PriceHistoryPoint, PriceTokenClient, type PriceTokenError, type PriceTokenResponse, type ProviderSummary, STATIC_AVATAR_PRICING, STATIC_IMAGE_PRICING, STATIC_PRICING, STATIC_STT_PRICING, STATIC_TTS_PRICING, STATIC_VIDEO_PRICING, type SttCostEstimate, type SttModelHistory, type SttModelPricing, type SttPriceHistoryPoint, type SttProviderSummary, type TtsCostEstimate, type TtsModelHistory, type TtsModelPricing, type TtsPriceHistoryPoint, type TtsProviderSummary, type VideoCostEstimate, type VideoInputType, type VideoModelHistory, type VideoModelPricing, type VideoPriceHistoryPoint, type VideoProviderSummary, calculateAvatarCost, calculateAvatarModelCost, calculateCost, calculateImageCost, calculateImageModelCost, calculateModelCost, calculateSttCost, calculateSttModelCost, calculateTtsCost, calculateTtsModelCost, calculateVideoCost, calculateVideoModelCost };
525
+ declare const STATIC_MUSIC_PRICING: MusicModelPricing[];
526
+
527
+ export { type AvatarCostEstimate, type AvatarModelHistory, type AvatarModelPricing, type AvatarPriceHistoryPoint, type AvatarProviderSummary, type ClientOptions, type ConfidenceLevel, type CostEstimate, type DataConfidence, type FreshnessInfo, type ImageCostEstimate, type ImageModelHistory, type ImageModelPricing, type ImagePriceHistoryPoint, type ImageProviderSummary, type ImageQualityTier, type ModelHistory, type ModelPricing, type ModelStatus, type MusicCostEstimate, type MusicModelHistory, type MusicModelPricing, type MusicPriceHistoryPoint, type MusicProviderSummary, type PriceHistoryPoint, PriceTokenClient, type PriceTokenError, type PriceTokenResponse, type ProviderSummary, STATIC_AVATAR_PRICING, STATIC_IMAGE_PRICING, STATIC_MUSIC_PRICING, STATIC_PRICING, STATIC_STT_PRICING, STATIC_TTS_PRICING, STATIC_VIDEO_PRICING, type SttCostEstimate, type SttModelHistory, type SttModelPricing, type SttPriceHistoryPoint, type SttProviderSummary, type TtsCostEstimate, type TtsModelHistory, type TtsModelPricing, type TtsPriceHistoryPoint, type TtsProviderSummary, type VideoCostEstimate, type VideoInputType, type VideoModelHistory, type VideoModelPricing, type VideoPriceHistoryPoint, type VideoProviderSummary, calculateAvatarCost, calculateAvatarModelCost, calculateCost, calculateImageCost, calculateImageModelCost, calculateModelCost, calculateMusicCost, calculateMusicModelCost, calculateSttCost, calculateSttModelCost, calculateTtsCost, calculateTtsModelCost, calculateVideoCost, calculateVideoModelCost };
package/dist/index.d.ts CHANGED
@@ -264,6 +264,47 @@ interface SttProviderSummary {
264
264
  modelCount: number;
265
265
  cheapestCostPerMinute: number;
266
266
  }
267
+ interface MusicModelPricing {
268
+ modelId: string;
269
+ provider: string;
270
+ displayName: string;
271
+ costPerMinute: number;
272
+ maxDuration: number | null;
273
+ outputFormat: string | null;
274
+ vocals: boolean | null;
275
+ official: boolean;
276
+ pricingNote: string | null;
277
+ source: 'fetched' | 'seed' | 'admin' | 'verified' | 'carried';
278
+ status: ModelStatus | null;
279
+ confidence: DataConfidence;
280
+ confidenceScore: number;
281
+ confidenceLevel: ConfidenceLevel;
282
+ freshness: FreshnessInfo;
283
+ lastUpdated: string | null;
284
+ launchDate: string | null;
285
+ }
286
+ interface MusicCostEstimate {
287
+ modelId: string;
288
+ durationSeconds: number;
289
+ costPerMinute: number;
290
+ totalCost: number;
291
+ }
292
+ interface MusicPriceHistoryPoint {
293
+ date: string;
294
+ costPerMinute: number;
295
+ }
296
+ interface MusicModelHistory {
297
+ modelId: string;
298
+ provider: string;
299
+ displayName: string;
300
+ history: MusicPriceHistoryPoint[];
301
+ }
302
+ interface MusicProviderSummary {
303
+ id: string;
304
+ displayName: string;
305
+ modelCount: number;
306
+ cheapestCostPerMinute: number;
307
+ }
267
308
 
268
309
  interface ClientOptions {
269
310
  baseUrl?: string;
@@ -422,6 +463,30 @@ declare class PriceTokenClient {
422
463
  after?: string;
423
464
  before?: string;
424
465
  }): Promise<SttModelPricing>;
466
+ getMusicPricing(opts?: {
467
+ provider?: string;
468
+ currency?: string;
469
+ after?: string;
470
+ before?: string;
471
+ }): Promise<MusicModelPricing[]>;
472
+ getMusicModel(modelId: string, opts?: {
473
+ currency?: string;
474
+ }): Promise<MusicModelPricing>;
475
+ getMusicHistory(opts?: {
476
+ days?: number;
477
+ modelId?: string;
478
+ provider?: string;
479
+ }): Promise<MusicModelHistory[]>;
480
+ getMusicProviders(): Promise<MusicProviderSummary[]>;
481
+ compareMusicModels(modelIds: string[], opts?: {
482
+ currency?: string;
483
+ }): Promise<MusicModelPricing[]>;
484
+ getCheapestMusicModel(opts?: {
485
+ provider?: string;
486
+ currency?: string;
487
+ after?: string;
488
+ before?: string;
489
+ }): Promise<MusicModelPricing>;
425
490
  }
426
491
 
427
492
  declare function calculateCost(modelId: string, inputPerMTok: number, outputPerMTok: number, inputTokens: number, outputTokens: number): CostEstimate;
@@ -442,6 +507,9 @@ declare function calculateTtsModelCost(modelId: string, characters: number, pric
442
507
  declare function calculateSttCost(modelId: string, costPerMinute: number, durationSeconds: number): SttCostEstimate;
443
508
  declare function calculateSttModelCost(modelId: string, durationSeconds: number, pricing?: SttModelPricing[]): SttCostEstimate;
444
509
 
510
+ declare function calculateMusicCost(modelId: string, costPerMinute: number, durationSeconds: number): MusicCostEstimate;
511
+ declare function calculateMusicModelCost(modelId: string, durationSeconds: number, pricing?: MusicModelPricing[]): MusicCostEstimate;
512
+
445
513
  declare const STATIC_PRICING: ModelPricing[];
446
514
 
447
515
  declare const STATIC_IMAGE_PRICING: ImageModelPricing[];
@@ -454,4 +522,6 @@ declare const STATIC_TTS_PRICING: TtsModelPricing[];
454
522
 
455
523
  declare const STATIC_STT_PRICING: SttModelPricing[];
456
524
 
457
- export { type AvatarCostEstimate, type AvatarModelHistory, type AvatarModelPricing, type AvatarPriceHistoryPoint, type AvatarProviderSummary, type ClientOptions, type ConfidenceLevel, type CostEstimate, type DataConfidence, type FreshnessInfo, type ImageCostEstimate, type ImageModelHistory, type ImageModelPricing, type ImagePriceHistoryPoint, type ImageProviderSummary, type ImageQualityTier, type ModelHistory, type ModelPricing, type ModelStatus, type PriceHistoryPoint, PriceTokenClient, type PriceTokenError, type PriceTokenResponse, type ProviderSummary, STATIC_AVATAR_PRICING, STATIC_IMAGE_PRICING, STATIC_PRICING, STATIC_STT_PRICING, STATIC_TTS_PRICING, STATIC_VIDEO_PRICING, type SttCostEstimate, type SttModelHistory, type SttModelPricing, type SttPriceHistoryPoint, type SttProviderSummary, type TtsCostEstimate, type TtsModelHistory, type TtsModelPricing, type TtsPriceHistoryPoint, type TtsProviderSummary, type VideoCostEstimate, type VideoInputType, type VideoModelHistory, type VideoModelPricing, type VideoPriceHistoryPoint, type VideoProviderSummary, calculateAvatarCost, calculateAvatarModelCost, calculateCost, calculateImageCost, calculateImageModelCost, calculateModelCost, calculateSttCost, calculateSttModelCost, calculateTtsCost, calculateTtsModelCost, calculateVideoCost, calculateVideoModelCost };
525
+ declare const STATIC_MUSIC_PRICING: MusicModelPricing[];
526
+
527
+ export { type AvatarCostEstimate, type AvatarModelHistory, type AvatarModelPricing, type AvatarPriceHistoryPoint, type AvatarProviderSummary, type ClientOptions, type ConfidenceLevel, type CostEstimate, type DataConfidence, type FreshnessInfo, type ImageCostEstimate, type ImageModelHistory, type ImageModelPricing, type ImagePriceHistoryPoint, type ImageProviderSummary, type ImageQualityTier, type ModelHistory, type ModelPricing, type ModelStatus, type MusicCostEstimate, type MusicModelHistory, type MusicModelPricing, type MusicPriceHistoryPoint, type MusicProviderSummary, type PriceHistoryPoint, PriceTokenClient, type PriceTokenError, type PriceTokenResponse, type ProviderSummary, STATIC_AVATAR_PRICING, STATIC_IMAGE_PRICING, STATIC_MUSIC_PRICING, STATIC_PRICING, STATIC_STT_PRICING, STATIC_TTS_PRICING, STATIC_VIDEO_PRICING, type SttCostEstimate, type SttModelHistory, type SttModelPricing, type SttPriceHistoryPoint, type SttProviderSummary, type TtsCostEstimate, type TtsModelHistory, type TtsModelPricing, type TtsPriceHistoryPoint, type TtsProviderSummary, type VideoCostEstimate, type VideoInputType, type VideoModelHistory, type VideoModelPricing, type VideoPriceHistoryPoint, type VideoProviderSummary, calculateAvatarCost, calculateAvatarModelCost, calculateCost, calculateImageCost, calculateImageModelCost, calculateModelCost, calculateMusicCost, calculateMusicModelCost, calculateSttCost, calculateSttModelCost, calculateTtsCost, calculateTtsModelCost, calculateVideoCost, calculateVideoModelCost };
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  PriceTokenClient: () => PriceTokenClient,
24
24
  STATIC_AVATAR_PRICING: () => STATIC_AVATAR_PRICING,
25
25
  STATIC_IMAGE_PRICING: () => STATIC_IMAGE_PRICING,
26
+ STATIC_MUSIC_PRICING: () => STATIC_MUSIC_PRICING,
26
27
  STATIC_PRICING: () => STATIC_PRICING,
27
28
  STATIC_STT_PRICING: () => STATIC_STT_PRICING,
28
29
  STATIC_TTS_PRICING: () => STATIC_TTS_PRICING,
@@ -33,6 +34,8 @@ __export(index_exports, {
33
34
  calculateImageCost: () => calculateImageCost,
34
35
  calculateImageModelCost: () => calculateImageModelCost,
35
36
  calculateModelCost: () => calculateModelCost,
37
+ calculateMusicCost: () => calculateMusicCost,
38
+ calculateMusicModelCost: () => calculateMusicModelCost,
36
39
  calculateSttCost: () => calculateSttCost,
37
40
  calculateSttModelCost: () => calculateSttModelCost,
38
41
  calculateTtsCost: () => calculateTtsCost,
@@ -328,6 +331,47 @@ var PriceTokenClient = class {
328
331
  const qs = params.toString();
329
332
  return this.request(`/api/v1/stt/cheapest${qs ? `?${qs}` : ""}`);
330
333
  }
334
+ // Music pricing methods
335
+ async getMusicPricing(opts) {
336
+ const params = new URLSearchParams();
337
+ if (opts?.provider) params.set("provider", opts.provider);
338
+ if (opts?.currency) params.set("currency", opts.currency);
339
+ if (opts?.after) params.set("after", opts.after);
340
+ if (opts?.before) params.set("before", opts.before);
341
+ const qs = params.toString();
342
+ return this.request(`/api/v1/music${qs ? `?${qs}` : ""}`);
343
+ }
344
+ async getMusicModel(modelId, opts) {
345
+ const params = new URLSearchParams();
346
+ if (opts?.currency) params.set("currency", opts.currency);
347
+ const qs = params.toString();
348
+ return this.request(`/api/v1/music/${encodeURIComponent(modelId)}${qs ? `?${qs}` : ""}`);
349
+ }
350
+ async getMusicHistory(opts) {
351
+ const params = new URLSearchParams();
352
+ if (opts?.days) params.set("days", String(opts.days));
353
+ if (opts?.modelId) params.set("modelId", opts.modelId);
354
+ if (opts?.provider) params.set("provider", opts.provider);
355
+ const qs = params.toString();
356
+ return this.request(`/api/v1/music/history${qs ? `?${qs}` : ""}`);
357
+ }
358
+ async getMusicProviders() {
359
+ return this.request("/api/v1/music/providers");
360
+ }
361
+ async compareMusicModels(modelIds, opts) {
362
+ const params = new URLSearchParams({ models: modelIds.join(",") });
363
+ if (opts?.currency) params.set("currency", opts.currency);
364
+ return this.request(`/api/v1/music/compare?${params}`);
365
+ }
366
+ async getCheapestMusicModel(opts) {
367
+ const params = new URLSearchParams();
368
+ if (opts?.provider) params.set("provider", opts.provider);
369
+ if (opts?.currency) params.set("currency", opts.currency);
370
+ if (opts?.after) params.set("after", opts.after);
371
+ if (opts?.before) params.set("before", opts.before);
372
+ const qs = params.toString();
373
+ return this.request(`/api/v1/music/cheapest${qs ? `?${qs}` : ""}`);
374
+ }
331
375
  };
332
376
 
333
377
  // src/static.ts
@@ -5397,11 +5441,168 @@ function calculateSttModelCost(modelId, durationSeconds, pricing) {
5397
5441
  }
5398
5442
  return calculateSttCost(modelId, model.costPerMinute, durationSeconds);
5399
5443
  }
5444
+
5445
+ // src/music-static.ts
5446
+ var STATIC_MUSIC_PRICING = [
5447
+ {
5448
+ modelId: "elevenlabs-eleven-music",
5449
+ provider: "elevenlabs",
5450
+ displayName: "ElevenLabs Eleven Music",
5451
+ costPerMinute: 0.5,
5452
+ maxDuration: null,
5453
+ outputFormat: "mp3",
5454
+ vocals: true,
5455
+ official: true,
5456
+ pricingNote: null,
5457
+ source: "seed",
5458
+ status: "active",
5459
+ confidence: "high",
5460
+ confidenceScore: 99,
5461
+ confidenceLevel: "high",
5462
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5463
+ lastUpdated: null,
5464
+ launchDate: "2025-06-01"
5465
+ },
5466
+ {
5467
+ modelId: "soundverse-music",
5468
+ provider: "soundverse",
5469
+ displayName: "Soundverse Music Generation",
5470
+ costPerMinute: 0.0125,
5471
+ maxDuration: 240,
5472
+ outputFormat: "mp3",
5473
+ vocals: true,
5474
+ official: true,
5475
+ pricingNote: "Approximated from ~$0.05/song at ~4 min avg",
5476
+ source: "seed",
5477
+ status: "active",
5478
+ confidence: "high",
5479
+ confidenceScore: 99,
5480
+ confidenceLevel: "high",
5481
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5482
+ lastUpdated: null,
5483
+ launchDate: "2025-01-01"
5484
+ },
5485
+ {
5486
+ modelId: "sunoapi-suno-v4",
5487
+ provider: "sunoapi",
5488
+ displayName: "Suno v4 via SunoAPI.org",
5489
+ costPerMinute: 75e-4,
5490
+ maxDuration: 240,
5491
+ outputFormat: "mp3",
5492
+ vocals: true,
5493
+ official: false,
5494
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 4 min max",
5495
+ source: "seed",
5496
+ status: "active",
5497
+ confidence: "high",
5498
+ confidenceScore: 99,
5499
+ confidenceLevel: "high",
5500
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5501
+ lastUpdated: null,
5502
+ launchDate: "2024-05-01"
5503
+ },
5504
+ {
5505
+ modelId: "sunoapi-suno-v4.5",
5506
+ provider: "sunoapi",
5507
+ displayName: "Suno v4.5 via SunoAPI.org",
5508
+ costPerMinute: 375e-5,
5509
+ maxDuration: 480,
5510
+ outputFormat: "mp3",
5511
+ vocals: true,
5512
+ official: false,
5513
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5514
+ source: "seed",
5515
+ status: "active",
5516
+ confidence: "high",
5517
+ confidenceScore: 99,
5518
+ confidenceLevel: "high",
5519
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5520
+ lastUpdated: null,
5521
+ launchDate: "2025-09-01"
5522
+ },
5523
+ {
5524
+ modelId: "sunoapi-suno-v4.5-all",
5525
+ provider: "sunoapi",
5526
+ displayName: "Suno v4.5 All via SunoAPI.org",
5527
+ costPerMinute: 375e-5,
5528
+ maxDuration: 480,
5529
+ outputFormat: "mp3",
5530
+ vocals: true,
5531
+ official: false,
5532
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5533
+ source: "seed",
5534
+ status: "active",
5535
+ confidence: "high",
5536
+ confidenceScore: 99,
5537
+ confidenceLevel: "high",
5538
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5539
+ lastUpdated: null,
5540
+ launchDate: "2025-09-01"
5541
+ },
5542
+ {
5543
+ modelId: "sunoapi-suno-v4.5-plus",
5544
+ provider: "sunoapi",
5545
+ displayName: "Suno v4.5 Plus via SunoAPI.org",
5546
+ costPerMinute: 375e-5,
5547
+ maxDuration: 480,
5548
+ outputFormat: "mp3",
5549
+ vocals: true,
5550
+ official: false,
5551
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5552
+ source: "seed",
5553
+ status: "active",
5554
+ confidence: "high",
5555
+ confidenceScore: 99,
5556
+ confidenceLevel: "high",
5557
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5558
+ lastUpdated: null,
5559
+ launchDate: "2025-09-01"
5560
+ },
5561
+ {
5562
+ modelId: "sunoapi-suno-v5",
5563
+ provider: "sunoapi",
5564
+ displayName: "Suno v5 via SunoAPI.org",
5565
+ costPerMinute: 375e-5,
5566
+ maxDuration: 480,
5567
+ outputFormat: "mp3",
5568
+ vocals: true,
5569
+ official: false,
5570
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5571
+ source: "seed",
5572
+ status: "active",
5573
+ confidence: "high",
5574
+ confidenceScore: 99,
5575
+ confidenceLevel: "high",
5576
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5577
+ lastUpdated: null,
5578
+ launchDate: "2026-01-01"
5579
+ }
5580
+ ];
5581
+
5582
+ // src/music-cost.ts
5583
+ function calculateMusicCost(modelId, costPerMinute, durationSeconds) {
5584
+ const totalCost = durationSeconds / 60 * costPerMinute;
5585
+ return {
5586
+ modelId,
5587
+ durationSeconds,
5588
+ costPerMinute,
5589
+ totalCost
5590
+ };
5591
+ }
5592
+ function calculateMusicModelCost(modelId, durationSeconds, pricing) {
5593
+ const data = pricing ?? STATIC_MUSIC_PRICING;
5594
+ const model = data.find((m) => m.modelId === modelId);
5595
+ if (!model) {
5596
+ throw new Error(`Unknown music model: ${modelId}. Provide pricing data or use calculateMusicCost().`);
5597
+ }
5598
+ return calculateMusicCost(modelId, model.costPerMinute, durationSeconds);
5599
+ }
5400
5600
  // Annotate the CommonJS export names for ESM import in node:
5401
5601
  0 && (module.exports = {
5402
5602
  PriceTokenClient,
5403
5603
  STATIC_AVATAR_PRICING,
5404
5604
  STATIC_IMAGE_PRICING,
5605
+ STATIC_MUSIC_PRICING,
5405
5606
  STATIC_PRICING,
5406
5607
  STATIC_STT_PRICING,
5407
5608
  STATIC_TTS_PRICING,
@@ -5412,6 +5613,8 @@ function calculateSttModelCost(modelId, durationSeconds, pricing) {
5412
5613
  calculateImageCost,
5413
5614
  calculateImageModelCost,
5414
5615
  calculateModelCost,
5616
+ calculateMusicCost,
5617
+ calculateMusicModelCost,
5415
5618
  calculateSttCost,
5416
5619
  calculateSttModelCost,
5417
5620
  calculateTtsCost,
package/dist/index.mjs CHANGED
@@ -284,6 +284,47 @@ var PriceTokenClient = class {
284
284
  const qs = params.toString();
285
285
  return this.request(`/api/v1/stt/cheapest${qs ? `?${qs}` : ""}`);
286
286
  }
287
+ // Music pricing methods
288
+ async getMusicPricing(opts) {
289
+ const params = new URLSearchParams();
290
+ if (opts?.provider) params.set("provider", opts.provider);
291
+ if (opts?.currency) params.set("currency", opts.currency);
292
+ if (opts?.after) params.set("after", opts.after);
293
+ if (opts?.before) params.set("before", opts.before);
294
+ const qs = params.toString();
295
+ return this.request(`/api/v1/music${qs ? `?${qs}` : ""}`);
296
+ }
297
+ async getMusicModel(modelId, opts) {
298
+ const params = new URLSearchParams();
299
+ if (opts?.currency) params.set("currency", opts.currency);
300
+ const qs = params.toString();
301
+ return this.request(`/api/v1/music/${encodeURIComponent(modelId)}${qs ? `?${qs}` : ""}`);
302
+ }
303
+ async getMusicHistory(opts) {
304
+ const params = new URLSearchParams();
305
+ if (opts?.days) params.set("days", String(opts.days));
306
+ if (opts?.modelId) params.set("modelId", opts.modelId);
307
+ if (opts?.provider) params.set("provider", opts.provider);
308
+ const qs = params.toString();
309
+ return this.request(`/api/v1/music/history${qs ? `?${qs}` : ""}`);
310
+ }
311
+ async getMusicProviders() {
312
+ return this.request("/api/v1/music/providers");
313
+ }
314
+ async compareMusicModels(modelIds, opts) {
315
+ const params = new URLSearchParams({ models: modelIds.join(",") });
316
+ if (opts?.currency) params.set("currency", opts.currency);
317
+ return this.request(`/api/v1/music/compare?${params}`);
318
+ }
319
+ async getCheapestMusicModel(opts) {
320
+ const params = new URLSearchParams();
321
+ if (opts?.provider) params.set("provider", opts.provider);
322
+ if (opts?.currency) params.set("currency", opts.currency);
323
+ if (opts?.after) params.set("after", opts.after);
324
+ if (opts?.before) params.set("before", opts.before);
325
+ const qs = params.toString();
326
+ return this.request(`/api/v1/music/cheapest${qs ? `?${qs}` : ""}`);
327
+ }
287
328
  };
288
329
 
289
330
  // src/static.ts
@@ -5353,10 +5394,167 @@ function calculateSttModelCost(modelId, durationSeconds, pricing) {
5353
5394
  }
5354
5395
  return calculateSttCost(modelId, model.costPerMinute, durationSeconds);
5355
5396
  }
5397
+
5398
+ // src/music-static.ts
5399
+ var STATIC_MUSIC_PRICING = [
5400
+ {
5401
+ modelId: "elevenlabs-eleven-music",
5402
+ provider: "elevenlabs",
5403
+ displayName: "ElevenLabs Eleven Music",
5404
+ costPerMinute: 0.5,
5405
+ maxDuration: null,
5406
+ outputFormat: "mp3",
5407
+ vocals: true,
5408
+ official: true,
5409
+ pricingNote: null,
5410
+ source: "seed",
5411
+ status: "active",
5412
+ confidence: "high",
5413
+ confidenceScore: 99,
5414
+ confidenceLevel: "high",
5415
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5416
+ lastUpdated: null,
5417
+ launchDate: "2025-06-01"
5418
+ },
5419
+ {
5420
+ modelId: "soundverse-music",
5421
+ provider: "soundverse",
5422
+ displayName: "Soundverse Music Generation",
5423
+ costPerMinute: 0.0125,
5424
+ maxDuration: 240,
5425
+ outputFormat: "mp3",
5426
+ vocals: true,
5427
+ official: true,
5428
+ pricingNote: "Approximated from ~$0.05/song at ~4 min avg",
5429
+ source: "seed",
5430
+ status: "active",
5431
+ confidence: "high",
5432
+ confidenceScore: 99,
5433
+ confidenceLevel: "high",
5434
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5435
+ lastUpdated: null,
5436
+ launchDate: "2025-01-01"
5437
+ },
5438
+ {
5439
+ modelId: "sunoapi-suno-v4",
5440
+ provider: "sunoapi",
5441
+ displayName: "Suno v4 via SunoAPI.org",
5442
+ costPerMinute: 75e-4,
5443
+ maxDuration: 240,
5444
+ outputFormat: "mp3",
5445
+ vocals: true,
5446
+ official: false,
5447
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 4 min max",
5448
+ source: "seed",
5449
+ status: "active",
5450
+ confidence: "high",
5451
+ confidenceScore: 99,
5452
+ confidenceLevel: "high",
5453
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5454
+ lastUpdated: null,
5455
+ launchDate: "2024-05-01"
5456
+ },
5457
+ {
5458
+ modelId: "sunoapi-suno-v4.5",
5459
+ provider: "sunoapi",
5460
+ displayName: "Suno v4.5 via SunoAPI.org",
5461
+ costPerMinute: 375e-5,
5462
+ maxDuration: 480,
5463
+ outputFormat: "mp3",
5464
+ vocals: true,
5465
+ official: false,
5466
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5467
+ source: "seed",
5468
+ status: "active",
5469
+ confidence: "high",
5470
+ confidenceScore: 99,
5471
+ confidenceLevel: "high",
5472
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5473
+ lastUpdated: null,
5474
+ launchDate: "2025-09-01"
5475
+ },
5476
+ {
5477
+ modelId: "sunoapi-suno-v4.5-all",
5478
+ provider: "sunoapi",
5479
+ displayName: "Suno v4.5 All via SunoAPI.org",
5480
+ costPerMinute: 375e-5,
5481
+ maxDuration: 480,
5482
+ outputFormat: "mp3",
5483
+ vocals: true,
5484
+ official: false,
5485
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5486
+ source: "seed",
5487
+ status: "active",
5488
+ confidence: "high",
5489
+ confidenceScore: 99,
5490
+ confidenceLevel: "high",
5491
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5492
+ lastUpdated: null,
5493
+ launchDate: "2025-09-01"
5494
+ },
5495
+ {
5496
+ modelId: "sunoapi-suno-v4.5-plus",
5497
+ provider: "sunoapi",
5498
+ displayName: "Suno v4.5 Plus via SunoAPI.org",
5499
+ costPerMinute: 375e-5,
5500
+ maxDuration: 480,
5501
+ outputFormat: "mp3",
5502
+ vocals: true,
5503
+ official: false,
5504
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5505
+ source: "seed",
5506
+ status: "active",
5507
+ confidence: "high",
5508
+ confidenceScore: 99,
5509
+ confidenceLevel: "high",
5510
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5511
+ lastUpdated: null,
5512
+ launchDate: "2025-09-01"
5513
+ },
5514
+ {
5515
+ modelId: "sunoapi-suno-v5",
5516
+ provider: "sunoapi",
5517
+ displayName: "Suno v5 via SunoAPI.org",
5518
+ costPerMinute: 375e-5,
5519
+ maxDuration: 480,
5520
+ outputFormat: "mp3",
5521
+ vocals: true,
5522
+ official: false,
5523
+ pricingNote: "Unofficial. 12 cr/call, 2 songs/call = $0.03/song at 8 min max",
5524
+ source: "seed",
5525
+ status: "active",
5526
+ confidence: "high",
5527
+ confidenceScore: 99,
5528
+ confidenceLevel: "high",
5529
+ freshness: { lastVerified: "", ageHours: 0, stale: false },
5530
+ lastUpdated: null,
5531
+ launchDate: "2026-01-01"
5532
+ }
5533
+ ];
5534
+
5535
+ // src/music-cost.ts
5536
+ function calculateMusicCost(modelId, costPerMinute, durationSeconds) {
5537
+ const totalCost = durationSeconds / 60 * costPerMinute;
5538
+ return {
5539
+ modelId,
5540
+ durationSeconds,
5541
+ costPerMinute,
5542
+ totalCost
5543
+ };
5544
+ }
5545
+ function calculateMusicModelCost(modelId, durationSeconds, pricing) {
5546
+ const data = pricing ?? STATIC_MUSIC_PRICING;
5547
+ const model = data.find((m) => m.modelId === modelId);
5548
+ if (!model) {
5549
+ throw new Error(`Unknown music model: ${modelId}. Provide pricing data or use calculateMusicCost().`);
5550
+ }
5551
+ return calculateMusicCost(modelId, model.costPerMinute, durationSeconds);
5552
+ }
5356
5553
  export {
5357
5554
  PriceTokenClient,
5358
5555
  STATIC_AVATAR_PRICING,
5359
5556
  STATIC_IMAGE_PRICING,
5557
+ STATIC_MUSIC_PRICING,
5360
5558
  STATIC_PRICING,
5361
5559
  STATIC_STT_PRICING,
5362
5560
  STATIC_TTS_PRICING,
@@ -5367,6 +5565,8 @@ export {
5367
5565
  calculateImageCost,
5368
5566
  calculateImageModelCost,
5369
5567
  calculateModelCost,
5568
+ calculateMusicCost,
5569
+ calculateMusicModelCost,
5370
5570
  calculateSttCost,
5371
5571
  calculateSttModelCost,
5372
5572
  calculateTtsCost,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pricetoken",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Real-time LLM pricing data — typed client, cost calculator, and static pricing",
5
5
  "keywords": [
6
6
  "llm",