@openmeter/sdk 1.0.0-beta-bb4645e4fad7 → 1.0.0-beta-56a331f85792

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.
@@ -590,6 +590,9 @@ export declare class CustomerEntitlementsV2 {
590
590
  readonly overage?: number;
591
591
  readonly totalAvailableGrantAmount?: number;
592
592
  readonly config?: string;
593
+ readonly grantBalances?: {
594
+ [key: string]: number;
595
+ };
593
596
  } | undefined>;
594
597
  /**
595
598
  * Get the history of a customer entitlement
@@ -1011,29 +1011,6 @@ export interface paths {
1011
1011
  patch?: never;
1012
1012
  trace?: never;
1013
1013
  };
1014
- '/api/v1/features/{featureId}/cost': {
1015
- parameters: {
1016
- query?: never;
1017
- header?: never;
1018
- path?: never;
1019
- cookie?: never;
1020
- };
1021
- /**
1022
- * Query feature cost
1023
- * @description Query the cost of a feature based on its unit cost configuration and underlying meter usage.
1024
- * For features with manual unit cost, the cost is usage × fixed amount.
1025
- * For features with LLM unit cost, the cost is resolved per row from the LLM cost database.
1026
- * The feature must have a meter and unit cost configured.
1027
- */
1028
- get: operations['queryFeatureCost'];
1029
- put?: never;
1030
- post?: never;
1031
- delete?: never;
1032
- options?: never;
1033
- head?: never;
1034
- patch?: never;
1035
- trace?: never;
1036
- };
1037
1014
  '/api/v1/grants': {
1038
1015
  parameters: {
1039
1016
  query?: never;
@@ -5796,6 +5773,50 @@ export interface components {
5796
5773
  */
5797
5774
  readonly config?: string;
5798
5775
  };
5776
+ /** @description EntitlementValueV2 returns entitlement access state and value fields for customer-scoped V2 APIs. */
5777
+ EntitlementValueV2: {
5778
+ /**
5779
+ * @description Whether the subject has access to the feature. Shared accross all entitlement types.
5780
+ * @example true
5781
+ */
5782
+ readonly hasAccess: boolean;
5783
+ /**
5784
+ * Format: double
5785
+ * @description Only available for metered entitlements. Metered entitlements are built around a balance calculation where feature usage is deducted from the issued grants. Balance represents the remaining balance of the entitlement, it's value never turns negative.
5786
+ * @example 100
5787
+ */
5788
+ readonly balance?: number;
5789
+ /**
5790
+ * Format: double
5791
+ * @description Only available for metered entitlements. Returns the total feature usage in the current period.
5792
+ * @example 50
5793
+ */
5794
+ readonly usage?: number;
5795
+ /**
5796
+ * Format: double
5797
+ * @description Only available for metered entitlements. Overage represents the usage that wasn't covered by grants, e.g. if the subject had a total feature usage of 100 in the period but they were only granted 80, there would be 20 overage.
5798
+ * @example 0
5799
+ */
5800
+ readonly overage?: number;
5801
+ /**
5802
+ * Format: double
5803
+ * @description Only available for metered entitlements. The summed amount of all grant active at query time PLUS the used amount of since inactive grants.
5804
+ * @example 100
5805
+ */
5806
+ readonly totalAvailableGrantAmount?: number;
5807
+ /**
5808
+ * @description Only available for static entitlements. The JSON parsable config of the entitlement.
5809
+ * @example { key: "value" }
5810
+ */
5811
+ readonly config?: string;
5812
+ /**
5813
+ * @description Only available for metered entitlements. The closing balance of each active grant at query time.
5814
+ * The key is the grant ID and the value is the remaining balance.
5815
+ */
5816
+ readonly grantBalances?: {
5817
+ [key: string]: number;
5818
+ };
5819
+ };
5799
5820
  /** @description Generic ErrorExtension as part of HTTPProblem.Extensions.[StatusCode] */
5800
5821
  ErrorExtension: {
5801
5822
  /**
@@ -6024,58 +6045,6 @@ export interface components {
6024
6045
  */
6025
6046
  readonly id: string;
6026
6047
  };
6027
- /** @description Result of a feature cost query. */
6028
- FeatureCostQueryResult: {
6029
- /**
6030
- * Format: date-time
6031
- * @description Start of the queried period.
6032
- * @example 2023-01-01T01:01:01.001Z
6033
- */
6034
- from?: Date;
6035
- /**
6036
- * Format: date-time
6037
- * @description End of the queried period.
6038
- * @example 2023-01-01T01:01:01.001Z
6039
- */
6040
- to?: Date;
6041
- /** @description The window size that the cost is aggregated. */
6042
- windowSize?: components['schemas']['WindowSize'];
6043
- /** @description The currency code of the cost amounts. */
6044
- currency: components['schemas']['CurrencyCode'];
6045
- /** @description The cost data rows. */
6046
- data: components['schemas']['FeatureCostQueryRow'][];
6047
- };
6048
- /** @description A row in the result of a feature cost query. */
6049
- FeatureCostQueryRow: {
6050
- /** @description The metered usage value for the period. */
6051
- usage: components['schemas']['Numeric'];
6052
- /** @description The computed cost amount (usage × unit cost). Null when pricing is not available for the group-by combination. */
6053
- cost: (string & components['schemas']['Numeric']) | null;
6054
- /** @description The currency code of the cost amount. */
6055
- currency: components['schemas']['CurrencyCode'];
6056
- /** @description Detail message when cost amount is null, explaining why the cost could not be resolved. */
6057
- detail?: string;
6058
- /**
6059
- * Format: date-time
6060
- * @description The start of the window the value is aggregated over.
6061
- * @example 2023-01-01T01:01:01.001Z
6062
- */
6063
- windowStart: Date;
6064
- /**
6065
- * Format: date-time
6066
- * @description The end of the window the value is aggregated over.
6067
- * @example 2023-01-01T01:01:01.001Z
6068
- */
6069
- windowEnd: Date;
6070
- /** @description The subject the value is aggregated over. */
6071
- subject?: string;
6072
- /** @description The customer ID the value is aggregated over. */
6073
- customerId?: string;
6074
- /** @description The group by values the value is aggregated over. */
6075
- groupBy?: {
6076
- [key: string]: string | null;
6077
- };
6078
- };
6079
6048
  /**
6080
6049
  * @description Represents a feature that can be enabled or disabled for a plan.
6081
6050
  * Used both for product catalog and entitlements.
@@ -12316,14 +12285,13 @@ export type EntitlementV2 = components['schemas']['EntitlementV2'];
12316
12285
  export type EntitlementV2CreateInputs = components['schemas']['EntitlementV2CreateInputs'];
12317
12286
  export type EntitlementV2PaginatedResponse = components['schemas']['EntitlementV2PaginatedResponse'];
12318
12287
  export type EntitlementValue = components['schemas']['EntitlementValue'];
12288
+ export type EntitlementValueV2 = components['schemas']['EntitlementValueV2'];
12319
12289
  export type ErrorExtension = components['schemas']['ErrorExtension'];
12320
12290
  export type Event = components['schemas']['Event'];
12321
12291
  export type EventDeliveryAttemptResponse = components['schemas']['EventDeliveryAttemptResponse'];
12322
12292
  export type ExpirationDuration = components['schemas']['ExpirationDuration'];
12323
12293
  export type ExpirationPeriod = components['schemas']['ExpirationPeriod'];
12324
12294
  export type Feature = components['schemas']['Feature'];
12325
- export type FeatureCostQueryResult = components['schemas']['FeatureCostQueryResult'];
12326
- export type FeatureCostQueryRow = components['schemas']['FeatureCostQueryRow'];
12327
12295
  export type FeatureCreateInputs = components['schemas']['FeatureCreateInputs'];
12328
12296
  export type FeatureLlmUnitCost = components['schemas']['FeatureLLMUnitCost'];
12329
12297
  export type FeatureLlmUnitCostPricing = components['schemas']['FeatureLLMUnitCostPricing'];
@@ -18617,168 +18585,6 @@ export interface operations {
18617
18585
  };
18618
18586
  };
18619
18587
  };
18620
- queryFeatureCost: {
18621
- parameters: {
18622
- query?: {
18623
- /**
18624
- * @description Client ID
18625
- * Useful to track progress of a query.
18626
- */
18627
- clientId?: components['parameters']['MeterQuery.clientId'];
18628
- /**
18629
- * @description Start date-time in RFC 3339 format.
18630
- *
18631
- * Inclusive.
18632
- *
18633
- * For example: ?from=2025-01-01T00%3A00%3A00.000Z
18634
- */
18635
- from?: components['parameters']['MeterQuery.from'];
18636
- /**
18637
- * @description End date-time in RFC 3339 format.
18638
- *
18639
- * Inclusive.
18640
- *
18641
- * For example: ?to=2025-02-01T00%3A00%3A00.000Z
18642
- */
18643
- to?: components['parameters']['MeterQuery.to'];
18644
- /**
18645
- * @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.
18646
- *
18647
- * For example: ?windowSize=DAY
18648
- */
18649
- windowSize?: components['parameters']['MeterQuery.windowSize'];
18650
- /**
18651
- * @description The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
18652
- * If not specified, the UTC timezone will be used.
18653
- *
18654
- * For example: ?windowTimeZone=UTC
18655
- */
18656
- windowTimeZone?: components['parameters']['MeterQuery.windowTimeZone'];
18657
- /**
18658
- * @description Filtering by multiple subjects.
18659
- *
18660
- * For example: ?subject=subject-1&subject=subject-2
18661
- */
18662
- subject?: components['parameters']['MeterQuery.subject'];
18663
- /**
18664
- * @description Filtering by multiple customers.
18665
- *
18666
- * For example: ?filterCustomerId=customer-1&filterCustomerId=customer-2
18667
- */
18668
- filterCustomerId?: components['parameters']['MeterQuery.filterCustomerId'];
18669
- /**
18670
- * @deprecated
18671
- * @description Simple filter for group bys with exact match.
18672
- *
18673
- * For example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo
18674
- *
18675
- * ⚠️ __Deprecated__: Use `advancedMeterGroupByFilters` instead
18676
- */
18677
- filterGroupBy?: components['parameters']['MeterQuery.filterGroupBy'];
18678
- /**
18679
- * @description Optional advanced meter group by filters.
18680
- * You can use this to filter for values of the meter groupBy fields.
18681
- */
18682
- advancedMeterGroupByFilters?: components['parameters']['MeterQuery.advancedMeterGroupByFilters'];
18683
- /**
18684
- * @description If not specified a single aggregate will be returned for each subject and time window.
18685
- * `subject` is a reserved group by value.
18686
- *
18687
- * For example: ?groupBy=subject&groupBy=model
18688
- */
18689
- groupBy?: components['parameters']['MeterQuery.groupBy'];
18690
- };
18691
- header?: never;
18692
- path: {
18693
- featureId: string;
18694
- };
18695
- cookie?: never;
18696
- };
18697
- requestBody?: never;
18698
- responses: {
18699
- /** @description The request has succeeded. */
18700
- 200: {
18701
- headers: {
18702
- [name: string]: unknown;
18703
- };
18704
- content: {
18705
- 'application/json': components['schemas']['FeatureCostQueryResult'];
18706
- };
18707
- };
18708
- /** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
18709
- 400: {
18710
- headers: {
18711
- [name: string]: unknown;
18712
- };
18713
- content: {
18714
- 'application/problem+json': components['schemas']['BadRequestProblemResponse'];
18715
- };
18716
- };
18717
- /** @description The request has not been applied because it lacks valid authentication credentials for the target resource. */
18718
- 401: {
18719
- headers: {
18720
- [name: string]: unknown;
18721
- };
18722
- content: {
18723
- 'application/problem+json': components['schemas']['UnauthorizedProblemResponse'];
18724
- };
18725
- };
18726
- /** @description The server understood the request but refuses to authorize it. */
18727
- 403: {
18728
- headers: {
18729
- [name: string]: unknown;
18730
- };
18731
- content: {
18732
- 'application/problem+json': components['schemas']['ForbiddenProblemResponse'];
18733
- };
18734
- };
18735
- /** @description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. */
18736
- 404: {
18737
- headers: {
18738
- [name: string]: unknown;
18739
- };
18740
- content: {
18741
- 'application/problem+json': components['schemas']['NotFoundProblemResponse'];
18742
- };
18743
- };
18744
- /** @description One or more conditions given in the request header fields evaluated to false when tested on the server. */
18745
- 412: {
18746
- headers: {
18747
- [name: string]: unknown;
18748
- };
18749
- content: {
18750
- 'application/problem+json': components['schemas']['PreconditionFailedProblemResponse'];
18751
- };
18752
- };
18753
- /** @description The server encountered an unexpected condition that prevented it from fulfilling the request. */
18754
- 500: {
18755
- headers: {
18756
- [name: string]: unknown;
18757
- };
18758
- content: {
18759
- 'application/problem+json': components['schemas']['InternalServerErrorProblemResponse'];
18760
- };
18761
- };
18762
- /** @description The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay. */
18763
- 503: {
18764
- headers: {
18765
- [name: string]: unknown;
18766
- };
18767
- content: {
18768
- 'application/problem+json': components['schemas']['ServiceUnavailableProblemResponse'];
18769
- };
18770
- };
18771
- /** @description An unexpected error response. */
18772
- default: {
18773
- headers: {
18774
- [name: string]: unknown;
18775
- };
18776
- content: {
18777
- 'application/problem+json': components['schemas']['UnexpectedProblemResponse'];
18778
- };
18779
- };
18780
- };
18781
- };
18782
18588
  listGrants: {
18783
18589
  parameters: {
18784
18590
  query?: {
@@ -27518,7 +27324,7 @@ export interface operations {
27518
27324
  [name: string]: unknown;
27519
27325
  };
27520
27326
  content: {
27521
- 'application/json': components['schemas']['EntitlementValue'];
27327
+ 'application/json': components['schemas']['EntitlementValueV2'];
27522
27328
  };
27523
27329
  };
27524
27330
  /** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */