@shotstack/schemas 1.18.1 → 1.18.2

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.
@@ -725,19 +725,8 @@
725
725
  "pricing": {
726
726
  "description": "What one generation with this model costs.",
727
727
  "properties": {
728
- "unit": {
729
- "description": "What one unit is. `render` means the whole generation counts as one unit, whatever its size.",
730
- "type": "string",
731
- "enum": [
732
- "render",
733
- "second",
734
- "minute",
735
- "thousandCharacters"
736
- ],
737
- "example": "second"
738
- },
739
728
  "credits": {
740
- "description": "Credits per unit. A number when the rate is flat, or an object keyed by the values of the options named in `tieredBy`.",
729
+ "description": "Credits per unit. A number when the rate is flat, or an object keyed by the values of the option named in `tieredBy`.",
741
730
  "oneOf": [
742
731
  {
743
732
  "type": "number"
@@ -754,19 +743,69 @@
754
743
  }
755
744
  },
756
745
  "tieredBy": {
757
- "description": "The options whose values select the rate, outermost first. Absent when `credits` is a single number.",
758
- "type": "array",
759
- "items": {
760
- "type": "string"
746
+ "description": "The option whose value selects the rate, and the value assumed when the option is absent. Present only when `credits` is keyed.",
747
+ "type": "object",
748
+ "properties": {
749
+ "option": {
750
+ "type": "string",
751
+ "example": "resolution"
752
+ },
753
+ "default": {
754
+ "type": "string",
755
+ "example": "720p"
756
+ }
761
757
  },
762
- "example": [
763
- "resolution"
758
+ "required": [
759
+ "option",
760
+ "default"
764
761
  ]
765
762
  },
766
- "minUnits": {
767
- "description": "The fewest units a generation is charged for, when a model has a minimum charge.",
768
- "type": "number",
769
- "example": 0.1
763
+ "quantity": {
764
+ "description": "How many units a generation consumes. Take the value `measure` names, or `default` when the request carries none, hold it within `min` and `max`, divide by `per`, and round up when `round` is `up`. Absent when one generation is one unit.",
765
+ "type": "object",
766
+ "properties": {
767
+ "measure": {
768
+ "description": "What the count is taken from, and the scale it is measured in.",
769
+ "type": "string",
770
+ "enum": [
771
+ "clipSeconds",
772
+ "promptCharacters"
773
+ ],
774
+ "example": "clipSeconds"
775
+ },
776
+ "per": {
777
+ "description": "How many of `measure` make one billable unit.",
778
+ "type": "number",
779
+ "example": 60
780
+ },
781
+ "min": {
782
+ "description": "Fewest accepted. A smaller request is charged at this.",
783
+ "type": "number",
784
+ "example": 3
785
+ },
786
+ "max": {
787
+ "description": "Most accepted. A larger request is charged at this.",
788
+ "type": "number",
789
+ "example": 600
790
+ },
791
+ "default": {
792
+ "description": "Assumed when the request carries no value.",
793
+ "type": "number",
794
+ "example": 30
795
+ },
796
+ "round": {
797
+ "description": "Present when a partial unit is charged as a whole one. A 61 second track on a per-minute rate is charged as two minutes.",
798
+ "type": "string",
799
+ "enum": [
800
+ "up"
801
+ ],
802
+ "example": "up"
803
+ }
804
+ },
805
+ "required": [
806
+ "measure",
807
+ "per"
808
+ ]
770
809
  },
771
810
  "effectiveFrom": {
772
811
  "description": "The date this rate took effect, or `legacy` for a rate that predates dated pricing.",
@@ -775,7 +814,6 @@
775
814
  }
776
815
  },
777
816
  "required": [
778
- "unit",
779
817
  "credits",
780
818
  "effectiveFrom"
781
819
  ],
package/dist/schema.d.ts CHANGED
@@ -4048,13 +4048,7 @@ export interface operations {
4048
4048
  /** @description What one generation with this model costs. */
4049
4049
  pricing?: {
4050
4050
  /**
4051
- * @description What one unit is. `render` means the whole generation counts as one unit, whatever its size.
4052
- * @example second
4053
- * @enum {string}
4054
- */
4055
- unit: "render" | "second" | "minute" | "thousandCharacters";
4056
- /**
4057
- * @description Credits per unit. A number when the rate is flat, or an object keyed by the values of the options named in `tieredBy`.
4051
+ * @description Credits per unit. A number when the rate is flat, or an object keyed by the values of the option named in `tieredBy`.
4058
4052
  * @example {
4059
4053
  * "480p": 0.9375,
4060
4054
  * "720p": 1.8962,
@@ -4064,18 +4058,48 @@ export interface operations {
4064
4058
  credits: number | {
4065
4059
  [key: string]: unknown;
4066
4060
  };
4067
- /**
4068
- * @description The options whose values select the rate, outermost first. Absent when `credits` is a single number.
4069
- * @example [
4070
- * "resolution"
4071
- * ]
4072
- */
4073
- tieredBy?: string[];
4074
- /**
4075
- * @description The fewest units a generation is charged for, when a model has a minimum charge.
4076
- * @example 0.1
4077
- */
4078
- minUnits?: number;
4061
+ /** @description The option whose value selects the rate, and the value assumed when the option is absent. Present only when `credits` is keyed. */
4062
+ tieredBy?: {
4063
+ /** @example resolution */
4064
+ option: string;
4065
+ /** @example 720p */
4066
+ default: string;
4067
+ };
4068
+ /** @description How many units a generation consumes. Take the value `measure` names, or `default` when the request carries none, hold it within `min` and `max`, divide by `per`, and round up when `round` is `up`. Absent when one generation is one unit. */
4069
+ quantity?: {
4070
+ /**
4071
+ * @description What the count is taken from, and the scale it is measured in.
4072
+ * @example clipSeconds
4073
+ * @enum {string}
4074
+ */
4075
+ measure: "clipSeconds" | "promptCharacters";
4076
+ /**
4077
+ * @description How many of `measure` make one billable unit.
4078
+ * @example 60
4079
+ */
4080
+ per: number;
4081
+ /**
4082
+ * @description Fewest accepted. A smaller request is charged at this.
4083
+ * @example 3
4084
+ */
4085
+ min?: number;
4086
+ /**
4087
+ * @description Most accepted. A larger request is charged at this.
4088
+ * @example 600
4089
+ */
4090
+ max?: number;
4091
+ /**
4092
+ * @description Assumed when the request carries no value.
4093
+ * @example 30
4094
+ */
4095
+ default?: number;
4096
+ /**
4097
+ * @description Present when a partial unit is charged as a whole one. A 61 second track on a per-minute rate is charged as two minutes.
4098
+ * @example up
4099
+ * @enum {string}
4100
+ */
4101
+ round?: "up";
4102
+ };
4079
4103
  /**
4080
4104
  * @description The date this rate took effect, or `legacy` for a rate that predates dated pricing.
4081
4105
  * @example 2026-08-13
@@ -429,15 +429,9 @@ exports.fontFontSchema = zod_1.z.object({
429
429
  }).strict();
430
430
  exports.fontSchema = exports.fontFontSchema;
431
431
  /**
432
- * What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
432
+ * What one generation costs, in credits: the rate multiplied by the units consumed. `quantity` says how to count the units, and is absent when one generation is one unit. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
433
433
  */
434
434
  exports.generationmodelpricingGenerationModelPricingSchema = zod_1.z.object({
435
- unit: zod_1.z.enum([
436
- 'render',
437
- 'second',
438
- 'minute',
439
- 'thousandCharacters'
440
- ]),
441
435
  credits: zod_1.z.union([
442
436
  zod_1.z.union([zod_1.z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
443
437
  return undefined; if (Array.isArray(v))
@@ -448,14 +442,42 @@ exports.generationmodelpricingGenerationModelPricingSchema = zod_1.z.object({
448
442
  } return v; }), zod_1.z.number()), zod_1.z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
449
443
  zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())
450
444
  ]),
451
- tieredBy: zod_1.z.optional(zod_1.z.array(zod_1.z.string())),
452
- minUnits: zod_1.z.optional(zod_1.z.union([zod_1.z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
453
- return undefined; if (Array.isArray(v))
454
- return v; if (typeof v === 'string') {
455
- if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
456
- return v;
457
- return Number(v);
458
- } return v; }), zod_1.z.number()), zod_1.z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
445
+ tieredBy: zod_1.z.optional(zod_1.z.object({
446
+ option: zod_1.z.string(),
447
+ default: zod_1.z.string()
448
+ })),
449
+ quantity: zod_1.z.optional(zod_1.z.object({
450
+ measure: zod_1.z.enum(['clipSeconds', 'promptCharacters']),
451
+ per: zod_1.z.union([zod_1.z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
452
+ return undefined; if (Array.isArray(v))
453
+ return v; if (typeof v === 'string') {
454
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
455
+ return v;
456
+ return Number(v);
457
+ } return v; }), zod_1.z.number()), zod_1.z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
458
+ min: zod_1.z.optional(zod_1.z.union([zod_1.z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
459
+ return undefined; if (Array.isArray(v))
460
+ return v; if (typeof v === 'string') {
461
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
462
+ return v;
463
+ return Number(v);
464
+ } return v; }), zod_1.z.number()), zod_1.z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
465
+ max: zod_1.z.optional(zod_1.z.union([zod_1.z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
466
+ return undefined; if (Array.isArray(v))
467
+ return v; if (typeof v === 'string') {
468
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
469
+ return v;
470
+ return Number(v);
471
+ } return v; }), zod_1.z.number()), zod_1.z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
472
+ default: zod_1.z.optional(zod_1.z.union([zod_1.z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
473
+ return undefined; if (Array.isArray(v))
474
+ return v; if (typeof v === 'string') {
475
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
476
+ return v;
477
+ return Number(v);
478
+ } return v; }), zod_1.z.number()), zod_1.z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
479
+ round: zod_1.z.optional(zod_1.z.enum(['up']))
480
+ })),
459
481
  effectiveFrom: zod_1.z.string()
460
482
  }).strict();
461
483
  /**
@@ -761,18 +761,27 @@ export declare const fontSchema: z.ZodObject<{
761
761
  src: z.ZodString;
762
762
  }, z.core.$strict>;
763
763
  /**
764
- * What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
764
+ * What one generation costs, in credits: the rate multiplied by the units consumed. `quantity` says how to count the units, and is absent when one generation is one unit. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
765
765
  */
766
766
  export declare const generationmodelpricingGenerationModelPricingSchema: z.ZodObject<{
767
- unit: z.ZodEnum<{
768
- render: "render";
769
- second: "second";
770
- minute: "minute";
771
- thousandCharacters: "thousandCharacters";
772
- }>;
773
767
  credits: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
774
- tieredBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
775
- minUnits: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
768
+ tieredBy: z.ZodOptional<z.ZodObject<{
769
+ option: z.ZodString;
770
+ default: z.ZodString;
771
+ }, z.core.$strip>>;
772
+ quantity: z.ZodOptional<z.ZodObject<{
773
+ measure: z.ZodEnum<{
774
+ clipSeconds: "clipSeconds";
775
+ promptCharacters: "promptCharacters";
776
+ }>;
777
+ per: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
778
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
779
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
780
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
781
+ round: z.ZodOptional<z.ZodEnum<{
782
+ up: "up";
783
+ }>>;
784
+ }, z.core.$strip>>;
776
785
  effectiveFrom: z.ZodString;
777
786
  }, z.core.$strict>;
778
787
  /**
@@ -786,15 +795,24 @@ export declare const generationmodelGenerationModelSchema: z.ZodObject<{
786
795
  audio: "audio";
787
796
  }>;
788
797
  pricing: z.ZodOptional<z.ZodObject<{
789
- unit: z.ZodEnum<{
790
- render: "render";
791
- second: "second";
792
- minute: "minute";
793
- thousandCharacters: "thousandCharacters";
794
- }>;
795
798
  credits: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
796
- tieredBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
797
- minUnits: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
799
+ tieredBy: z.ZodOptional<z.ZodObject<{
800
+ option: z.ZodString;
801
+ default: z.ZodString;
802
+ }, z.core.$strip>>;
803
+ quantity: z.ZodOptional<z.ZodObject<{
804
+ measure: z.ZodEnum<{
805
+ clipSeconds: "clipSeconds";
806
+ promptCharacters: "promptCharacters";
807
+ }>;
808
+ per: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
809
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
810
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
811
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
812
+ round: z.ZodOptional<z.ZodEnum<{
813
+ up: "up";
814
+ }>>;
815
+ }, z.core.$strip>>;
798
816
  effectiveFrom: z.ZodString;
799
817
  }, z.core.$strict>>;
800
818
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1497,15 +1515,24 @@ export declare const generationmodellistresponseGenerationModelListResponseSchem
1497
1515
  audio: "audio";
1498
1516
  }>;
1499
1517
  pricing: z.ZodOptional<z.ZodObject<{
1500
- unit: z.ZodEnum<{
1501
- render: "render";
1502
- second: "second";
1503
- minute: "minute";
1504
- thousandCharacters: "thousandCharacters";
1505
- }>;
1506
1518
  credits: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
1507
- tieredBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
1508
- minUnits: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
1519
+ tieredBy: z.ZodOptional<z.ZodObject<{
1520
+ option: z.ZodString;
1521
+ default: z.ZodString;
1522
+ }, z.core.$strip>>;
1523
+ quantity: z.ZodOptional<z.ZodObject<{
1524
+ measure: z.ZodEnum<{
1525
+ clipSeconds: "clipSeconds";
1526
+ promptCharacters: "promptCharacters";
1527
+ }>;
1528
+ per: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
1529
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
1530
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
1531
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
1532
+ round: z.ZodOptional<z.ZodEnum<{
1533
+ up: "up";
1534
+ }>>;
1535
+ }, z.core.$strip>>;
1509
1536
  effectiveFrom: z.ZodString;
1510
1537
  }, z.core.$strict>>;
1511
1538
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -60500,15 +60527,24 @@ export declare const getModelsResponse: z.ZodObject<{
60500
60527
  audio: "audio";
60501
60528
  }>;
60502
60529
  pricing: z.ZodOptional<z.ZodObject<{
60503
- unit: z.ZodEnum<{
60504
- render: "render";
60505
- second: "second";
60506
- minute: "minute";
60507
- thousandCharacters: "thousandCharacters";
60508
- }>;
60509
60530
  credits: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
60510
- tieredBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
60511
- minUnits: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60531
+ tieredBy: z.ZodOptional<z.ZodObject<{
60532
+ option: z.ZodString;
60533
+ default: z.ZodString;
60534
+ }, z.core.$strip>>;
60535
+ quantity: z.ZodOptional<z.ZodObject<{
60536
+ measure: z.ZodEnum<{
60537
+ clipSeconds: "clipSeconds";
60538
+ promptCharacters: "promptCharacters";
60539
+ }>;
60540
+ per: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
60541
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60542
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60543
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60544
+ round: z.ZodOptional<z.ZodEnum<{
60545
+ up: "up";
60546
+ }>>;
60547
+ }, z.core.$strip>>;
60512
60548
  effectiveFrom: z.ZodString;
60513
60549
  }, z.core.$strict>>;
60514
60550
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -60532,15 +60568,24 @@ export declare const getModelResponse: z.ZodObject<{
60532
60568
  audio: "audio";
60533
60569
  }>;
60534
60570
  pricing: z.ZodOptional<z.ZodObject<{
60535
- unit: z.ZodEnum<{
60536
- render: "render";
60537
- second: "second";
60538
- minute: "minute";
60539
- thousandCharacters: "thousandCharacters";
60540
- }>;
60541
60571
  credits: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
60542
- tieredBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
60543
- minUnits: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60572
+ tieredBy: z.ZodOptional<z.ZodObject<{
60573
+ option: z.ZodString;
60574
+ default: z.ZodString;
60575
+ }, z.core.$strip>>;
60576
+ quantity: z.ZodOptional<z.ZodObject<{
60577
+ measure: z.ZodEnum<{
60578
+ clipSeconds: "clipSeconds";
60579
+ promptCharacters: "promptCharacters";
60580
+ }>;
60581
+ per: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
60582
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60583
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60584
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
60585
+ round: z.ZodOptional<z.ZodEnum<{
60586
+ up: "up";
60587
+ }>>;
60588
+ }, z.core.$strip>>;
60544
60589
  effectiveFrom: z.ZodString;
60545
60590
  }, z.core.$strict>>;
60546
60591
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -420,15 +420,9 @@ export const fontFontSchema = z.object({
420
420
  }).strict();
421
421
  export const fontSchema = fontFontSchema;
422
422
  /**
423
- * What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
423
+ * What one generation costs, in credits: the rate multiplied by the units consumed. `quantity` says how to count the units, and is absent when one generation is one unit. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
424
424
  */
425
425
  export const generationmodelpricingGenerationModelPricingSchema = z.object({
426
- unit: z.enum([
427
- 'render',
428
- 'second',
429
- 'minute',
430
- 'thousandCharacters'
431
- ]),
432
426
  credits: z.union([
433
427
  z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
434
428
  return undefined; if (Array.isArray(v))
@@ -439,14 +433,42 @@ export const generationmodelpricingGenerationModelPricingSchema = z.object({
439
433
  } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
440
434
  z.record(z.string(), z.unknown())
441
435
  ]),
442
- tieredBy: z.optional(z.array(z.string())),
443
- minUnits: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
444
- return undefined; if (Array.isArray(v))
445
- return v; if (typeof v === 'string') {
446
- if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
447
- return v;
448
- return Number(v);
449
- } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
436
+ tieredBy: z.optional(z.object({
437
+ option: z.string(),
438
+ default: z.string()
439
+ })),
440
+ quantity: z.optional(z.object({
441
+ measure: z.enum(['clipSeconds', 'promptCharacters']),
442
+ per: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
443
+ return undefined; if (Array.isArray(v))
444
+ return v; if (typeof v === 'string') {
445
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
446
+ return v;
447
+ return Number(v);
448
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
449
+ min: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
450
+ return undefined; if (Array.isArray(v))
451
+ return v; if (typeof v === 'string') {
452
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
453
+ return v;
454
+ return Number(v);
455
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
456
+ max: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
457
+ return undefined; if (Array.isArray(v))
458
+ return v; if (typeof v === 'string') {
459
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
460
+ return v;
461
+ return Number(v);
462
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
463
+ default: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
464
+ return undefined; if (Array.isArray(v))
465
+ return v; if (typeof v === 'string') {
466
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
467
+ return v;
468
+ return Number(v);
469
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
470
+ round: z.optional(z.enum(['up']))
471
+ })),
450
472
  effectiveFrom: z.string()
451
473
  }).strict();
452
474
  /**
@@ -380,21 +380,25 @@ export const fontFontSchema = z.object({
380
380
  export const fontSchema = fontFontSchema;
381
381
 
382
382
  /**
383
- * What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
383
+ * What one generation costs, in credits: the rate multiplied by the units consumed. `quantity` says how to count the units, and is absent when one generation is one unit. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
384
384
  */
385
385
  export const generationmodelpricingGenerationModelPricingSchema = z.object({
386
- unit: z.enum([
387
- 'render',
388
- 'second',
389
- 'minute',
390
- 'thousandCharacters'
391
- ]),
392
386
  credits: z.union([
393
387
  z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
394
388
  z.record(z.string(), z.unknown())
395
389
  ]),
396
- tieredBy: z.optional(z.array(z.string())),
397
- minUnits: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
390
+ tieredBy: z.optional(z.object({
391
+ option: z.string(),
392
+ default: z.string()
393
+ })),
394
+ quantity: z.optional(z.object({
395
+ measure: z.enum(['clipSeconds', 'promptCharacters']),
396
+ per: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
397
+ min: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
398
+ max: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
399
+ default: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
400
+ round: z.optional(z.enum(['up']))
401
+ })),
398
402
  effectiveFrom: z.string()
399
403
  }).strict();
400
404
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.18.1",
3
+ "version": "1.18.2",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",