@soat/sdk 0.15.3 → 0.15.4

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.mjs CHANGED
@@ -2951,13 +2951,65 @@ var Usage = class {
2951
2951
  });
2952
2952
  }
2953
2953
  /**
2954
- * Get a generation's billing receipt
2954
+ * Get aggregated usage for a project
2955
2955
  *
2956
- * Returns a billing receipt for a completed generation: per-model line items (tokens, the price-book version that priced them, and cost) plus totals.
2956
+ * Returns a project's usage rolled up over an optional `[from, to]` time window, bucketed by a single dimension. Each group and the grand total carry summed token counts and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw meter rows client-side.
2957
2957
  *
2958
2958
  */
2959
- static getUsageReceipt(options) {
2959
+ static getUsage(options) {
2960
2960
  return (options.client ?? client).get({
2961
+ url: "/api/v1/usage",
2962
+ ...options
2963
+ });
2964
+ }
2965
+ /**
2966
+ * List usage thresholds
2967
+ *
2968
+ * Lists the usage alert thresholds the caller can access, optionally filtered by project_id. Each threshold fires the `usage.threshold_crossed` webhook when a project's cost or token usage over a calendar-month or rolling-24h window crosses the configured value.
2969
+ *
2970
+ */
2971
+ static listUsageThresholds(options) {
2972
+ return (options?.client ?? client).get({
2973
+ url: "/api/v1/usage/thresholds",
2974
+ ...options
2975
+ });
2976
+ }
2977
+ /**
2978
+ * Create a usage threshold
2979
+ *
2980
+ * Creates a usage alert threshold on a project. Thresholds are immutable apart from deletion — to change one, delete and recreate it (which resets its fire state).
2981
+ *
2982
+ */
2983
+ static createUsageThreshold(options) {
2984
+ return (options.client ?? client).post({
2985
+ url: "/api/v1/usage/thresholds",
2986
+ ...options,
2987
+ headers: {
2988
+ "Content-Type": "application/json",
2989
+ ...options.headers
2990
+ }
2991
+ });
2992
+ }
2993
+ /**
2994
+ * Delete a usage threshold
2995
+ *
2996
+ * Deletes a usage threshold, resetting its fire state. Recreating a threshold starts its once-per-window / hysteresis state fresh.
2997
+ *
2998
+ */
2999
+ static deleteUsageThreshold(options) {
3000
+ return (options.client ?? client).delete({
3001
+ url: "/api/v1/usage/thresholds/{threshold_id}",
3002
+ ...options
3003
+ });
3004
+ }
3005
+ /**
3006
+ * Get a generation or run billing receipt
3007
+ *
3008
+ * Returns a billing receipt. Pass generation_id for a per-generation receipt, or run_id for a per-run receipt summed across the orchestration run's meters — both share the same shape (per-model line items with tokens, the price-book version that priced them, and cost, plus totals). Exactly one of generation_id or run_id must be supplied.
3009
+ *
3010
+ */
3011
+ static getUsageReceipt(options) {
3012
+ return (options?.client ?? client).get({
2961
3013
  url: "/api/v1/usage/receipt",
2962
3014
  ...options
2963
3015
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soat/sdk",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "description": "TypeScript SDK for the SOAT API",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",