@soat/sdk 0.15.3 → 0.15.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/dist/index.cjs CHANGED
@@ -2952,13 +2952,65 @@ var Usage = class {
2952
2952
  });
2953
2953
  }
2954
2954
  /**
2955
- * Get a generation's billing receipt
2955
+ * Get aggregated usage for a project
2956
2956
  *
2957
- * Returns a billing receipt for a completed generation: per-model line items (tokens, the price-book version that priced them, and cost) plus totals.
2957
+ * 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.
2958
2958
  *
2959
2959
  */
2960
- static getUsageReceipt(options) {
2960
+ static getUsage(options) {
2961
2961
  return (options.client ?? client).get({
2962
+ url: "/api/v1/usage",
2963
+ ...options
2964
+ });
2965
+ }
2966
+ /**
2967
+ * List usage thresholds
2968
+ *
2969
+ * 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.
2970
+ *
2971
+ */
2972
+ static listUsageThresholds(options) {
2973
+ return (options?.client ?? client).get({
2974
+ url: "/api/v1/usage/thresholds",
2975
+ ...options
2976
+ });
2977
+ }
2978
+ /**
2979
+ * Create a usage threshold
2980
+ *
2981
+ * 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).
2982
+ *
2983
+ */
2984
+ static createUsageThreshold(options) {
2985
+ return (options.client ?? client).post({
2986
+ url: "/api/v1/usage/thresholds",
2987
+ ...options,
2988
+ headers: {
2989
+ "Content-Type": "application/json",
2990
+ ...options.headers
2991
+ }
2992
+ });
2993
+ }
2994
+ /**
2995
+ * Delete a usage threshold
2996
+ *
2997
+ * Deletes a usage threshold, resetting its fire state. Recreating a threshold starts its once-per-window / hysteresis state fresh.
2998
+ *
2999
+ */
3000
+ static deleteUsageThreshold(options) {
3001
+ return (options.client ?? client).delete({
3002
+ url: "/api/v1/usage/thresholds/{threshold_id}",
3003
+ ...options
3004
+ });
3005
+ }
3006
+ /**
3007
+ * Get a generation or run billing receipt
3008
+ *
3009
+ * 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.
3010
+ *
3011
+ */
3012
+ static getUsageReceipt(options) {
3013
+ return (options?.client ?? client).get({
2962
3014
  url: "/api/v1/usage/receipt",
2963
3015
  ...options
2964
3016
  });