@usagetap/sdk 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -532,6 +532,29 @@ UsageTap responds exclusively with the canonical `{ result, data, correlationId
532
532
 
533
533
  `metered` is derived from the raw Dynamo deltas. Additional meters (audio seconds, reasoning tokens, balances) will populate in later phases without breaking the contract.
534
534
 
535
+ ### Premium detection and override
536
+
537
+ UsageTap automatically determines whether a call is premium based on the model's output token pricing:
538
+ - If the output token price exceeds **$4.00 per million tokens**, the call is classified as premium
539
+ - Otherwise, it's classified as standard
540
+
541
+ You can explicitly override this detection by passing `isPremium` in your `call_end` request:
542
+
543
+ ```ts
544
+ await usageTap.endCall({
545
+ callId: begin.data.callId,
546
+ modelUsed: "custom-model-v2",
547
+ inputTokens: 100,
548
+ responseTokens: 200,
549
+ isPremium: true, // Explicitly mark this as a premium call
550
+ });
551
+ ```
552
+
553
+ This is useful when:
554
+ - You're using custom models that aren't in UsageTap's pricing database
555
+ - You want to enforce specific billing tiers regardless of pricing
556
+ - You're implementing your own tier classification logic
557
+
535
558
  ### Raw fetch integrations
536
559
 
537
560
  Prefer `UsageTapClient` whenever possible—it handles retries, headers, and idempotency for you. If you still need to work with `fetch` directly, remember to request the canonical media type and consume the envelope shape directly:
package/dist/index.cjs CHANGED
@@ -126,7 +126,7 @@ var IDEMPOTENCY_HEADER = "idempotency-key";
126
126
  var SDK_HEADER = "x-usage-sdk";
127
127
  var USER_AGENT = "UsageTapClient";
128
128
  var CANONICAL_MEDIA_TYPE = "application/vnd.usagetap.v1+json";
129
- var SDK_VERSION = "0.2.0" ;
129
+ var SDK_VERSION = "0.2.1" ;
130
130
  var HAS_WINDOW = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
131
131
  var UsageTapClient = class {
132
132
  apiKey;
package/dist/index.js CHANGED
@@ -124,7 +124,7 @@ var IDEMPOTENCY_HEADER = "idempotency-key";
124
124
  var SDK_HEADER = "x-usage-sdk";
125
125
  var USER_AGENT = "UsageTapClient";
126
126
  var CANONICAL_MEDIA_TYPE = "application/vnd.usagetap.v1+json";
127
- var SDK_VERSION = "0.2.0" ;
127
+ var SDK_VERSION = "0.2.1" ;
128
128
  var HAS_WINDOW = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
129
129
  var UsageTapClient = class {
130
130
  apiKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usagetap/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "UsageTap SDK core client plus optional React helpers.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",