@kalaa/node 1.0.5 → 1.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/costmeter.js +3 -4
- package/package.json +1 -1
package/costmeter.js
CHANGED
|
@@ -353,11 +353,10 @@ function wrapAnthropicStreamForUsage(stream, { _step, _user, model, t0 }) {
|
|
|
353
353
|
|
|
354
354
|
function patchOpenAIModule() {
|
|
355
355
|
let OpenAIMod;
|
|
356
|
-
try { OpenAIMod = require('openai'); } catch
|
|
357
|
-
log('openai require() succeeded, module keys:', Object.keys(OpenAIMod).slice(0, 10).join(','));
|
|
356
|
+
try { OpenAIMod = require('openai'); } catch { return; } // not installed, skip
|
|
358
357
|
const OpenAI = OpenAIMod.OpenAI || OpenAIMod.default || OpenAIMod;
|
|
359
|
-
if (!OpenAI || typeof OpenAI !== 'function')
|
|
360
|
-
if (OpenAI.__cm_patched)
|
|
358
|
+
if (!OpenAI || typeof OpenAI !== 'function') return;
|
|
359
|
+
if (OpenAI.__cm_patched) return;
|
|
361
360
|
|
|
362
361
|
|
|
363
362
|
let Completions, Transcriptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalaa/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Drop-in AI cost tracking for Node.js and TypeScript. Auto-instruments OpenAI, Anthropic, and Gemini at the class level, with zero code at each call site.",
|
|
5
5
|
"main": "costmeter.js",
|
|
6
6
|
"types": "costmeter.d.ts",
|