@trazum/core 2.7.2 → 2.7.3
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/anthropic-usage.d.ts +58 -0
- package/dist/anthropic-usage.d.ts.map +1 -1
- package/dist/anthropic-usage.js +91 -0
- package/dist/anthropic-usage.js.map +1 -1
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +1 -0
- package/dist/billing.js.map +1 -1
- package/dist/claude-code.d.ts +2 -0
- package/dist/claude-code.d.ts.map +1 -1
- package/dist/claude-code.js +9 -0
- package/dist/claude-code.js.map +1 -1
- package/dist/connector.d.ts +3 -1
- package/dist/connector.d.ts.map +1 -1
- package/dist/connector.js +64 -5
- package/dist/connector.js.map +1 -1
- package/dist/gateway.d.ts +10 -0
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +7 -1
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/openai-usage.d.ts +38 -6
- package/dist/openai-usage.d.ts.map +1 -1
- package/dist/openai-usage.js +44 -8
- package/dist/openai-usage.js.map +1 -1
- package/dist/pricing-overlay.d.ts +1 -1
- package/dist/pricing-overlay.d.ts.map +1 -1
- package/dist/pricing-overlay.js +21 -0
- package/dist/pricing-overlay.js.map +1 -1
- package/dist/pricing.d.ts +16 -1
- package/dist/pricing.d.ts.map +1 -1
- package/dist/pricing.js +68 -0
- package/dist/pricing.js.map +1 -1
- package/dist/store.d.ts +4 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +22 -1
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usage.d.ts +8 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +8 -0
- package/dist/usage.js.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-usage.ts +134 -1
- package/src/billing.ts +1 -0
- package/src/claude-code.ts +11 -0
- package/src/connector.ts +69 -6
- package/src/gateway.ts +16 -2
- package/src/index.ts +1 -0
- package/src/openai-usage.ts +72 -10
- package/src/pricing-overlay.ts +21 -0
- package/src/pricing.ts +78 -1
- package/src/store.ts +24 -3
- package/src/types.ts +18 -0
- package/src/usage.ts +16 -0
package/src/usage.ts
CHANGED
|
@@ -193,6 +193,14 @@ export interface UsageRecord {
|
|
|
193
193
|
* catalogue). Absent, or `"default"`, is the standard rate.
|
|
194
194
|
*/
|
|
195
195
|
serviceTier?: string;
|
|
196
|
+
/**
|
|
197
|
+
* The geography the provider says the call ran in, when the log kept it:
|
|
198
|
+
* Anthropic's `usage.inference_geo`, `"us"`, `"global"` or
|
|
199
|
+
* `"not_available"`. US-only inference bills 1.1x on Claude 4.6 and later
|
|
200
|
+
* (`inferenceGeoMultipliers` in the catalogue). Absent, global and
|
|
201
|
+
* not-available are the row's own price.
|
|
202
|
+
*/
|
|
203
|
+
inferenceGeo?: string;
|
|
196
204
|
/**
|
|
197
205
|
* Set when an OpenAI-shaped line split its cache writes by lifetime and the
|
|
198
206
|
* parts did not add up to the total. The lifetime is then unknown even on a
|
|
@@ -983,6 +991,14 @@ export function parseUsageLine(line: string): UsageRecord | null {
|
|
|
983
991
|
...(typeof record.service_tier === 'string' && record.service_tier !== ''
|
|
984
992
|
? { serviceTier: record.service_tier }
|
|
985
993
|
: {}),
|
|
994
|
+
/*
|
|
995
|
+
* Anthropic's `usage.inference_geo`, which every Messages response and
|
|
996
|
+
* every Claude Code log line carries: "us" bills 1.1x on Claude 4.6 and
|
|
997
|
+
* later, "global" and "not_available" do not.
|
|
998
|
+
*/
|
|
999
|
+
...(typeof usage.inference_geo === 'string' && usage.inference_geo !== ''
|
|
1000
|
+
? { inferenceGeo: usage.inference_geo }
|
|
1001
|
+
: {}),
|
|
986
1002
|
...(openAiSplitGiven && !openAiSplitAgrees ? { writeSplitContradicted: true as const } : {}),
|
|
987
1003
|
};
|
|
988
1004
|
}
|