@kaana.ai/contracts 0.0.0-stage → 4.4.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 (79) hide show
  1. package/LICENSE +673 -0
  2. package/NOTICE +21 -0
  3. package/dist/index.d.ts +29 -0
  4. package/dist/index.js +29 -0
  5. package/dist/internal/attribution.d.ts +116 -0
  6. package/dist/internal/attribution.js +82 -0
  7. package/dist/internal/canonical.d.ts +31 -0
  8. package/dist/internal/canonical.js +57 -0
  9. package/dist/internal/catalogue.d.ts +1059 -0
  10. package/dist/internal/catalogue.js +389 -0
  11. package/dist/internal/credentialControl.d.ts +329 -0
  12. package/dist/internal/credentialControl.js +256 -0
  13. package/dist/internal/decisions.d.ts +245 -0
  14. package/dist/internal/decisions.js +69 -0
  15. package/dist/internal/economics.d.ts +27 -0
  16. package/dist/internal/economics.js +26 -0
  17. package/dist/internal/embeddings.d.ts +164 -0
  18. package/dist/internal/embeddings.js +59 -0
  19. package/dist/internal/errors.d.ts +185 -0
  20. package/dist/internal/errors.js +211 -0
  21. package/dist/internal/grant.d.ts +699 -0
  22. package/dist/internal/grant.js +445 -0
  23. package/dist/internal/identifiers.d.ts +63 -0
  24. package/dist/internal/identifiers.js +65 -0
  25. package/dist/internal/privateAutoExecution.d.ts +158 -0
  26. package/dist/internal/privateAutoExecution.js +188 -0
  27. package/dist/internal/realtime.d.ts +1005 -0
  28. package/dist/internal/realtime.js +187 -0
  29. package/dist/internal/request.d.ts +1079 -0
  30. package/dist/internal/request.js +404 -0
  31. package/dist/internal/routing.d.ts +90 -0
  32. package/dist/internal/routing.js +139 -0
  33. package/dist/internal/scopedExecution.d.ts +74 -0
  34. package/dist/internal/scopedExecution.js +61 -0
  35. package/dist/internal/settlement.d.ts +205 -0
  36. package/dist/internal/settlement.js +71 -0
  37. package/dist/internal/streamEvents.d.ts +422 -0
  38. package/dist/internal/streamEvents.js +171 -0
  39. package/dist/internal/usage.d.ts +127 -0
  40. package/dist/internal/usage.js +109 -0
  41. package/dist/internal.d.ts +30 -0
  42. package/dist/internal.js +30 -0
  43. package/dist/public/audio.d.ts +347 -0
  44. package/dist/public/audio.js +236 -0
  45. package/dist/public/audioFormats.d.ts +64 -0
  46. package/dist/public/audioFormats.js +60 -0
  47. package/dist/public/catalogue.d.ts +914 -0
  48. package/dist/public/catalogue.js +516 -0
  49. package/dist/public/chatCompletions.d.ts +381 -0
  50. package/dist/public/chatCompletions.js +321 -0
  51. package/dist/public/decisions.d.ts +182 -0
  52. package/dist/public/decisions.js +257 -0
  53. package/dist/public/embeddings.d.ts +34 -0
  54. package/dist/public/embeddings.js +66 -0
  55. package/dist/public/errors.d.ts +195 -0
  56. package/dist/public/errors.js +274 -0
  57. package/dist/public/generations.d.ts +330 -0
  58. package/dist/public/generations.js +121 -0
  59. package/dist/public/identifiers.d.ts +139 -0
  60. package/dist/public/identifiers.js +160 -0
  61. package/dist/public/images.d.ts +36 -0
  62. package/dist/public/images.js +36 -0
  63. package/dist/public/messages.d.ts +297 -0
  64. package/dist/public/messages.js +251 -0
  65. package/dist/public/money.d.ts +308 -0
  66. package/dist/public/money.js +237 -0
  67. package/dist/public/policy.d.ts +19 -0
  68. package/dist/public/policy.js +20 -0
  69. package/dist/public/realtime.d.ts +2006 -0
  70. package/dist/public/realtime.js +797 -0
  71. package/dist/public/responses.d.ts +253 -0
  72. package/dist/public/responses.js +95 -0
  73. package/dist/public/streamEvents.d.ts +372 -0
  74. package/dist/public/streamEvents.js +157 -0
  75. package/dist/public/version.d.ts +184 -0
  76. package/dist/public/version.js +184 -0
  77. package/openapi.json +6967 -0
  78. package/package.json +44 -4
  79. package/README.md +0 -3
@@ -0,0 +1,1005 @@
1
+ /**
2
+ * The signed realtime session request and the server events that name the
3
+ * serving provider and deployment.
4
+ *
5
+ * Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/realtime.ts`) by Kaana ADR 0002.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * What the edge records about the session CALL. Strict for the reason
10
+ * `clientRequestMetadataSchema` is: this object is where an IP would be added.
11
+ */
12
+ export declare const realtimeClientMetadataSchema: z.ZodObject<{
13
+ endpoint: z.ZodString;
14
+ clientSessionId: z.ZodOptional<z.ZodString>;
15
+ receivedAt: z.ZodString;
16
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
17
+ }, z.core.$strict>;
18
+ /**
19
+ * The signed request that opens a session: the first frame of its connection.
20
+ */
21
+ export declare const realtimeSessionRequestSchema: z.ZodObject<{
22
+ schemaVersion: z.ZodLiteral<1>;
23
+ attribution: z.ZodObject<{
24
+ principal: z.ZodObject<{
25
+ billing: z.ZodObject<{
26
+ accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
27
+ }, z.core.$strict>;
28
+ applicationId: z.ZodString;
29
+ credentialId: z.ZodString;
30
+ environment: z.ZodEnum<{
31
+ development: "development";
32
+ staging: "staging";
33
+ production: "production";
34
+ }>;
35
+ inferenceScopes: z.ZodArray<z.ZodEnum<{
36
+ "inference:invoke": "inference:invoke";
37
+ "inference:models:read": "inference:models:read";
38
+ "inference:usage:read": "inference:usage:read";
39
+ "inference:routing:read": "inference:routing:read";
40
+ "inference:routing:write": "inference:routing:write";
41
+ "inference:providers:read": "inference:providers:read";
42
+ "inference:providers:write": "inference:providers:write";
43
+ }>>;
44
+ }, z.core.$strip>;
45
+ userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
46
+ requestId: z.ZodString;
47
+ generationId: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>;
49
+ modelReference: z.ZodString;
50
+ kind: z.ZodEnum<{
51
+ conversation: "conversation";
52
+ transcription: "transcription";
53
+ translation: "translation";
54
+ }>;
55
+ transport: z.ZodEnum<{
56
+ websocket: "websocket";
57
+ }>;
58
+ config: z.ZodObject<{
59
+ instructions: z.ZodOptional<z.ZodString>;
60
+ outputModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
61
+ text: "text";
62
+ audio: "audio";
63
+ }>>>;
64
+ voice: z.ZodOptional<z.ZodString>;
65
+ inputAudioFormat: z.ZodEnum<{
66
+ pcm16_24khz: "pcm16_24khz";
67
+ g711_ulaw: "g711_ulaw";
68
+ g711_alaw: "g711_alaw";
69
+ }>;
70
+ outputAudioFormat: z.ZodOptional<z.ZodEnum<{
71
+ pcm16_24khz: "pcm16_24khz";
72
+ g711_ulaw: "g711_ulaw";
73
+ g711_alaw: "g711_alaw";
74
+ }>>;
75
+ turnDetection: z.ZodDiscriminatedUnion<[z.ZodObject<{
76
+ type: z.ZodLiteral<"none">;
77
+ }, z.core.$strict>, z.ZodObject<{
78
+ type: z.ZodLiteral<"server_vad">;
79
+ threshold: z.ZodOptional<z.ZodNumber>;
80
+ prefixPaddingMs: z.ZodOptional<z.ZodNumber>;
81
+ silenceDurationMs: z.ZodOptional<z.ZodNumber>;
82
+ createResponse: z.ZodBoolean;
83
+ interruptResponse: z.ZodBoolean;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ type: z.ZodLiteral<"semantic_vad">;
86
+ eagerness: z.ZodEnum<{
87
+ low: "low";
88
+ medium: "medium";
89
+ high: "high";
90
+ auto: "auto";
91
+ }>;
92
+ createResponse: z.ZodBoolean;
93
+ interruptResponse: z.ZodBoolean;
94
+ }, z.core.$strict>], "type">;
95
+ inputAudioTranscription: z.ZodOptional<z.ZodObject<{
96
+ language: z.ZodOptional<z.ZodString>;
97
+ prompt: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>>;
99
+ translation: z.ZodOptional<z.ZodObject<{
100
+ targetLanguage: z.ZodString;
101
+ }, z.core.$strict>>;
102
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
103
+ type: z.ZodLiteral<"function">;
104
+ name: z.ZodString;
105
+ description: z.ZodOptional<z.ZodString>;
106
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
107
+ strict: z.ZodOptional<z.ZodBoolean>;
108
+ }, z.core.$strict>>>;
109
+ toolChoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
110
+ auto: "auto";
111
+ none: "none";
112
+ required: "required";
113
+ }>, z.ZodObject<{
114
+ type: z.ZodLiteral<"function">;
115
+ name: z.ZodString;
116
+ }, z.core.$strict>]>>;
117
+ temperature: z.ZodOptional<z.ZodNumber>;
118
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
119
+ }, z.core.$strict>;
120
+ limits: z.ZodObject<{
121
+ maxDurationMs: z.ZodNumber;
122
+ idleTimeoutMs: z.ZodNumber;
123
+ maxInputAudioBytes: z.ZodNumber;
124
+ maxOutputAudioBytes: z.ZodNumber;
125
+ maxResponses: z.ZodNumber;
126
+ }, z.core.$strict>;
127
+ client: z.ZodObject<{
128
+ endpoint: z.ZodString;
129
+ clientSessionId: z.ZodOptional<z.ZodString>;
130
+ receivedAt: z.ZodString;
131
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
132
+ }, z.core.$strict>;
133
+ routingPolicy: z.ZodObject<{
134
+ routingPolicyId: z.ZodString;
135
+ policyVersion: z.ZodNumber;
136
+ }, z.core.$strict>;
137
+ authorizedRoutes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
138
+ deploymentId: z.ZodString;
139
+ modelReference: z.ZodString;
140
+ provider: z.ZodString;
141
+ regions: z.ZodArray<z.ZodString>;
142
+ maxFundingTier: z.ZodOptional<z.ZodEnum<{
143
+ free: "free";
144
+ credit: "credit";
145
+ paid: "paid";
146
+ }>>;
147
+ customerProviderCredential: z.ZodOptional<z.ZodObject<{
148
+ credentialHandle: z.ZodString;
149
+ credentialRevision: z.ZodNumber;
150
+ ownerAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
151
+ connectionId: z.ZodString;
152
+ environment: z.ZodEnum<{
153
+ development: "development";
154
+ staging: "staging";
155
+ production: "production";
156
+ }>;
157
+ }, z.core.$strict>>;
158
+ substitution: z.ZodLiteral<"same_model">;
159
+ }, z.core.$strict>, z.ZodObject<{
160
+ authorizedByPolicy: z.ZodLiteral<true>;
161
+ deploymentId: z.ZodString;
162
+ modelReference: z.ZodString;
163
+ provider: z.ZodString;
164
+ regions: z.ZodArray<z.ZodString>;
165
+ maxFundingTier: z.ZodOptional<z.ZodEnum<{
166
+ free: "free";
167
+ credit: "credit";
168
+ paid: "paid";
169
+ }>>;
170
+ customerProviderCredential: z.ZodOptional<z.ZodObject<{
171
+ credentialHandle: z.ZodString;
172
+ credentialRevision: z.ZodNumber;
173
+ ownerAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
174
+ connectionId: z.ZodString;
175
+ environment: z.ZodEnum<{
176
+ development: "development";
177
+ staging: "staging";
178
+ production: "production";
179
+ }>;
180
+ }, z.core.$strict>>;
181
+ substitution: z.ZodLiteral<"cross_model">;
182
+ }, z.core.$strict>], "substitution">>;
183
+ }, z.core.$strip>;
184
+ /**
185
+ * The session opened. Names the revision-pinned model, the serving provider and
186
+ * the exact deployment — fixed for the rest of the session — and the effective
187
+ * configuration and limits. `deploymentId` is for settlement: like the usage
188
+ * event's, it is not rendered to the customer.
189
+ */
190
+ export declare const realtimeSessionCreatedEventSchema: z.ZodObject<{
191
+ type: z.ZodLiteral<"session.created">;
192
+ resolvedModelReference: z.ZodString;
193
+ servingProvider: z.ZodString;
194
+ deploymentId: z.ZodString;
195
+ kind: z.ZodEnum<{
196
+ conversation: "conversation";
197
+ transcription: "transcription";
198
+ translation: "translation";
199
+ }>;
200
+ config: z.ZodObject<{
201
+ instructions: z.ZodOptional<z.ZodString>;
202
+ outputModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
203
+ text: "text";
204
+ audio: "audio";
205
+ }>>>;
206
+ voice: z.ZodOptional<z.ZodString>;
207
+ inputAudioFormat: z.ZodEnum<{
208
+ pcm16_24khz: "pcm16_24khz";
209
+ g711_ulaw: "g711_ulaw";
210
+ g711_alaw: "g711_alaw";
211
+ }>;
212
+ outputAudioFormat: z.ZodOptional<z.ZodEnum<{
213
+ pcm16_24khz: "pcm16_24khz";
214
+ g711_ulaw: "g711_ulaw";
215
+ g711_alaw: "g711_alaw";
216
+ }>>;
217
+ turnDetection: z.ZodDiscriminatedUnion<[z.ZodObject<{
218
+ type: z.ZodLiteral<"none">;
219
+ }, z.core.$strict>, z.ZodObject<{
220
+ type: z.ZodLiteral<"server_vad">;
221
+ threshold: z.ZodOptional<z.ZodNumber>;
222
+ prefixPaddingMs: z.ZodOptional<z.ZodNumber>;
223
+ silenceDurationMs: z.ZodOptional<z.ZodNumber>;
224
+ createResponse: z.ZodBoolean;
225
+ interruptResponse: z.ZodBoolean;
226
+ }, z.core.$strict>, z.ZodObject<{
227
+ type: z.ZodLiteral<"semantic_vad">;
228
+ eagerness: z.ZodEnum<{
229
+ low: "low";
230
+ medium: "medium";
231
+ high: "high";
232
+ auto: "auto";
233
+ }>;
234
+ createResponse: z.ZodBoolean;
235
+ interruptResponse: z.ZodBoolean;
236
+ }, z.core.$strict>], "type">;
237
+ inputAudioTranscription: z.ZodOptional<z.ZodObject<{
238
+ language: z.ZodOptional<z.ZodString>;
239
+ prompt: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strict>>;
241
+ translation: z.ZodOptional<z.ZodObject<{
242
+ targetLanguage: z.ZodString;
243
+ }, z.core.$strict>>;
244
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ type: z.ZodLiteral<"function">;
246
+ name: z.ZodString;
247
+ description: z.ZodOptional<z.ZodString>;
248
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
249
+ strict: z.ZodOptional<z.ZodBoolean>;
250
+ }, z.core.$strict>>>;
251
+ toolChoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
252
+ auto: "auto";
253
+ none: "none";
254
+ required: "required";
255
+ }>, z.ZodObject<{
256
+ type: z.ZodLiteral<"function">;
257
+ name: z.ZodString;
258
+ }, z.core.$strict>]>>;
259
+ temperature: z.ZodOptional<z.ZodNumber>;
260
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
261
+ }, z.core.$strict>;
262
+ limits: z.ZodObject<{
263
+ maxDurationMs: z.ZodNumber;
264
+ idleTimeoutMs: z.ZodNumber;
265
+ maxInputAudioBytes: z.ZodNumber;
266
+ maxOutputAudioBytes: z.ZodNumber;
267
+ maxResponses: z.ZodNumber;
268
+ }, z.core.$strict>;
269
+ resumeWindowMs: z.ZodNumber;
270
+ startedAt: z.ZodString;
271
+ expiresAt: z.ZodString;
272
+ schemaVersion: z.ZodLiteral<1>;
273
+ requestId: z.ZodString;
274
+ sequence: z.ZodNumber;
275
+ commandId: z.ZodOptional<z.ZodString>;
276
+ }, z.core.$strip>;
277
+ /**
278
+ * A response ended, with the units it consumed — measurement evidence, as on
279
+ * the one-shot usage event. A cancelled or failed response still consumed what
280
+ * it consumed, so its units are reported too.
281
+ */
282
+ export declare const realtimeResponseDoneEventSchema: z.ZodObject<{
283
+ type: z.ZodLiteral<"response.done">;
284
+ responseId: z.ZodString;
285
+ status: z.ZodEnum<{
286
+ cancelled: "cancelled";
287
+ completed: "completed";
288
+ failed: "failed";
289
+ incomplete: "incomplete";
290
+ }>;
291
+ finishReason: z.ZodOptional<z.ZodEnum<{
292
+ content_filter: "content_filter";
293
+ cancelled: "cancelled";
294
+ refusal: "refusal";
295
+ stop: "stop";
296
+ length: "length";
297
+ tool_calls: "tool_calls";
298
+ }>>;
299
+ deploymentId: z.ZodString;
300
+ units: z.ZodArray<z.ZodObject<{
301
+ unit: z.ZodEnum<{
302
+ input_tokens: "input_tokens";
303
+ cached_input_tokens: "cached_input_tokens";
304
+ output_tokens: "output_tokens";
305
+ reasoning_tokens: "reasoning_tokens";
306
+ requests: "requests";
307
+ images: "images";
308
+ audio_input_milliseconds: "audio_input_milliseconds";
309
+ audio_output_milliseconds: "audio_output_milliseconds";
310
+ video_milliseconds: "video_milliseconds";
311
+ characters: "characters";
312
+ embeddings: "embeddings";
313
+ audio_input_tokens: "audio_input_tokens";
314
+ cached_audio_input_tokens: "cached_audio_input_tokens";
315
+ audio_output_tokens: "audio_output_tokens";
316
+ session_milliseconds: "session_milliseconds";
317
+ input_transcription_milliseconds: "input_transcription_milliseconds";
318
+ }>;
319
+ quantity: z.ZodNumber;
320
+ }, z.core.$strict>>;
321
+ usageSource: z.ZodEnum<{
322
+ provider_reported: "provider_reported";
323
+ oxy_measured: "oxy_measured";
324
+ estimated: "estimated";
325
+ }>;
326
+ schemaVersion: z.ZodLiteral<1>;
327
+ requestId: z.ZodString;
328
+ sequence: z.ZodNumber;
329
+ commandId: z.ZodOptional<z.ZodString>;
330
+ }, z.core.$strip>;
331
+ /**
332
+ * An error. `fatal: false` refuses one command and the session continues;
333
+ * `fatal: true` is followed by `session.closed` and nothing else.
334
+ */
335
+ export declare const realtimeErrorEventSchema: z.ZodObject<{
336
+ type: z.ZodLiteral<"error">;
337
+ fatal: z.ZodBoolean;
338
+ error: z.ZodObject<{
339
+ schemaVersion: z.ZodLiteral<1>;
340
+ code: z.ZodEnum<{
341
+ invalid_request: "invalid_request";
342
+ authentication_failed: "authentication_failed";
343
+ permission_denied: "permission_denied";
344
+ insufficient_scope: "insufficient_scope";
345
+ model_not_found: "model_not_found";
346
+ unsupported_modality: "unsupported_modality";
347
+ context_length_exceeded: "context_length_exceeded";
348
+ request_too_large: "request_too_large";
349
+ output_limit_exceeded: "output_limit_exceeded";
350
+ idempotency_conflict: "idempotency_conflict";
351
+ insufficient_balance: "insufficient_balance";
352
+ spending_limit_exceeded: "spending_limit_exceeded";
353
+ quota_exceeded: "quota_exceeded";
354
+ byok_credential_invalid: "byok_credential_invalid";
355
+ policy_violation: "policy_violation";
356
+ commercial_permission_denied: "commercial_permission_denied";
357
+ no_route_available: "no_route_available";
358
+ upstream_content_filtered: "upstream_content_filtered";
359
+ cancelled: "cancelled";
360
+ rate_limited: "rate_limited";
361
+ provider_error: "provider_error";
362
+ provider_timeout: "provider_timeout";
363
+ provider_overloaded: "provider_overloaded";
364
+ service_unavailable: "service_unavailable";
365
+ internal_error: "internal_error";
366
+ deployment_unavailable: "deployment_unavailable";
367
+ provider_credential_invalid: "provider_credential_invalid";
368
+ provider_billing_refused: "provider_billing_refused";
369
+ }>;
370
+ message: z.ZodString;
371
+ retryable: z.ZodBoolean;
372
+ requestId: z.ZodString;
373
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
374
+ param: z.ZodOptional<z.ZodString>;
375
+ upstreamCategory: z.ZodOptional<z.ZodEnum<{
376
+ rate_limit: "rate_limit";
377
+ quota: "quota";
378
+ timeout: "timeout";
379
+ overloaded: "overloaded";
380
+ server_error: "server_error";
381
+ content_filter: "content_filter";
382
+ invalid_request: "invalid_request";
383
+ authentication: "authentication";
384
+ unknown: "unknown";
385
+ }>>;
386
+ providerError: z.ZodOptional<z.ZodObject<{
387
+ provider: z.ZodString;
388
+ status: z.ZodOptional<z.ZodNumber>;
389
+ code: z.ZodOptional<z.ZodString>;
390
+ message: z.ZodOptional<z.ZodString>;
391
+ }, z.core.$strict>>;
392
+ }, z.core.$strip>;
393
+ schemaVersion: z.ZodLiteral<1>;
394
+ requestId: z.ZodString;
395
+ sequence: z.ZodNumber;
396
+ commandId: z.ZodOptional<z.ZodString>;
397
+ }, z.core.$strip>;
398
+ /**
399
+ * The terminal event. Carries the session's total units; `deploymentId` is
400
+ * absent only when no route ever opened, in which case nothing was consumed.
401
+ */
402
+ export declare const realtimeSessionClosedEventSchema: z.ZodObject<{
403
+ type: z.ZodLiteral<"session.closed">;
404
+ reason: z.ZodEnum<{
405
+ no_route_available: "no_route_available";
406
+ client_closed: "client_closed";
407
+ max_duration: "max_duration";
408
+ idle_timeout: "idle_timeout";
409
+ limit_exceeded: "limit_exceeded";
410
+ resume_expired: "resume_expired";
411
+ upstream_closed: "upstream_closed";
412
+ upstream_error: "upstream_error";
413
+ server_shutdown: "server_shutdown";
414
+ }>;
415
+ deploymentId: z.ZodOptional<z.ZodString>;
416
+ units: z.ZodArray<z.ZodObject<{
417
+ unit: z.ZodEnum<{
418
+ input_tokens: "input_tokens";
419
+ cached_input_tokens: "cached_input_tokens";
420
+ output_tokens: "output_tokens";
421
+ reasoning_tokens: "reasoning_tokens";
422
+ requests: "requests";
423
+ images: "images";
424
+ audio_input_milliseconds: "audio_input_milliseconds";
425
+ audio_output_milliseconds: "audio_output_milliseconds";
426
+ video_milliseconds: "video_milliseconds";
427
+ characters: "characters";
428
+ embeddings: "embeddings";
429
+ audio_input_tokens: "audio_input_tokens";
430
+ cached_audio_input_tokens: "cached_audio_input_tokens";
431
+ audio_output_tokens: "audio_output_tokens";
432
+ session_milliseconds: "session_milliseconds";
433
+ input_transcription_milliseconds: "input_transcription_milliseconds";
434
+ }>;
435
+ quantity: z.ZodNumber;
436
+ }, z.core.$strict>>;
437
+ usageSource: z.ZodEnum<{
438
+ provider_reported: "provider_reported";
439
+ oxy_measured: "oxy_measured";
440
+ estimated: "estimated";
441
+ }>;
442
+ closedAt: z.ZodString;
443
+ schemaVersion: z.ZodLiteral<1>;
444
+ requestId: z.ZodString;
445
+ sequence: z.ZodNumber;
446
+ commandId: z.ZodOptional<z.ZodString>;
447
+ }, z.core.$strip>;
448
+ /** Every event a session can emit. */
449
+ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
450
+ type: z.ZodLiteral<"session.created">;
451
+ resolvedModelReference: z.ZodString;
452
+ servingProvider: z.ZodString;
453
+ deploymentId: z.ZodString;
454
+ kind: z.ZodEnum<{
455
+ conversation: "conversation";
456
+ transcription: "transcription";
457
+ translation: "translation";
458
+ }>;
459
+ config: z.ZodObject<{
460
+ instructions: z.ZodOptional<z.ZodString>;
461
+ outputModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
462
+ text: "text";
463
+ audio: "audio";
464
+ }>>>;
465
+ voice: z.ZodOptional<z.ZodString>;
466
+ inputAudioFormat: z.ZodEnum<{
467
+ pcm16_24khz: "pcm16_24khz";
468
+ g711_ulaw: "g711_ulaw";
469
+ g711_alaw: "g711_alaw";
470
+ }>;
471
+ outputAudioFormat: z.ZodOptional<z.ZodEnum<{
472
+ pcm16_24khz: "pcm16_24khz";
473
+ g711_ulaw: "g711_ulaw";
474
+ g711_alaw: "g711_alaw";
475
+ }>>;
476
+ turnDetection: z.ZodDiscriminatedUnion<[z.ZodObject<{
477
+ type: z.ZodLiteral<"none">;
478
+ }, z.core.$strict>, z.ZodObject<{
479
+ type: z.ZodLiteral<"server_vad">;
480
+ threshold: z.ZodOptional<z.ZodNumber>;
481
+ prefixPaddingMs: z.ZodOptional<z.ZodNumber>;
482
+ silenceDurationMs: z.ZodOptional<z.ZodNumber>;
483
+ createResponse: z.ZodBoolean;
484
+ interruptResponse: z.ZodBoolean;
485
+ }, z.core.$strict>, z.ZodObject<{
486
+ type: z.ZodLiteral<"semantic_vad">;
487
+ eagerness: z.ZodEnum<{
488
+ low: "low";
489
+ medium: "medium";
490
+ high: "high";
491
+ auto: "auto";
492
+ }>;
493
+ createResponse: z.ZodBoolean;
494
+ interruptResponse: z.ZodBoolean;
495
+ }, z.core.$strict>], "type">;
496
+ inputAudioTranscription: z.ZodOptional<z.ZodObject<{
497
+ language: z.ZodOptional<z.ZodString>;
498
+ prompt: z.ZodOptional<z.ZodString>;
499
+ }, z.core.$strict>>;
500
+ translation: z.ZodOptional<z.ZodObject<{
501
+ targetLanguage: z.ZodString;
502
+ }, z.core.$strict>>;
503
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
504
+ type: z.ZodLiteral<"function">;
505
+ name: z.ZodString;
506
+ description: z.ZodOptional<z.ZodString>;
507
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
508
+ strict: z.ZodOptional<z.ZodBoolean>;
509
+ }, z.core.$strict>>>;
510
+ toolChoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
511
+ auto: "auto";
512
+ none: "none";
513
+ required: "required";
514
+ }>, z.ZodObject<{
515
+ type: z.ZodLiteral<"function">;
516
+ name: z.ZodString;
517
+ }, z.core.$strict>]>>;
518
+ temperature: z.ZodOptional<z.ZodNumber>;
519
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
520
+ }, z.core.$strict>;
521
+ limits: z.ZodObject<{
522
+ maxDurationMs: z.ZodNumber;
523
+ idleTimeoutMs: z.ZodNumber;
524
+ maxInputAudioBytes: z.ZodNumber;
525
+ maxOutputAudioBytes: z.ZodNumber;
526
+ maxResponses: z.ZodNumber;
527
+ }, z.core.$strict>;
528
+ resumeWindowMs: z.ZodNumber;
529
+ startedAt: z.ZodString;
530
+ expiresAt: z.ZodString;
531
+ schemaVersion: z.ZodLiteral<1>;
532
+ requestId: z.ZodString;
533
+ sequence: z.ZodNumber;
534
+ commandId: z.ZodOptional<z.ZodString>;
535
+ }, z.core.$strip>, z.ZodObject<{
536
+ type: z.ZodLiteral<"session.updated">;
537
+ config: z.ZodObject<{
538
+ instructions: z.ZodOptional<z.ZodString>;
539
+ outputModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
540
+ text: "text";
541
+ audio: "audio";
542
+ }>>>;
543
+ voice: z.ZodOptional<z.ZodString>;
544
+ inputAudioFormat: z.ZodEnum<{
545
+ pcm16_24khz: "pcm16_24khz";
546
+ g711_ulaw: "g711_ulaw";
547
+ g711_alaw: "g711_alaw";
548
+ }>;
549
+ outputAudioFormat: z.ZodOptional<z.ZodEnum<{
550
+ pcm16_24khz: "pcm16_24khz";
551
+ g711_ulaw: "g711_ulaw";
552
+ g711_alaw: "g711_alaw";
553
+ }>>;
554
+ turnDetection: z.ZodDiscriminatedUnion<[z.ZodObject<{
555
+ type: z.ZodLiteral<"none">;
556
+ }, z.core.$strict>, z.ZodObject<{
557
+ type: z.ZodLiteral<"server_vad">;
558
+ threshold: z.ZodOptional<z.ZodNumber>;
559
+ prefixPaddingMs: z.ZodOptional<z.ZodNumber>;
560
+ silenceDurationMs: z.ZodOptional<z.ZodNumber>;
561
+ createResponse: z.ZodBoolean;
562
+ interruptResponse: z.ZodBoolean;
563
+ }, z.core.$strict>, z.ZodObject<{
564
+ type: z.ZodLiteral<"semantic_vad">;
565
+ eagerness: z.ZodEnum<{
566
+ low: "low";
567
+ medium: "medium";
568
+ high: "high";
569
+ auto: "auto";
570
+ }>;
571
+ createResponse: z.ZodBoolean;
572
+ interruptResponse: z.ZodBoolean;
573
+ }, z.core.$strict>], "type">;
574
+ inputAudioTranscription: z.ZodOptional<z.ZodObject<{
575
+ language: z.ZodOptional<z.ZodString>;
576
+ prompt: z.ZodOptional<z.ZodString>;
577
+ }, z.core.$strict>>;
578
+ translation: z.ZodOptional<z.ZodObject<{
579
+ targetLanguage: z.ZodString;
580
+ }, z.core.$strict>>;
581
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
582
+ type: z.ZodLiteral<"function">;
583
+ name: z.ZodString;
584
+ description: z.ZodOptional<z.ZodString>;
585
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
586
+ strict: z.ZodOptional<z.ZodBoolean>;
587
+ }, z.core.$strict>>>;
588
+ toolChoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
589
+ auto: "auto";
590
+ none: "none";
591
+ required: "required";
592
+ }>, z.ZodObject<{
593
+ type: z.ZodLiteral<"function">;
594
+ name: z.ZodString;
595
+ }, z.core.$strict>]>>;
596
+ temperature: z.ZodOptional<z.ZodNumber>;
597
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
598
+ }, z.core.$strict>;
599
+ schemaVersion: z.ZodLiteral<1>;
600
+ requestId: z.ZodString;
601
+ sequence: z.ZodNumber;
602
+ commandId: z.ZodOptional<z.ZodString>;
603
+ }, z.core.$strip>, z.ZodObject<{
604
+ type: z.ZodLiteral<"session.resumed">;
605
+ afterSequence: z.ZodNumber;
606
+ schemaVersion: z.ZodLiteral<1>;
607
+ requestId: z.ZodString;
608
+ sequence: z.ZodNumber;
609
+ commandId: z.ZodOptional<z.ZodString>;
610
+ }, z.core.$strip>, z.ZodObject<{
611
+ type: z.ZodLiteral<"command.accepted">;
612
+ commandId: z.ZodString;
613
+ duplicate: z.ZodBoolean;
614
+ schemaVersion: z.ZodLiteral<1>;
615
+ requestId: z.ZodString;
616
+ sequence: z.ZodNumber;
617
+ }, z.core.$strip>, z.ZodObject<{
618
+ type: z.ZodLiteral<"conversation.item.added">;
619
+ itemId: z.ZodString;
620
+ previousItemId: z.ZodOptional<z.ZodString>;
621
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
622
+ type: z.ZodLiteral<"message">;
623
+ itemId: z.ZodOptional<z.ZodString>;
624
+ role: z.ZodEnum<{
625
+ user: "user";
626
+ system: "system";
627
+ assistant: "assistant";
628
+ }>;
629
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
630
+ type: z.ZodLiteral<"input_text">;
631
+ text: z.ZodString;
632
+ }, z.core.$strict>, z.ZodObject<{
633
+ type: z.ZodLiteral<"input_audio">;
634
+ format: z.ZodEnum<{
635
+ pcm16_24khz: "pcm16_24khz";
636
+ g711_ulaw: "g711_ulaw";
637
+ g711_alaw: "g711_alaw";
638
+ }>;
639
+ data: z.ZodOptional<z.ZodString>;
640
+ transcript: z.ZodOptional<z.ZodString>;
641
+ }, z.core.$strict>, z.ZodObject<{
642
+ type: z.ZodLiteral<"output_text">;
643
+ text: z.ZodString;
644
+ }, z.core.$strict>, z.ZodObject<{
645
+ type: z.ZodLiteral<"output_audio">;
646
+ format: z.ZodEnum<{
647
+ pcm16_24khz: "pcm16_24khz";
648
+ g711_ulaw: "g711_ulaw";
649
+ g711_alaw: "g711_alaw";
650
+ }>;
651
+ transcript: z.ZodOptional<z.ZodString>;
652
+ }, z.core.$strict>], "type">>;
653
+ }, z.core.$strict>, z.ZodObject<{
654
+ type: z.ZodLiteral<"function_call">;
655
+ itemId: z.ZodOptional<z.ZodString>;
656
+ callId: z.ZodString;
657
+ name: z.ZodString;
658
+ arguments: z.ZodString;
659
+ }, z.core.$strict>, z.ZodObject<{
660
+ type: z.ZodLiteral<"function_call_output">;
661
+ itemId: z.ZodOptional<z.ZodString>;
662
+ callId: z.ZodString;
663
+ output: z.ZodString;
664
+ }, z.core.$strict>], "type">;
665
+ schemaVersion: z.ZodLiteral<1>;
666
+ requestId: z.ZodString;
667
+ sequence: z.ZodNumber;
668
+ commandId: z.ZodOptional<z.ZodString>;
669
+ }, z.core.$strip>, z.ZodObject<{
670
+ type: z.ZodLiteral<"conversation.item.done">;
671
+ itemId: z.ZodString;
672
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
673
+ type: z.ZodLiteral<"message">;
674
+ itemId: z.ZodOptional<z.ZodString>;
675
+ role: z.ZodEnum<{
676
+ user: "user";
677
+ system: "system";
678
+ assistant: "assistant";
679
+ }>;
680
+ content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
681
+ type: z.ZodLiteral<"input_text">;
682
+ text: z.ZodString;
683
+ }, z.core.$strict>, z.ZodObject<{
684
+ type: z.ZodLiteral<"input_audio">;
685
+ format: z.ZodEnum<{
686
+ pcm16_24khz: "pcm16_24khz";
687
+ g711_ulaw: "g711_ulaw";
688
+ g711_alaw: "g711_alaw";
689
+ }>;
690
+ data: z.ZodOptional<z.ZodString>;
691
+ transcript: z.ZodOptional<z.ZodString>;
692
+ }, z.core.$strict>, z.ZodObject<{
693
+ type: z.ZodLiteral<"output_text">;
694
+ text: z.ZodString;
695
+ }, z.core.$strict>, z.ZodObject<{
696
+ type: z.ZodLiteral<"output_audio">;
697
+ format: z.ZodEnum<{
698
+ pcm16_24khz: "pcm16_24khz";
699
+ g711_ulaw: "g711_ulaw";
700
+ g711_alaw: "g711_alaw";
701
+ }>;
702
+ transcript: z.ZodOptional<z.ZodString>;
703
+ }, z.core.$strict>], "type">>;
704
+ }, z.core.$strict>, z.ZodObject<{
705
+ type: z.ZodLiteral<"function_call">;
706
+ itemId: z.ZodOptional<z.ZodString>;
707
+ callId: z.ZodString;
708
+ name: z.ZodString;
709
+ arguments: z.ZodString;
710
+ }, z.core.$strict>, z.ZodObject<{
711
+ type: z.ZodLiteral<"function_call_output">;
712
+ itemId: z.ZodOptional<z.ZodString>;
713
+ callId: z.ZodString;
714
+ output: z.ZodString;
715
+ }, z.core.$strict>], "type">;
716
+ schemaVersion: z.ZodLiteral<1>;
717
+ requestId: z.ZodString;
718
+ sequence: z.ZodNumber;
719
+ commandId: z.ZodOptional<z.ZodString>;
720
+ }, z.core.$strip>, z.ZodObject<{
721
+ type: z.ZodLiteral<"conversation.item.deleted">;
722
+ itemId: z.ZodString;
723
+ schemaVersion: z.ZodLiteral<1>;
724
+ requestId: z.ZodString;
725
+ sequence: z.ZodNumber;
726
+ commandId: z.ZodOptional<z.ZodString>;
727
+ }, z.core.$strip>, z.ZodObject<{
728
+ type: z.ZodLiteral<"conversation.item.truncated">;
729
+ itemId: z.ZodString;
730
+ contentIndex: z.ZodNumber;
731
+ audioEndMs: z.ZodNumber;
732
+ schemaVersion: z.ZodLiteral<1>;
733
+ requestId: z.ZodString;
734
+ sequence: z.ZodNumber;
735
+ commandId: z.ZodOptional<z.ZodString>;
736
+ }, z.core.$strip>, z.ZodObject<{
737
+ type: z.ZodLiteral<"input_audio.speech_started">;
738
+ itemId: z.ZodString;
739
+ audioStartMs: z.ZodNumber;
740
+ schemaVersion: z.ZodLiteral<1>;
741
+ requestId: z.ZodString;
742
+ sequence: z.ZodNumber;
743
+ commandId: z.ZodOptional<z.ZodString>;
744
+ }, z.core.$strip>, z.ZodObject<{
745
+ type: z.ZodLiteral<"input_audio.speech_stopped">;
746
+ itemId: z.ZodString;
747
+ audioEndMs: z.ZodNumber;
748
+ schemaVersion: z.ZodLiteral<1>;
749
+ requestId: z.ZodString;
750
+ sequence: z.ZodNumber;
751
+ commandId: z.ZodOptional<z.ZodString>;
752
+ }, z.core.$strip>, z.ZodObject<{
753
+ type: z.ZodLiteral<"input_audio.committed">;
754
+ itemId: z.ZodString;
755
+ previousItemId: z.ZodOptional<z.ZodString>;
756
+ schemaVersion: z.ZodLiteral<1>;
757
+ requestId: z.ZodString;
758
+ sequence: z.ZodNumber;
759
+ commandId: z.ZodOptional<z.ZodString>;
760
+ }, z.core.$strip>, z.ZodObject<{
761
+ type: z.ZodLiteral<"input_audio.cleared">;
762
+ schemaVersion: z.ZodLiteral<1>;
763
+ requestId: z.ZodString;
764
+ sequence: z.ZodNumber;
765
+ commandId: z.ZodOptional<z.ZodString>;
766
+ }, z.core.$strip>, z.ZodObject<{
767
+ type: z.ZodLiteral<"response.created">;
768
+ responseId: z.ZodString;
769
+ schemaVersion: z.ZodLiteral<1>;
770
+ requestId: z.ZodString;
771
+ sequence: z.ZodNumber;
772
+ commandId: z.ZodOptional<z.ZodString>;
773
+ }, z.core.$strip>, z.ZodObject<{
774
+ type: z.ZodLiteral<"output_audio.delta">;
775
+ responseId: z.ZodString;
776
+ itemId: z.ZodString;
777
+ contentIndex: z.ZodNumber;
778
+ format: z.ZodEnum<{
779
+ pcm16_24khz: "pcm16_24khz";
780
+ g711_ulaw: "g711_ulaw";
781
+ g711_alaw: "g711_alaw";
782
+ }>;
783
+ data: z.ZodString;
784
+ schemaVersion: z.ZodLiteral<1>;
785
+ requestId: z.ZodString;
786
+ sequence: z.ZodNumber;
787
+ commandId: z.ZodOptional<z.ZodString>;
788
+ }, z.core.$strip>, z.ZodObject<{
789
+ type: z.ZodLiteral<"output_audio.done">;
790
+ responseId: z.ZodString;
791
+ itemId: z.ZodString;
792
+ contentIndex: z.ZodNumber;
793
+ schemaVersion: z.ZodLiteral<1>;
794
+ requestId: z.ZodString;
795
+ sequence: z.ZodNumber;
796
+ commandId: z.ZodOptional<z.ZodString>;
797
+ }, z.core.$strip>, z.ZodObject<{
798
+ type: z.ZodLiteral<"transcript.delta">;
799
+ source: z.ZodEnum<{
800
+ input_audio: "input_audio";
801
+ output_audio: "output_audio";
802
+ }>;
803
+ itemId: z.ZodString;
804
+ contentIndex: z.ZodNumber;
805
+ responseId: z.ZodOptional<z.ZodString>;
806
+ text: z.ZodString;
807
+ schemaVersion: z.ZodLiteral<1>;
808
+ requestId: z.ZodString;
809
+ sequence: z.ZodNumber;
810
+ commandId: z.ZodOptional<z.ZodString>;
811
+ }, z.core.$strip>, z.ZodObject<{
812
+ type: z.ZodLiteral<"transcript.done">;
813
+ source: z.ZodEnum<{
814
+ input_audio: "input_audio";
815
+ output_audio: "output_audio";
816
+ }>;
817
+ itemId: z.ZodString;
818
+ contentIndex: z.ZodNumber;
819
+ responseId: z.ZodOptional<z.ZodString>;
820
+ transcript: z.ZodString;
821
+ schemaVersion: z.ZodLiteral<1>;
822
+ requestId: z.ZodString;
823
+ sequence: z.ZodNumber;
824
+ commandId: z.ZodOptional<z.ZodString>;
825
+ }, z.core.$strip>, z.ZodObject<{
826
+ type: z.ZodLiteral<"text.delta">;
827
+ responseId: z.ZodString;
828
+ itemId: z.ZodString;
829
+ contentIndex: z.ZodNumber;
830
+ text: z.ZodString;
831
+ schemaVersion: z.ZodLiteral<1>;
832
+ requestId: z.ZodString;
833
+ sequence: z.ZodNumber;
834
+ commandId: z.ZodOptional<z.ZodString>;
835
+ }, z.core.$strip>, z.ZodObject<{
836
+ type: z.ZodLiteral<"tool_call">;
837
+ responseId: z.ZodString;
838
+ itemId: z.ZodString;
839
+ toolCallId: z.ZodString;
840
+ name: z.ZodOptional<z.ZodString>;
841
+ argumentsDelta: z.ZodOptional<z.ZodString>;
842
+ complete: z.ZodBoolean;
843
+ schemaVersion: z.ZodLiteral<1>;
844
+ requestId: z.ZodString;
845
+ sequence: z.ZodNumber;
846
+ commandId: z.ZodOptional<z.ZodString>;
847
+ }, z.core.$strip>, z.ZodObject<{
848
+ type: z.ZodLiteral<"response.done">;
849
+ responseId: z.ZodString;
850
+ status: z.ZodEnum<{
851
+ cancelled: "cancelled";
852
+ completed: "completed";
853
+ failed: "failed";
854
+ incomplete: "incomplete";
855
+ }>;
856
+ finishReason: z.ZodOptional<z.ZodEnum<{
857
+ content_filter: "content_filter";
858
+ cancelled: "cancelled";
859
+ refusal: "refusal";
860
+ stop: "stop";
861
+ length: "length";
862
+ tool_calls: "tool_calls";
863
+ }>>;
864
+ deploymentId: z.ZodString;
865
+ units: z.ZodArray<z.ZodObject<{
866
+ unit: z.ZodEnum<{
867
+ input_tokens: "input_tokens";
868
+ cached_input_tokens: "cached_input_tokens";
869
+ output_tokens: "output_tokens";
870
+ reasoning_tokens: "reasoning_tokens";
871
+ requests: "requests";
872
+ images: "images";
873
+ audio_input_milliseconds: "audio_input_milliseconds";
874
+ audio_output_milliseconds: "audio_output_milliseconds";
875
+ video_milliseconds: "video_milliseconds";
876
+ characters: "characters";
877
+ embeddings: "embeddings";
878
+ audio_input_tokens: "audio_input_tokens";
879
+ cached_audio_input_tokens: "cached_audio_input_tokens";
880
+ audio_output_tokens: "audio_output_tokens";
881
+ session_milliseconds: "session_milliseconds";
882
+ input_transcription_milliseconds: "input_transcription_milliseconds";
883
+ }>;
884
+ quantity: z.ZodNumber;
885
+ }, z.core.$strict>>;
886
+ usageSource: z.ZodEnum<{
887
+ provider_reported: "provider_reported";
888
+ oxy_measured: "oxy_measured";
889
+ estimated: "estimated";
890
+ }>;
891
+ schemaVersion: z.ZodLiteral<1>;
892
+ requestId: z.ZodString;
893
+ sequence: z.ZodNumber;
894
+ commandId: z.ZodOptional<z.ZodString>;
895
+ }, z.core.$strip>, z.ZodObject<{
896
+ type: z.ZodLiteral<"error">;
897
+ fatal: z.ZodBoolean;
898
+ error: z.ZodObject<{
899
+ schemaVersion: z.ZodLiteral<1>;
900
+ code: z.ZodEnum<{
901
+ invalid_request: "invalid_request";
902
+ authentication_failed: "authentication_failed";
903
+ permission_denied: "permission_denied";
904
+ insufficient_scope: "insufficient_scope";
905
+ model_not_found: "model_not_found";
906
+ unsupported_modality: "unsupported_modality";
907
+ context_length_exceeded: "context_length_exceeded";
908
+ request_too_large: "request_too_large";
909
+ output_limit_exceeded: "output_limit_exceeded";
910
+ idempotency_conflict: "idempotency_conflict";
911
+ insufficient_balance: "insufficient_balance";
912
+ spending_limit_exceeded: "spending_limit_exceeded";
913
+ quota_exceeded: "quota_exceeded";
914
+ byok_credential_invalid: "byok_credential_invalid";
915
+ policy_violation: "policy_violation";
916
+ commercial_permission_denied: "commercial_permission_denied";
917
+ no_route_available: "no_route_available";
918
+ upstream_content_filtered: "upstream_content_filtered";
919
+ cancelled: "cancelled";
920
+ rate_limited: "rate_limited";
921
+ provider_error: "provider_error";
922
+ provider_timeout: "provider_timeout";
923
+ provider_overloaded: "provider_overloaded";
924
+ service_unavailable: "service_unavailable";
925
+ internal_error: "internal_error";
926
+ deployment_unavailable: "deployment_unavailable";
927
+ provider_credential_invalid: "provider_credential_invalid";
928
+ provider_billing_refused: "provider_billing_refused";
929
+ }>;
930
+ message: z.ZodString;
931
+ retryable: z.ZodBoolean;
932
+ requestId: z.ZodString;
933
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
934
+ param: z.ZodOptional<z.ZodString>;
935
+ upstreamCategory: z.ZodOptional<z.ZodEnum<{
936
+ rate_limit: "rate_limit";
937
+ quota: "quota";
938
+ timeout: "timeout";
939
+ overloaded: "overloaded";
940
+ server_error: "server_error";
941
+ content_filter: "content_filter";
942
+ invalid_request: "invalid_request";
943
+ authentication: "authentication";
944
+ unknown: "unknown";
945
+ }>>;
946
+ providerError: z.ZodOptional<z.ZodObject<{
947
+ provider: z.ZodString;
948
+ status: z.ZodOptional<z.ZodNumber>;
949
+ code: z.ZodOptional<z.ZodString>;
950
+ message: z.ZodOptional<z.ZodString>;
951
+ }, z.core.$strict>>;
952
+ }, z.core.$strip>;
953
+ schemaVersion: z.ZodLiteral<1>;
954
+ requestId: z.ZodString;
955
+ sequence: z.ZodNumber;
956
+ commandId: z.ZodOptional<z.ZodString>;
957
+ }, z.core.$strip>, z.ZodObject<{
958
+ type: z.ZodLiteral<"session.closed">;
959
+ reason: z.ZodEnum<{
960
+ no_route_available: "no_route_available";
961
+ client_closed: "client_closed";
962
+ max_duration: "max_duration";
963
+ idle_timeout: "idle_timeout";
964
+ limit_exceeded: "limit_exceeded";
965
+ resume_expired: "resume_expired";
966
+ upstream_closed: "upstream_closed";
967
+ upstream_error: "upstream_error";
968
+ server_shutdown: "server_shutdown";
969
+ }>;
970
+ deploymentId: z.ZodOptional<z.ZodString>;
971
+ units: z.ZodArray<z.ZodObject<{
972
+ unit: z.ZodEnum<{
973
+ input_tokens: "input_tokens";
974
+ cached_input_tokens: "cached_input_tokens";
975
+ output_tokens: "output_tokens";
976
+ reasoning_tokens: "reasoning_tokens";
977
+ requests: "requests";
978
+ images: "images";
979
+ audio_input_milliseconds: "audio_input_milliseconds";
980
+ audio_output_milliseconds: "audio_output_milliseconds";
981
+ video_milliseconds: "video_milliseconds";
982
+ characters: "characters";
983
+ embeddings: "embeddings";
984
+ audio_input_tokens: "audio_input_tokens";
985
+ cached_audio_input_tokens: "cached_audio_input_tokens";
986
+ audio_output_tokens: "audio_output_tokens";
987
+ session_milliseconds: "session_milliseconds";
988
+ input_transcription_milliseconds: "input_transcription_milliseconds";
989
+ }>;
990
+ quantity: z.ZodNumber;
991
+ }, z.core.$strict>>;
992
+ usageSource: z.ZodEnum<{
993
+ provider_reported: "provider_reported";
994
+ oxy_measured: "oxy_measured";
995
+ estimated: "estimated";
996
+ }>;
997
+ closedAt: z.ZodString;
998
+ schemaVersion: z.ZodLiteral<1>;
999
+ requestId: z.ZodString;
1000
+ sequence: z.ZodNumber;
1001
+ commandId: z.ZodOptional<z.ZodString>;
1002
+ }, z.core.$strip>], "type">;
1003
+ export type RealtimeClientMetadata = z.infer<typeof realtimeClientMetadataSchema>;
1004
+ export type RealtimeSessionRequest = z.infer<typeof realtimeSessionRequestSchema>;
1005
+ export type RealtimeServerEvent = z.infer<typeof realtimeServerEventSchema>;