@oxyhq/contracts 0.29.0 → 0.31.0

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.
Files changed (51) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/accountGraph.js +41 -0
  3. package/dist/cjs/identity.js +33 -1
  4. package/dist/cjs/index.js +35 -7
  5. package/dist/cjs/inference/aliaModelRelease.js +262 -0
  6. package/dist/cjs/inference/catalogue.js +1 -4
  7. package/dist/cjs/inference/identifiers.js +23 -3
  8. package/dist/cjs/inference/modelDocumentation.js +433 -0
  9. package/dist/cjs/inference/providerConnection.js +77 -7
  10. package/dist/cjs/inference/request.js +188 -5
  11. package/dist/cjs/inference/routingPolicy.js +81 -2
  12. package/dist/cjs/inference/streamEvents.js +27 -0
  13. package/dist/cjs/inference/usage.js +32 -1
  14. package/dist/cjs/inference/version.js +15 -2
  15. package/dist/cjs/updates.js +2 -0
  16. package/dist/esm/.tsbuildinfo +1 -1
  17. package/dist/esm/accountGraph.js +41 -0
  18. package/dist/esm/identity.js +32 -0
  19. package/dist/esm/index.js +14 -4
  20. package/dist/esm/inference/aliaModelRelease.js +259 -0
  21. package/dist/esm/inference/catalogue.js +2 -5
  22. package/dist/esm/inference/identifiers.js +22 -2
  23. package/dist/esm/inference/modelDocumentation.js +430 -0
  24. package/dist/esm/inference/providerConnection.js +76 -6
  25. package/dist/esm/inference/request.js +189 -6
  26. package/dist/esm/inference/routingPolicy.js +81 -2
  27. package/dist/esm/inference/streamEvents.js +27 -0
  28. package/dist/esm/inference/usage.js +32 -1
  29. package/dist/esm/inference/version.js +15 -2
  30. package/dist/esm/updates.js +2 -0
  31. package/dist/types/.tsbuildinfo +1 -1
  32. package/dist/types/accountGraph.d.ts +43 -0
  33. package/dist/types/identity.d.ts +59 -1
  34. package/dist/types/index.d.ts +10 -6
  35. package/dist/types/inference/accountBilling.d.ts +26 -26
  36. package/dist/types/inference/aliaModelRelease.d.ts +609 -0
  37. package/dist/types/inference/catalogue.d.ts +6 -6
  38. package/dist/types/inference/entitlement.d.ts +4 -4
  39. package/dist/types/inference/identifiers.d.ts +20 -2
  40. package/dist/types/inference/modelDocumentation.d.ts +1603 -0
  41. package/dist/types/inference/money.d.ts +4 -4
  42. package/dist/types/inference/priceVersion.d.ts +14 -14
  43. package/dist/types/inference/providerConnection.d.ts +37 -8
  44. package/dist/types/inference/request.d.ts +291 -5
  45. package/dist/types/inference/routingPolicy.d.ts +109 -13
  46. package/dist/types/inference/streamEvents.d.ts +53 -26
  47. package/dist/types/inference/usage.d.ts +103 -79
  48. package/dist/types/inference/version.d.ts +15 -2
  49. package/dist/types/keyRecovery.d.ts +4 -4
  50. package/dist/types/updates.d.ts +10 -0
  51. package/package.json +1 -1
@@ -122,6 +122,7 @@ export declare const usageReservationRequestSchema: z.ZodObject<{
122
122
  currency: z.ZodString;
123
123
  expiresInSeconds: z.ZodNumber;
124
124
  }, "strip", z.ZodTypeAny, {
125
+ currency: string;
125
126
  attribution: {
126
127
  requestId: string;
127
128
  principal: {
@@ -137,7 +138,6 @@ export declare const usageReservationRequestSchema: z.ZodObject<{
137
138
  generationId?: string | undefined;
138
139
  };
139
140
  idempotencyKey: string;
140
- currency: string;
141
141
  schemaVersion: 1;
142
142
  knownUnits: {
143
143
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
@@ -148,6 +148,7 @@ export declare const usageReservationRequestSchema: z.ZodObject<{
148
148
  expiresInSeconds: number;
149
149
  maxOutputTokens?: number | undefined;
150
150
  }, {
151
+ currency: string;
151
152
  attribution: {
152
153
  requestId: string;
153
154
  principal: {
@@ -163,7 +164,6 @@ export declare const usageReservationRequestSchema: z.ZodObject<{
163
164
  generationId?: string | undefined;
164
165
  };
165
166
  idempotencyKey: string;
166
- currency: string;
167
167
  schemaVersion: 1;
168
168
  ceilingPriceVersionId: string;
169
169
  maxAmount: string;
@@ -259,6 +259,10 @@ export declare const usageReservationSchema: z.ZodEffects<z.ZodObject<{
259
259
  }, "strip", z.ZodTypeAny, {
260
260
  status: "expired" | "held" | "settled" | "released";
261
261
  expiresAt: string;
262
+ currency: string;
263
+ createdAt: string;
264
+ reservationId: string;
265
+ reservedAmount: string & z.BRAND<"ExactDecimal">;
262
266
  attribution: {
263
267
  requestId: string;
264
268
  principal: {
@@ -274,16 +278,16 @@ export declare const usageReservationSchema: z.ZodEffects<z.ZodObject<{
274
278
  generationId?: string | undefined;
275
279
  };
276
280
  idempotencyKey: string;
277
- createdAt: string;
278
- currency: string;
279
281
  schemaVersion: 1;
280
282
  ceilingPriceVersionId: string;
281
- reservationId: string;
282
- reservedAmount: string & z.BRAND<"ExactDecimal">;
283
283
  settledReceiptId?: string | undefined;
284
284
  }, {
285
285
  status: "expired" | "held" | "settled" | "released";
286
286
  expiresAt: string;
287
+ currency: string;
288
+ createdAt: string;
289
+ reservationId: string;
290
+ reservedAmount: string;
287
291
  attribution: {
288
292
  requestId: string;
289
293
  principal: {
@@ -299,16 +303,16 @@ export declare const usageReservationSchema: z.ZodEffects<z.ZodObject<{
299
303
  generationId?: string | undefined;
300
304
  };
301
305
  idempotencyKey: string;
302
- createdAt: string;
303
- currency: string;
304
306
  schemaVersion: 1;
305
307
  ceilingPriceVersionId: string;
306
- reservationId: string;
307
- reservedAmount: string;
308
308
  settledReceiptId?: string | undefined;
309
309
  }>, {
310
310
  status: "expired" | "held" | "settled" | "released";
311
311
  expiresAt: string;
312
+ currency: string;
313
+ createdAt: string;
314
+ reservationId: string;
315
+ reservedAmount: string & z.BRAND<"ExactDecimal">;
312
316
  attribution: {
313
317
  requestId: string;
314
318
  principal: {
@@ -324,16 +328,16 @@ export declare const usageReservationSchema: z.ZodEffects<z.ZodObject<{
324
328
  generationId?: string | undefined;
325
329
  };
326
330
  idempotencyKey: string;
327
- createdAt: string;
328
- currency: string;
329
331
  schemaVersion: 1;
330
332
  ceilingPriceVersionId: string;
331
- reservationId: string;
332
- reservedAmount: string & z.BRAND<"ExactDecimal">;
333
333
  settledReceiptId?: string | undefined;
334
334
  }, {
335
335
  status: "expired" | "held" | "settled" | "released";
336
336
  expiresAt: string;
337
+ currency: string;
338
+ createdAt: string;
339
+ reservationId: string;
340
+ reservedAmount: string;
337
341
  attribution: {
338
342
  requestId: string;
339
343
  principal: {
@@ -349,18 +353,20 @@ export declare const usageReservationSchema: z.ZodEffects<z.ZodObject<{
349
353
  generationId?: string | undefined;
350
354
  };
351
355
  idempotencyKey: string;
352
- createdAt: string;
353
- currency: string;
354
356
  schemaVersion: 1;
355
357
  ceilingPriceVersionId: string;
356
- reservationId: string;
357
- reservedAmount: string;
358
358
  settledReceiptId?: string | undefined;
359
359
  }>;
360
360
  /** How a request ended, from the data plane's point of view. */
361
361
  export declare const inferenceRequestOutcomeSchema: z.ZodEnum<["completed", "partial", "cancelled", "failed"]>;
362
362
  /**
363
- * The data plane's technical account of one request.
363
+ * The data plane's technical account of one request, and the ONLY shape a
364
+ * settlement is written from.
365
+ *
366
+ * `inferenceStreamUsageEventSchema` is not a narrower version of this one that
367
+ * could be widened into it — see that event's own comment. Its units are exact
368
+ * and settleable; the record around them is not inferable, so an edge settling
369
+ * from a stream event supplies the outcome itself and never promotes the event.
364
370
  *
365
371
  * No money and no price: the data plane measures units and names the route it
366
372
  * used, and the control plane decides what that costs. Keeping the two apart is
@@ -376,6 +382,24 @@ export declare const inferenceRequestOutcomeSchema: z.ZodEnum<["completed", "par
376
382
  * nested `prompt_tokens`/`completion_tokens` verbatim charges the cached and
377
383
  * reasoning tokens twice, so subtracting the children out is part of what
378
384
  * "normalized" means in this shape's name.
385
+ *
386
+ * **A `completed` report carries at least one unit, and the other outcomes need
387
+ * not.** `completed` is the one outcome that asserts the customer received the
388
+ * whole answer, so "delivered in full, consumed nothing measurable" is a
389
+ * contradiction — and it is one that BILLS NOTHING: settlement prices every
390
+ * reported unit and sums, so an empty list is a free request produced by a
391
+ * provider that simply omitted its usage block. The refinement makes that shape
392
+ * unparseable, and the policy behind it is refuse-and-release: the report is
393
+ * rejected and the hold is released, never estimated and charged.
394
+ *
395
+ * The three other outcomes legitimately carry none, which is why the rule is
396
+ * conditional rather than a `.min(1)` on the field. In the reference data plane
397
+ * `failed` is DERIVED from having no units — `outcomeFor` in
398
+ * `internal/relay/executor.go` returns `partial` when units exist and `failed`
399
+ * when they do not — and `cancelled` is reported for a client that stopped
400
+ * before anything was measured. An unconditional minimum would refuse those
401
+ * reports, and a refused report is a request that ran, cost money upstream and
402
+ * can never be settled or refunded.
379
403
  */
380
404
  export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
381
405
  /** See `version.ts`: emitted by the data plane as a whole message. */
@@ -464,6 +488,9 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
464
488
  timeToFirstTokenMs: z.ZodOptional<z.ZodNumber>;
465
489
  }, "strip", z.ZodTypeAny, {
466
490
  requestId: string;
491
+ outcome: "cancelled" | "completed" | "partial" | "failed";
492
+ resolvedModelReference: string;
493
+ servingProvider: string;
467
494
  attribution: {
468
495
  requestId: string;
469
496
  principal: {
@@ -479,8 +506,6 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
479
506
  generationId?: string | undefined;
480
507
  };
481
508
  schemaVersion: 1;
482
- resolvedModelReference: string;
483
- servingProvider: string;
484
509
  startedAt: string;
485
510
  units: {
486
511
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
@@ -488,13 +513,15 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
488
513
  }[];
489
514
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
490
515
  completedAt: string;
491
- outcome: "cancelled" | "completed" | "partial" | "failed";
492
516
  routeSwitches: number;
493
517
  generationId?: string | undefined;
494
518
  deploymentId?: string | undefined;
495
519
  timeToFirstTokenMs?: number | undefined;
496
520
  }, {
497
521
  requestId: string;
522
+ outcome: "cancelled" | "completed" | "partial" | "failed";
523
+ resolvedModelReference: string;
524
+ servingProvider: string;
498
525
  attribution: {
499
526
  requestId: string;
500
527
  principal: {
@@ -510,8 +537,6 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
510
537
  generationId?: string | undefined;
511
538
  };
512
539
  schemaVersion: 1;
513
- resolvedModelReference: string;
514
- servingProvider: string;
515
540
  startedAt: string;
516
541
  units: {
517
542
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
@@ -519,13 +544,15 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
519
544
  }[];
520
545
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
521
546
  completedAt: string;
522
- outcome: "cancelled" | "completed" | "partial" | "failed";
523
547
  routeSwitches: number;
524
548
  generationId?: string | undefined;
525
549
  deploymentId?: string | undefined;
526
550
  timeToFirstTokenMs?: number | undefined;
527
551
  }>, {
528
552
  requestId: string;
553
+ outcome: "cancelled" | "completed" | "partial" | "failed";
554
+ resolvedModelReference: string;
555
+ servingProvider: string;
529
556
  attribution: {
530
557
  requestId: string;
531
558
  principal: {
@@ -541,8 +568,6 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
541
568
  generationId?: string | undefined;
542
569
  };
543
570
  schemaVersion: 1;
544
- resolvedModelReference: string;
545
- servingProvider: string;
546
571
  startedAt: string;
547
572
  units: {
548
573
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
@@ -550,13 +575,15 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
550
575
  }[];
551
576
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
552
577
  completedAt: string;
553
- outcome: "cancelled" | "completed" | "partial" | "failed";
554
578
  routeSwitches: number;
555
579
  generationId?: string | undefined;
556
580
  deploymentId?: string | undefined;
557
581
  timeToFirstTokenMs?: number | undefined;
558
582
  }, {
559
583
  requestId: string;
584
+ outcome: "cancelled" | "completed" | "partial" | "failed";
585
+ resolvedModelReference: string;
586
+ servingProvider: string;
560
587
  attribution: {
561
588
  requestId: string;
562
589
  principal: {
@@ -572,8 +599,6 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
572
599
  generationId?: string | undefined;
573
600
  };
574
601
  schemaVersion: 1;
575
- resolvedModelReference: string;
576
- servingProvider: string;
577
602
  startedAt: string;
578
603
  units: {
579
604
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
@@ -581,7 +606,6 @@ export declare const normalizedUsageReportSchema: z.ZodEffects<z.ZodObject<{
581
606
  }[];
582
607
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
583
608
  completedAt: string;
584
- outcome: "cancelled" | "completed" | "partial" | "failed";
585
609
  routeSwitches: number;
586
610
  generationId?: string | undefined;
587
611
  deploymentId?: string | undefined;
@@ -687,13 +711,13 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
687
711
  per: z.ZodNumber;
688
712
  currency: z.ZodString;
689
713
  }, "strict", z.ZodTypeAny, {
690
- amount: string & z.BRAND<"ExactDecimal">;
691
714
  currency: string;
715
+ amount: string & z.BRAND<"ExactDecimal">;
692
716
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
693
717
  per: number;
694
718
  }, {
695
- amount: string;
696
719
  currency: string;
720
+ amount: string;
697
721
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
698
722
  per: number;
699
723
  }>, "many">;
@@ -701,8 +725,8 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
701
725
  currency: string;
702
726
  priceVersionId: string;
703
727
  unitPrices: {
704
- amount: string & z.BRAND<"ExactDecimal">;
705
728
  currency: string;
729
+ amount: string & z.BRAND<"ExactDecimal">;
706
730
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
707
731
  per: number;
708
732
  }[];
@@ -710,8 +734,8 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
710
734
  currency: string;
711
735
  priceVersionId: string;
712
736
  unitPrices: {
713
- amount: string;
714
737
  currency: string;
738
+ amount: string;
715
739
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
716
740
  per: number;
717
741
  }[];
@@ -723,6 +747,14 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
723
747
  servingProvider: z.ZodString;
724
748
  settledAt: z.ZodString;
725
749
  }, "strip", z.ZodTypeAny, {
750
+ receiptId: string;
751
+ settledAt: string;
752
+ billedAmount: string & z.BRAND<"ExactDecimal">;
753
+ currency: string;
754
+ outcome: "cancelled" | "completed" | "partial" | "failed";
755
+ resolvedModelReference: string;
756
+ servingProvider: string;
757
+ platformFeeOnly: boolean;
726
758
  attribution: {
727
759
  requestId: string;
728
760
  principal: {
@@ -738,32 +770,32 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
738
770
  generationId?: string | undefined;
739
771
  };
740
772
  idempotencyKey: string;
741
- currency: string;
742
773
  schemaVersion: 1;
743
- resolvedModelReference: string;
744
- servingProvider: string;
745
774
  units: {
746
775
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
747
776
  quantity: number;
748
777
  }[];
749
778
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
750
- receiptId: string;
751
- outcome: "cancelled" | "completed" | "partial" | "failed";
752
779
  priceSnapshot: {
753
780
  currency: string;
754
781
  priceVersionId: string;
755
782
  unitPrices: {
756
- amount: string & z.BRAND<"ExactDecimal">;
757
783
  currency: string;
784
+ amount: string & z.BRAND<"ExactDecimal">;
758
785
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
759
786
  per: number;
760
787
  }[];
761
788
  };
762
- billedAmount: string & z.BRAND<"ExactDecimal">;
763
- platformFeeOnly: boolean;
764
- settledAt: string;
765
789
  reservationId?: string | undefined;
766
790
  }, {
791
+ receiptId: string;
792
+ settledAt: string;
793
+ billedAmount: string;
794
+ currency: string;
795
+ outcome: "cancelled" | "completed" | "partial" | "failed";
796
+ resolvedModelReference: string;
797
+ servingProvider: string;
798
+ platformFeeOnly: boolean;
767
799
  attribution: {
768
800
  requestId: string;
769
801
  principal: {
@@ -779,32 +811,32 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
779
811
  generationId?: string | undefined;
780
812
  };
781
813
  idempotencyKey: string;
782
- currency: string;
783
814
  schemaVersion: 1;
784
- resolvedModelReference: string;
785
- servingProvider: string;
786
815
  units: {
787
816
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
788
817
  quantity: number;
789
818
  }[];
790
819
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
791
- receiptId: string;
792
- outcome: "cancelled" | "completed" | "partial" | "failed";
793
820
  priceSnapshot: {
794
821
  currency: string;
795
822
  priceVersionId: string;
796
823
  unitPrices: {
797
- amount: string;
798
824
  currency: string;
825
+ amount: string;
799
826
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
800
827
  per: number;
801
828
  }[];
802
829
  };
803
- billedAmount: string;
804
- platformFeeOnly: boolean;
805
- settledAt: string;
806
830
  reservationId?: string | undefined;
807
831
  }>, {
832
+ receiptId: string;
833
+ settledAt: string;
834
+ billedAmount: string & z.BRAND<"ExactDecimal">;
835
+ currency: string;
836
+ outcome: "cancelled" | "completed" | "partial" | "failed";
837
+ resolvedModelReference: string;
838
+ servingProvider: string;
839
+ platformFeeOnly: boolean;
808
840
  attribution: {
809
841
  requestId: string;
810
842
  principal: {
@@ -820,32 +852,32 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
820
852
  generationId?: string | undefined;
821
853
  };
822
854
  idempotencyKey: string;
823
- currency: string;
824
855
  schemaVersion: 1;
825
- resolvedModelReference: string;
826
- servingProvider: string;
827
856
  units: {
828
857
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
829
858
  quantity: number;
830
859
  }[];
831
860
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
832
- receiptId: string;
833
- outcome: "cancelled" | "completed" | "partial" | "failed";
834
861
  priceSnapshot: {
835
862
  currency: string;
836
863
  priceVersionId: string;
837
864
  unitPrices: {
838
- amount: string & z.BRAND<"ExactDecimal">;
839
865
  currency: string;
866
+ amount: string & z.BRAND<"ExactDecimal">;
840
867
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
841
868
  per: number;
842
869
  }[];
843
870
  };
844
- billedAmount: string & z.BRAND<"ExactDecimal">;
845
- platformFeeOnly: boolean;
846
- settledAt: string;
847
871
  reservationId?: string | undefined;
848
872
  }, {
873
+ receiptId: string;
874
+ settledAt: string;
875
+ billedAmount: string;
876
+ currency: string;
877
+ outcome: "cancelled" | "completed" | "partial" | "failed";
878
+ resolvedModelReference: string;
879
+ servingProvider: string;
880
+ platformFeeOnly: boolean;
849
881
  attribution: {
850
882
  requestId: string;
851
883
  principal: {
@@ -861,30 +893,22 @@ export declare const usageReceiptSchema: z.ZodEffects<z.ZodObject<{
861
893
  generationId?: string | undefined;
862
894
  };
863
895
  idempotencyKey: string;
864
- currency: string;
865
896
  schemaVersion: 1;
866
- resolvedModelReference: string;
867
- servingProvider: string;
868
897
  units: {
869
898
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
870
899
  quantity: number;
871
900
  }[];
872
901
  usageSource: "provider_reported" | "oxy_measured" | "estimated";
873
- receiptId: string;
874
- outcome: "cancelled" | "completed" | "partial" | "failed";
875
902
  priceSnapshot: {
876
903
  currency: string;
877
904
  priceVersionId: string;
878
905
  unitPrices: {
879
- amount: string;
880
906
  currency: string;
907
+ amount: string;
881
908
  unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
882
909
  per: number;
883
910
  }[];
884
911
  };
885
- billedAmount: string;
886
- platformFeeOnly: boolean;
887
- settledAt: string;
888
912
  reservationId?: string | undefined;
889
913
  }>;
890
914
  /**
@@ -1020,6 +1044,8 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1020
1044
  kind: "receipt";
1021
1045
  receiptId: string;
1022
1046
  };
1047
+ currency: string;
1048
+ createdAt: string;
1023
1049
  attribution: {
1024
1050
  requestId: string;
1025
1051
  principal: {
@@ -1035,9 +1061,7 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1035
1061
  generationId?: string | undefined;
1036
1062
  };
1037
1063
  idempotencyKey: string;
1038
- createdAt: string;
1039
1064
  amount: string & z.BRAND<"ExactDecimal">;
1040
- currency: string;
1041
1065
  schemaVersion: 1;
1042
1066
  refundId: string;
1043
1067
  }, {
@@ -1049,6 +1073,8 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1049
1073
  kind: "receipt";
1050
1074
  receiptId: string;
1051
1075
  };
1076
+ currency: string;
1077
+ createdAt: string;
1052
1078
  attribution: {
1053
1079
  requestId: string;
1054
1080
  principal: {
@@ -1064,9 +1090,7 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1064
1090
  generationId?: string | undefined;
1065
1091
  };
1066
1092
  idempotencyKey: string;
1067
- createdAt: string;
1068
1093
  amount: string;
1069
- currency: string;
1070
1094
  schemaVersion: 1;
1071
1095
  refundId: string;
1072
1096
  }>, {
@@ -1078,6 +1102,8 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1078
1102
  kind: "receipt";
1079
1103
  receiptId: string;
1080
1104
  };
1105
+ currency: string;
1106
+ createdAt: string;
1081
1107
  attribution: {
1082
1108
  requestId: string;
1083
1109
  principal: {
@@ -1093,9 +1119,7 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1093
1119
  generationId?: string | undefined;
1094
1120
  };
1095
1121
  idempotencyKey: string;
1096
- createdAt: string;
1097
1122
  amount: string & z.BRAND<"ExactDecimal">;
1098
- currency: string;
1099
1123
  schemaVersion: 1;
1100
1124
  refundId: string;
1101
1125
  }, {
@@ -1107,6 +1131,8 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1107
1131
  kind: "receipt";
1108
1132
  receiptId: string;
1109
1133
  };
1134
+ currency: string;
1135
+ createdAt: string;
1110
1136
  attribution: {
1111
1137
  requestId: string;
1112
1138
  principal: {
@@ -1122,9 +1148,7 @@ export declare const usageRefundSchema: z.ZodEffects<z.ZodObject<{
1122
1148
  generationId?: string | undefined;
1123
1149
  };
1124
1150
  idempotencyKey: string;
1125
- createdAt: string;
1126
1151
  amount: string;
1127
- currency: string;
1128
1152
  schemaVersion: 1;
1129
1153
  refundId: string;
1130
1154
  }>;
@@ -62,7 +62,20 @@
62
62
  * escapes, and the billing and entitlement records, where one is a second
63
63
  * number beside an exact amount.
64
64
  *
65
- * Decided in: docs/adr/0006-oxy-relay-boundary.md, docs/adr/0010-public-api-compatibility.md.
65
+ * A SIGNED document is strict at its top level for a third reason, and there it
66
+ * is forced rather than chosen. `aliaModelReleaseManifestSchema` carries
67
+ * signatures over its own canonical bytes, so a field stripped at this parse is a
68
+ * field missing from the bytes a verifier re-canonicalizes: a tolerant parse
69
+ * would report an invalid SIGNATURE where the truth is that this build does not
70
+ * understand the DOCUMENT. Its producer can run ahead of this package — Alia's
71
+ * release tooling is deployed independently — so the usual argument applies here
72
+ * and is outweighed, because the refusal costs an operator one retry after Oxy
73
+ * takes the newer contract, while the tolerant parse costs a misdiagnosis of a
74
+ * cryptographic failure.
75
+ *
76
+ * Decided in: docs/adr/0006-oxy-relay-boundary.md,
77
+ * docs/adr/0010-public-api-compatibility.md,
78
+ * docs/adr/0017-authorized-routes-in-the-envelope.md.
66
79
  */
67
80
  /**
68
81
  * Version of the contract SET as a whole — the value the control plane and the
@@ -86,4 +99,4 @@
86
99
  * change to, say, the catalogue reject every in-flight inference request; the
87
100
  * per-shape `schemaVersion` is what a message is validated against.
88
101
  */
89
- export declare const INFERENCE_CONTRACT_VERSION = "1.1.0";
102
+ export declare const INFERENCE_CONTRACT_VERSION = "1.3.0";
@@ -60,17 +60,17 @@ export declare const encryptedBackupEnvelopeSchema: z.ZodObject<{
60
60
  createdAt: z.ZodString;
61
61
  }, "strip", z.ZodTypeAny, {
62
62
  version: number;
63
+ createdAt: string;
63
64
  nonce: string;
64
65
  ciphertext: string;
65
- createdAt: string;
66
66
  algorithm: "xchacha20poly1305";
67
67
  kdfInfo: string;
68
68
  publicKeyHint: string;
69
69
  }, {
70
70
  version: number;
71
+ createdAt: string;
71
72
  nonce: string;
72
73
  ciphertext: string;
73
- createdAt: string;
74
74
  algorithm: "xchacha20poly1305";
75
75
  kdfInfo: string;
76
76
  publicKeyHint: string;
@@ -99,18 +99,18 @@ export declare const backupUploadRequestSchema: z.ZodObject<{
99
99
  lookupId: z.ZodString;
100
100
  }, "strip", z.ZodTypeAny, {
101
101
  version: number;
102
+ createdAt: string;
102
103
  nonce: string;
103
104
  ciphertext: string;
104
- createdAt: string;
105
105
  algorithm: "xchacha20poly1305";
106
106
  kdfInfo: string;
107
107
  publicKeyHint: string;
108
108
  lookupId: string;
109
109
  }, {
110
110
  version: number;
111
+ createdAt: string;
111
112
  nonce: string;
112
113
  ciphertext: string;
113
- createdAt: string;
114
114
  algorithm: "xchacha20poly1305";
115
115
  kdfInfo: string;
116
116
  publicKeyHint: string;
@@ -115,18 +115,22 @@ export declare const assetUploadTicketSchema: z.ZodObject<{
115
115
  * carries the long immutable cache header (assets are content-addressed).
116
116
  */
117
117
  cacheControl: z.ZodString;
118
+ /** Base64 SHA-256 value required in the presigned PUT's checksum header. */
119
+ checksumSHA256: z.ZodString;
118
120
  }, "strip", z.ZodTypeAny, {
119
121
  sha256: string;
120
122
  contentType: string;
121
123
  uploadUrl: string;
122
124
  storageKey: string;
123
125
  cacheControl: string;
126
+ checksumSHA256: string;
124
127
  }, {
125
128
  sha256: string;
126
129
  contentType: string;
127
130
  uploadUrl: string;
128
131
  storageKey: string;
129
132
  cacheControl: string;
133
+ checksumSHA256: string;
130
134
  }>;
131
135
  export type AssetUploadTicket = z.infer<typeof assetUploadTicketSchema>;
132
136
  /**
@@ -149,18 +153,22 @@ export declare const assetInitResponseSchema: z.ZodObject<{
149
153
  * carries the long immutable cache header (assets are content-addressed).
150
154
  */
151
155
  cacheControl: z.ZodString;
156
+ /** Base64 SHA-256 value required in the presigned PUT's checksum header. */
157
+ checksumSHA256: z.ZodString;
152
158
  }, "strip", z.ZodTypeAny, {
153
159
  sha256: string;
154
160
  contentType: string;
155
161
  uploadUrl: string;
156
162
  storageKey: string;
157
163
  cacheControl: string;
164
+ checksumSHA256: string;
158
165
  }, {
159
166
  sha256: string;
160
167
  contentType: string;
161
168
  uploadUrl: string;
162
169
  storageKey: string;
163
170
  cacheControl: string;
171
+ checksumSHA256: string;
164
172
  }>, "many">;
165
173
  existing: z.ZodArray<z.ZodString, "many">;
166
174
  }, "strip", z.ZodTypeAny, {
@@ -170,6 +178,7 @@ export declare const assetInitResponseSchema: z.ZodObject<{
170
178
  uploadUrl: string;
171
179
  storageKey: string;
172
180
  cacheControl: string;
181
+ checksumSHA256: string;
173
182
  }[];
174
183
  existing: string[];
175
184
  }, {
@@ -179,6 +188,7 @@ export declare const assetInitResponseSchema: z.ZodObject<{
179
188
  uploadUrl: string;
180
189
  storageKey: string;
181
190
  cacheControl: string;
191
+ checksumSHA256: string;
182
192
  }[];
183
193
  existing: string[];
184
194
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/contracts",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",