@kalaa/node 1.0.4 → 1.0.5
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 +4 -3
- package/package.json +1 -1
package/costmeter.js
CHANGED
|
@@ -353,10 +353,11 @@ function wrapAnthropicStreamForUsage(stream, { _step, _user, model, t0 }) {
|
|
|
353
353
|
|
|
354
354
|
function patchOpenAIModule() {
|
|
355
355
|
let OpenAIMod;
|
|
356
|
-
try { OpenAIMod = require('openai'); } catch {
|
|
356
|
+
try { OpenAIMod = require('openai'); } catch (e) { log('openai require() failed:', e.message); return; }
|
|
357
|
+
log('openai require() succeeded, module keys:', Object.keys(OpenAIMod).slice(0, 10).join(','));
|
|
357
358
|
const OpenAI = OpenAIMod.OpenAI || OpenAIMod.default || OpenAIMod;
|
|
358
|
-
if (!OpenAI || typeof OpenAI !== 'function') return;
|
|
359
|
-
if (OpenAI.__cm_patched) return;
|
|
359
|
+
if (!OpenAI || typeof OpenAI !== 'function') { log('openai class did not resolve to a function, typeof:', typeof OpenAI); return; }
|
|
360
|
+
if (OpenAI.__cm_patched) { log('openai already patched, skipping'); return; }
|
|
360
361
|
|
|
361
362
|
|
|
362
363
|
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.5",
|
|
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",
|