@oxyhq/contracts 0.28.0 → 0.30.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 (43) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/identity.js +33 -1
  3. package/dist/cjs/index.js +20 -7
  4. package/dist/cjs/inference/aliaModelRelease.js +250 -0
  5. package/dist/cjs/inference/catalogue.js +1 -4
  6. package/dist/cjs/inference/errors.js +108 -9
  7. package/dist/cjs/inference/identifiers.js +23 -3
  8. package/dist/cjs/inference/request.js +188 -5
  9. package/dist/cjs/inference/routingPolicy.js +81 -2
  10. package/dist/cjs/inference/streamEvents.js +38 -1
  11. package/dist/cjs/inference/usage.js +32 -1
  12. package/dist/cjs/inference/version.js +24 -4
  13. package/dist/esm/.tsbuildinfo +1 -1
  14. package/dist/esm/identity.js +32 -0
  15. package/dist/esm/index.js +8 -3
  16. package/dist/esm/inference/aliaModelRelease.js +247 -0
  17. package/dist/esm/inference/catalogue.js +2 -5
  18. package/dist/esm/inference/errors.js +108 -9
  19. package/dist/esm/inference/identifiers.js +22 -2
  20. package/dist/esm/inference/request.js +189 -6
  21. package/dist/esm/inference/routingPolicy.js +81 -2
  22. package/dist/esm/inference/streamEvents.js +38 -1
  23. package/dist/esm/inference/usage.js +32 -1
  24. package/dist/esm/inference/version.js +24 -4
  25. package/dist/types/.tsbuildinfo +1 -1
  26. package/dist/types/identity.d.ts +59 -1
  27. package/dist/types/index.d.ts +7 -5
  28. package/dist/types/inference/accountBilling.d.ts +26 -26
  29. package/dist/types/inference/aliaModelRelease.d.ts +597 -0
  30. package/dist/types/inference/catalogue.d.ts +6 -6
  31. package/dist/types/inference/entitlement.d.ts +4 -4
  32. package/dist/types/inference/errors.d.ts +46 -10
  33. package/dist/types/inference/identifiers.d.ts +20 -2
  34. package/dist/types/inference/money.d.ts +4 -4
  35. package/dist/types/inference/priceVersion.d.ts +14 -14
  36. package/dist/types/inference/providerConnection.d.ts +4 -4
  37. package/dist/types/inference/request.d.ts +291 -5
  38. package/dist/types/inference/routingPolicy.d.ts +109 -13
  39. package/dist/types/inference/streamEvents.d.ts +84 -48
  40. package/dist/types/inference/usage.d.ts +103 -79
  41. package/dist/types/inference/version.d.ts +24 -4
  42. package/dist/types/keyRecovery.d.ts +4 -4
  43. package/package.json +1 -1
@@ -43,19 +43,19 @@ export declare const inferenceStreamStartEventSchema: z.ZodObject<{
43
43
  }, "strip", z.ZodTypeAny, {
44
44
  type: "start";
45
45
  requestId: string;
46
- schemaVersion: 1;
47
- sequence: number;
48
46
  resolvedModelReference: string;
49
47
  servingProvider: string;
48
+ schemaVersion: 1;
49
+ sequence: number;
50
50
  startedAt: string;
51
51
  generationId?: string | undefined;
52
52
  }, {
53
53
  type: "start";
54
54
  requestId: string;
55
- schemaVersion: 1;
56
- sequence: number;
57
55
  resolvedModelReference: string;
58
56
  servingProvider: string;
57
+ schemaVersion: 1;
58
+ sequence: number;
59
59
  startedAt: string;
60
60
  generationId?: string | undefined;
61
61
  }>;
@@ -77,7 +77,7 @@ export declare const inferenceStreamDeltaEventSchema: z.ZodObject<{
77
77
  channel: z.ZodEnum<["output_text", "reasoning", "refusal"]>;
78
78
  text: z.ZodString;
79
79
  }, "strip", z.ZodTypeAny, {
80
- channel: "reasoning" | "output_text" | "refusal";
80
+ channel: "reasoning" | "refusal" | "output_text";
81
81
  type: "delta";
82
82
  requestId: string;
83
83
  schemaVersion: 1;
@@ -85,7 +85,7 @@ export declare const inferenceStreamDeltaEventSchema: z.ZodObject<{
85
85
  sequence: number;
86
86
  outputIndex: number;
87
87
  }, {
88
- channel: "reasoning" | "output_text" | "refusal";
88
+ channel: "reasoning" | "refusal" | "output_text";
89
89
  type: "delta";
90
90
  requestId: string;
91
91
  schemaVersion: 1;
@@ -136,6 +136,33 @@ export declare const inferenceStreamToolCallEventSchema: z.ZodObject<{
136
136
  * derived from these units and a price version at settlement; a cost quoted by
137
137
  * the data plane would be a second, unauthoritative answer to the same
138
138
  * question.
139
+ *
140
+ * ## This event is MEASUREMENT EVIDENCE, never a settleable record
141
+ *
142
+ * `normalizedUsageReportSchema` is the only shape a settlement is written from,
143
+ * and this event is deliberately NOT a subset of it that could be widened into
144
+ * one. It carries units and a source; a report additionally carries the
145
+ * attribution block, the outcome, the resolved route, the route-switch count and
146
+ * the two timestamps. Every one of those is knowable only by one END of the
147
+ * request rather than by the frame: the outcome only by the edge, which is the
148
+ * only party that knows whether the CLIENT cancelled, and the route record only
149
+ * by the data plane.
150
+ *
151
+ * So the event is not widened, and that is a decision rather than an omission.
152
+ * Adding the route record and the attribution block here would repeat both on
153
+ * EVERY usage frame of every stream, and each repetition is one more place two
154
+ * frames of one stream could disagree about which route served it — a second
155
+ * source of truth per frame, for fields no consumer of a progress signal reads.
156
+ *
157
+ * **What the edge may do with it, and what it may not.** The units are exact and
158
+ * may be settled; the record around them may not be inferred. When no terminal
159
+ * report arrives — the ordinary case for a client disconnect, since the report
160
+ * frame can no longer be delivered to a connection that is gone — the edge
161
+ * settles the units from the last such event and takes the OUTCOME from itself,
162
+ * never from the event. Its outcome is then `cancelled`, `partial` or `failed`;
163
+ * it is never `completed`, because nothing here can witness that the customer
164
+ * received the whole answer. Zero units marked `estimated` is the arm for no
165
+ * evidence at ALL, not for a disconnect that reported some.
139
166
  */
140
167
  export declare const inferenceStreamUsageEventSchema: z.ZodObject<{
141
168
  /** See `version.ts`: each stream event is a whole message on the wire. */
@@ -216,18 +243,18 @@ export declare const inferenceRouteSwitchDetailSchema: z.ZodDiscriminatedUnion<"
216
243
  authorizedByPolicy: z.ZodLiteral<true>;
217
244
  }, "strict", z.ZodTypeAny, {
218
245
  scope: "model";
246
+ authorizedByPolicy: true;
219
247
  toProvider: string;
220
248
  requestedModelId: string;
221
249
  fromModelReference: string;
222
250
  toModelReference: string;
223
- authorizedByPolicy: true;
224
251
  }, {
225
252
  scope: "model";
253
+ authorizedByPolicy: true;
226
254
  toProvider: string;
227
255
  requestedModelId: string;
228
256
  fromModelReference: string;
229
257
  toModelReference: string;
230
- authorizedByPolicy: true;
231
258
  }>]>;
232
259
  /** Why a route changed mid-request. */
233
260
  export declare const inferenceRouteSwitchReasonSchema: z.ZodEnum<["deployment_unavailable", "provider_error", "provider_timeout", "provider_overloaded", "rate_limited", "capacity", "policy_preference"]>;
@@ -277,18 +304,18 @@ export declare const inferenceStreamRouteSwitchEventSchema: z.ZodObject<{
277
304
  authorizedByPolicy: z.ZodLiteral<true>;
278
305
  }, "strict", z.ZodTypeAny, {
279
306
  scope: "model";
307
+ authorizedByPolicy: true;
280
308
  toProvider: string;
281
309
  requestedModelId: string;
282
310
  fromModelReference: string;
283
311
  toModelReference: string;
284
- authorizedByPolicy: true;
285
312
  }, {
286
313
  scope: "model";
314
+ authorizedByPolicy: true;
287
315
  toProvider: string;
288
316
  requestedModelId: string;
289
317
  fromModelReference: string;
290
318
  toModelReference: string;
291
- authorizedByPolicy: true;
292
319
  }>]>;
293
320
  occurredAt: z.ZodString;
294
321
  }, "strip", z.ZodTypeAny, {
@@ -304,11 +331,11 @@ export declare const inferenceStreamRouteSwitchEventSchema: z.ZodObject<{
304
331
  toDeploymentId?: string | undefined;
305
332
  } | {
306
333
  scope: "model";
334
+ authorizedByPolicy: true;
307
335
  toProvider: string;
308
336
  requestedModelId: string;
309
337
  fromModelReference: string;
310
338
  toModelReference: string;
311
- authorizedByPolicy: true;
312
339
  };
313
340
  sequence: number;
314
341
  }, {
@@ -324,11 +351,11 @@ export declare const inferenceStreamRouteSwitchEventSchema: z.ZodObject<{
324
351
  toDeploymentId?: string | undefined;
325
352
  } | {
326
353
  scope: "model";
354
+ authorizedByPolicy: true;
327
355
  toProvider: string;
328
356
  requestedModelId: string;
329
357
  fromModelReference: string;
330
358
  toModelReference: string;
331
- authorizedByPolicy: true;
332
359
  };
333
360
  sequence: number;
334
361
  }>;
@@ -345,7 +372,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
345
372
  /** Carries its own `schemaVersion`: the same body is returned non-streaming. */
346
373
  error: z.ZodEffects<z.ZodObject<{
347
374
  schemaVersion: z.ZodLiteral<1>;
348
- 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", "service_unavailable", "internal_error"]>;
375
+ 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"]>;
349
376
  message: z.ZodEffects<z.ZodString, string, string>;
350
377
  retryable: z.ZodBoolean;
351
378
  requestId: z.ZodString;
@@ -369,7 +396,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
369
396
  status?: number | undefined;
370
397
  }>>;
371
398
  }, "strip", z.ZodTypeAny, {
372
- code: "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" | "service_unavailable" | "internal_error";
399
+ code: "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";
373
400
  message: string;
374
401
  requestId: string;
375
402
  schemaVersion: 1;
@@ -384,7 +411,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
384
411
  status?: number | undefined;
385
412
  } | undefined;
386
413
  }, {
387
- code: "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" | "service_unavailable" | "internal_error";
414
+ code: "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";
388
415
  message: string;
389
416
  requestId: string;
390
417
  schemaVersion: 1;
@@ -399,7 +426,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
399
426
  status?: number | undefined;
400
427
  } | undefined;
401
428
  }>, {
402
- code: "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" | "service_unavailable" | "internal_error";
429
+ code: "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";
403
430
  message: string;
404
431
  requestId: string;
405
432
  schemaVersion: 1;
@@ -414,7 +441,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
414
441
  status?: number | undefined;
415
442
  } | undefined;
416
443
  }, {
417
- code: "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" | "service_unavailable" | "internal_error";
444
+ code: "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";
418
445
  message: string;
419
446
  requestId: string;
420
447
  schemaVersion: 1;
@@ -435,7 +462,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
435
462
  schemaVersion: 1;
436
463
  sequence: number;
437
464
  error: {
438
- code: "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" | "service_unavailable" | "internal_error";
465
+ code: "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";
439
466
  message: string;
440
467
  requestId: string;
441
468
  schemaVersion: 1;
@@ -456,7 +483,7 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
456
483
  schemaVersion: 1;
457
484
  sequence: number;
458
485
  error: {
459
- code: "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" | "service_unavailable" | "internal_error";
486
+ code: "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";
460
487
  message: string;
461
488
  requestId: string;
462
489
  schemaVersion: 1;
@@ -472,8 +499,17 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
472
499
  } | undefined;
473
500
  };
474
501
  }>;
475
- /** Why generation stopped. */
476
- export declare const inferenceFinishReasonSchema: z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "cancelled"]>;
502
+ /**
503
+ * Why generation stopped.
504
+ *
505
+ * `refusal` and `content_filter` are separate members because they are separate
506
+ * events: the MODEL declining to answer is a property of the answer, while a
507
+ * filter is an upstream system removing one. The delta channels already carry
508
+ * that distinction (`channel: 'refusal'` beside the filter's own error code),
509
+ * so collapsing it here would have made the terminal event less specific than
510
+ * the stream that produced it.
511
+ */
512
+ export declare const inferenceFinishReasonSchema: z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "refusal", "cancelled"]>;
477
513
  /**
478
514
  * The successful terminal event.
479
515
  *
@@ -487,7 +523,7 @@ export declare const inferenceStreamDoneEventSchema: z.ZodObject<{
487
523
  requestId: z.ZodString;
488
524
  sequence: z.ZodNumber;
489
525
  generationId: z.ZodOptional<z.ZodString>;
490
- finishReason: z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "cancelled"]>;
526
+ finishReason: z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "refusal", "cancelled"]>;
491
527
  receiptId: z.ZodOptional<z.ZodString>;
492
528
  completedAt: z.ZodString;
493
529
  }, "strip", z.ZodTypeAny, {
@@ -495,19 +531,19 @@ export declare const inferenceStreamDoneEventSchema: z.ZodObject<{
495
531
  requestId: string;
496
532
  schemaVersion: 1;
497
533
  sequence: number;
498
- finishReason: "length" | "cancelled" | "content_filter" | "stop" | "tool_calls";
534
+ finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
499
535
  completedAt: string;
500
- generationId?: string | undefined;
501
536
  receiptId?: string | undefined;
537
+ generationId?: string | undefined;
502
538
  }, {
503
539
  type: "done";
504
540
  requestId: string;
505
541
  schemaVersion: 1;
506
542
  sequence: number;
507
- finishReason: "length" | "cancelled" | "content_filter" | "stop" | "tool_calls";
543
+ finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
508
544
  completedAt: string;
509
- generationId?: string | undefined;
510
545
  receiptId?: string | undefined;
546
+ generationId?: string | undefined;
511
547
  }>;
512
548
  /**
513
549
  * Every event a normalized stream can carry.
@@ -529,19 +565,19 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
529
565
  }, "strip", z.ZodTypeAny, {
530
566
  type: "start";
531
567
  requestId: string;
532
- schemaVersion: 1;
533
- sequence: number;
534
568
  resolvedModelReference: string;
535
569
  servingProvider: string;
570
+ schemaVersion: 1;
571
+ sequence: number;
536
572
  startedAt: string;
537
573
  generationId?: string | undefined;
538
574
  }, {
539
575
  type: "start";
540
576
  requestId: string;
541
- schemaVersion: 1;
542
- sequence: number;
543
577
  resolvedModelReference: string;
544
578
  servingProvider: string;
579
+ schemaVersion: 1;
580
+ sequence: number;
545
581
  startedAt: string;
546
582
  generationId?: string | undefined;
547
583
  }>, z.ZodObject<{
@@ -555,7 +591,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
555
591
  channel: z.ZodEnum<["output_text", "reasoning", "refusal"]>;
556
592
  text: z.ZodString;
557
593
  }, "strip", z.ZodTypeAny, {
558
- channel: "reasoning" | "output_text" | "refusal";
594
+ channel: "reasoning" | "refusal" | "output_text";
559
595
  type: "delta";
560
596
  requestId: string;
561
597
  schemaVersion: 1;
@@ -563,7 +599,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
563
599
  sequence: number;
564
600
  outputIndex: number;
565
601
  }, {
566
- channel: "reasoning" | "output_text" | "refusal";
602
+ channel: "reasoning" | "refusal" | "output_text";
567
603
  type: "delta";
568
604
  requestId: string;
569
605
  schemaVersion: 1;
@@ -675,18 +711,18 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
675
711
  authorizedByPolicy: z.ZodLiteral<true>;
676
712
  }, "strict", z.ZodTypeAny, {
677
713
  scope: "model";
714
+ authorizedByPolicy: true;
678
715
  toProvider: string;
679
716
  requestedModelId: string;
680
717
  fromModelReference: string;
681
718
  toModelReference: string;
682
- authorizedByPolicy: true;
683
719
  }, {
684
720
  scope: "model";
721
+ authorizedByPolicy: true;
685
722
  toProvider: string;
686
723
  requestedModelId: string;
687
724
  fromModelReference: string;
688
725
  toModelReference: string;
689
- authorizedByPolicy: true;
690
726
  }>]>;
691
727
  occurredAt: z.ZodString;
692
728
  }, "strip", z.ZodTypeAny, {
@@ -702,11 +738,11 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
702
738
  toDeploymentId?: string | undefined;
703
739
  } | {
704
740
  scope: "model";
741
+ authorizedByPolicy: true;
705
742
  toProvider: string;
706
743
  requestedModelId: string;
707
744
  fromModelReference: string;
708
745
  toModelReference: string;
709
- authorizedByPolicy: true;
710
746
  };
711
747
  sequence: number;
712
748
  }, {
@@ -722,11 +758,11 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
722
758
  toDeploymentId?: string | undefined;
723
759
  } | {
724
760
  scope: "model";
761
+ authorizedByPolicy: true;
725
762
  toProvider: string;
726
763
  requestedModelId: string;
727
764
  fromModelReference: string;
728
765
  toModelReference: string;
729
- authorizedByPolicy: true;
730
766
  };
731
767
  sequence: number;
732
768
  }>, z.ZodObject<{
@@ -738,7 +774,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
738
774
  /** Carries its own `schemaVersion`: the same body is returned non-streaming. */
739
775
  error: z.ZodEffects<z.ZodObject<{
740
776
  schemaVersion: z.ZodLiteral<1>;
741
- 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", "service_unavailable", "internal_error"]>;
777
+ 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"]>;
742
778
  message: z.ZodEffects<z.ZodString, string, string>;
743
779
  retryable: z.ZodBoolean;
744
780
  requestId: z.ZodString;
@@ -762,7 +798,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
762
798
  status?: number | undefined;
763
799
  }>>;
764
800
  }, "strip", z.ZodTypeAny, {
765
- code: "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" | "service_unavailable" | "internal_error";
801
+ code: "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";
766
802
  message: string;
767
803
  requestId: string;
768
804
  schemaVersion: 1;
@@ -777,7 +813,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
777
813
  status?: number | undefined;
778
814
  } | undefined;
779
815
  }, {
780
- code: "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" | "service_unavailable" | "internal_error";
816
+ code: "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";
781
817
  message: string;
782
818
  requestId: string;
783
819
  schemaVersion: 1;
@@ -792,7 +828,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
792
828
  status?: number | undefined;
793
829
  } | undefined;
794
830
  }>, {
795
- code: "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" | "service_unavailable" | "internal_error";
831
+ code: "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";
796
832
  message: string;
797
833
  requestId: string;
798
834
  schemaVersion: 1;
@@ -807,7 +843,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
807
843
  status?: number | undefined;
808
844
  } | undefined;
809
845
  }, {
810
- code: "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" | "service_unavailable" | "internal_error";
846
+ code: "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";
811
847
  message: string;
812
848
  requestId: string;
813
849
  schemaVersion: 1;
@@ -828,7 +864,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
828
864
  schemaVersion: 1;
829
865
  sequence: number;
830
866
  error: {
831
- code: "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" | "service_unavailable" | "internal_error";
867
+ code: "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";
832
868
  message: string;
833
869
  requestId: string;
834
870
  schemaVersion: 1;
@@ -849,7 +885,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
849
885
  schemaVersion: 1;
850
886
  sequence: number;
851
887
  error: {
852
- code: "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" | "service_unavailable" | "internal_error";
888
+ code: "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";
853
889
  message: string;
854
890
  requestId: string;
855
891
  schemaVersion: 1;
@@ -871,7 +907,7 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
871
907
  requestId: z.ZodString;
872
908
  sequence: z.ZodNumber;
873
909
  generationId: z.ZodOptional<z.ZodString>;
874
- finishReason: z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "cancelled"]>;
910
+ finishReason: z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "refusal", "cancelled"]>;
875
911
  receiptId: z.ZodOptional<z.ZodString>;
876
912
  completedAt: z.ZodString;
877
913
  }, "strip", z.ZodTypeAny, {
@@ -879,19 +915,19 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<"type",
879
915
  requestId: string;
880
916
  schemaVersion: 1;
881
917
  sequence: number;
882
- finishReason: "length" | "cancelled" | "content_filter" | "stop" | "tool_calls";
918
+ finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
883
919
  completedAt: string;
884
- generationId?: string | undefined;
885
920
  receiptId?: string | undefined;
921
+ generationId?: string | undefined;
886
922
  }, {
887
923
  type: "done";
888
924
  requestId: string;
889
925
  schemaVersion: 1;
890
926
  sequence: number;
891
- finishReason: "length" | "cancelled" | "content_filter" | "stop" | "tool_calls";
927
+ finishReason: "length" | "cancelled" | "content_filter" | "refusal" | "stop" | "tool_calls";
892
928
  completedAt: string;
893
- generationId?: string | undefined;
894
929
  receiptId?: string | undefined;
930
+ generationId?: string | undefined;
895
931
  }>]>;
896
932
  export type InferenceStreamStartEvent = z.infer<typeof inferenceStreamStartEventSchema>;
897
933
  export type InferenceStreamDeltaEvent = z.infer<typeof inferenceStreamDeltaEventSchema>;