claudish 3.3.8 → 3.3.9
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/index.js +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57001,10 +57001,11 @@ class OpenAIHandler {
|
|
|
57001
57001
|
}
|
|
57002
57002
|
}
|
|
57003
57003
|
updateTokenTracking(inputTokens, outputTokens) {
|
|
57004
|
+
const incrementalInputTokens = Math.max(0, inputTokens - this.sessionInputTokens);
|
|
57004
57005
|
this.sessionInputTokens = inputTokens;
|
|
57005
57006
|
this.sessionOutputTokens += outputTokens;
|
|
57006
57007
|
const pricing = this.getPricing();
|
|
57007
|
-
const cost =
|
|
57008
|
+
const cost = incrementalInputTokens / 1e6 * pricing.inputCostPer1M + outputTokens / 1e6 * pricing.outputCostPer1M;
|
|
57008
57009
|
this.sessionTotalCost += cost;
|
|
57009
57010
|
this.writeTokenFile(inputTokens, this.sessionOutputTokens);
|
|
57010
57011
|
}
|