@cellaware/utils 5.0.5 → 5.0.7
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/llm/cost.js +32 -25
- package/dist/llm/model.d.ts +1 -1
- package/package.json +1 -1
package/dist/llm/cost.js
CHANGED
|
@@ -4,45 +4,52 @@ export function getLLMCostPerToken(modelName) {
|
|
|
4
4
|
let outputCost = 0.0;
|
|
5
5
|
switch (modelName) {
|
|
6
6
|
case 'gpt-4.1':
|
|
7
|
-
inputCost =
|
|
8
|
-
outputCost =
|
|
7
|
+
inputCost = 2.00;
|
|
8
|
+
outputCost = 8.00;
|
|
9
9
|
break;
|
|
10
10
|
case 'gpt-4.1-mini':
|
|
11
|
-
inputCost = 0.
|
|
12
|
-
outputCost =
|
|
11
|
+
inputCost = 0.40;
|
|
12
|
+
outputCost = 1.60;
|
|
13
13
|
break;
|
|
14
14
|
case 'gpt-4.1-nano':
|
|
15
|
-
inputCost = 0.
|
|
16
|
-
outputCost = 0.
|
|
15
|
+
inputCost = 0.10;
|
|
16
|
+
outputCost = 0.40;
|
|
17
|
+
break;
|
|
18
|
+
case 'gpt-4o':
|
|
19
|
+
inputCost = 2.50;
|
|
20
|
+
outputCost = 10.00;
|
|
21
|
+
break;
|
|
22
|
+
case 'gpt-4o-mini':
|
|
23
|
+
inputCost = 0.15;
|
|
24
|
+
outputCost = 0.60;
|
|
17
25
|
break;
|
|
18
26
|
case 'o1':
|
|
19
|
-
inputCost =
|
|
20
|
-
outputCost =
|
|
27
|
+
inputCost = 15.00;
|
|
28
|
+
outputCost = 60.00;
|
|
21
29
|
break;
|
|
22
30
|
case 'o1-mini':
|
|
23
|
-
inputCost =
|
|
24
|
-
outputCost =
|
|
31
|
+
inputCost = 1.10;
|
|
32
|
+
outputCost = 4.40;
|
|
25
33
|
break;
|
|
26
|
-
case 'o3
|
|
27
|
-
inputCost =
|
|
28
|
-
outputCost =
|
|
34
|
+
case 'o3':
|
|
35
|
+
inputCost = 10.00;
|
|
36
|
+
outputCost = 40.00;
|
|
29
37
|
break;
|
|
30
|
-
case '
|
|
31
|
-
inputCost =
|
|
32
|
-
outputCost =
|
|
38
|
+
case 'o3-mini':
|
|
39
|
+
inputCost = 1.10;
|
|
40
|
+
outputCost = 4.40;
|
|
33
41
|
break;
|
|
34
|
-
case '
|
|
35
|
-
inputCost =
|
|
36
|
-
outputCost =
|
|
42
|
+
case 'o4-mini':
|
|
43
|
+
inputCost = 1.10;
|
|
44
|
+
outputCost = 4.40;
|
|
37
45
|
break;
|
|
38
46
|
default:
|
|
39
|
-
|
|
40
|
-
outputCost = 0.0;
|
|
41
|
-
break;
|
|
47
|
+
throw new Error(`Model '${modelName}' cost is not configured`);
|
|
42
48
|
}
|
|
43
|
-
// OpenAI model costs are measured in
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
// OpenAI model costs are measured in millions of tokens -- therefore we need to divide each figure by 1,000,000 before returning.
|
|
50
|
+
const unit = 1_000_000.0;
|
|
51
|
+
inputCost /= unit;
|
|
52
|
+
outputCost /= unit;
|
|
46
53
|
return { inputCost, outputCost };
|
|
47
54
|
}
|
|
48
55
|
export function getLLMTransactionCost(tokenUsage, modelName) {
|
package/dist/llm/model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ModelName = 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3
|
|
1
|
+
export type ModelName = 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-4o' | 'gpt-4o-mini' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini';
|
|
2
2
|
export type ReasoningEffort = 'low' | 'medium' | 'high';
|
|
3
3
|
export interface OpenAIModelOptions {
|
|
4
4
|
reasoning_effort?: ReasoningEffort;
|