@openmeter/client 1.0.0-beta-1e01089e8f75 → 1.0.0-beta-19a1f6bdbcd5

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.
@@ -466,23 +466,23 @@ export const chargeFlatFeeDiscounts = z
466
466
  export const rateCardProrationMode = z
467
467
  .enum(['no_proration', 'prorate_prices'])
468
468
  .describe('The proration mode of the rate card. Values: - `no_proration`: No proration. - `prorate_prices`: Prorate the price based on the time remaining in the billing period.');
469
- export const priceFree = z
470
- .object({
471
- type: z.literal('free').describe('The type of the price.'),
472
- })
473
- .describe('Free price.');
474
- export const subscriptionCostBasisMode = z
475
- .enum(['dynamic', 'pinned'])
476
- .describe('Controls how custom-currency cost bases are selected for the subscription.');
477
- export const subscriptionStatus = z
478
- .enum(['active', 'inactive', 'canceled', 'scheduled'])
479
- .describe('Subscription status.');
480
469
  export const unitConfigOperation = z
481
470
  .enum(['divide', 'multiply'])
482
471
  .describe('The arithmetic operation used to convert raw metered units into billing units. - `divide`: Divide the metered quantity by the conversion factor (e.g., bytes ÷ 1e9 = GB). - `multiply`: Multiply the metered quantity by the conversion factor (e.g., cost × 1.2 = cost + 20% margin).');
483
472
  export const unitConfigRoundingMode = z
484
473
  .enum(['ceiling', 'floor', 'half_up', 'none'])
485
474
  .describe('The rounding mode applied to the converted quantity for invoicing. Rounding is applied only to the invoiced quantity. Entitlement balance checks use the precise decimal value after conversion. - `ceiling`: Round up to the next integer (typical for package-style billing). - `floor`: Round down to the previous integer. - `half_up`: Round to the nearest integer, with 0.5 rounding up. - `none`: No rounding; the converted value is used as-is.');
475
+ export const subscriptionCostBasisMode = z
476
+ .enum(['dynamic', 'pinned'])
477
+ .describe('Controls how custom-currency cost bases are selected for the subscription.');
478
+ export const subscriptionStatus = z
479
+ .enum(['active', 'inactive', 'canceled', 'scheduled'])
480
+ .describe('Subscription status.');
481
+ export const priceFree = z
482
+ .object({
483
+ type: z.literal('free').describe('The type of the price.'),
484
+ })
485
+ .describe('Free price.');
486
486
  export const rateCardStaticEntitlement = z
487
487
  .object({
488
488
  type: z.literal('static').describe('The type of the entitlement template.'),
@@ -1110,12 +1110,6 @@ export const priceFlat = z
1110
1110
  amount: numeric,
1111
1111
  })
1112
1112
  .describe('Flat price.');
1113
- export const priceUnit = z
1114
- .object({
1115
- type: z.literal('unit').describe('The type of the price.'),
1116
- amount: numeric,
1117
- })
1118
- .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the rate card, billing units are the converted quantities (e.g. GB instead of bytes).');
1119
1113
  export const rateCardDiscounts = z
1120
1114
  .object({
1121
1115
  percentage: z
@@ -1139,12 +1133,18 @@ export const totals = z
1139
1133
  total: numeric,
1140
1134
  })
1141
1135
  .describe('Totals contains the summaries of all calculations for a billing resource.');
1136
+ export const priceUnit = z
1137
+ .object({
1138
+ type: z.literal('unit').describe('The type of the price.'),
1139
+ amount: numeric,
1140
+ })
1141
+ .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the object, billing units are the converted quantities (e.g. GB instead of bytes).');
1142
1142
  export const spendCommitments = z
1143
1143
  .object({
1144
1144
  minimumAmount: numeric.optional(),
1145
1145
  maximumAmount: numeric.optional(),
1146
1146
  })
1147
- .describe('Spend commitments for a rate card. The customer is committed to spend at least the minimum amount and at most the maximum amount.');
1147
+ .describe('Spend commitments for a usage-based price. The customer is committed to spend at least the minimum amount and at most the maximum amount.');
1148
1148
  export const invoiceLineCreditsApplied = z
1149
1149
  .object({
1150
1150
  amount: numeric,
@@ -1175,7 +1175,7 @@ export const updatePriceUnit = z
1175
1175
  type: z.literal('unit').describe('The type of the price.'),
1176
1176
  amount: numeric,
1177
1177
  })
1178
- .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the rate card, billing units are the converted quantities (e.g. GB instead of bytes).');
1178
+ .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the object, billing units are the converted quantities (e.g. GB instead of bytes).');
1179
1179
  export const updateDiscounts = z
1180
1180
  .object({
1181
1181
  percentage: z
@@ -2072,6 +2072,23 @@ export const subscriptionProRatingConfig = z
2072
2072
  mode: rateCardProrationMode,
2073
2073
  })
2074
2074
  .describe('The pro-rating configuration of a subscription.');
2075
+ export const unitConfig = z
2076
+ .object({
2077
+ operation: unitConfigOperation,
2078
+ conversionFactor: numeric,
2079
+ rounding: unitConfigRoundingMode.optional().default('none'),
2080
+ precision: z
2081
+ .number()
2082
+ .int()
2083
+ .optional()
2084
+ .default(0)
2085
+ .describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
2086
+ displayUnit: z
2087
+ .string()
2088
+ .optional()
2089
+ .describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
2090
+ })
2091
+ .describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Stored with a resource\'s rating configuration so the same metered feature can be billed in different units across plans and charges. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
2075
2092
  export const subscriptionCreate = z
2076
2093
  .object({
2077
2094
  labels: labels.optional(),
@@ -2097,23 +2114,6 @@ export const subscriptionCreate = z
2097
2114
  costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
2098
2115
  })
2099
2116
  .describe('Subscription create request.');
2100
- export const unitConfig = z
2101
- .object({
2102
- operation: unitConfigOperation,
2103
- conversionFactor: numeric,
2104
- rounding: unitConfigRoundingMode.optional().default('none'),
2105
- precision: z
2106
- .number()
2107
- .int()
2108
- .optional()
2109
- .default(0)
2110
- .describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
2111
- displayUnit: z
2112
- .string()
2113
- .optional()
2114
- .describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
2115
- })
2116
- .describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
2117
2117
  export const subscriptionEditTiming = z
2118
2118
  .union([subscriptionEditTimingEnum, dateTime])
2119
2119
  .describe('Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned.');
@@ -2426,26 +2426,26 @@ export const creditTransaction = z
2426
2426
  .describe('The available balance before and after the transaction.'),
2427
2427
  })
2428
2428
  .describe("A credit transaction represents a single credit movement on the customer's balance. Credit transactions are immutable.");
2429
+ export const chargeTotals = z
2430
+ .object({
2431
+ booked: totals,
2432
+ realtime: totals.optional(),
2433
+ })
2434
+ .describe('The totals of a charge. RealTime is only expanded when the `real_time_usage` expand is used.');
2429
2435
  export const priceTier = z
2430
2436
  .object({
2431
2437
  upToAmount: numeric.optional(),
2432
2438
  flatPrice: priceFlat.optional(),
2433
2439
  unitPrice: priceUnit.optional(),
2434
2440
  })
2435
- .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the rate card, up_to_amount is expressed in converted billing units.');
2436
- export const chargeTotals = z
2437
- .object({
2438
- booked: totals,
2439
- realtime: totals.optional(),
2440
- })
2441
- .describe('The totals of a change. RealTime is only expanded when the `real_time_usage` expand is used.');
2441
+ .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the containing resource, up_to_amount is expressed in converted billing units.');
2442
2442
  export const updatePriceTier = z
2443
2443
  .object({
2444
2444
  upToAmount: numeric.optional(),
2445
2445
  flatPrice: updatePriceFlat.optional(),
2446
2446
  unitPrice: updatePriceUnit.optional(),
2447
2447
  })
2448
- .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the rate card, up_to_amount is expressed in converted billing units.');
2448
+ .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the containing resource, up_to_amount is expressed in converted billing units.');
2449
2449
  export const featureLlmUnitCost = z
2450
2450
  .object({
2451
2451
  type: z
@@ -3162,7 +3162,7 @@ export const priceGraduated = z
3162
3162
  .min(1)
3163
3163
  .describe('The tiers of the graduated price. At least one tier is required.'),
3164
3164
  })
3165
- .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.");
3165
+ .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.");
3166
3166
  export const priceVolume = z
3167
3167
  .object({
3168
3168
  type: z.literal('volume').describe('The type of the price.'),
@@ -3171,7 +3171,7 @@ export const priceVolume = z
3171
3171
  .min(1)
3172
3172
  .describe('The tiers of the volume price. At least one tier is required.'),
3173
3173
  })
3174
- .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.');
3174
+ .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.');
3175
3175
  export const updatePriceGraduated = z
3176
3176
  .object({
3177
3177
  type: z.literal('graduated').describe('The type of the price.'),
@@ -3180,7 +3180,7 @@ export const updatePriceGraduated = z
3180
3180
  .min(1)
3181
3181
  .describe('The tiers of the graduated price. At least one tier is required.'),
3182
3182
  })
3183
- .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.");
3183
+ .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.");
3184
3184
  export const updatePriceVolume = z
3185
3185
  .object({
3186
3186
  type: z.literal('volume').describe('The type of the price.'),
@@ -3189,7 +3189,7 @@ export const updatePriceVolume = z
3189
3189
  .min(1)
3190
3190
  .describe('The tiers of the volume price. At least one tier is required.'),
3191
3191
  })
3192
- .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.');
3192
+ .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.');
3193
3193
  export const featureUnitCost = z
3194
3194
  .discriminatedUnion('type', [featureManualUnitCost, featureLlmUnitCost])
3195
3195
  .describe('Per-unit cost configuration for a feature. Either a fixed manual amount or a dynamic LLM cost lookup.');
@@ -3451,6 +3451,56 @@ export const workflowCollectionAlignment = z
3451
3451
  workflowCollectionAlignmentAnchored,
3452
3452
  ])
3453
3453
  .describe('The alignment for collecting the pending line items into an invoice. Defaults to subscription, which means that we are to create a new invoice every time the a subscription period starts (for in advance items) or ends (for in arrears items).');
3454
+ export const chargeFlatFee = z
3455
+ .object({
3456
+ id: ulid,
3457
+ name: z
3458
+ .string()
3459
+ .min(1)
3460
+ .max(256)
3461
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3462
+ description: z
3463
+ .string()
3464
+ .max(1024)
3465
+ .optional()
3466
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3467
+ labels: labels.optional(),
3468
+ createdAt: dateTime,
3469
+ updatedAt: dateTime,
3470
+ deletedAt: dateTime.optional(),
3471
+ type: z.literal('flat_fee').describe('The type of the charge.'),
3472
+ customer: billingCustomerReference,
3473
+ lifecycleController: lifecycleController,
3474
+ subscription: subscriptionReference.optional(),
3475
+ currency: currencyCode,
3476
+ status: chargeStatus,
3477
+ invoiceAt: dateTime,
3478
+ servicePeriod: closedPeriod,
3479
+ fullServicePeriod: closedPeriod,
3480
+ billingPeriod: closedPeriod,
3481
+ advanceAfter: dateTime.optional(),
3482
+ uniqueReferenceId: z
3483
+ .string()
3484
+ .optional()
3485
+ .describe('Unique reference ID of the charge.'),
3486
+ settlementMode: settlementMode,
3487
+ taxConfig: taxConfig.optional(),
3488
+ paymentTerm: pricePaymentTerm,
3489
+ discounts: chargeFlatFeeDiscounts.optional(),
3490
+ featureKey: z
3491
+ .string()
3492
+ .optional()
3493
+ .describe('The feature associated with the charge, when applicable.'),
3494
+ featureId: z
3495
+ .string()
3496
+ .optional()
3497
+ .describe('The feature ID associated with the charge.'),
3498
+ prorationConfiguration: rateCardProrationConfiguration,
3499
+ amountAfterProration: currencyAmount,
3500
+ price: priceFlat,
3501
+ systemIntent: chargeFlatFeeSystemIntent.optional(),
3502
+ })
3503
+ .describe('A flat fee charge for a customer.');
3454
3504
  export const taxCodePagePaginatedResponse = z
3455
3505
  .object({
3456
3506
  data: z.array(taxCode),
@@ -3688,6 +3738,9 @@ export const entitlementAccessQueryResult = z
3688
3738
  updatedAt: dateTime,
3689
3739
  })
3690
3740
  .describe('Access evaluation result for a single resolved customer.');
3741
+ export const priceUsageBased = z
3742
+ .discriminatedUnion('type', [priceUnit, priceGraduated, priceVolume])
3743
+ .describe('Usage-based price types for a rate card or charge. When UnitConfig is present on the object, these price types operate on billing units (i.e. post-conversion quantities), not raw metered units.');
3691
3744
  export const price = z
3692
3745
  .discriminatedUnion('type', [
3693
3746
  priceFree,
@@ -3697,9 +3750,6 @@ export const price = z
3697
3750
  priceVolume,
3698
3751
  ])
3699
3752
  .describe('Price.');
3700
- export const priceUsageBased = z
3701
- .discriminatedUnion('type', [priceUnit, priceGraduated, priceVolume])
3702
- .describe('Usage-based price types that can appear on a usage-based rate card. When UnitConfig is present on the rate card, these price types operate on billing units (i.e. post-conversion quantities), not raw metered units.');
3703
3753
  export const updatePrice = z
3704
3754
  .discriminatedUnion('type', [
3705
3755
  updatePriceFree,
@@ -3837,56 +3887,6 @@ export const entitlementAccessQueryResponse = z
3837
3887
  meta: cursorMeta,
3838
3888
  })
3839
3889
  .describe('Response of the entitlement access query.');
3840
- export const chargeFlatFee = z
3841
- .object({
3842
- id: ulid,
3843
- name: z
3844
- .string()
3845
- .min(1)
3846
- .max(256)
3847
- .describe('Display name of the resource. Between 1 and 256 characters.'),
3848
- description: z
3849
- .string()
3850
- .max(1024)
3851
- .optional()
3852
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3853
- labels: labels.optional(),
3854
- createdAt: dateTime,
3855
- updatedAt: dateTime,
3856
- deletedAt: dateTime.optional(),
3857
- type: z.literal('flat_fee').describe('The type of the charge.'),
3858
- customer: billingCustomerReference,
3859
- lifecycleController: lifecycleController,
3860
- subscription: subscriptionReference.optional(),
3861
- currency: currencyCode,
3862
- status: chargeStatus,
3863
- invoiceAt: dateTime,
3864
- servicePeriod: closedPeriod,
3865
- fullServicePeriod: closedPeriod,
3866
- billingPeriod: closedPeriod,
3867
- advanceAfter: dateTime.optional(),
3868
- uniqueReferenceId: z
3869
- .string()
3870
- .optional()
3871
- .describe('Unique reference ID of the charge.'),
3872
- settlementMode: settlementMode,
3873
- taxConfig: taxConfig.optional(),
3874
- paymentTerm: pricePaymentTerm,
3875
- discounts: chargeFlatFeeDiscounts.optional(),
3876
- featureKey: z
3877
- .string()
3878
- .optional()
3879
- .describe('The feature associated with the charge, when applicable.'),
3880
- featureId: z
3881
- .string()
3882
- .optional()
3883
- .describe('The feature ID associated with the charge.'),
3884
- prorationConfiguration: rateCardProrationConfiguration,
3885
- amountAfterProration: currencyAmount,
3886
- price: price,
3887
- systemIntent: chargeFlatFeeSystemIntent.optional(),
3888
- })
3889
- .describe('A flat fee charge for a customer.');
3890
3890
  export const chargeUsageBasedSystemIntent = z
3891
3891
  .object({
3892
3892
  name: z
@@ -3905,7 +3905,9 @@ export const chargeUsageBasedSystemIntent = z
3905
3905
  fullServicePeriod: closedPeriod,
3906
3906
  billingPeriod: closedPeriod,
3907
3907
  discounts: rateCardDiscounts.optional(),
3908
- price: price,
3908
+ price: priceUsageBased,
3909
+ commitments: spendCommitments.optional(),
3910
+ unitConfig: unitConfig.optional(),
3909
3911
  deletedAt: dateTime.optional(),
3910
3912
  })
3911
3913
  .describe('Usage-based intent fields from the system lifecycle controller shadowed by a manual override.');
@@ -3936,7 +3938,9 @@ export const createChargeUsageBasedRequest = z
3936
3938
  featureId: z
3937
3939
  .string()
3938
3940
  .describe('The feature ID associated with the charge.'),
3939
- price: price,
3941
+ price: priceUsageBased,
3942
+ commitments: spendCommitments.optional(),
3943
+ unitConfig: unitConfig.optional(),
3940
3944
  fullServicePeriod: closedPeriod.optional(),
3941
3945
  billingPeriod: closedPeriod.optional(),
3942
3946
  })
@@ -4051,7 +4055,9 @@ export const chargeUsageBased = z
4051
4055
  .string()
4052
4056
  .describe('The feature ID associated with the charge.'),
4053
4057
  totals: chargeTotals,
4054
- price: price,
4058
+ price: priceUsageBased,
4059
+ commitments: spendCommitments.optional(),
4060
+ unitConfig: unitConfig.optional(),
4055
4061
  systemIntent: chargeUsageBasedSystemIntent.optional(),
4056
4062
  })
4057
4063
  .describe('A usage-based charge for a customer.');
@@ -5786,23 +5792,23 @@ export const chargeFlatFeeDiscountsWire = z
5786
5792
  export const rateCardProrationModeWire = z
5787
5793
  .enum(['no_proration', 'prorate_prices'])
5788
5794
  .describe('The proration mode of the rate card. Values: - `no_proration`: No proration. - `prorate_prices`: Prorate the price based on the time remaining in the billing period.');
5789
- export const priceFreeWire = z
5790
- .strictObject({
5791
- type: z.literal('free').describe('The type of the price.'),
5792
- })
5793
- .describe('Free price.');
5794
- export const subscriptionCostBasisModeWire = z
5795
- .enum(['dynamic', 'pinned'])
5796
- .describe('Controls how custom-currency cost bases are selected for the subscription.');
5797
- export const subscriptionStatusWire = z
5798
- .enum(['active', 'inactive', 'canceled', 'scheduled'])
5799
- .describe('Subscription status.');
5800
5795
  export const unitConfigOperationWire = z
5801
5796
  .enum(['divide', 'multiply'])
5802
5797
  .describe('The arithmetic operation used to convert raw metered units into billing units. - `divide`: Divide the metered quantity by the conversion factor (e.g., bytes ÷ 1e9 = GB). - `multiply`: Multiply the metered quantity by the conversion factor (e.g., cost × 1.2 = cost + 20% margin).');
5803
5798
  export const unitConfigRoundingModeWire = z
5804
5799
  .enum(['ceiling', 'floor', 'half_up', 'none'])
5805
5800
  .describe('The rounding mode applied to the converted quantity for invoicing. Rounding is applied only to the invoiced quantity. Entitlement balance checks use the precise decimal value after conversion. - `ceiling`: Round up to the next integer (typical for package-style billing). - `floor`: Round down to the previous integer. - `half_up`: Round to the nearest integer, with 0.5 rounding up. - `none`: No rounding; the converted value is used as-is.');
5801
+ export const subscriptionCostBasisModeWire = z
5802
+ .enum(['dynamic', 'pinned'])
5803
+ .describe('Controls how custom-currency cost bases are selected for the subscription.');
5804
+ export const subscriptionStatusWire = z
5805
+ .enum(['active', 'inactive', 'canceled', 'scheduled'])
5806
+ .describe('Subscription status.');
5807
+ export const priceFreeWire = z
5808
+ .strictObject({
5809
+ type: z.literal('free').describe('The type of the price.'),
5810
+ })
5811
+ .describe('Free price.');
5806
5812
  export const rateCardStaticEntitlementWire = z
5807
5813
  .strictObject({
5808
5814
  type: z.literal('static').describe('The type of the entitlement template.'),
@@ -6424,12 +6430,6 @@ export const priceFlatWire = z
6424
6430
  amount: numericWire,
6425
6431
  })
6426
6432
  .describe('Flat price.');
6427
- export const priceUnitWire = z
6428
- .strictObject({
6429
- type: z.literal('unit').describe('The type of the price.'),
6430
- amount: numericWire,
6431
- })
6432
- .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the rate card, billing units are the converted quantities (e.g. GB instead of bytes).');
6433
6433
  export const rateCardDiscountsWire = z
6434
6434
  .strictObject({
6435
6435
  percentage: z
@@ -6453,12 +6453,18 @@ export const totalsWire = z
6453
6453
  total: numericWire,
6454
6454
  })
6455
6455
  .describe('Totals contains the summaries of all calculations for a billing resource.');
6456
+ export const priceUnitWire = z
6457
+ .strictObject({
6458
+ type: z.literal('unit').describe('The type of the price.'),
6459
+ amount: numericWire,
6460
+ })
6461
+ .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the object, billing units are the converted quantities (e.g. GB instead of bytes).');
6456
6462
  export const spendCommitmentsWire = z
6457
6463
  .strictObject({
6458
6464
  minimum_amount: numericWire.optional(),
6459
6465
  maximum_amount: numericWire.optional(),
6460
6466
  })
6461
- .describe('Spend commitments for a rate card. The customer is committed to spend at least the minimum amount and at most the maximum amount.');
6467
+ .describe('Spend commitments for a usage-based price. The customer is committed to spend at least the minimum amount and at most the maximum amount.');
6462
6468
  export const invoiceLineCreditsAppliedWire = z
6463
6469
  .strictObject({
6464
6470
  amount: numericWire,
@@ -6489,7 +6495,7 @@ export const updatePriceUnitWire = z
6489
6495
  type: z.literal('unit').describe('The type of the price.'),
6490
6496
  amount: numericWire,
6491
6497
  })
6492
- .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the rate card, billing units are the converted quantities (e.g. GB instead of bytes).');
6498
+ .describe('Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the object, billing units are the converted quantities (e.g. GB instead of bytes).');
6493
6499
  export const updateDiscountsWire = z
6494
6500
  .strictObject({
6495
6501
  percentage: z
@@ -7369,6 +7375,22 @@ export const subscriptionProRatingConfigWire = z
7369
7375
  mode: rateCardProrationModeWire,
7370
7376
  })
7371
7377
  .describe('The pro-rating configuration of a subscription.');
7378
+ export const unitConfigWire = z
7379
+ .strictObject({
7380
+ operation: unitConfigOperationWire,
7381
+ conversion_factor: numericWire,
7382
+ rounding: unitConfigRoundingModeWire.optional(),
7383
+ precision: z
7384
+ .number()
7385
+ .int()
7386
+ .optional()
7387
+ .describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
7388
+ display_unit: z
7389
+ .string()
7390
+ .optional()
7391
+ .describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
7392
+ })
7393
+ .describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Stored with a resource\'s rating configuration so the same metered feature can be billed in different units across plans and charges. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
7372
7394
  export const subscriptionCreateWire = z
7373
7395
  .strictObject({
7374
7396
  labels: labelsWire.optional(),
@@ -7394,22 +7416,6 @@ export const subscriptionCreateWire = z
7394
7416
  cost_basis_mode: subscriptionCostBasisModeWire.optional(),
7395
7417
  })
7396
7418
  .describe('Subscription create request.');
7397
- export const unitConfigWire = z
7398
- .strictObject({
7399
- operation: unitConfigOperationWire,
7400
- conversion_factor: numericWire,
7401
- rounding: unitConfigRoundingModeWire.optional(),
7402
- precision: z
7403
- .number()
7404
- .int()
7405
- .optional()
7406
- .describe('The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).'),
7407
- display_unit: z
7408
- .string()
7409
- .optional()
7410
- .describe('A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.'),
7411
- })
7412
- .describe('Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)');
7413
7419
  export const subscriptionEditTimingWire = z
7414
7420
  .union([subscriptionEditTimingEnumWire, dateTimeWire])
7415
7421
  .describe('Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned.');
@@ -7716,26 +7722,26 @@ export const creditTransactionWire = z
7716
7722
  .describe('The available balance before and after the transaction.'),
7717
7723
  })
7718
7724
  .describe("A credit transaction represents a single credit movement on the customer's balance. Credit transactions are immutable.");
7725
+ export const chargeTotalsWire = z
7726
+ .strictObject({
7727
+ booked: totalsWire,
7728
+ realtime: totalsWire.optional(),
7729
+ })
7730
+ .describe('The totals of a charge. RealTime is only expanded when the `real_time_usage` expand is used.');
7719
7731
  export const priceTierWire = z
7720
7732
  .strictObject({
7721
7733
  up_to_amount: numericWire.optional(),
7722
7734
  flat_price: priceFlatWire.optional(),
7723
7735
  unit_price: priceUnitWire.optional(),
7724
7736
  })
7725
- .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the rate card, up_to_amount is expressed in converted billing units.');
7726
- export const chargeTotalsWire = z
7727
- .strictObject({
7728
- booked: totalsWire,
7729
- realtime: totalsWire.optional(),
7730
- })
7731
- .describe('The totals of a change. RealTime is only expanded when the `real_time_usage` expand is used.');
7737
+ .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the containing resource, up_to_amount is expressed in converted billing units.');
7732
7738
  export const updatePriceTierWire = z
7733
7739
  .strictObject({
7734
7740
  up_to_amount: numericWire.optional(),
7735
7741
  flat_price: updatePriceFlatWire.optional(),
7736
7742
  unit_price: updatePriceUnitWire.optional(),
7737
7743
  })
7738
- .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the rate card, up_to_amount is expressed in converted billing units.');
7744
+ .describe('A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the containing resource, up_to_amount is expressed in converted billing units.');
7739
7745
  export const featureLlmUnitCostWire = z
7740
7746
  .strictObject({
7741
7747
  type: z
@@ -8456,7 +8462,7 @@ export const priceGraduatedWire = z
8456
8462
  .min(1)
8457
8463
  .describe('The tiers of the graduated price. At least one tier is required.'),
8458
8464
  })
8459
- .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.");
8465
+ .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.");
8460
8466
  export const priceVolumeWire = z
8461
8467
  .strictObject({
8462
8468
  type: z.literal('volume').describe('The type of the price.'),
@@ -8465,7 +8471,7 @@ export const priceVolumeWire = z
8465
8471
  .min(1)
8466
8472
  .describe('The tiers of the volume price. At least one tier is required.'),
8467
8473
  })
8468
- .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.');
8474
+ .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.');
8469
8475
  export const updatePriceGraduatedWire = z
8470
8476
  .strictObject({
8471
8477
  type: z.literal('graduated').describe('The type of the price.'),
@@ -8474,7 +8480,7 @@ export const updatePriceGraduatedWire = z
8474
8480
  .min(1)
8475
8481
  .describe('The tiers of the graduated price. At least one tier is required.'),
8476
8482
  })
8477
- .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.");
8483
+ .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.");
8478
8484
  export const updatePriceVolumeWire = z
8479
8485
  .strictObject({
8480
8486
  type: z.literal('volume').describe('The type of the price.'),
@@ -8483,7 +8489,7 @@ export const updatePriceVolumeWire = z
8483
8489
  .min(1)
8484
8490
  .describe('The tiers of the volume price. At least one tier is required.'),
8485
8491
  })
8486
- .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.');
8492
+ .describe('Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the containing resource, tier boundaries (up_to_amount) are expressed in converted billing units.');
8487
8493
  export const featureUnitCostWire = z
8488
8494
  .discriminatedUnion('type', [
8489
8495
  featureManualUnitCostWire,
@@ -8741,6 +8747,56 @@ export const workflowCollectionAlignmentWire = z
8741
8747
  workflowCollectionAlignmentAnchoredWire,
8742
8748
  ])
8743
8749
  .describe('The alignment for collecting the pending line items into an invoice. Defaults to subscription, which means that we are to create a new invoice every time the a subscription period starts (for in advance items) or ends (for in arrears items).');
8750
+ export const chargeFlatFeeWire = z
8751
+ .strictObject({
8752
+ id: ulidWire,
8753
+ name: z
8754
+ .string()
8755
+ .min(1)
8756
+ .max(256)
8757
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
8758
+ description: z
8759
+ .string()
8760
+ .max(1024)
8761
+ .optional()
8762
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
8763
+ labels: labelsWire.optional(),
8764
+ created_at: dateTimeWire,
8765
+ updated_at: dateTimeWire,
8766
+ deleted_at: dateTimeWire.optional(),
8767
+ type: z.literal('flat_fee').describe('The type of the charge.'),
8768
+ customer: billingCustomerReferenceWire,
8769
+ lifecycle_controller: lifecycleControllerWire,
8770
+ subscription: subscriptionReferenceWire.optional(),
8771
+ currency: currencyCodeWire,
8772
+ status: chargeStatusWire,
8773
+ invoice_at: dateTimeWire,
8774
+ service_period: closedPeriodWire,
8775
+ full_service_period: closedPeriodWire,
8776
+ billing_period: closedPeriodWire,
8777
+ advance_after: dateTimeWire.optional(),
8778
+ unique_reference_id: z
8779
+ .string()
8780
+ .optional()
8781
+ .describe('Unique reference ID of the charge.'),
8782
+ settlement_mode: settlementModeWire,
8783
+ tax_config: taxConfigWire.optional(),
8784
+ payment_term: pricePaymentTermWire,
8785
+ discounts: chargeFlatFeeDiscountsWire.optional(),
8786
+ feature_key: z
8787
+ .string()
8788
+ .optional()
8789
+ .describe('The feature associated with the charge, when applicable.'),
8790
+ feature_id: z
8791
+ .string()
8792
+ .optional()
8793
+ .describe('The feature ID associated with the charge.'),
8794
+ proration_configuration: rateCardProrationConfigurationWire,
8795
+ amount_after_proration: currencyAmountWire,
8796
+ price: priceFlatWire,
8797
+ system_intent: chargeFlatFeeSystemIntentWire.optional(),
8798
+ })
8799
+ .describe('A flat fee charge for a customer.');
8744
8800
  export const taxCodePagePaginatedResponseWire = z
8745
8801
  .strictObject({
8746
8802
  data: z.array(taxCodeWire),
@@ -8978,22 +9034,22 @@ export const entitlementAccessQueryResultWire = z
8978
9034
  updated_at: dateTimeWire,
8979
9035
  })
8980
9036
  .describe('Access evaluation result for a single resolved customer.');
8981
- export const priceWire = z
9037
+ export const priceUsageBasedWire = z
8982
9038
  .discriminatedUnion('type', [
8983
- priceFreeWire,
8984
- priceFlatWire,
8985
9039
  priceUnitWire,
8986
9040
  priceGraduatedWire,
8987
9041
  priceVolumeWire,
8988
9042
  ])
8989
- .describe('Price.');
8990
- export const priceUsageBasedWire = z
9043
+ .describe('Usage-based price types for a rate card or charge. When UnitConfig is present on the object, these price types operate on billing units (i.e. post-conversion quantities), not raw metered units.');
9044
+ export const priceWire = z
8991
9045
  .discriminatedUnion('type', [
9046
+ priceFreeWire,
9047
+ priceFlatWire,
8992
9048
  priceUnitWire,
8993
9049
  priceGraduatedWire,
8994
9050
  priceVolumeWire,
8995
9051
  ])
8996
- .describe('Usage-based price types that can appear on a usage-based rate card. When UnitConfig is present on the rate card, these price types operate on billing units (i.e. post-conversion quantities), not raw metered units.');
9052
+ .describe('Price.');
8997
9053
  export const updatePriceWire = z
8998
9054
  .discriminatedUnion('type', [
8999
9055
  updatePriceFreeWire,
@@ -9132,56 +9188,6 @@ export const entitlementAccessQueryResponseWire = z
9132
9188
  meta: cursorMetaWire,
9133
9189
  })
9134
9190
  .describe('Response of the entitlement access query.');
9135
- export const chargeFlatFeeWire = z
9136
- .strictObject({
9137
- id: ulidWire,
9138
- name: z
9139
- .string()
9140
- .min(1)
9141
- .max(256)
9142
- .describe('Display name of the resource. Between 1 and 256 characters.'),
9143
- description: z
9144
- .string()
9145
- .max(1024)
9146
- .optional()
9147
- .describe('Optional description of the resource. Maximum 1024 characters.'),
9148
- labels: labelsWire.optional(),
9149
- created_at: dateTimeWire,
9150
- updated_at: dateTimeWire,
9151
- deleted_at: dateTimeWire.optional(),
9152
- type: z.literal('flat_fee').describe('The type of the charge.'),
9153
- customer: billingCustomerReferenceWire,
9154
- lifecycle_controller: lifecycleControllerWire,
9155
- subscription: subscriptionReferenceWire.optional(),
9156
- currency: currencyCodeWire,
9157
- status: chargeStatusWire,
9158
- invoice_at: dateTimeWire,
9159
- service_period: closedPeriodWire,
9160
- full_service_period: closedPeriodWire,
9161
- billing_period: closedPeriodWire,
9162
- advance_after: dateTimeWire.optional(),
9163
- unique_reference_id: z
9164
- .string()
9165
- .optional()
9166
- .describe('Unique reference ID of the charge.'),
9167
- settlement_mode: settlementModeWire,
9168
- tax_config: taxConfigWire.optional(),
9169
- payment_term: pricePaymentTermWire,
9170
- discounts: chargeFlatFeeDiscountsWire.optional(),
9171
- feature_key: z
9172
- .string()
9173
- .optional()
9174
- .describe('The feature associated with the charge, when applicable.'),
9175
- feature_id: z
9176
- .string()
9177
- .optional()
9178
- .describe('The feature ID associated with the charge.'),
9179
- proration_configuration: rateCardProrationConfigurationWire,
9180
- amount_after_proration: currencyAmountWire,
9181
- price: priceWire,
9182
- system_intent: chargeFlatFeeSystemIntentWire.optional(),
9183
- })
9184
- .describe('A flat fee charge for a customer.');
9185
9191
  export const chargeUsageBasedSystemIntentWire = z
9186
9192
  .strictObject({
9187
9193
  name: z
@@ -9200,7 +9206,9 @@ export const chargeUsageBasedSystemIntentWire = z
9200
9206
  full_service_period: closedPeriodWire,
9201
9207
  billing_period: closedPeriodWire,
9202
9208
  discounts: rateCardDiscountsWire.optional(),
9203
- price: priceWire,
9209
+ price: priceUsageBasedWire,
9210
+ commitments: spendCommitmentsWire.optional(),
9211
+ unit_config: unitConfigWire.optional(),
9204
9212
  deleted_at: dateTimeWire.optional(),
9205
9213
  })
9206
9214
  .describe('Usage-based intent fields from the system lifecycle controller shadowed by a manual override.');
@@ -9231,7 +9239,9 @@ export const createChargeUsageBasedRequestWire = z
9231
9239
  feature_id: z
9232
9240
  .string()
9233
9241
  .describe('The feature ID associated with the charge.'),
9234
- price: priceWire,
9242
+ price: priceUsageBasedWire,
9243
+ commitments: spendCommitmentsWire.optional(),
9244
+ unit_config: unitConfigWire.optional(),
9235
9245
  full_service_period: closedPeriodWire.optional(),
9236
9246
  billing_period: closedPeriodWire.optional(),
9237
9247
  })
@@ -9346,7 +9356,9 @@ export const chargeUsageBasedWire = z
9346
9356
  .string()
9347
9357
  .describe('The feature ID associated with the charge.'),
9348
9358
  totals: chargeTotalsWire,
9349
- price: priceWire,
9359
+ price: priceUsageBasedWire,
9360
+ commitments: spendCommitmentsWire.optional(),
9361
+ unit_config: unitConfigWire.optional(),
9350
9362
  system_intent: chargeUsageBasedSystemIntentWire.optional(),
9351
9363
  })
9352
9364
  .describe('A usage-based charge for a customer.');