pricetoken 0.12.0 → 0.13.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 +71 -1
- package/dist/index.d.ts +71 -1
- package/dist/index.js +127 -0
- package/dist/index.mjs +124 -0
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
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,92 @@ 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.5",
|
|
5487
|
+
provider: "sunoapi",
|
|
5488
|
+
displayName: "Suno v4.5 via SunoAPI.org",
|
|
5489
|
+
costPerMinute: 625e-5,
|
|
5490
|
+
maxDuration: 480,
|
|
5491
|
+
outputFormat: "mp3",
|
|
5492
|
+
vocals: true,
|
|
5493
|
+
official: false,
|
|
5494
|
+
pricingNote: "Unofficial wrapper. ~$0.025/song ($0.005/credit x 5 credits) at ~4 min avg",
|
|
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: "2025-09-01"
|
|
5503
|
+
}
|
|
5504
|
+
];
|
|
5505
|
+
|
|
5506
|
+
// src/music-cost.ts
|
|
5507
|
+
function calculateMusicCost(modelId, costPerMinute, durationSeconds) {
|
|
5508
|
+
const totalCost = durationSeconds / 60 * costPerMinute;
|
|
5509
|
+
return {
|
|
5510
|
+
modelId,
|
|
5511
|
+
durationSeconds,
|
|
5512
|
+
costPerMinute,
|
|
5513
|
+
totalCost
|
|
5514
|
+
};
|
|
5515
|
+
}
|
|
5516
|
+
function calculateMusicModelCost(modelId, durationSeconds, pricing) {
|
|
5517
|
+
const data = pricing ?? STATIC_MUSIC_PRICING;
|
|
5518
|
+
const model = data.find((m) => m.modelId === modelId);
|
|
5519
|
+
if (!model) {
|
|
5520
|
+
throw new Error(`Unknown music model: ${modelId}. Provide pricing data or use calculateMusicCost().`);
|
|
5521
|
+
}
|
|
5522
|
+
return calculateMusicCost(modelId, model.costPerMinute, durationSeconds);
|
|
5523
|
+
}
|
|
5400
5524
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5401
5525
|
0 && (module.exports = {
|
|
5402
5526
|
PriceTokenClient,
|
|
5403
5527
|
STATIC_AVATAR_PRICING,
|
|
5404
5528
|
STATIC_IMAGE_PRICING,
|
|
5529
|
+
STATIC_MUSIC_PRICING,
|
|
5405
5530
|
STATIC_PRICING,
|
|
5406
5531
|
STATIC_STT_PRICING,
|
|
5407
5532
|
STATIC_TTS_PRICING,
|
|
@@ -5412,6 +5537,8 @@ function calculateSttModelCost(modelId, durationSeconds, pricing) {
|
|
|
5412
5537
|
calculateImageCost,
|
|
5413
5538
|
calculateImageModelCost,
|
|
5414
5539
|
calculateModelCost,
|
|
5540
|
+
calculateMusicCost,
|
|
5541
|
+
calculateMusicModelCost,
|
|
5415
5542
|
calculateSttCost,
|
|
5416
5543
|
calculateSttModelCost,
|
|
5417
5544
|
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,91 @@ 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.5",
|
|
5440
|
+
provider: "sunoapi",
|
|
5441
|
+
displayName: "Suno v4.5 via SunoAPI.org",
|
|
5442
|
+
costPerMinute: 625e-5,
|
|
5443
|
+
maxDuration: 480,
|
|
5444
|
+
outputFormat: "mp3",
|
|
5445
|
+
vocals: true,
|
|
5446
|
+
official: false,
|
|
5447
|
+
pricingNote: "Unofficial wrapper. ~$0.025/song ($0.005/credit x 5 credits) at ~4 min avg",
|
|
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: "2025-09-01"
|
|
5456
|
+
}
|
|
5457
|
+
];
|
|
5458
|
+
|
|
5459
|
+
// src/music-cost.ts
|
|
5460
|
+
function calculateMusicCost(modelId, costPerMinute, durationSeconds) {
|
|
5461
|
+
const totalCost = durationSeconds / 60 * costPerMinute;
|
|
5462
|
+
return {
|
|
5463
|
+
modelId,
|
|
5464
|
+
durationSeconds,
|
|
5465
|
+
costPerMinute,
|
|
5466
|
+
totalCost
|
|
5467
|
+
};
|
|
5468
|
+
}
|
|
5469
|
+
function calculateMusicModelCost(modelId, durationSeconds, pricing) {
|
|
5470
|
+
const data = pricing ?? STATIC_MUSIC_PRICING;
|
|
5471
|
+
const model = data.find((m) => m.modelId === modelId);
|
|
5472
|
+
if (!model) {
|
|
5473
|
+
throw new Error(`Unknown music model: ${modelId}. Provide pricing data or use calculateMusicCost().`);
|
|
5474
|
+
}
|
|
5475
|
+
return calculateMusicCost(modelId, model.costPerMinute, durationSeconds);
|
|
5476
|
+
}
|
|
5356
5477
|
export {
|
|
5357
5478
|
PriceTokenClient,
|
|
5358
5479
|
STATIC_AVATAR_PRICING,
|
|
5359
5480
|
STATIC_IMAGE_PRICING,
|
|
5481
|
+
STATIC_MUSIC_PRICING,
|
|
5360
5482
|
STATIC_PRICING,
|
|
5361
5483
|
STATIC_STT_PRICING,
|
|
5362
5484
|
STATIC_TTS_PRICING,
|
|
@@ -5367,6 +5489,8 @@ export {
|
|
|
5367
5489
|
calculateImageCost,
|
|
5368
5490
|
calculateImageModelCost,
|
|
5369
5491
|
calculateModelCost,
|
|
5492
|
+
calculateMusicCost,
|
|
5493
|
+
calculateMusicModelCost,
|
|
5370
5494
|
calculateSttCost,
|
|
5371
5495
|
calculateSttModelCost,
|
|
5372
5496
|
calculateTtsCost,
|