@aigne/openai 0.16.15 → 0.16.16-beta.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,137 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.16.16-beta.10](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.9...openai-v0.16.16-beta.10) (2026-01-06)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/core bumped to 1.72.0-beta.10
11
+ * devDependencies
12
+ * @aigne/test-utils bumped to 0.5.69-beta.10
13
+
14
+ ## [0.16.16-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.8...openai-v0.16.16-beta.9) (2026-01-02)
15
+
16
+
17
+ ### Dependencies
18
+
19
+ * The following workspace dependencies were updated
20
+ * dependencies
21
+ * @aigne/core bumped to 1.72.0-beta.9
22
+ * devDependencies
23
+ * @aigne/test-utils bumped to 0.5.69-beta.9
24
+
25
+ ## [0.16.16-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.7...openai-v0.16.16-beta.8) (2025-12-31)
26
+
27
+
28
+ ### Dependencies
29
+
30
+ * The following workspace dependencies were updated
31
+ * dependencies
32
+ * @aigne/core bumped to 1.72.0-beta.8
33
+ * devDependencies
34
+ * @aigne/test-utils bumped to 0.5.69-beta.8
35
+
36
+ ## [0.16.16-beta.7](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.6...openai-v0.16.16-beta.7) (2025-12-26)
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @aigne/core bumped to 1.72.0-beta.7
44
+ * devDependencies
45
+ * @aigne/test-utils bumped to 0.5.69-beta.7
46
+
47
+ ## [0.16.16-beta.6](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.5...openai-v0.16.16-beta.6) (2025-12-25)
48
+
49
+
50
+ ### Dependencies
51
+
52
+ * The following workspace dependencies were updated
53
+ * dependencies
54
+ * @aigne/core bumped to 1.72.0-beta.6
55
+ * devDependencies
56
+ * @aigne/test-utils bumped to 0.5.69-beta.6
57
+
58
+ ## [0.16.16-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.4...openai-v0.16.16-beta.5) (2025-12-25)
59
+
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @aigne/core bumped to 1.72.0-beta.5
66
+ * devDependencies
67
+ * @aigne/test-utils bumped to 0.5.69-beta.5
68
+
69
+ ## [0.16.16-beta.4](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.3...openai-v0.16.16-beta.4) (2025-12-24)
70
+
71
+
72
+ ### Dependencies
73
+
74
+ * The following workspace dependencies were updated
75
+ * dependencies
76
+ * @aigne/core bumped to 1.72.0-beta.4
77
+ * devDependencies
78
+ * @aigne/test-utils bumped to 0.5.69-beta.4
79
+
80
+ ## [0.16.16-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.2...openai-v0.16.16-beta.3) (2025-12-19)
81
+
82
+
83
+ ### Features
84
+
85
+ * add prompt caching for OpenAI/Gemini/Anthropic and cache token display ([#838](https://github.com/AIGNE-io/aigne-framework/issues/838)) ([46c628f](https://github.com/AIGNE-io/aigne-framework/commit/46c628f180572ea1b955d1a9888aad6145204842))
86
+
87
+
88
+ ### Dependencies
89
+
90
+ * The following workspace dependencies were updated
91
+ * dependencies
92
+ * @aigne/core bumped to 1.72.0-beta.3
93
+ * devDependencies
94
+ * @aigne/test-utils bumped to 0.5.69-beta.3
95
+
96
+ ## [0.16.16-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta.1...openai-v0.16.16-beta.2) (2025-12-19)
97
+
98
+
99
+ ### Dependencies
100
+
101
+ * The following workspace dependencies were updated
102
+ * dependencies
103
+ * @aigne/core bumped to 1.72.0-beta.2
104
+ * devDependencies
105
+ * @aigne/test-utils bumped to 0.5.69-beta.2
106
+
107
+ ## [0.16.16-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.16-beta...openai-v0.16.16-beta.1) (2025-12-17)
108
+
109
+
110
+ ### Bug Fixes
111
+
112
+ * bump version ([70d217c](https://github.com/AIGNE-io/aigne-framework/commit/70d217c8360dd0dda7f5f17011c4e92ec836e801))
113
+
114
+
115
+ ### Dependencies
116
+
117
+ * The following workspace dependencies were updated
118
+ * dependencies
119
+ * @aigne/core bumped to 1.72.0-beta.1
120
+ * @aigne/platform-helpers bumped to 0.6.7-beta
121
+ * devDependencies
122
+ * @aigne/test-utils bumped to 0.5.69-beta.1
123
+
124
+ ## [0.16.16-beta](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.15...openai-v0.16.16-beta) (2025-12-17)
125
+
126
+
127
+ ### Dependencies
128
+
129
+ * The following workspace dependencies were updated
130
+ * dependencies
131
+ * @aigne/core bumped to 1.72.0-beta
132
+ * devDependencies
133
+ * @aigne/test-utils bumped to 0.5.69-beta
134
+
3
135
  ## [0.16.15](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.15-beta.6...openai-v0.16.15) (2025-12-12)
4
136
 
5
137
 
@@ -288,13 +288,19 @@ class OpenAIChatModel extends core_1.ChatModel {
288
288
  refusal += delta.refusal;
289
289
  }
290
290
  if (chunk.usage) {
291
+ const usage = {
292
+ inputTokens: chunk.usage.prompt_tokens,
293
+ outputTokens: chunk.usage.completion_tokens,
294
+ };
295
+ // Parse cache statistics if available
296
+ const inputDetails = chunk.usage.prompt_tokens_details;
297
+ if (inputDetails?.cached_tokens) {
298
+ usage.cacheReadInputTokens = inputDetails.cached_tokens;
299
+ }
291
300
  controller.enqueue({
292
301
  delta: {
293
302
  json: {
294
- usage: {
295
- inputTokens: chunk.usage.prompt_tokens,
296
- outputTokens: chunk.usage.completion_tokens,
297
- },
303
+ usage,
298
304
  },
299
305
  },
300
306
  });
@@ -283,13 +283,19 @@ export class OpenAIChatModel extends ChatModel {
283
283
  refusal += delta.refusal;
284
284
  }
285
285
  if (chunk.usage) {
286
+ const usage = {
287
+ inputTokens: chunk.usage.prompt_tokens,
288
+ outputTokens: chunk.usage.completion_tokens,
289
+ };
290
+ // Parse cache statistics if available
291
+ const inputDetails = chunk.usage.prompt_tokens_details;
292
+ if (inputDetails?.cached_tokens) {
293
+ usage.cacheReadInputTokens = inputDetails.cached_tokens;
294
+ }
286
295
  controller.enqueue({
287
296
  delta: {
288
297
  json: {
289
- usage: {
290
- inputTokens: chunk.usage.prompt_tokens,
291
- outputTokens: chunk.usage.completion_tokens,
292
- },
298
+ usage,
293
299
  },
294
300
  },
295
301
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/openai",
3
- "version": "0.16.15",
3
+ "version": "0.16.16-beta.10",
4
4
  "description": "AIGNE OpenAI SDK for integrating with OpenAI's GPT models and API services",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@aigne/uuid": "^13.0.1",
39
- "openai": "^6.5.0",
39
+ "openai": "^6.14.0",
40
40
  "zod": "^3.25.67",
41
- "@aigne/core": "^1.71.0",
42
- "@aigne/platform-helpers": "^0.6.6"
41
+ "@aigne/core": "^1.72.0-beta.10",
42
+ "@aigne/platform-helpers": "^0.6.7-beta"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/bun": "^1.2.22",
@@ -47,7 +47,7 @@
47
47
  "npm-run-all": "^4.1.5",
48
48
  "rimraf": "^6.0.1",
49
49
  "typescript": "^5.9.2",
50
- "@aigne/test-utils": "^0.5.68"
50
+ "@aigne/test-utils": "^0.5.69-beta.10"
51
51
  },
52
52
  "scripts": {
53
53
  "lint": "tsc --noEmit",