@common_ch/common 1.0.268 → 1.0.269
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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateCostChat = calculateCostChat;
|
|
4
|
+
const pricingTable_1 = require("./pricingTable");
|
|
5
|
+
function calculateCostChat(model, promptTokens, completionTokens) {
|
|
6
|
+
const pricing = pricingTable_1.pricingTableChat[model];
|
|
7
|
+
if (!pricing)
|
|
8
|
+
throw new Error(`No pricing found for model: ${model}`);
|
|
9
|
+
const cost = (promptTokens / 1000000) * pricing.prompt +
|
|
10
|
+
(completionTokens / 1000000) * pricing.completion;
|
|
11
|
+
return parseFloat(cost.toFixed(6));
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface ModelPricingChat {
|
|
2
|
+
prompt: number;
|
|
3
|
+
completion: number;
|
|
4
|
+
}
|
|
5
|
+
interface ModelPricingImage {
|
|
6
|
+
imageGen?: number;
|
|
7
|
+
}
|
|
8
|
+
interface ModelPricingAudio {
|
|
9
|
+
audioIn?: number;
|
|
10
|
+
}
|
|
11
|
+
interface ModelPricingTTS {
|
|
12
|
+
audioOut?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const pricingTableChat: Record<string, ModelPricingChat>;
|
|
15
|
+
export declare const pricingTableImage: Record<string, ModelPricingImage>;
|
|
16
|
+
export declare const pricingTableAudio: Record<string, ModelPricingAudio>;
|
|
17
|
+
export declare const pricingTableTTS: Record<string, ModelPricingTTS>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pricingTableTTS = exports.pricingTableAudio = exports.pricingTableImage = exports.pricingTableChat = void 0;
|
|
4
|
+
exports.pricingTableChat = {
|
|
5
|
+
// --- GPT-5 family ---
|
|
6
|
+
'gpt-5-mini': { prompt: 0.15, completion: 0.6 },
|
|
7
|
+
'gpt-5-nano': { prompt: 0.05, completion: 0.2 },
|
|
8
|
+
'gpt-5': { prompt: 10, completion: 30 },
|
|
9
|
+
// --- GPT-4 family ---
|
|
10
|
+
'gpt-4o': { prompt: 2.5, completion: 10 },
|
|
11
|
+
'gpt-4.1': { prompt: 5, completion: 15 },
|
|
12
|
+
'gpt-4.1-mini': { prompt: 0.15, completion: 0.6 },
|
|
13
|
+
'gpt-4.1-nano': { prompt: 0.05, completion: 0.2 },
|
|
14
|
+
'gpt-4o-mini': { prompt: 0.3, completion: 1.2 },
|
|
15
|
+
// --- GPT-3.5 family ---
|
|
16
|
+
'gpt-3.5-turbo': { prompt: 0.5, completion: 1.5 },
|
|
17
|
+
};
|
|
18
|
+
exports.pricingTableImage = {
|
|
19
|
+
// --- Images ---
|
|
20
|
+
'dall-e-3': { imageGen: 0.04 }, // $0.04 per image (standard)
|
|
21
|
+
};
|
|
22
|
+
exports.pricingTableAudio = {
|
|
23
|
+
// --- Audio / Whisper ---
|
|
24
|
+
'whisper-1': { audioIn: 0.006 }, // $0.006 / minute
|
|
25
|
+
'whisper-large': { audioIn: 0.006 }, // whisper-1
|
|
26
|
+
};
|
|
27
|
+
exports.pricingTableTTS = {
|
|
28
|
+
// --- Text-to-Speech ---
|
|
29
|
+
'tts-1': { audioOut: 0.015 }, // $0.015 / minute
|
|
30
|
+
};
|