@oxy.so/contracts 4.6.0 → 4.7.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.
@@ -0,0 +1,1833 @@
1
+ import { z } from "zod";
2
+ export declare const decisionEffortSchema: z.ZodEnum<["instant", "low", "medium", "high", "xhigh"]>;
3
+ export declare const decisionQuestionSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4
+ kind: z.ZodLiteral<"choice">;
5
+ options: z.ZodArray<z.ZodString, "many">;
6
+ id: z.ZodString;
7
+ question: z.ZodString;
8
+ criteria: z.ZodOptional<z.ZodString>;
9
+ }, "strict", z.ZodTypeAny, {
10
+ options: string[];
11
+ kind: "choice";
12
+ id: string;
13
+ question: string;
14
+ criteria?: string | undefined;
15
+ }, {
16
+ options: string[];
17
+ kind: "choice";
18
+ id: string;
19
+ question: string;
20
+ criteria?: string | undefined;
21
+ }>, z.ZodObject<{
22
+ kind: z.ZodLiteral<"score">;
23
+ levels: z.ZodArray<z.ZodString, "many">;
24
+ id: z.ZodString;
25
+ question: z.ZodString;
26
+ criteria: z.ZodOptional<z.ZodString>;
27
+ }, "strict", z.ZodTypeAny, {
28
+ kind: "score";
29
+ id: string;
30
+ question: string;
31
+ levels: string[];
32
+ criteria?: string | undefined;
33
+ }, {
34
+ kind: "score";
35
+ id: string;
36
+ question: string;
37
+ levels: string[];
38
+ criteria?: string | undefined;
39
+ }>, z.ZodObject<{
40
+ kind: z.ZodLiteral<"noul">;
41
+ id: z.ZodString;
42
+ question: z.ZodString;
43
+ criteria: z.ZodOptional<z.ZodString>;
44
+ }, "strict", z.ZodTypeAny, {
45
+ kind: "noul";
46
+ id: string;
47
+ question: string;
48
+ criteria?: string | undefined;
49
+ }, {
50
+ kind: "noul";
51
+ id: string;
52
+ question: string;
53
+ criteria?: string | undefined;
54
+ }>]>;
55
+ /**
56
+ * Conservative serialized input accounting, including escaping and structure.
57
+ * Measures both the normalized payload and the provider's structured-question
58
+ * representation. Common instructions repeat per question there. A 255-byte
59
+ * model identity and 4096-byte gateway-policy allowance bound adapter metadata.
60
+ * Kaana must also check its final serialized body before sending it.
61
+ */
62
+ export declare function decisionInputBudget(payload: DecisionInput): {
63
+ total: number;
64
+ context: number;
65
+ gateway: number;
66
+ };
67
+ /** OpenRouter's TOTAL limit is separate from direct state-plus-longest context. */
68
+ export declare function decisionFitsGateway(payload: DecisionInput): boolean;
69
+ export declare const decisionInputSchema: z.ZodEffects<z.ZodObject<{
70
+ state: z.ZodString;
71
+ instructions: z.ZodOptional<z.ZodString>;
72
+ questions: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
73
+ kind: z.ZodLiteral<"choice">;
74
+ options: z.ZodArray<z.ZodString, "many">;
75
+ id: z.ZodString;
76
+ question: z.ZodString;
77
+ criteria: z.ZodOptional<z.ZodString>;
78
+ }, "strict", z.ZodTypeAny, {
79
+ options: string[];
80
+ kind: "choice";
81
+ id: string;
82
+ question: string;
83
+ criteria?: string | undefined;
84
+ }, {
85
+ options: string[];
86
+ kind: "choice";
87
+ id: string;
88
+ question: string;
89
+ criteria?: string | undefined;
90
+ }>, z.ZodObject<{
91
+ kind: z.ZodLiteral<"score">;
92
+ levels: z.ZodArray<z.ZodString, "many">;
93
+ id: z.ZodString;
94
+ question: z.ZodString;
95
+ criteria: z.ZodOptional<z.ZodString>;
96
+ }, "strict", z.ZodTypeAny, {
97
+ kind: "score";
98
+ id: string;
99
+ question: string;
100
+ levels: string[];
101
+ criteria?: string | undefined;
102
+ }, {
103
+ kind: "score";
104
+ id: string;
105
+ question: string;
106
+ levels: string[];
107
+ criteria?: string | undefined;
108
+ }>, z.ZodObject<{
109
+ kind: z.ZodLiteral<"noul">;
110
+ id: z.ZodString;
111
+ question: z.ZodString;
112
+ criteria: z.ZodOptional<z.ZodString>;
113
+ }, "strict", z.ZodTypeAny, {
114
+ kind: "noul";
115
+ id: string;
116
+ question: string;
117
+ criteria?: string | undefined;
118
+ }, {
119
+ kind: "noul";
120
+ id: string;
121
+ question: string;
122
+ criteria?: string | undefined;
123
+ }>]>, "many">;
124
+ effort: z.ZodOptional<z.ZodEnum<["instant", "low", "medium", "high", "xhigh"]>>;
125
+ }, "strict", z.ZodTypeAny, {
126
+ state: string;
127
+ questions: ({
128
+ options: string[];
129
+ kind: "choice";
130
+ id: string;
131
+ question: string;
132
+ criteria?: string | undefined;
133
+ } | {
134
+ kind: "score";
135
+ id: string;
136
+ question: string;
137
+ levels: string[];
138
+ criteria?: string | undefined;
139
+ } | {
140
+ kind: "noul";
141
+ id: string;
142
+ question: string;
143
+ criteria?: string | undefined;
144
+ })[];
145
+ instructions?: string | undefined;
146
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
147
+ }, {
148
+ state: string;
149
+ questions: ({
150
+ options: string[];
151
+ kind: "choice";
152
+ id: string;
153
+ question: string;
154
+ criteria?: string | undefined;
155
+ } | {
156
+ kind: "score";
157
+ id: string;
158
+ question: string;
159
+ levels: string[];
160
+ criteria?: string | undefined;
161
+ } | {
162
+ kind: "noul";
163
+ id: string;
164
+ question: string;
165
+ criteria?: string | undefined;
166
+ })[];
167
+ instructions?: string | undefined;
168
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
169
+ }>, {
170
+ state: string;
171
+ questions: ({
172
+ options: string[];
173
+ kind: "choice";
174
+ id: string;
175
+ question: string;
176
+ criteria?: string | undefined;
177
+ } | {
178
+ kind: "score";
179
+ id: string;
180
+ question: string;
181
+ levels: string[];
182
+ criteria?: string | undefined;
183
+ } | {
184
+ kind: "noul";
185
+ id: string;
186
+ question: string;
187
+ criteria?: string | undefined;
188
+ })[];
189
+ instructions?: string | undefined;
190
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
191
+ }, {
192
+ state: string;
193
+ questions: ({
194
+ options: string[];
195
+ kind: "choice";
196
+ id: string;
197
+ question: string;
198
+ criteria?: string | undefined;
199
+ } | {
200
+ kind: "score";
201
+ id: string;
202
+ question: string;
203
+ levels: string[];
204
+ criteria?: string | undefined;
205
+ } | {
206
+ kind: "noul";
207
+ id: string;
208
+ question: string;
209
+ criteria?: string | undefined;
210
+ })[];
211
+ instructions?: string | undefined;
212
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
213
+ }>;
214
+ export declare const decisionRequestSchema: z.ZodEffects<z.ZodObject<{
215
+ state: z.ZodString;
216
+ instructions: z.ZodOptional<z.ZodString>;
217
+ questions: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
218
+ kind: z.ZodLiteral<"choice">;
219
+ options: z.ZodArray<z.ZodString, "many">;
220
+ id: z.ZodString;
221
+ question: z.ZodString;
222
+ criteria: z.ZodOptional<z.ZodString>;
223
+ }, "strict", z.ZodTypeAny, {
224
+ options: string[];
225
+ kind: "choice";
226
+ id: string;
227
+ question: string;
228
+ criteria?: string | undefined;
229
+ }, {
230
+ options: string[];
231
+ kind: "choice";
232
+ id: string;
233
+ question: string;
234
+ criteria?: string | undefined;
235
+ }>, z.ZodObject<{
236
+ kind: z.ZodLiteral<"score">;
237
+ levels: z.ZodArray<z.ZodString, "many">;
238
+ id: z.ZodString;
239
+ question: z.ZodString;
240
+ criteria: z.ZodOptional<z.ZodString>;
241
+ }, "strict", z.ZodTypeAny, {
242
+ kind: "score";
243
+ id: string;
244
+ question: string;
245
+ levels: string[];
246
+ criteria?: string | undefined;
247
+ }, {
248
+ kind: "score";
249
+ id: string;
250
+ question: string;
251
+ levels: string[];
252
+ criteria?: string | undefined;
253
+ }>, z.ZodObject<{
254
+ kind: z.ZodLiteral<"noul">;
255
+ id: z.ZodString;
256
+ question: z.ZodString;
257
+ criteria: z.ZodOptional<z.ZodString>;
258
+ }, "strict", z.ZodTypeAny, {
259
+ kind: "noul";
260
+ id: string;
261
+ question: string;
262
+ criteria?: string | undefined;
263
+ }, {
264
+ kind: "noul";
265
+ id: string;
266
+ question: string;
267
+ criteria?: string | undefined;
268
+ }>]>, "many">;
269
+ effort: z.ZodOptional<z.ZodEnum<["instant", "low", "medium", "high", "xhigh"]>>;
270
+ model: z.ZodEffects<z.ZodString, string, string>;
271
+ }, "strict", z.ZodTypeAny, {
272
+ state: string;
273
+ model: string;
274
+ questions: ({
275
+ options: string[];
276
+ kind: "choice";
277
+ id: string;
278
+ question: string;
279
+ criteria?: string | undefined;
280
+ } | {
281
+ kind: "score";
282
+ id: string;
283
+ question: string;
284
+ levels: string[];
285
+ criteria?: string | undefined;
286
+ } | {
287
+ kind: "noul";
288
+ id: string;
289
+ question: string;
290
+ criteria?: string | undefined;
291
+ })[];
292
+ instructions?: string | undefined;
293
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
294
+ }, {
295
+ state: string;
296
+ model: string;
297
+ questions: ({
298
+ options: string[];
299
+ kind: "choice";
300
+ id: string;
301
+ question: string;
302
+ criteria?: string | undefined;
303
+ } | {
304
+ kind: "score";
305
+ id: string;
306
+ question: string;
307
+ levels: string[];
308
+ criteria?: string | undefined;
309
+ } | {
310
+ kind: "noul";
311
+ id: string;
312
+ question: string;
313
+ criteria?: string | undefined;
314
+ })[];
315
+ instructions?: string | undefined;
316
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
317
+ }>, {
318
+ state: string;
319
+ model: string;
320
+ questions: ({
321
+ options: string[];
322
+ kind: "choice";
323
+ id: string;
324
+ question: string;
325
+ criteria?: string | undefined;
326
+ } | {
327
+ kind: "score";
328
+ id: string;
329
+ question: string;
330
+ levels: string[];
331
+ criteria?: string | undefined;
332
+ } | {
333
+ kind: "noul";
334
+ id: string;
335
+ question: string;
336
+ criteria?: string | undefined;
337
+ })[];
338
+ instructions?: string | undefined;
339
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
340
+ }, {
341
+ state: string;
342
+ model: string;
343
+ questions: ({
344
+ options: string[];
345
+ kind: "choice";
346
+ id: string;
347
+ question: string;
348
+ criteria?: string | undefined;
349
+ } | {
350
+ kind: "score";
351
+ id: string;
352
+ question: string;
353
+ levels: string[];
354
+ criteria?: string | undefined;
355
+ } | {
356
+ kind: "noul";
357
+ id: string;
358
+ question: string;
359
+ criteria?: string | undefined;
360
+ })[];
361
+ instructions?: string | undefined;
362
+ effort?: "low" | "medium" | "high" | "instant" | "xhigh" | undefined;
363
+ }>;
364
+ export declare const decisionAnswerSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
365
+ id: z.ZodString;
366
+ kind: z.ZodLiteral<"choice">;
367
+ /** Actual provider-selected option. Never reconstructed from probabilities. */
368
+ reply: z.ZodString;
369
+ /** Provider-returned confidence, not a correctness probability. */
370
+ confidence: z.ZodNumber;
371
+ probabilities: z.ZodArray<z.ZodNumber, "many">;
372
+ }, "strict", z.ZodTypeAny, {
373
+ kind: "choice";
374
+ id: string;
375
+ reply: string;
376
+ confidence: number;
377
+ probabilities: number[];
378
+ }, {
379
+ kind: "choice";
380
+ id: string;
381
+ reply: string;
382
+ confidence: number;
383
+ probabilities: number[];
384
+ }>, z.ZodObject<{
385
+ id: z.ZodString;
386
+ kind: z.ZodLiteral<"score">;
387
+ /** Actual provider score. Kept separate from the validated expected index. */
388
+ reply: z.ZodNumber;
389
+ confidence: z.ZodNumber;
390
+ mean: z.ZodNumber;
391
+ distribution: z.ZodArray<z.ZodNumber, "many">;
392
+ }, "strict", z.ZodTypeAny, {
393
+ kind: "score";
394
+ id: string;
395
+ reply: number;
396
+ confidence: number;
397
+ mean: number;
398
+ distribution: number[];
399
+ }, {
400
+ kind: "score";
401
+ id: string;
402
+ reply: number;
403
+ confidence: number;
404
+ mean: number;
405
+ distribution: number[];
406
+ }>, z.ZodObject<{
407
+ id: z.ZodString;
408
+ kind: z.ZodLiteral<"noul">;
409
+ probability: z.ZodNumber;
410
+ }, "strict", z.ZodTypeAny, {
411
+ kind: "noul";
412
+ id: string;
413
+ probability: number;
414
+ }, {
415
+ kind: "noul";
416
+ id: string;
417
+ probability: number;
418
+ }>]>, {
419
+ kind: "choice";
420
+ id: string;
421
+ reply: string;
422
+ confidence: number;
423
+ probabilities: number[];
424
+ } | {
425
+ kind: "score";
426
+ id: string;
427
+ reply: number;
428
+ confidence: number;
429
+ mean: number;
430
+ distribution: number[];
431
+ } | {
432
+ kind: "noul";
433
+ id: string;
434
+ probability: number;
435
+ }, {
436
+ kind: "choice";
437
+ id: string;
438
+ reply: string;
439
+ confidence: number;
440
+ probabilities: number[];
441
+ } | {
442
+ kind: "score";
443
+ id: string;
444
+ reply: number;
445
+ confidence: number;
446
+ mean: number;
447
+ distribution: number[];
448
+ } | {
449
+ kind: "noul";
450
+ id: string;
451
+ probability: number;
452
+ }>;
453
+ export declare const decisionResultSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
454
+ usage: z.ZodEffects<z.ZodObject<{
455
+ schemaVersion: z.ZodLiteral<2>;
456
+ requestId: z.ZodString;
457
+ generationId: z.ZodOptional<z.ZodString>;
458
+ attribution: z.ZodObject<{
459
+ principal: z.ZodObject<{
460
+ billing: z.ZodObject<{
461
+ accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
462
+ }, "strict", z.ZodTypeAny, {
463
+ accountId: string & z.BRAND<"OxyAccountId">;
464
+ }, {
465
+ accountId: string;
466
+ }>;
467
+ applicationId: z.ZodString;
468
+ credentialId: z.ZodString;
469
+ environment: z.ZodEnum<["development", "staging", "production"]>;
470
+ inferenceScopes: z.ZodArray<z.ZodEnum<["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"]>, "many">;
471
+ }, "strip", z.ZodTypeAny, {
472
+ environment: "development" | "staging" | "production";
473
+ applicationId: string;
474
+ credentialId: string;
475
+ billing: {
476
+ accountId: string & z.BRAND<"OxyAccountId">;
477
+ };
478
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
479
+ }, {
480
+ environment: "development" | "staging" | "production";
481
+ applicationId: string;
482
+ credentialId: string;
483
+ billing: {
484
+ accountId: string;
485
+ };
486
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
487
+ }>;
488
+ userId: z.ZodOptional<z.ZodBranded<z.ZodString, "DelegatedUserId">>;
489
+ requestId: z.ZodString;
490
+ generationId: z.ZodOptional<z.ZodString>;
491
+ }, "strip", z.ZodTypeAny, {
492
+ requestId: string;
493
+ principal: {
494
+ environment: "development" | "staging" | "production";
495
+ applicationId: string;
496
+ credentialId: string;
497
+ billing: {
498
+ accountId: string & z.BRAND<"OxyAccountId">;
499
+ };
500
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
501
+ };
502
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
503
+ generationId?: string | undefined;
504
+ }, {
505
+ requestId: string;
506
+ principal: {
507
+ environment: "development" | "staging" | "production";
508
+ applicationId: string;
509
+ credentialId: string;
510
+ billing: {
511
+ accountId: string;
512
+ };
513
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
514
+ };
515
+ userId?: string | undefined;
516
+ generationId?: string | undefined;
517
+ }>;
518
+ outcome: z.ZodEnum<["completed", "partial", "cancelled", "failed"]>;
519
+ units: z.ZodArray<z.ZodObject<{
520
+ unit: z.ZodEnum<["input_tokens", "cached_input_tokens", "output_tokens", "reasoning_tokens", "requests", "images", "audio_input_milliseconds", "audio_output_milliseconds", "video_milliseconds", "characters", "embeddings", "audio_input_tokens", "cached_audio_input_tokens", "audio_output_tokens", "session_milliseconds"]>;
521
+ quantity: z.ZodNumber;
522
+ }, "strict", z.ZodTypeAny, {
523
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
524
+ quantity: number;
525
+ }, {
526
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
527
+ quantity: number;
528
+ }>, "many">;
529
+ usageSource: z.ZodEnum<["provider_reported", "oxy_measured", "estimated"]>;
530
+ resolvedModelReference: z.ZodString;
531
+ servingProvider: z.ZodString;
532
+ deploymentId: z.ZodString;
533
+ routeSwitches: z.ZodNumber;
534
+ startedAt: z.ZodString;
535
+ completedAt: z.ZodString;
536
+ timeToFirstTokenMs: z.ZodOptional<z.ZodNumber>;
537
+ }, "strip", z.ZodTypeAny, {
538
+ schemaVersion: 2;
539
+ requestId: string;
540
+ outcome: "failed" | "completed" | "cancelled" | "partial";
541
+ resolvedModelReference: string;
542
+ servingProvider: string;
543
+ attribution: {
544
+ requestId: string;
545
+ principal: {
546
+ environment: "development" | "staging" | "production";
547
+ applicationId: string;
548
+ credentialId: string;
549
+ billing: {
550
+ accountId: string & z.BRAND<"OxyAccountId">;
551
+ };
552
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
553
+ };
554
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
555
+ generationId?: string | undefined;
556
+ };
557
+ deploymentId: string;
558
+ completedAt: string;
559
+ units: {
560
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
561
+ quantity: number;
562
+ }[];
563
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
564
+ routeSwitches: number;
565
+ startedAt: string;
566
+ generationId?: string | undefined;
567
+ timeToFirstTokenMs?: number | undefined;
568
+ }, {
569
+ schemaVersion: 2;
570
+ requestId: string;
571
+ outcome: "failed" | "completed" | "cancelled" | "partial";
572
+ resolvedModelReference: string;
573
+ servingProvider: string;
574
+ attribution: {
575
+ requestId: string;
576
+ principal: {
577
+ environment: "development" | "staging" | "production";
578
+ applicationId: string;
579
+ credentialId: string;
580
+ billing: {
581
+ accountId: string;
582
+ };
583
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
584
+ };
585
+ userId?: string | undefined;
586
+ generationId?: string | undefined;
587
+ };
588
+ deploymentId: string;
589
+ completedAt: string;
590
+ units: {
591
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
592
+ quantity: number;
593
+ }[];
594
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
595
+ routeSwitches: number;
596
+ startedAt: string;
597
+ generationId?: string | undefined;
598
+ timeToFirstTokenMs?: number | undefined;
599
+ }>, {
600
+ schemaVersion: 2;
601
+ requestId: string;
602
+ outcome: "failed" | "completed" | "cancelled" | "partial";
603
+ resolvedModelReference: string;
604
+ servingProvider: string;
605
+ attribution: {
606
+ requestId: string;
607
+ principal: {
608
+ environment: "development" | "staging" | "production";
609
+ applicationId: string;
610
+ credentialId: string;
611
+ billing: {
612
+ accountId: string & z.BRAND<"OxyAccountId">;
613
+ };
614
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
615
+ };
616
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
617
+ generationId?: string | undefined;
618
+ };
619
+ deploymentId: string;
620
+ completedAt: string;
621
+ units: {
622
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
623
+ quantity: number;
624
+ }[];
625
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
626
+ routeSwitches: number;
627
+ startedAt: string;
628
+ generationId?: string | undefined;
629
+ timeToFirstTokenMs?: number | undefined;
630
+ }, {
631
+ schemaVersion: 2;
632
+ requestId: string;
633
+ outcome: "failed" | "completed" | "cancelled" | "partial";
634
+ resolvedModelReference: string;
635
+ servingProvider: string;
636
+ attribution: {
637
+ requestId: string;
638
+ principal: {
639
+ environment: "development" | "staging" | "production";
640
+ applicationId: string;
641
+ credentialId: string;
642
+ billing: {
643
+ accountId: string;
644
+ };
645
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
646
+ };
647
+ userId?: string | undefined;
648
+ generationId?: string | undefined;
649
+ };
650
+ deploymentId: string;
651
+ completedAt: string;
652
+ units: {
653
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
654
+ quantity: number;
655
+ }[];
656
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
657
+ routeSwitches: number;
658
+ startedAt: string;
659
+ generationId?: string | undefined;
660
+ timeToFirstTokenMs?: number | undefined;
661
+ }>;
662
+ schemaVersion: z.ZodLiteral<1>;
663
+ requestId: z.ZodString;
664
+ model: z.ZodEffects<z.ZodString, string, string>;
665
+ data: z.ZodArray<z.ZodEffects<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
666
+ id: z.ZodString;
667
+ kind: z.ZodLiteral<"choice">;
668
+ /** Actual provider-selected option. Never reconstructed from probabilities. */
669
+ reply: z.ZodString;
670
+ /** Provider-returned confidence, not a correctness probability. */
671
+ confidence: z.ZodNumber;
672
+ probabilities: z.ZodArray<z.ZodNumber, "many">;
673
+ }, "strict", z.ZodTypeAny, {
674
+ kind: "choice";
675
+ id: string;
676
+ reply: string;
677
+ confidence: number;
678
+ probabilities: number[];
679
+ }, {
680
+ kind: "choice";
681
+ id: string;
682
+ reply: string;
683
+ confidence: number;
684
+ probabilities: number[];
685
+ }>, z.ZodObject<{
686
+ id: z.ZodString;
687
+ kind: z.ZodLiteral<"score">;
688
+ /** Actual provider score. Kept separate from the validated expected index. */
689
+ reply: z.ZodNumber;
690
+ confidence: z.ZodNumber;
691
+ mean: z.ZodNumber;
692
+ distribution: z.ZodArray<z.ZodNumber, "many">;
693
+ }, "strict", z.ZodTypeAny, {
694
+ kind: "score";
695
+ id: string;
696
+ reply: number;
697
+ confidence: number;
698
+ mean: number;
699
+ distribution: number[];
700
+ }, {
701
+ kind: "score";
702
+ id: string;
703
+ reply: number;
704
+ confidence: number;
705
+ mean: number;
706
+ distribution: number[];
707
+ }>, z.ZodObject<{
708
+ id: z.ZodString;
709
+ kind: z.ZodLiteral<"noul">;
710
+ probability: z.ZodNumber;
711
+ }, "strict", z.ZodTypeAny, {
712
+ kind: "noul";
713
+ id: string;
714
+ probability: number;
715
+ }, {
716
+ kind: "noul";
717
+ id: string;
718
+ probability: number;
719
+ }>]>, {
720
+ kind: "choice";
721
+ id: string;
722
+ reply: string;
723
+ confidence: number;
724
+ probabilities: number[];
725
+ } | {
726
+ kind: "score";
727
+ id: string;
728
+ reply: number;
729
+ confidence: number;
730
+ mean: number;
731
+ distribution: number[];
732
+ } | {
733
+ kind: "noul";
734
+ id: string;
735
+ probability: number;
736
+ }, {
737
+ kind: "choice";
738
+ id: string;
739
+ reply: string;
740
+ confidence: number;
741
+ probabilities: number[];
742
+ } | {
743
+ kind: "score";
744
+ id: string;
745
+ reply: number;
746
+ confidence: number;
747
+ mean: number;
748
+ distribution: number[];
749
+ } | {
750
+ kind: "noul";
751
+ id: string;
752
+ probability: number;
753
+ }>, "many">;
754
+ }, "strict", z.ZodTypeAny, {
755
+ schemaVersion: 1;
756
+ data: ({
757
+ kind: "choice";
758
+ id: string;
759
+ reply: string;
760
+ confidence: number;
761
+ probabilities: number[];
762
+ } | {
763
+ kind: "score";
764
+ id: string;
765
+ reply: number;
766
+ confidence: number;
767
+ mean: number;
768
+ distribution: number[];
769
+ } | {
770
+ kind: "noul";
771
+ id: string;
772
+ probability: number;
773
+ })[];
774
+ requestId: string;
775
+ model: string;
776
+ usage: {
777
+ schemaVersion: 2;
778
+ requestId: string;
779
+ outcome: "failed" | "completed" | "cancelled" | "partial";
780
+ resolvedModelReference: string;
781
+ servingProvider: string;
782
+ attribution: {
783
+ requestId: string;
784
+ principal: {
785
+ environment: "development" | "staging" | "production";
786
+ applicationId: string;
787
+ credentialId: string;
788
+ billing: {
789
+ accountId: string & z.BRAND<"OxyAccountId">;
790
+ };
791
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
792
+ };
793
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
794
+ generationId?: string | undefined;
795
+ };
796
+ deploymentId: string;
797
+ completedAt: string;
798
+ units: {
799
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
800
+ quantity: number;
801
+ }[];
802
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
803
+ routeSwitches: number;
804
+ startedAt: string;
805
+ generationId?: string | undefined;
806
+ timeToFirstTokenMs?: number | undefined;
807
+ };
808
+ }, {
809
+ schemaVersion: 1;
810
+ data: ({
811
+ kind: "choice";
812
+ id: string;
813
+ reply: string;
814
+ confidence: number;
815
+ probabilities: number[];
816
+ } | {
817
+ kind: "score";
818
+ id: string;
819
+ reply: number;
820
+ confidence: number;
821
+ mean: number;
822
+ distribution: number[];
823
+ } | {
824
+ kind: "noul";
825
+ id: string;
826
+ probability: number;
827
+ })[];
828
+ requestId: string;
829
+ model: string;
830
+ usage: {
831
+ schemaVersion: 2;
832
+ requestId: string;
833
+ outcome: "failed" | "completed" | "cancelled" | "partial";
834
+ resolvedModelReference: string;
835
+ servingProvider: string;
836
+ attribution: {
837
+ requestId: string;
838
+ principal: {
839
+ environment: "development" | "staging" | "production";
840
+ applicationId: string;
841
+ credentialId: string;
842
+ billing: {
843
+ accountId: string;
844
+ };
845
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
846
+ };
847
+ userId?: string | undefined;
848
+ generationId?: string | undefined;
849
+ };
850
+ deploymentId: string;
851
+ completedAt: string;
852
+ units: {
853
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
854
+ quantity: number;
855
+ }[];
856
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
857
+ routeSwitches: number;
858
+ startedAt: string;
859
+ generationId?: string | undefined;
860
+ timeToFirstTokenMs?: number | undefined;
861
+ };
862
+ }>, {
863
+ schemaVersion: 1;
864
+ data: ({
865
+ kind: "choice";
866
+ id: string;
867
+ reply: string;
868
+ confidence: number;
869
+ probabilities: number[];
870
+ } | {
871
+ kind: "score";
872
+ id: string;
873
+ reply: number;
874
+ confidence: number;
875
+ mean: number;
876
+ distribution: number[];
877
+ } | {
878
+ kind: "noul";
879
+ id: string;
880
+ probability: number;
881
+ })[];
882
+ requestId: string;
883
+ model: string;
884
+ usage: {
885
+ schemaVersion: 2;
886
+ requestId: string;
887
+ outcome: "failed" | "completed" | "cancelled" | "partial";
888
+ resolvedModelReference: string;
889
+ servingProvider: string;
890
+ attribution: {
891
+ requestId: string;
892
+ principal: {
893
+ environment: "development" | "staging" | "production";
894
+ applicationId: string;
895
+ credentialId: string;
896
+ billing: {
897
+ accountId: string & z.BRAND<"OxyAccountId">;
898
+ };
899
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
900
+ };
901
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
902
+ generationId?: string | undefined;
903
+ };
904
+ deploymentId: string;
905
+ completedAt: string;
906
+ units: {
907
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
908
+ quantity: number;
909
+ }[];
910
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
911
+ routeSwitches: number;
912
+ startedAt: string;
913
+ generationId?: string | undefined;
914
+ timeToFirstTokenMs?: number | undefined;
915
+ };
916
+ }, {
917
+ schemaVersion: 1;
918
+ data: ({
919
+ kind: "choice";
920
+ id: string;
921
+ reply: string;
922
+ confidence: number;
923
+ probabilities: number[];
924
+ } | {
925
+ kind: "score";
926
+ id: string;
927
+ reply: number;
928
+ confidence: number;
929
+ mean: number;
930
+ distribution: number[];
931
+ } | {
932
+ kind: "noul";
933
+ id: string;
934
+ probability: number;
935
+ })[];
936
+ requestId: string;
937
+ model: string;
938
+ usage: {
939
+ schemaVersion: 2;
940
+ requestId: string;
941
+ outcome: "failed" | "completed" | "cancelled" | "partial";
942
+ resolvedModelReference: string;
943
+ servingProvider: string;
944
+ attribution: {
945
+ requestId: string;
946
+ principal: {
947
+ environment: "development" | "staging" | "production";
948
+ applicationId: string;
949
+ credentialId: string;
950
+ billing: {
951
+ accountId: string;
952
+ };
953
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
954
+ };
955
+ userId?: string | undefined;
956
+ generationId?: string | undefined;
957
+ };
958
+ deploymentId: string;
959
+ completedAt: string;
960
+ units: {
961
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
962
+ quantity: number;
963
+ }[];
964
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
965
+ routeSwitches: number;
966
+ startedAt: string;
967
+ generationId?: string | undefined;
968
+ timeToFirstTokenMs?: number | undefined;
969
+ };
970
+ }>, {
971
+ schemaVersion: 1;
972
+ data: ({
973
+ kind: "choice";
974
+ id: string;
975
+ reply: string;
976
+ confidence: number;
977
+ probabilities: number[];
978
+ } | {
979
+ kind: "score";
980
+ id: string;
981
+ reply: number;
982
+ confidence: number;
983
+ mean: number;
984
+ distribution: number[];
985
+ } | {
986
+ kind: "noul";
987
+ id: string;
988
+ probability: number;
989
+ })[];
990
+ requestId: string;
991
+ model: string;
992
+ usage: {
993
+ schemaVersion: 2;
994
+ requestId: string;
995
+ outcome: "failed" | "completed" | "cancelled" | "partial";
996
+ resolvedModelReference: string;
997
+ servingProvider: string;
998
+ attribution: {
999
+ requestId: string;
1000
+ principal: {
1001
+ environment: "development" | "staging" | "production";
1002
+ applicationId: string;
1003
+ credentialId: string;
1004
+ billing: {
1005
+ accountId: string & z.BRAND<"OxyAccountId">;
1006
+ };
1007
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1008
+ };
1009
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
1010
+ generationId?: string | undefined;
1011
+ };
1012
+ deploymentId: string;
1013
+ completedAt: string;
1014
+ units: {
1015
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1016
+ quantity: number;
1017
+ }[];
1018
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1019
+ routeSwitches: number;
1020
+ startedAt: string;
1021
+ generationId?: string | undefined;
1022
+ timeToFirstTokenMs?: number | undefined;
1023
+ };
1024
+ }, {
1025
+ schemaVersion: 1;
1026
+ data: ({
1027
+ kind: "choice";
1028
+ id: string;
1029
+ reply: string;
1030
+ confidence: number;
1031
+ probabilities: number[];
1032
+ } | {
1033
+ kind: "score";
1034
+ id: string;
1035
+ reply: number;
1036
+ confidence: number;
1037
+ mean: number;
1038
+ distribution: number[];
1039
+ } | {
1040
+ kind: "noul";
1041
+ id: string;
1042
+ probability: number;
1043
+ })[];
1044
+ requestId: string;
1045
+ model: string;
1046
+ usage: {
1047
+ schemaVersion: 2;
1048
+ requestId: string;
1049
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1050
+ resolvedModelReference: string;
1051
+ servingProvider: string;
1052
+ attribution: {
1053
+ requestId: string;
1054
+ principal: {
1055
+ environment: "development" | "staging" | "production";
1056
+ applicationId: string;
1057
+ credentialId: string;
1058
+ billing: {
1059
+ accountId: string;
1060
+ };
1061
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1062
+ };
1063
+ userId?: string | undefined;
1064
+ generationId?: string | undefined;
1065
+ };
1066
+ deploymentId: string;
1067
+ completedAt: string;
1068
+ units: {
1069
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1070
+ quantity: number;
1071
+ }[];
1072
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1073
+ routeSwitches: number;
1074
+ startedAt: string;
1075
+ generationId?: string | undefined;
1076
+ timeToFirstTokenMs?: number | undefined;
1077
+ };
1078
+ }>;
1079
+ /**
1080
+ * Kaana's typed decisions failure. `usage` is present only when the provider
1081
+ * measured something before failing; its absence means nothing was measured,
1082
+ * never that the cost was zero. A failure carrying usage did execute.
1083
+ */
1084
+ export declare const decisionFailureSchema: z.ZodEffects<z.ZodObject<{
1085
+ schemaVersion: z.ZodLiteral<1>;
1086
+ requestId: z.ZodString;
1087
+ error: z.ZodEffects<z.ZodObject<{
1088
+ schemaVersion: z.ZodLiteral<1>;
1089
+ code: z.ZodEnum<["invalid_request", "authentication_failed", "permission_denied", "insufficient_scope", "model_not_found", "unsupported_modality", "context_length_exceeded", "request_too_large", "output_limit_exceeded", "idempotency_conflict", "insufficient_balance", "spending_limit_exceeded", "quota_exceeded", "byok_credential_invalid", "policy_violation", "commercial_permission_denied", "no_route_available", "upstream_content_filtered", "cancelled", "rate_limited", "deployment_unavailable", "provider_error", "provider_timeout", "provider_overloaded", "provider_credential_invalid", "provider_billing_refused", "service_unavailable", "internal_error"]>;
1090
+ message: z.ZodEffects<z.ZodString, string, string>;
1091
+ retryable: z.ZodBoolean;
1092
+ requestId: z.ZodString;
1093
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
1094
+ param: z.ZodOptional<z.ZodString>;
1095
+ upstreamCategory: z.ZodOptional<z.ZodEnum<["rate_limit", "quota", "timeout", "overloaded", "server_error", "content_filter", "invalid_request", "authentication", "unknown"]>>;
1096
+ providerError: z.ZodOptional<z.ZodObject<{
1097
+ provider: z.ZodString;
1098
+ status: z.ZodOptional<z.ZodNumber>;
1099
+ code: z.ZodOptional<z.ZodString>;
1100
+ message: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1101
+ }, "strict", z.ZodTypeAny, {
1102
+ provider: string;
1103
+ status?: number | undefined;
1104
+ code?: string | undefined;
1105
+ message?: string | undefined;
1106
+ }, {
1107
+ provider: string;
1108
+ status?: number | undefined;
1109
+ code?: string | undefined;
1110
+ message?: string | undefined;
1111
+ }>>;
1112
+ }, "strip", z.ZodTypeAny, {
1113
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1114
+ message: string;
1115
+ schemaVersion: 1;
1116
+ requestId: string;
1117
+ retryable: boolean;
1118
+ retryAfterMs?: number | undefined;
1119
+ param?: string | undefined;
1120
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1121
+ providerError?: {
1122
+ provider: string;
1123
+ status?: number | undefined;
1124
+ code?: string | undefined;
1125
+ message?: string | undefined;
1126
+ } | undefined;
1127
+ }, {
1128
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1129
+ message: string;
1130
+ schemaVersion: 1;
1131
+ requestId: string;
1132
+ retryable: boolean;
1133
+ retryAfterMs?: number | undefined;
1134
+ param?: string | undefined;
1135
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1136
+ providerError?: {
1137
+ provider: string;
1138
+ status?: number | undefined;
1139
+ code?: string | undefined;
1140
+ message?: string | undefined;
1141
+ } | undefined;
1142
+ }>, {
1143
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1144
+ message: string;
1145
+ schemaVersion: 1;
1146
+ requestId: string;
1147
+ retryable: boolean;
1148
+ retryAfterMs?: number | undefined;
1149
+ param?: string | undefined;
1150
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1151
+ providerError?: {
1152
+ provider: string;
1153
+ status?: number | undefined;
1154
+ code?: string | undefined;
1155
+ message?: string | undefined;
1156
+ } | undefined;
1157
+ }, {
1158
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1159
+ message: string;
1160
+ schemaVersion: 1;
1161
+ requestId: string;
1162
+ retryable: boolean;
1163
+ retryAfterMs?: number | undefined;
1164
+ param?: string | undefined;
1165
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1166
+ providerError?: {
1167
+ provider: string;
1168
+ status?: number | undefined;
1169
+ code?: string | undefined;
1170
+ message?: string | undefined;
1171
+ } | undefined;
1172
+ }>;
1173
+ usage: z.ZodOptional<z.ZodEffects<z.ZodObject<{
1174
+ schemaVersion: z.ZodLiteral<2>;
1175
+ requestId: z.ZodString;
1176
+ generationId: z.ZodOptional<z.ZodString>;
1177
+ attribution: z.ZodObject<{
1178
+ principal: z.ZodObject<{
1179
+ billing: z.ZodObject<{
1180
+ accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
1181
+ }, "strict", z.ZodTypeAny, {
1182
+ accountId: string & z.BRAND<"OxyAccountId">;
1183
+ }, {
1184
+ accountId: string;
1185
+ }>;
1186
+ applicationId: z.ZodString;
1187
+ credentialId: z.ZodString;
1188
+ environment: z.ZodEnum<["development", "staging", "production"]>;
1189
+ inferenceScopes: z.ZodArray<z.ZodEnum<["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"]>, "many">;
1190
+ }, "strip", z.ZodTypeAny, {
1191
+ environment: "development" | "staging" | "production";
1192
+ applicationId: string;
1193
+ credentialId: string;
1194
+ billing: {
1195
+ accountId: string & z.BRAND<"OxyAccountId">;
1196
+ };
1197
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1198
+ }, {
1199
+ environment: "development" | "staging" | "production";
1200
+ applicationId: string;
1201
+ credentialId: string;
1202
+ billing: {
1203
+ accountId: string;
1204
+ };
1205
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1206
+ }>;
1207
+ userId: z.ZodOptional<z.ZodBranded<z.ZodString, "DelegatedUserId">>;
1208
+ requestId: z.ZodString;
1209
+ generationId: z.ZodOptional<z.ZodString>;
1210
+ }, "strip", z.ZodTypeAny, {
1211
+ requestId: string;
1212
+ principal: {
1213
+ environment: "development" | "staging" | "production";
1214
+ applicationId: string;
1215
+ credentialId: string;
1216
+ billing: {
1217
+ accountId: string & z.BRAND<"OxyAccountId">;
1218
+ };
1219
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1220
+ };
1221
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
1222
+ generationId?: string | undefined;
1223
+ }, {
1224
+ requestId: string;
1225
+ principal: {
1226
+ environment: "development" | "staging" | "production";
1227
+ applicationId: string;
1228
+ credentialId: string;
1229
+ billing: {
1230
+ accountId: string;
1231
+ };
1232
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1233
+ };
1234
+ userId?: string | undefined;
1235
+ generationId?: string | undefined;
1236
+ }>;
1237
+ outcome: z.ZodEnum<["completed", "partial", "cancelled", "failed"]>;
1238
+ units: z.ZodArray<z.ZodObject<{
1239
+ unit: z.ZodEnum<["input_tokens", "cached_input_tokens", "output_tokens", "reasoning_tokens", "requests", "images", "audio_input_milliseconds", "audio_output_milliseconds", "video_milliseconds", "characters", "embeddings", "audio_input_tokens", "cached_audio_input_tokens", "audio_output_tokens", "session_milliseconds"]>;
1240
+ quantity: z.ZodNumber;
1241
+ }, "strict", z.ZodTypeAny, {
1242
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1243
+ quantity: number;
1244
+ }, {
1245
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1246
+ quantity: number;
1247
+ }>, "many">;
1248
+ usageSource: z.ZodEnum<["provider_reported", "oxy_measured", "estimated"]>;
1249
+ resolvedModelReference: z.ZodString;
1250
+ servingProvider: z.ZodString;
1251
+ deploymentId: z.ZodString;
1252
+ routeSwitches: z.ZodNumber;
1253
+ startedAt: z.ZodString;
1254
+ completedAt: z.ZodString;
1255
+ timeToFirstTokenMs: z.ZodOptional<z.ZodNumber>;
1256
+ }, "strip", z.ZodTypeAny, {
1257
+ schemaVersion: 2;
1258
+ requestId: string;
1259
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1260
+ resolvedModelReference: string;
1261
+ servingProvider: string;
1262
+ attribution: {
1263
+ requestId: string;
1264
+ principal: {
1265
+ environment: "development" | "staging" | "production";
1266
+ applicationId: string;
1267
+ credentialId: string;
1268
+ billing: {
1269
+ accountId: string & z.BRAND<"OxyAccountId">;
1270
+ };
1271
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1272
+ };
1273
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
1274
+ generationId?: string | undefined;
1275
+ };
1276
+ deploymentId: string;
1277
+ completedAt: string;
1278
+ units: {
1279
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1280
+ quantity: number;
1281
+ }[];
1282
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1283
+ routeSwitches: number;
1284
+ startedAt: string;
1285
+ generationId?: string | undefined;
1286
+ timeToFirstTokenMs?: number | undefined;
1287
+ }, {
1288
+ schemaVersion: 2;
1289
+ requestId: string;
1290
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1291
+ resolvedModelReference: string;
1292
+ servingProvider: string;
1293
+ attribution: {
1294
+ requestId: string;
1295
+ principal: {
1296
+ environment: "development" | "staging" | "production";
1297
+ applicationId: string;
1298
+ credentialId: string;
1299
+ billing: {
1300
+ accountId: string;
1301
+ };
1302
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1303
+ };
1304
+ userId?: string | undefined;
1305
+ generationId?: string | undefined;
1306
+ };
1307
+ deploymentId: string;
1308
+ completedAt: string;
1309
+ units: {
1310
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1311
+ quantity: number;
1312
+ }[];
1313
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1314
+ routeSwitches: number;
1315
+ startedAt: string;
1316
+ generationId?: string | undefined;
1317
+ timeToFirstTokenMs?: number | undefined;
1318
+ }>, {
1319
+ schemaVersion: 2;
1320
+ requestId: string;
1321
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1322
+ resolvedModelReference: string;
1323
+ servingProvider: string;
1324
+ attribution: {
1325
+ requestId: string;
1326
+ principal: {
1327
+ environment: "development" | "staging" | "production";
1328
+ applicationId: string;
1329
+ credentialId: string;
1330
+ billing: {
1331
+ accountId: string & z.BRAND<"OxyAccountId">;
1332
+ };
1333
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1334
+ };
1335
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
1336
+ generationId?: string | undefined;
1337
+ };
1338
+ deploymentId: string;
1339
+ completedAt: string;
1340
+ units: {
1341
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1342
+ quantity: number;
1343
+ }[];
1344
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1345
+ routeSwitches: number;
1346
+ startedAt: string;
1347
+ generationId?: string | undefined;
1348
+ timeToFirstTokenMs?: number | undefined;
1349
+ }, {
1350
+ schemaVersion: 2;
1351
+ requestId: string;
1352
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1353
+ resolvedModelReference: string;
1354
+ servingProvider: string;
1355
+ attribution: {
1356
+ requestId: string;
1357
+ principal: {
1358
+ environment: "development" | "staging" | "production";
1359
+ applicationId: string;
1360
+ credentialId: string;
1361
+ billing: {
1362
+ accountId: string;
1363
+ };
1364
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1365
+ };
1366
+ userId?: string | undefined;
1367
+ generationId?: string | undefined;
1368
+ };
1369
+ deploymentId: string;
1370
+ completedAt: string;
1371
+ units: {
1372
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1373
+ quantity: number;
1374
+ }[];
1375
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1376
+ routeSwitches: number;
1377
+ startedAt: string;
1378
+ generationId?: string | undefined;
1379
+ timeToFirstTokenMs?: number | undefined;
1380
+ }>>;
1381
+ }, "strict", z.ZodTypeAny, {
1382
+ schemaVersion: 1;
1383
+ requestId: string;
1384
+ error: {
1385
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1386
+ message: string;
1387
+ schemaVersion: 1;
1388
+ requestId: string;
1389
+ retryable: boolean;
1390
+ retryAfterMs?: number | undefined;
1391
+ param?: string | undefined;
1392
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1393
+ providerError?: {
1394
+ provider: string;
1395
+ status?: number | undefined;
1396
+ code?: string | undefined;
1397
+ message?: string | undefined;
1398
+ } | undefined;
1399
+ };
1400
+ usage?: {
1401
+ schemaVersion: 2;
1402
+ requestId: string;
1403
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1404
+ resolvedModelReference: string;
1405
+ servingProvider: string;
1406
+ attribution: {
1407
+ requestId: string;
1408
+ principal: {
1409
+ environment: "development" | "staging" | "production";
1410
+ applicationId: string;
1411
+ credentialId: string;
1412
+ billing: {
1413
+ accountId: string & z.BRAND<"OxyAccountId">;
1414
+ };
1415
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1416
+ };
1417
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
1418
+ generationId?: string | undefined;
1419
+ };
1420
+ deploymentId: string;
1421
+ completedAt: string;
1422
+ units: {
1423
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1424
+ quantity: number;
1425
+ }[];
1426
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1427
+ routeSwitches: number;
1428
+ startedAt: string;
1429
+ generationId?: string | undefined;
1430
+ timeToFirstTokenMs?: number | undefined;
1431
+ } | undefined;
1432
+ }, {
1433
+ schemaVersion: 1;
1434
+ requestId: string;
1435
+ error: {
1436
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1437
+ message: string;
1438
+ schemaVersion: 1;
1439
+ requestId: string;
1440
+ retryable: boolean;
1441
+ retryAfterMs?: number | undefined;
1442
+ param?: string | undefined;
1443
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1444
+ providerError?: {
1445
+ provider: string;
1446
+ status?: number | undefined;
1447
+ code?: string | undefined;
1448
+ message?: string | undefined;
1449
+ } | undefined;
1450
+ };
1451
+ usage?: {
1452
+ schemaVersion: 2;
1453
+ requestId: string;
1454
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1455
+ resolvedModelReference: string;
1456
+ servingProvider: string;
1457
+ attribution: {
1458
+ requestId: string;
1459
+ principal: {
1460
+ environment: "development" | "staging" | "production";
1461
+ applicationId: string;
1462
+ credentialId: string;
1463
+ billing: {
1464
+ accountId: string;
1465
+ };
1466
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1467
+ };
1468
+ userId?: string | undefined;
1469
+ generationId?: string | undefined;
1470
+ };
1471
+ deploymentId: string;
1472
+ completedAt: string;
1473
+ units: {
1474
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1475
+ quantity: number;
1476
+ }[];
1477
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1478
+ routeSwitches: number;
1479
+ startedAt: string;
1480
+ generationId?: string | undefined;
1481
+ timeToFirstTokenMs?: number | undefined;
1482
+ } | undefined;
1483
+ }>, {
1484
+ schemaVersion: 1;
1485
+ requestId: string;
1486
+ error: {
1487
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1488
+ message: string;
1489
+ schemaVersion: 1;
1490
+ requestId: string;
1491
+ retryable: boolean;
1492
+ retryAfterMs?: number | undefined;
1493
+ param?: string | undefined;
1494
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1495
+ providerError?: {
1496
+ provider: string;
1497
+ status?: number | undefined;
1498
+ code?: string | undefined;
1499
+ message?: string | undefined;
1500
+ } | undefined;
1501
+ };
1502
+ usage?: {
1503
+ schemaVersion: 2;
1504
+ requestId: string;
1505
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1506
+ resolvedModelReference: string;
1507
+ servingProvider: string;
1508
+ attribution: {
1509
+ requestId: string;
1510
+ principal: {
1511
+ environment: "development" | "staging" | "production";
1512
+ applicationId: string;
1513
+ credentialId: string;
1514
+ billing: {
1515
+ accountId: string & z.BRAND<"OxyAccountId">;
1516
+ };
1517
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1518
+ };
1519
+ userId?: (string & z.BRAND<"DelegatedUserId">) | undefined;
1520
+ generationId?: string | undefined;
1521
+ };
1522
+ deploymentId: string;
1523
+ completedAt: string;
1524
+ units: {
1525
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1526
+ quantity: number;
1527
+ }[];
1528
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1529
+ routeSwitches: number;
1530
+ startedAt: string;
1531
+ generationId?: string | undefined;
1532
+ timeToFirstTokenMs?: number | undefined;
1533
+ } | undefined;
1534
+ }, {
1535
+ schemaVersion: 1;
1536
+ requestId: string;
1537
+ error: {
1538
+ code: "cancelled" | "invalid_request" | "authentication_failed" | "permission_denied" | "insufficient_scope" | "model_not_found" | "unsupported_modality" | "context_length_exceeded" | "request_too_large" | "output_limit_exceeded" | "idempotency_conflict" | "insufficient_balance" | "spending_limit_exceeded" | "quota_exceeded" | "byok_credential_invalid" | "policy_violation" | "commercial_permission_denied" | "no_route_available" | "upstream_content_filtered" | "rate_limited" | "deployment_unavailable" | "provider_error" | "provider_timeout" | "provider_overloaded" | "provider_credential_invalid" | "provider_billing_refused" | "service_unavailable" | "internal_error";
1539
+ message: string;
1540
+ schemaVersion: 1;
1541
+ requestId: string;
1542
+ retryable: boolean;
1543
+ retryAfterMs?: number | undefined;
1544
+ param?: string | undefined;
1545
+ upstreamCategory?: "unknown" | "authentication" | "invalid_request" | "rate_limit" | "quota" | "timeout" | "overloaded" | "server_error" | "content_filter" | undefined;
1546
+ providerError?: {
1547
+ provider: string;
1548
+ status?: number | undefined;
1549
+ code?: string | undefined;
1550
+ message?: string | undefined;
1551
+ } | undefined;
1552
+ };
1553
+ usage?: {
1554
+ schemaVersion: 2;
1555
+ requestId: string;
1556
+ outcome: "failed" | "completed" | "cancelled" | "partial";
1557
+ resolvedModelReference: string;
1558
+ servingProvider: string;
1559
+ attribution: {
1560
+ requestId: string;
1561
+ principal: {
1562
+ environment: "development" | "staging" | "production";
1563
+ applicationId: string;
1564
+ credentialId: string;
1565
+ billing: {
1566
+ accountId: string;
1567
+ };
1568
+ inferenceScopes: ("inference:invoke" | "inference:models:read" | "inference:usage:read" | "inference:routing:read" | "inference:routing:write" | "inference:providers:read" | "inference:providers:write")[];
1569
+ };
1570
+ userId?: string | undefined;
1571
+ generationId?: string | undefined;
1572
+ };
1573
+ deploymentId: string;
1574
+ completedAt: string;
1575
+ units: {
1576
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1577
+ quantity: number;
1578
+ }[];
1579
+ usageSource: "provider_reported" | "oxy_measured" | "estimated";
1580
+ routeSwitches: number;
1581
+ startedAt: string;
1582
+ generationId?: string | undefined;
1583
+ timeToFirstTokenMs?: number | undefined;
1584
+ } | undefined;
1585
+ }>;
1586
+ export declare const decisionSuccessSchema: z.ZodEffects<z.ZodObject<{
1587
+ usage: z.ZodArray<z.ZodObject<{
1588
+ unit: z.ZodEnum<["input_tokens", "cached_input_tokens", "output_tokens", "reasoning_tokens", "requests", "images", "audio_input_milliseconds", "audio_output_milliseconds", "video_milliseconds", "characters", "embeddings", "audio_input_tokens", "cached_audio_input_tokens", "audio_output_tokens", "session_milliseconds"]>;
1589
+ quantity: z.ZodNumber;
1590
+ }, "strict", z.ZodTypeAny, {
1591
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1592
+ quantity: number;
1593
+ }, {
1594
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1595
+ quantity: number;
1596
+ }>, "many">;
1597
+ routingPolicy: z.ZodObject<{
1598
+ routingPolicyId: z.ZodString;
1599
+ policyVersion: z.ZodNumber;
1600
+ }, "strict", z.ZodTypeAny, {
1601
+ routingPolicyId: string;
1602
+ policyVersion: number;
1603
+ }, {
1604
+ routingPolicyId: string;
1605
+ policyVersion: number;
1606
+ }>;
1607
+ schemaVersion: z.ZodLiteral<1>;
1608
+ requestId: z.ZodString;
1609
+ model: z.ZodEffects<z.ZodString, string, string>;
1610
+ data: z.ZodArray<z.ZodEffects<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1611
+ id: z.ZodString;
1612
+ kind: z.ZodLiteral<"choice">;
1613
+ /** Actual provider-selected option. Never reconstructed from probabilities. */
1614
+ reply: z.ZodString;
1615
+ /** Provider-returned confidence, not a correctness probability. */
1616
+ confidence: z.ZodNumber;
1617
+ probabilities: z.ZodArray<z.ZodNumber, "many">;
1618
+ }, "strict", z.ZodTypeAny, {
1619
+ kind: "choice";
1620
+ id: string;
1621
+ reply: string;
1622
+ confidence: number;
1623
+ probabilities: number[];
1624
+ }, {
1625
+ kind: "choice";
1626
+ id: string;
1627
+ reply: string;
1628
+ confidence: number;
1629
+ probabilities: number[];
1630
+ }>, z.ZodObject<{
1631
+ id: z.ZodString;
1632
+ kind: z.ZodLiteral<"score">;
1633
+ /** Actual provider score. Kept separate from the validated expected index. */
1634
+ reply: z.ZodNumber;
1635
+ confidence: z.ZodNumber;
1636
+ mean: z.ZodNumber;
1637
+ distribution: z.ZodArray<z.ZodNumber, "many">;
1638
+ }, "strict", z.ZodTypeAny, {
1639
+ kind: "score";
1640
+ id: string;
1641
+ reply: number;
1642
+ confidence: number;
1643
+ mean: number;
1644
+ distribution: number[];
1645
+ }, {
1646
+ kind: "score";
1647
+ id: string;
1648
+ reply: number;
1649
+ confidence: number;
1650
+ mean: number;
1651
+ distribution: number[];
1652
+ }>, z.ZodObject<{
1653
+ id: z.ZodString;
1654
+ kind: z.ZodLiteral<"noul">;
1655
+ probability: z.ZodNumber;
1656
+ }, "strict", z.ZodTypeAny, {
1657
+ kind: "noul";
1658
+ id: string;
1659
+ probability: number;
1660
+ }, {
1661
+ kind: "noul";
1662
+ id: string;
1663
+ probability: number;
1664
+ }>]>, {
1665
+ kind: "choice";
1666
+ id: string;
1667
+ reply: string;
1668
+ confidence: number;
1669
+ probabilities: number[];
1670
+ } | {
1671
+ kind: "score";
1672
+ id: string;
1673
+ reply: number;
1674
+ confidence: number;
1675
+ mean: number;
1676
+ distribution: number[];
1677
+ } | {
1678
+ kind: "noul";
1679
+ id: string;
1680
+ probability: number;
1681
+ }, {
1682
+ kind: "choice";
1683
+ id: string;
1684
+ reply: string;
1685
+ confidence: number;
1686
+ probabilities: number[];
1687
+ } | {
1688
+ kind: "score";
1689
+ id: string;
1690
+ reply: number;
1691
+ confidence: number;
1692
+ mean: number;
1693
+ distribution: number[];
1694
+ } | {
1695
+ kind: "noul";
1696
+ id: string;
1697
+ probability: number;
1698
+ }>, "many">;
1699
+ }, "strict", z.ZodTypeAny, {
1700
+ schemaVersion: 1;
1701
+ data: ({
1702
+ kind: "choice";
1703
+ id: string;
1704
+ reply: string;
1705
+ confidence: number;
1706
+ probabilities: number[];
1707
+ } | {
1708
+ kind: "score";
1709
+ id: string;
1710
+ reply: number;
1711
+ confidence: number;
1712
+ mean: number;
1713
+ distribution: number[];
1714
+ } | {
1715
+ kind: "noul";
1716
+ id: string;
1717
+ probability: number;
1718
+ })[];
1719
+ requestId: string;
1720
+ model: string;
1721
+ usage: {
1722
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1723
+ quantity: number;
1724
+ }[];
1725
+ routingPolicy: {
1726
+ routingPolicyId: string;
1727
+ policyVersion: number;
1728
+ };
1729
+ }, {
1730
+ schemaVersion: 1;
1731
+ data: ({
1732
+ kind: "choice";
1733
+ id: string;
1734
+ reply: string;
1735
+ confidence: number;
1736
+ probabilities: number[];
1737
+ } | {
1738
+ kind: "score";
1739
+ id: string;
1740
+ reply: number;
1741
+ confidence: number;
1742
+ mean: number;
1743
+ distribution: number[];
1744
+ } | {
1745
+ kind: "noul";
1746
+ id: string;
1747
+ probability: number;
1748
+ })[];
1749
+ requestId: string;
1750
+ model: string;
1751
+ usage: {
1752
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1753
+ quantity: number;
1754
+ }[];
1755
+ routingPolicy: {
1756
+ routingPolicyId: string;
1757
+ policyVersion: number;
1758
+ };
1759
+ }>, {
1760
+ schemaVersion: 1;
1761
+ data: ({
1762
+ kind: "choice";
1763
+ id: string;
1764
+ reply: string;
1765
+ confidence: number;
1766
+ probabilities: number[];
1767
+ } | {
1768
+ kind: "score";
1769
+ id: string;
1770
+ reply: number;
1771
+ confidence: number;
1772
+ mean: number;
1773
+ distribution: number[];
1774
+ } | {
1775
+ kind: "noul";
1776
+ id: string;
1777
+ probability: number;
1778
+ })[];
1779
+ requestId: string;
1780
+ model: string;
1781
+ usage: {
1782
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1783
+ quantity: number;
1784
+ }[];
1785
+ routingPolicy: {
1786
+ routingPolicyId: string;
1787
+ policyVersion: number;
1788
+ };
1789
+ }, {
1790
+ schemaVersion: 1;
1791
+ data: ({
1792
+ kind: "choice";
1793
+ id: string;
1794
+ reply: string;
1795
+ confidence: number;
1796
+ probabilities: number[];
1797
+ } | {
1798
+ kind: "score";
1799
+ id: string;
1800
+ reply: number;
1801
+ confidence: number;
1802
+ mean: number;
1803
+ distribution: number[];
1804
+ } | {
1805
+ kind: "noul";
1806
+ id: string;
1807
+ probability: number;
1808
+ })[];
1809
+ requestId: string;
1810
+ model: string;
1811
+ usage: {
1812
+ unit: "input_tokens" | "cached_input_tokens" | "output_tokens" | "reasoning_tokens" | "requests" | "images" | "audio_input_milliseconds" | "audio_output_milliseconds" | "video_milliseconds" | "characters" | "embeddings" | "audio_input_tokens" | "cached_audio_input_tokens" | "audio_output_tokens" | "session_milliseconds";
1813
+ quantity: number;
1814
+ }[];
1815
+ routingPolicy: {
1816
+ routingPolicyId: string;
1817
+ policyVersion: number;
1818
+ };
1819
+ }>;
1820
+ /** Bind output to the exact request. Provider order is not semantic. */
1821
+ export declare function decisionAnswersMatch(input: DecisionInput, answers: readonly DecisionAnswer[]): boolean;
1822
+ export type DecisionQuestion = z.infer<typeof decisionQuestionSchema>;
1823
+ export type DecisionInput = {
1824
+ state: string;
1825
+ instructions?: string;
1826
+ questions: DecisionQuestion[];
1827
+ effort?: z.infer<typeof decisionEffortSchema>;
1828
+ };
1829
+ export type DecisionRequest = z.infer<typeof decisionRequestSchema>;
1830
+ export type DecisionAnswer = z.infer<typeof decisionAnswerSchema>;
1831
+ export type DecisionResult = z.infer<typeof decisionResultSchema>;
1832
+ export type DecisionSuccess = z.infer<typeof decisionSuccessSchema>;
1833
+ export type DecisionFailure = z.infer<typeof decisionFailureSchema>;