@oxy.so/contracts 1.0.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 (147) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +16 -0
  3. package/dist/cjs/.tsbuildinfo +1 -0
  4. package/dist/cjs/accountGraph.js +489 -0
  5. package/dist/cjs/agency.js +439 -0
  6. package/dist/cjs/browserHub.js +215 -0
  7. package/dist/cjs/civic.js +163 -0
  8. package/dist/cjs/commonsSignIn.js +59 -0
  9. package/dist/cjs/deviceBoot.js +50 -0
  10. package/dist/cjs/deviceDirectory.js +189 -0
  11. package/dist/cjs/devicePairing.js +138 -0
  12. package/dist/cjs/deviceSession.js +164 -0
  13. package/dist/cjs/emailAgentContext.js +32 -0
  14. package/dist/cjs/followGraph.js +28 -0
  15. package/dist/cjs/identity.js +258 -0
  16. package/dist/cjs/inboxPush.js +24 -0
  17. package/dist/cjs/index.js +618 -0
  18. package/dist/cjs/inference/accountBilling.js +334 -0
  19. package/dist/cjs/inference/aliaModelRelease.js +262 -0
  20. package/dist/cjs/inference/attribution.js +106 -0
  21. package/dist/cjs/inference/catalogue.js +487 -0
  22. package/dist/cjs/inference/entitlement.js +217 -0
  23. package/dist/cjs/inference/errors.js +309 -0
  24. package/dist/cjs/inference/identifiers.js +224 -0
  25. package/dist/cjs/inference/inbox.js +105 -0
  26. package/dist/cjs/inference/modelDocumentation.js +433 -0
  27. package/dist/cjs/inference/money.js +188 -0
  28. package/dist/cjs/inference/priceVersion.js +110 -0
  29. package/dist/cjs/inference/providerConnection.js +455 -0
  30. package/dist/cjs/inference/request.js +477 -0
  31. package/dist/cjs/inference/routingPolicy.js +318 -0
  32. package/dist/cjs/inference/streamEvents.js +258 -0
  33. package/dist/cjs/inference/usage.js +329 -0
  34. package/dist/cjs/inference/version.js +105 -0
  35. package/dist/cjs/keyRecovery.js +91 -0
  36. package/dist/cjs/keyRotation.js +75 -0
  37. package/dist/cjs/links.js +68 -0
  38. package/dist/cjs/moderationReputation.js +298 -0
  39. package/dist/cjs/oauth.js +66 -0
  40. package/dist/cjs/oxyRecordTypes.js +71 -0
  41. package/dist/cjs/protocol.js +53 -0
  42. package/dist/cjs/recommendations.js +168 -0
  43. package/dist/cjs/reputation.js +297 -0
  44. package/dist/cjs/sessionStatus.js +121 -0
  45. package/dist/cjs/transparency.js +89 -0
  46. package/dist/cjs/updates.js +252 -0
  47. package/dist/cjs/userInvalidation.js +89 -0
  48. package/dist/cjs/userResponse.js +245 -0
  49. package/dist/cjs/username.js +290 -0
  50. package/dist/cjs/webauthn.js +71 -0
  51. package/dist/esm/.tsbuildinfo +1 -0
  52. package/dist/esm/accountGraph.js +480 -0
  53. package/dist/esm/agency.js +436 -0
  54. package/dist/esm/browserHub.js +212 -0
  55. package/dist/esm/civic.js +160 -0
  56. package/dist/esm/commonsSignIn.js +56 -0
  57. package/dist/esm/deviceBoot.js +47 -0
  58. package/dist/esm/deviceDirectory.js +186 -0
  59. package/dist/esm/devicePairing.js +135 -0
  60. package/dist/esm/deviceSession.js +161 -0
  61. package/dist/esm/emailAgentContext.js +29 -0
  62. package/dist/esm/followGraph.js +27 -0
  63. package/dist/esm/identity.js +255 -0
  64. package/dist/esm/inboxPush.js +21 -0
  65. package/dist/esm/index.js +172 -0
  66. package/dist/esm/inference/accountBilling.js +331 -0
  67. package/dist/esm/inference/aliaModelRelease.js +259 -0
  68. package/dist/esm/inference/attribution.js +103 -0
  69. package/dist/esm/inference/catalogue.js +484 -0
  70. package/dist/esm/inference/entitlement.js +214 -0
  71. package/dist/esm/inference/errors.js +306 -0
  72. package/dist/esm/inference/identifiers.js +221 -0
  73. package/dist/esm/inference/inbox.js +102 -0
  74. package/dist/esm/inference/modelDocumentation.js +430 -0
  75. package/dist/esm/inference/money.js +185 -0
  76. package/dist/esm/inference/priceVersion.js +107 -0
  77. package/dist/esm/inference/providerConnection.js +452 -0
  78. package/dist/esm/inference/request.js +474 -0
  79. package/dist/esm/inference/routingPolicy.js +315 -0
  80. package/dist/esm/inference/streamEvents.js +255 -0
  81. package/dist/esm/inference/usage.js +326 -0
  82. package/dist/esm/inference/version.js +102 -0
  83. package/dist/esm/keyRecovery.js +88 -0
  84. package/dist/esm/keyRotation.js +72 -0
  85. package/dist/esm/links.js +65 -0
  86. package/dist/esm/moderationReputation.js +295 -0
  87. package/dist/esm/oauth.js +63 -0
  88. package/dist/esm/oxyRecordTypes.js +68 -0
  89. package/dist/esm/protocol.js +50 -0
  90. package/dist/esm/recommendations.js +165 -0
  91. package/dist/esm/reputation.js +293 -0
  92. package/dist/esm/sessionStatus.js +118 -0
  93. package/dist/esm/transparency.js +86 -0
  94. package/dist/esm/updates.js +249 -0
  95. package/dist/esm/userInvalidation.js +85 -0
  96. package/dist/esm/userResponse.js +240 -0
  97. package/dist/esm/username.js +283 -0
  98. package/dist/esm/webauthn.js +68 -0
  99. package/dist/types/.tsbuildinfo +1 -0
  100. package/dist/types/accountGraph.d.ts +378 -0
  101. package/dist/types/agency.d.ts +2162 -0
  102. package/dist/types/browserHub.d.ts +856 -0
  103. package/dist/types/civic.d.ts +338 -0
  104. package/dist/types/commonsSignIn.d.ts +58 -0
  105. package/dist/types/deviceBoot.d.ts +74 -0
  106. package/dist/types/deviceDirectory.d.ts +1317 -0
  107. package/dist/types/devicePairing.d.ts +130 -0
  108. package/dist/types/deviceSession.d.ts +411 -0
  109. package/dist/types/emailAgentContext.d.ts +248 -0
  110. package/dist/types/followGraph.d.ts +150 -0
  111. package/dist/types/identity.d.ts +402 -0
  112. package/dist/types/inboxPush.d.ts +30 -0
  113. package/dist/types/index.d.ts +100 -0
  114. package/dist/types/inference/accountBilling.d.ts +738 -0
  115. package/dist/types/inference/aliaModelRelease.d.ts +609 -0
  116. package/dist/types/inference/attribution.d.ts +176 -0
  117. package/dist/types/inference/catalogue.d.ts +1618 -0
  118. package/dist/types/inference/entitlement.d.ts +519 -0
  119. package/dist/types/inference/errors.d.ts +242 -0
  120. package/dist/types/inference/identifiers.d.ts +182 -0
  121. package/dist/types/inference/inbox.d.ts +374 -0
  122. package/dist/types/inference/modelDocumentation.d.ts +1603 -0
  123. package/dist/types/inference/money.d.ts +185 -0
  124. package/dist/types/inference/priceVersion.d.ts +182 -0
  125. package/dist/types/inference/providerConnection.d.ts +968 -0
  126. package/dist/types/inference/request.d.ts +2800 -0
  127. package/dist/types/inference/routingPolicy.d.ts +616 -0
  128. package/dist/types/inference/streamEvents.d.ts +950 -0
  129. package/dist/types/inference/usage.d.ts +1164 -0
  130. package/dist/types/inference/version.d.ts +102 -0
  131. package/dist/types/keyRecovery.d.ts +138 -0
  132. package/dist/types/keyRotation.d.ts +103 -0
  133. package/dist/types/links.d.ts +96 -0
  134. package/dist/types/moderationReputation.d.ts +487 -0
  135. package/dist/types/oauth.d.ts +86 -0
  136. package/dist/types/oxyRecordTypes.d.ts +62 -0
  137. package/dist/types/protocol.d.ts +86 -0
  138. package/dist/types/recommendations.d.ts +542 -0
  139. package/dist/types/reputation.d.ts +457 -0
  140. package/dist/types/sessionStatus.d.ts +231 -0
  141. package/dist/types/transparency.d.ts +392 -0
  142. package/dist/types/updates.d.ts +545 -0
  143. package/dist/types/userInvalidation.d.ts +94 -0
  144. package/dist/types/userResponse.d.ts +1706 -0
  145. package/dist/types/username.d.ts +265 -0
  146. package/dist/types/webauthn.d.ts +77 -0
  147. package/package.json +87 -0
@@ -0,0 +1,616 @@
1
+ /**
2
+ * Routing policy — the customer-facing routing configuration.
3
+ *
4
+ * Stored under an Oxy account or application (the control plane owns it),
5
+ * executed by the data plane, which owns execution. Every request records the
6
+ * exact `{routingPolicyId, policyVersion}` it was served under, so a route
7
+ * decision months old can be explained against the policy that was in force,
8
+ * not against the policy that exists now.
9
+ *
10
+ * Two rules shape the fallback controls:
11
+ *
12
+ * - **Same-model deployment failover is not cross-model fallback.** Moving
13
+ * between two deployments of the SAME revision is an availability decision
14
+ * and is on by default; serving a DIFFERENT model is a substitution the
15
+ * customer must have authorized by name.
16
+ * - **A request for a concrete model is never silently replaced.** Cross-model
17
+ * fallback is an explicit list of references, and a switch that uses it emits
18
+ * a customer-visible route-switch event.
19
+ *
20
+ * The controls are flat and independent, matching what Console renders — which
21
+ * means contradictory combinations are EXPRESSIBLE and must therefore be
22
+ * REJECTED, rather than being quietly resolved by whichever field the executor
23
+ * happens to read first. That rejection is `routingPolicySchema`'s refinement.
24
+ *
25
+ * **The policy itself never crosses to the data plane.** What crosses is
26
+ * {@link authorizedRouteSchema} — the candidate routes that SURVIVED these
27
+ * controls, in preference order — plus {@link routingPolicyReferenceSchema} as
28
+ * provenance for the receipt. The data plane holds no control value and needs
29
+ * none: it fails over by taking the next entry. See ADR 0017.
30
+ *
31
+ * Decided in: docs/adr/0008-catalogue-concept-separation.md,
32
+ * docs/adr/0017-authorized-routes-in-the-envelope.md, issue #972 workstream 6.
33
+ */
34
+ import { z } from "zod";
35
+ /**
36
+ * What a policy resolves to when a caller names no model.
37
+ *
38
+ * A discriminated union rather than two optional fields, so "which one did the
39
+ * customer configure" is never a question about which field is non-null.
40
+ */
41
+ export declare const routingTargetSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
42
+ kind: z.ZodLiteral<"model">;
43
+ modelReference: z.ZodString;
44
+ }, "strict", z.ZodTypeAny, {
45
+ kind: "model";
46
+ modelReference: string;
47
+ }, {
48
+ kind: "model";
49
+ modelReference: string;
50
+ }>, z.ZodObject<{
51
+ kind: z.ZodLiteral<"routing_profile_id">;
52
+ routingProfileId: z.ZodString;
53
+ }, "strict", z.ZodTypeAny, {
54
+ kind: "routing_profile_id";
55
+ routingProfileId: string;
56
+ }, {
57
+ kind: "routing_profile_id";
58
+ routingProfileId: string;
59
+ }>]>;
60
+ /**
61
+ * Which account or application a policy governs.
62
+ *
63
+ * Application-scoped policies are the common case; an account-scoped policy is
64
+ * the floor its applications inherit, and inheritance is resolved by the control
65
+ * plane before a policy reaches the data plane.
66
+ */
67
+ export declare const routingPolicyScopeSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
68
+ kind: z.ZodLiteral<"account">;
69
+ accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
70
+ }, "strict", z.ZodTypeAny, {
71
+ kind: "account";
72
+ accountId: string & z.BRAND<"OxyAccountId">;
73
+ }, {
74
+ kind: "account";
75
+ accountId: string;
76
+ }>, z.ZodObject<{
77
+ kind: z.ZodLiteral<"application">;
78
+ accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
79
+ applicationId: z.ZodString;
80
+ }, "strict", z.ZodTypeAny, {
81
+ kind: "application";
82
+ accountId: string & z.BRAND<"OxyAccountId">;
83
+ applicationId: string;
84
+ }, {
85
+ kind: "application";
86
+ accountId: string;
87
+ applicationId: string;
88
+ }>]>;
89
+ /**
90
+ * The fallback controls, kept together so a reviewer sees all three at once.
91
+ *
92
+ * `authorizedCrossModel` is a list of model references the customer has
93
+ * explicitly permitted as substitutes — never a boolean, because "allow
94
+ * fallback" without naming the destination is exactly the silent substitution
95
+ * the invariant forbids.
96
+ */
97
+ export declare const routingFallbackPolicySchema: z.ZodObject<{
98
+ disabled: z.ZodBoolean;
99
+ sameModelDeployment: z.ZodBoolean;
100
+ authorizedCrossModel: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
101
+ }, "strict", z.ZodTypeAny, {
102
+ disabled: boolean;
103
+ sameModelDeployment: boolean;
104
+ authorizedCrossModel: string[];
105
+ }, {
106
+ disabled: boolean;
107
+ sameModelDeployment: boolean;
108
+ authorizedCrossModel?: string[] | undefined;
109
+ }>;
110
+ /**
111
+ * A versioned routing policy.
112
+ *
113
+ * `policyVersion` is the CUSTOMER's revision of their own configuration and is
114
+ * unrelated to `schemaVersion`, which is the version of this wire shape. They
115
+ * are two different clocks: a customer edits their policy without any contract
116
+ * change, and a contract change does not renumber anybody's policy.
117
+ */
118
+ export declare const routingPolicySchema: z.ZodEffects<z.ZodObject<{
119
+ /** See `version.ts`: exchanged with the data plane on its own. */
120
+ schemaVersion: z.ZodLiteral<2>;
121
+ routingPolicyId: z.ZodString;
122
+ policyVersion: z.ZodNumber;
123
+ scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
124
+ kind: z.ZodLiteral<"account">;
125
+ accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
126
+ }, "strict", z.ZodTypeAny, {
127
+ kind: "account";
128
+ accountId: string & z.BRAND<"OxyAccountId">;
129
+ }, {
130
+ kind: "account";
131
+ accountId: string;
132
+ }>, z.ZodObject<{
133
+ kind: z.ZodLiteral<"application">;
134
+ accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
135
+ applicationId: z.ZodString;
136
+ }, "strict", z.ZodTypeAny, {
137
+ kind: "application";
138
+ accountId: string & z.BRAND<"OxyAccountId">;
139
+ applicationId: string;
140
+ }, {
141
+ kind: "application";
142
+ accountId: string;
143
+ applicationId: string;
144
+ }>]>;
145
+ /** Absent when every request must name its own model. */
146
+ defaultTarget: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
147
+ kind: z.ZodLiteral<"model">;
148
+ modelReference: z.ZodString;
149
+ }, "strict", z.ZodTypeAny, {
150
+ kind: "model";
151
+ modelReference: string;
152
+ }, {
153
+ kind: "model";
154
+ modelReference: string;
155
+ }>, z.ZodObject<{
156
+ kind: z.ZodLiteral<"routing_profile_id">;
157
+ routingProfileId: z.ZodString;
158
+ }, "strict", z.ZodTypeAny, {
159
+ kind: "routing_profile_id";
160
+ routingProfileId: string;
161
+ }, {
162
+ kind: "routing_profile_id";
163
+ routingProfileId: string;
164
+ }>]>>;
165
+ /** Empty means "no allowlist" — every provider qualifies unless denied. */
166
+ providerAllowlist: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
167
+ providerDenylist: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
168
+ /** Empty means "no residency constraint". */
169
+ allowedRegions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
170
+ deniedRegions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
171
+ requireZeroDataRetention: z.ZodBoolean;
172
+ prohibitTrainingOnCustomerData: z.ZodBoolean;
173
+ /** Ceilings on what a route may cost the customer, quoted like catalogue prices. */
174
+ maxPricePerUnit: z.ZodDefault<z.ZodArray<z.ZodObject<{
175
+ unit: z.ZodEnum<["input_tokens", "cached_input_tokens", "output_tokens", "reasoning_tokens", "requests", "images", "audio_input_milliseconds", "audio_output_milliseconds", "video_milliseconds", "characters", "embeddings"]>;
176
+ amount: z.ZodBranded<z.ZodString, "ExactDecimal">;
177
+ per: z.ZodNumber;
178
+ currency: z.ZodString;
179
+ }, "strict", z.ZodTypeAny, {
180
+ currency: string;
181
+ amount: string & z.BRAND<"ExactDecimal">;
182
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
183
+ per: number;
184
+ }, {
185
+ currency: string;
186
+ amount: string;
187
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
188
+ per: number;
189
+ }>, "many">>;
190
+ maxPricePerRequest: z.ZodOptional<z.ZodObject<{
191
+ amount: z.ZodBranded<z.ZodString, "ExactDecimal">;
192
+ currency: z.ZodString;
193
+ }, "strict", z.ZodTypeAny, {
194
+ currency: string;
195
+ amount: string & z.BRAND<"ExactDecimal">;
196
+ }, {
197
+ currency: string;
198
+ amount: string;
199
+ }>>;
200
+ /** What to optimise for among the routes that qualify. */
201
+ optimiseFor: z.ZodEnum<["price", "latency", "throughput", "balanced"]>;
202
+ /** Serve only from Oxy's own hosting of open-weight models. */
203
+ oxyHostedOnly: z.ZodBoolean;
204
+ /** License / usage-right constraints. Empty license list means unconstrained. */
205
+ allowedLicenseIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
206
+ requireCommercialUseRights: z.ZodBoolean;
207
+ fallback: z.ZodObject<{
208
+ disabled: z.ZodBoolean;
209
+ sameModelDeployment: z.ZodBoolean;
210
+ authorizedCrossModel: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
211
+ }, "strict", z.ZodTypeAny, {
212
+ disabled: boolean;
213
+ sameModelDeployment: boolean;
214
+ authorizedCrossModel: string[];
215
+ }, {
216
+ disabled: boolean;
217
+ sameModelDeployment: boolean;
218
+ authorizedCrossModel?: string[] | undefined;
219
+ }>;
220
+ /** Whether the customer's own provider credentials may or must be used. */
221
+ byokPreference: z.ZodEnum<["disabled", "prefer", "require"]>;
222
+ /** Enterprise reserved capacity rather than shared endpoints. */
223
+ dedicatedCapacity: z.ZodEnum<["disabled", "prefer", "require"]>;
224
+ updatedAt: z.ZodString;
225
+ }, "strip", z.ZodTypeAny, {
226
+ updatedAt: string;
227
+ schemaVersion: 2;
228
+ scope: {
229
+ kind: "account";
230
+ accountId: string & z.BRAND<"OxyAccountId">;
231
+ } | {
232
+ kind: "application";
233
+ accountId: string & z.BRAND<"OxyAccountId">;
234
+ applicationId: string;
235
+ };
236
+ dedicatedCapacity: "disabled" | "prefer" | "require";
237
+ optimiseFor: "price" | "latency" | "throughput" | "balanced";
238
+ routingPolicyId: string;
239
+ policyVersion: number;
240
+ providerAllowlist: string[];
241
+ providerDenylist: string[];
242
+ allowedRegions: string[];
243
+ deniedRegions: string[];
244
+ requireZeroDataRetention: boolean;
245
+ prohibitTrainingOnCustomerData: boolean;
246
+ maxPricePerUnit: {
247
+ currency: string;
248
+ amount: string & z.BRAND<"ExactDecimal">;
249
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
250
+ per: number;
251
+ }[];
252
+ oxyHostedOnly: boolean;
253
+ allowedLicenseIds: string[];
254
+ requireCommercialUseRights: boolean;
255
+ fallback: {
256
+ disabled: boolean;
257
+ sameModelDeployment: boolean;
258
+ authorizedCrossModel: string[];
259
+ };
260
+ byokPreference: "disabled" | "prefer" | "require";
261
+ defaultTarget?: {
262
+ kind: "model";
263
+ modelReference: string;
264
+ } | {
265
+ kind: "routing_profile_id";
266
+ routingProfileId: string;
267
+ } | undefined;
268
+ maxPricePerRequest?: {
269
+ currency: string;
270
+ amount: string & z.BRAND<"ExactDecimal">;
271
+ } | undefined;
272
+ }, {
273
+ updatedAt: string;
274
+ schemaVersion: 2;
275
+ scope: {
276
+ kind: "account";
277
+ accountId: string;
278
+ } | {
279
+ kind: "application";
280
+ accountId: string;
281
+ applicationId: string;
282
+ };
283
+ dedicatedCapacity: "disabled" | "prefer" | "require";
284
+ optimiseFor: "price" | "latency" | "throughput" | "balanced";
285
+ routingPolicyId: string;
286
+ policyVersion: number;
287
+ requireZeroDataRetention: boolean;
288
+ prohibitTrainingOnCustomerData: boolean;
289
+ oxyHostedOnly: boolean;
290
+ requireCommercialUseRights: boolean;
291
+ fallback: {
292
+ disabled: boolean;
293
+ sameModelDeployment: boolean;
294
+ authorizedCrossModel?: string[] | undefined;
295
+ };
296
+ byokPreference: "disabled" | "prefer" | "require";
297
+ defaultTarget?: {
298
+ kind: "model";
299
+ modelReference: string;
300
+ } | {
301
+ kind: "routing_profile_id";
302
+ routingProfileId: string;
303
+ } | undefined;
304
+ providerAllowlist?: string[] | undefined;
305
+ providerDenylist?: string[] | undefined;
306
+ allowedRegions?: string[] | undefined;
307
+ deniedRegions?: string[] | undefined;
308
+ maxPricePerUnit?: {
309
+ currency: string;
310
+ amount: string;
311
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
312
+ per: number;
313
+ }[] | undefined;
314
+ maxPricePerRequest?: {
315
+ currency: string;
316
+ amount: string;
317
+ } | undefined;
318
+ allowedLicenseIds?: string[] | undefined;
319
+ }>, {
320
+ updatedAt: string;
321
+ schemaVersion: 2;
322
+ scope: {
323
+ kind: "account";
324
+ accountId: string & z.BRAND<"OxyAccountId">;
325
+ } | {
326
+ kind: "application";
327
+ accountId: string & z.BRAND<"OxyAccountId">;
328
+ applicationId: string;
329
+ };
330
+ dedicatedCapacity: "disabled" | "prefer" | "require";
331
+ optimiseFor: "price" | "latency" | "throughput" | "balanced";
332
+ routingPolicyId: string;
333
+ policyVersion: number;
334
+ providerAllowlist: string[];
335
+ providerDenylist: string[];
336
+ allowedRegions: string[];
337
+ deniedRegions: string[];
338
+ requireZeroDataRetention: boolean;
339
+ prohibitTrainingOnCustomerData: boolean;
340
+ maxPricePerUnit: {
341
+ currency: string;
342
+ amount: string & z.BRAND<"ExactDecimal">;
343
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
344
+ per: number;
345
+ }[];
346
+ oxyHostedOnly: boolean;
347
+ allowedLicenseIds: string[];
348
+ requireCommercialUseRights: boolean;
349
+ fallback: {
350
+ disabled: boolean;
351
+ sameModelDeployment: boolean;
352
+ authorizedCrossModel: string[];
353
+ };
354
+ byokPreference: "disabled" | "prefer" | "require";
355
+ defaultTarget?: {
356
+ kind: "model";
357
+ modelReference: string;
358
+ } | {
359
+ kind: "routing_profile_id";
360
+ routingProfileId: string;
361
+ } | undefined;
362
+ maxPricePerRequest?: {
363
+ currency: string;
364
+ amount: string & z.BRAND<"ExactDecimal">;
365
+ } | undefined;
366
+ }, {
367
+ updatedAt: string;
368
+ schemaVersion: 2;
369
+ scope: {
370
+ kind: "account";
371
+ accountId: string;
372
+ } | {
373
+ kind: "application";
374
+ accountId: string;
375
+ applicationId: string;
376
+ };
377
+ dedicatedCapacity: "disabled" | "prefer" | "require";
378
+ optimiseFor: "price" | "latency" | "throughput" | "balanced";
379
+ routingPolicyId: string;
380
+ policyVersion: number;
381
+ requireZeroDataRetention: boolean;
382
+ prohibitTrainingOnCustomerData: boolean;
383
+ oxyHostedOnly: boolean;
384
+ requireCommercialUseRights: boolean;
385
+ fallback: {
386
+ disabled: boolean;
387
+ sameModelDeployment: boolean;
388
+ authorizedCrossModel?: string[] | undefined;
389
+ };
390
+ byokPreference: "disabled" | "prefer" | "require";
391
+ defaultTarget?: {
392
+ kind: "model";
393
+ modelReference: string;
394
+ } | {
395
+ kind: "routing_profile_id";
396
+ routingProfileId: string;
397
+ } | undefined;
398
+ providerAllowlist?: string[] | undefined;
399
+ providerDenylist?: string[] | undefined;
400
+ allowedRegions?: string[] | undefined;
401
+ deniedRegions?: string[] | undefined;
402
+ maxPricePerUnit?: {
403
+ currency: string;
404
+ amount: string;
405
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings";
406
+ per: number;
407
+ }[] | undefined;
408
+ maxPricePerRequest?: {
409
+ currency: string;
410
+ amount: string;
411
+ } | undefined;
412
+ allowedLicenseIds?: string[] | undefined;
413
+ }>;
414
+ /**
415
+ * The reference a request records: which policy, at which of the customer's own
416
+ * revisions. Embedded in the request envelope and in the settled receipt, so a
417
+ * charge can be explained against the exact configuration that produced it.
418
+ */
419
+ export declare const routingPolicyReferenceSchema: z.ZodObject<{
420
+ routingPolicyId: z.ZodString;
421
+ policyVersion: z.ZodNumber;
422
+ }, "strict", z.ZodTypeAny, {
423
+ routingPolicyId: string;
424
+ policyVersion: number;
425
+ }, {
426
+ routingPolicyId: string;
427
+ policyVersion: number;
428
+ }>;
429
+ /**
430
+ * One route the control plane has already authorized for one request.
431
+ *
432
+ * **Authorization is an ENTRY, never a boolean.** The same stance
433
+ * `inference_routing_policy_fallbacks` takes in storage: being allowed to serve
434
+ * a route IS appearing here, and every entry names its destination. A flag
435
+ * saying "substitution allowed" without naming the destination is exactly the
436
+ * silent substitution the platform forbids, and it invents a "flag set, list
437
+ * empty" state somebody then has to decide what to do with.
438
+ *
439
+ * Discriminated on `substitution`, relative to the FIRST entry — the primary
440
+ * route Oxy resolved:
441
+ *
442
+ * - `same_model` serves the same model line as the primary. This is
443
+ * availability failover between deployments of one model.
444
+ * - `cross_model` serves a DIFFERENT model line, and is expressible only with
445
+ * `authorizedByPolicy: true` as a literal. So "a model was substituted
446
+ * without the customer authorizing it" is not a sentence this contract can
447
+ * say — the same construction `inferenceRouteSwitchDetailSchema` uses to make
448
+ * the resulting route-switch event unreportable.
449
+ */
450
+ export declare const authorizedRouteSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"substitution", [z.ZodObject<{
451
+ deploymentId: z.ZodString;
452
+ modelReference: z.ZodString;
453
+ provider: z.ZodString;
454
+ regions: z.ZodArray<z.ZodString, "many">;
455
+ customerProviderCredential: z.ZodOptional<z.ZodObject<{
456
+ credentialHandle: z.ZodString;
457
+ credentialRevision: z.ZodNumber;
458
+ ownerAccountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
459
+ connectionId: z.ZodString;
460
+ environment: z.ZodEnum<["development", "staging", "production"]>;
461
+ }, "strict", z.ZodTypeAny, {
462
+ environment: "development" | "staging" | "production";
463
+ ownerAccountId: string & z.BRAND<"OxyAccountId">;
464
+ connectionId: string;
465
+ credentialHandle: string;
466
+ credentialRevision: number;
467
+ }, {
468
+ environment: "development" | "staging" | "production";
469
+ ownerAccountId: string;
470
+ connectionId: string;
471
+ credentialHandle: string;
472
+ credentialRevision: number;
473
+ }>>;
474
+ substitution: z.ZodLiteral<"same_model">;
475
+ }, "strict", z.ZodTypeAny, {
476
+ provider: string;
477
+ modelReference: string;
478
+ regions: string[];
479
+ deploymentId: string;
480
+ substitution: "same_model";
481
+ customerProviderCredential?: {
482
+ environment: "development" | "staging" | "production";
483
+ ownerAccountId: string & z.BRAND<"OxyAccountId">;
484
+ connectionId: string;
485
+ credentialHandle: string;
486
+ credentialRevision: number;
487
+ } | undefined;
488
+ }, {
489
+ provider: string;
490
+ modelReference: string;
491
+ regions: string[];
492
+ deploymentId: string;
493
+ substitution: "same_model";
494
+ customerProviderCredential?: {
495
+ environment: "development" | "staging" | "production";
496
+ ownerAccountId: string;
497
+ connectionId: string;
498
+ credentialHandle: string;
499
+ credentialRevision: number;
500
+ } | undefined;
501
+ }>, z.ZodObject<{
502
+ /** Literal `true`: an unauthorized substitution cannot be expressed. */
503
+ authorizedByPolicy: z.ZodLiteral<true>;
504
+ deploymentId: z.ZodString;
505
+ modelReference: z.ZodString;
506
+ provider: z.ZodString;
507
+ regions: z.ZodArray<z.ZodString, "many">;
508
+ customerProviderCredential: z.ZodOptional<z.ZodObject<{
509
+ credentialHandle: z.ZodString;
510
+ credentialRevision: z.ZodNumber;
511
+ ownerAccountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
512
+ connectionId: z.ZodString;
513
+ environment: z.ZodEnum<["development", "staging", "production"]>;
514
+ }, "strict", z.ZodTypeAny, {
515
+ environment: "development" | "staging" | "production";
516
+ ownerAccountId: string & z.BRAND<"OxyAccountId">;
517
+ connectionId: string;
518
+ credentialHandle: string;
519
+ credentialRevision: number;
520
+ }, {
521
+ environment: "development" | "staging" | "production";
522
+ ownerAccountId: string;
523
+ connectionId: string;
524
+ credentialHandle: string;
525
+ credentialRevision: number;
526
+ }>>;
527
+ substitution: z.ZodLiteral<"cross_model">;
528
+ }, "strict", z.ZodTypeAny, {
529
+ provider: string;
530
+ modelReference: string;
531
+ regions: string[];
532
+ deploymentId: string;
533
+ substitution: "cross_model";
534
+ authorizedByPolicy: true;
535
+ customerProviderCredential?: {
536
+ environment: "development" | "staging" | "production";
537
+ ownerAccountId: string & z.BRAND<"OxyAccountId">;
538
+ connectionId: string;
539
+ credentialHandle: string;
540
+ credentialRevision: number;
541
+ } | undefined;
542
+ }, {
543
+ provider: string;
544
+ modelReference: string;
545
+ regions: string[];
546
+ deploymentId: string;
547
+ substitution: "cross_model";
548
+ authorizedByPolicy: true;
549
+ customerProviderCredential?: {
550
+ environment: "development" | "staging" | "production";
551
+ ownerAccountId: string;
552
+ connectionId: string;
553
+ credentialHandle: string;
554
+ credentialRevision: number;
555
+ } | undefined;
556
+ }>]>, {
557
+ provider: string;
558
+ modelReference: string;
559
+ regions: string[];
560
+ deploymentId: string;
561
+ substitution: "same_model";
562
+ customerProviderCredential?: {
563
+ environment: "development" | "staging" | "production";
564
+ ownerAccountId: string & z.BRAND<"OxyAccountId">;
565
+ connectionId: string;
566
+ credentialHandle: string;
567
+ credentialRevision: number;
568
+ } | undefined;
569
+ } | {
570
+ provider: string;
571
+ modelReference: string;
572
+ regions: string[];
573
+ deploymentId: string;
574
+ substitution: "cross_model";
575
+ authorizedByPolicy: true;
576
+ customerProviderCredential?: {
577
+ environment: "development" | "staging" | "production";
578
+ ownerAccountId: string & z.BRAND<"OxyAccountId">;
579
+ connectionId: string;
580
+ credentialHandle: string;
581
+ credentialRevision: number;
582
+ } | undefined;
583
+ }, {
584
+ provider: string;
585
+ modelReference: string;
586
+ regions: string[];
587
+ deploymentId: string;
588
+ substitution: "same_model";
589
+ customerProviderCredential?: {
590
+ environment: "development" | "staging" | "production";
591
+ ownerAccountId: string;
592
+ connectionId: string;
593
+ credentialHandle: string;
594
+ credentialRevision: number;
595
+ } | undefined;
596
+ } | {
597
+ provider: string;
598
+ modelReference: string;
599
+ regions: string[];
600
+ deploymentId: string;
601
+ substitution: "cross_model";
602
+ authorizedByPolicy: true;
603
+ customerProviderCredential?: {
604
+ environment: "development" | "staging" | "production";
605
+ ownerAccountId: string;
606
+ connectionId: string;
607
+ credentialHandle: string;
608
+ credentialRevision: number;
609
+ } | undefined;
610
+ }>;
611
+ export type RoutingTarget = z.infer<typeof routingTargetSchema>;
612
+ export type RoutingPolicyScope = z.infer<typeof routingPolicyScopeSchema>;
613
+ export type RoutingFallbackPolicy = z.infer<typeof routingFallbackPolicySchema>;
614
+ export type RoutingPolicy = z.infer<typeof routingPolicySchema>;
615
+ export type RoutingPolicyReference = z.infer<typeof routingPolicyReferenceSchema>;
616
+ export type AuthorizedRoute = z.infer<typeof authorizedRouteSchema>;