@common_ch/common 1.0.282 → 1.0.284

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.
@@ -1,10 +1,10 @@
1
- import { AiOptionFieldEnum } from "../../../enums/ai";
1
+ import { AiOptionFieldEnum, AiOptionNamesEnum } from "../../../enums/ai";
2
2
  import { Subjects } from "../../subjects";
3
3
  export interface AiOptionCreatedEvent {
4
4
  subject: Subjects.AiOptionCreated;
5
5
  data: {
6
6
  id: string;
7
- name: string;
7
+ name: AiOptionNamesEnum;
8
8
  field: AiOptionFieldEnum;
9
9
  image?: string;
10
10
  description?: string;
@@ -1,10 +1,10 @@
1
- import { AiOptionFieldEnum } from "../../../enums/ai";
1
+ import { AiOptionFieldEnum, AiOptionNamesEnum } from "../../../enums/ai";
2
2
  import { Subjects } from "../../subjects";
3
3
  export interface AiOptionUpdatedEvent {
4
4
  subject: Subjects.AiOptionUpdated;
5
5
  data: {
6
6
  id: string;
7
- name: string;
7
+ name: AiOptionNamesEnum;
8
8
  field: AiOptionFieldEnum;
9
9
  image: string;
10
10
  description: string;
package/build/index.d.ts CHANGED
@@ -28,9 +28,9 @@ export * from './events/portal/ai/ai-changeStatus-event';
28
28
  export * from './events/portal/ai/ai-update-event';
29
29
  export * from './events/portal/ai/ai-set-default-show-event';
30
30
  export * from './events/portal/ai/ai-unset-defaultShow-event';
31
- export * from './events/portal/ai-option/ai-created-event';
31
+ export * from './events/portal/ai-option/ai-option-created-event';
32
32
  export * from './events/portal/ai-option/ai-option-changeStatus-event';
33
- export * from './events/portal/ai-option/ai-updated-event';
33
+ export * from './events/portal/ai-option/ai-option-updated-event';
34
34
  export * from './events/portal/ai-option/ai-option-set-default-show-event';
35
35
  export * from './events/portal/ai-option/ai-option-unset-defaultShow-event';
36
36
  export * from './events/portal/user/user-updated-event';
package/build/index.js CHANGED
@@ -54,9 +54,9 @@ __exportStar(require("./events/portal/ai/ai-changeStatus-event"), exports);
54
54
  __exportStar(require("./events/portal/ai/ai-update-event"), exports);
55
55
  __exportStar(require("./events/portal/ai/ai-set-default-show-event"), exports);
56
56
  __exportStar(require("./events/portal/ai/ai-unset-defaultShow-event"), exports);
57
- __exportStar(require("./events/portal/ai-option/ai-created-event"), exports);
57
+ __exportStar(require("./events/portal/ai-option/ai-option-created-event"), exports);
58
58
  __exportStar(require("./events/portal/ai-option/ai-option-changeStatus-event"), exports);
59
- __exportStar(require("./events/portal/ai-option/ai-updated-event"), exports);
59
+ __exportStar(require("./events/portal/ai-option/ai-option-updated-event"), exports);
60
60
  __exportStar(require("./events/portal/ai-option/ai-option-set-default-show-event"), exports);
61
61
  __exportStar(require("./events/portal/ai-option/ai-option-unset-defaultShow-event"), exports);
62
62
  __exportStar(require("./events/portal/user/user-updated-event"), exports);
@@ -1,2 +1,2 @@
1
1
  import { AiOptionNamesEnum } from "../../enums/ai";
2
- export declare function calculateCostChat(model: AiOptionNamesEnum, promptTokens: number, completionTokens: number): number;
2
+ export declare function calculateCostChat(model: AiOptionNamesEnum, promptTokens: number, cacheToken: number, completionTokens: number): number;
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateCostChat = calculateCostChat;
4
4
  const pricingTable_1 = require("./pricingTable");
5
- function calculateCostChat(model, promptTokens, completionTokens) {
5
+ function calculateCostChat(model, promptTokens, cacheToken, completionTokens) {
6
6
  const pricing = pricingTable_1.pricingTableChat[model];
7
7
  if (!pricing)
8
8
  throw new Error(`No pricing found for model: ${model}`);
9
- const cost = (promptTokens / 1000) * pricing.prompt +
10
- (completionTokens / 1000) * pricing.completion;
9
+ const cost = (promptTokens / 1000000) * pricing.prompt +
10
+ (cacheToken / 1000000) * pricing.cache +
11
+ (completionTokens / 1000000) * pricing.completion;
11
12
  return parseFloat(cost.toFixed(6));
12
13
  }
@@ -1,6 +1,7 @@
1
1
  interface ModelPricingChat {
2
2
  prompt: number;
3
3
  completion: number;
4
+ cache: number;
4
5
  }
5
6
  interface ModelPricingImage {
6
7
  imageGen?: number;
@@ -3,17 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pricingTableTTS = exports.pricingTableAudio = exports.pricingTableImage = exports.pricingTableChat = void 0;
4
4
  exports.pricingTableChat = {
5
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 },
6
+ 'gpt-5-mini': { prompt: 0.25, cache: 0.025, completion: 2.0 },
7
+ 'gpt-5-nano': { prompt: 0.05, cache: 0.005, completion: 0.4 },
8
+ 'gpt-5': { prompt: 1.25, cache: 0.125, completion: 10.00 },
9
+ 'gpt-5-pro': { prompt: 15.00, cache: 0.001, completion: 120.00 },
9
10
  // --- 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 },
11
+ 'gpt-4o': { prompt: 2.5, cache: 1.25, completion: 10 },
12
+ 'gpt-4.1': { prompt: 3, cache: 0.75, completion: 12 },
13
+ 'gpt-4.1-mini': { prompt: 0.80, cache: 0.20, completion: 3.20 },
14
+ 'gpt-4.1-nano': { prompt: 0.20, cache: 0.05, completion: 0.80 },
15
+ 'gpt-4o-mini': { prompt: 0.15, cache: 0.075, completion: 0.60 },
15
16
  // --- GPT-3.5 family ---
16
- 'gpt-3.5-turbo': { prompt: 0.5, completion: 1.5 },
17
+ 'gpt-3.5-turbo': { prompt: 3.00, cache: 0.2, completion: 6.00 },
17
18
  };
18
19
  exports.pricingTableImage = {
19
20
  // --- Images ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.282",
3
+ "version": "1.0.284",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [