@kaana.ai/contracts 4.4.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,6 +50,25 @@ export declare const realtimeAudioFormatSchema: z.ZodEnum<{
50
50
  g711_ulaw: "g711_ulaw";
51
51
  g711_alaw: "g711_alaw";
52
52
  }>;
53
+ /**
54
+ * What a session's responses produce. Declared here, beside the encodings and
55
+ * for the same reason, since contract set 5.0.0: the catalogue publishes which
56
+ * sets of them a model serves (`capabilities.realtime.parameters`).
57
+ */
58
+ export declare const realtimeOutputModalitySchema: z.ZodEnum<{
59
+ text: "text";
60
+ audio: "audio";
61
+ }>;
62
+ /**
63
+ * How the end of a caller's turn is detected: the discriminant of
64
+ * `realtimeTurnDetectionSchema`, published per model by the catalogue
65
+ * (contract set 5.0.0).
66
+ */
67
+ export declare const realtimeTurnDetectionTypeSchema: z.ZodEnum<{
68
+ none: "none";
69
+ server_vad: "server_vad";
70
+ semantic_vad: "semantic_vad";
71
+ }>;
53
72
  /**
54
73
  * The media type a speech request's `response_format` produces. A client
55
74
  * knows it before the first byte, which is why the speech stream events do
@@ -42,6 +42,18 @@ export const audioInputMediaTypeSchema = z.enum([
42
42
  * catalogue cannot import the realtime module that imports it.
43
43
  */
44
44
  export const realtimeAudioFormatSchema = z.enum(['pcm16_24khz', 'g711_ulaw', 'g711_alaw']);
45
+ /**
46
+ * What a session's responses produce. Declared here, beside the encodings and
47
+ * for the same reason, since contract set 5.0.0: the catalogue publishes which
48
+ * sets of them a model serves (`capabilities.realtime.parameters`).
49
+ */
50
+ export const realtimeOutputModalitySchema = z.enum(['text', 'audio']);
51
+ /**
52
+ * How the end of a caller's turn is detected: the discriminant of
53
+ * `realtimeTurnDetectionSchema`, published per model by the catalogue
54
+ * (contract set 5.0.0).
55
+ */
56
+ export const realtimeTurnDetectionTypeSchema = z.enum(['none', 'server_vad', 'semantic_vad']);
45
57
  const SPEECH_MEDIA_TYPES = {
46
58
  mp3: 'audio/mpeg',
47
59
  opus: 'audio/ogg',
@@ -116,6 +116,120 @@ export declare const realtimeSessionKindSchema: z.ZodEnum<{
116
116
  export declare const realtimeSessionTransportSchema: z.ZodEnum<{
117
117
  websocket: "websocket";
118
118
  }>;
119
+ /** A closed interval. */
120
+ export declare const numberRangeSchema: z.ZodObject<{
121
+ min: z.ZodNumber;
122
+ max: z.ZodNumber;
123
+ }, z.core.$strict>;
124
+ /** One kind of tool choice: the modes, and `function` for one that names a tool. */
125
+ export declare const realtimeToolChoiceKindSchema: z.ZodEnum<{
126
+ function: "function";
127
+ none: "none";
128
+ auto: "auto";
129
+ required: "required";
130
+ }>;
131
+ /**
132
+ * One turn detection a realtime model serves (contract set 5.0.0).
133
+ *
134
+ * - `fixedResponses` — the detection always answers the turn it detected and
135
+ * lets the caller's speech interrupt the answer: it has neither switch, so a
136
+ * session must state `createResponse: true` and `interruptResponse: true`.
137
+ * - `threshold` — server_vad's `threshold` range; absent, the contract's 0–1.
138
+ * - `meteredUnits` — the units a session under this detection is billed in:
139
+ * what a caller multiplies the model's prices by to estimate a call. A
140
+ * provider that bills by the clock under one detection and by the audio
141
+ * under another states each.
142
+ */
143
+ export declare const realtimeTurnDetectionParametersSchema: z.ZodObject<{
144
+ type: z.ZodEnum<{
145
+ none: "none";
146
+ server_vad: "server_vad";
147
+ semantic_vad: "semantic_vad";
148
+ }>;
149
+ fixedResponses: z.ZodBoolean;
150
+ threshold: z.ZodOptional<z.ZodObject<{
151
+ min: z.ZodNumber;
152
+ max: z.ZodNumber;
153
+ }, z.core.$strict>>;
154
+ meteredUnits: z.ZodArray<z.ZodEnum<{
155
+ input_tokens: "input_tokens";
156
+ cached_input_tokens: "cached_input_tokens";
157
+ output_tokens: "output_tokens";
158
+ reasoning_tokens: "reasoning_tokens";
159
+ requests: "requests";
160
+ images: "images";
161
+ audio_input_milliseconds: "audio_input_milliseconds";
162
+ audio_output_milliseconds: "audio_output_milliseconds";
163
+ video_milliseconds: "video_milliseconds";
164
+ characters: "characters";
165
+ embeddings: "embeddings";
166
+ audio_input_tokens: "audio_input_tokens";
167
+ cached_audio_input_tokens: "cached_audio_input_tokens";
168
+ audio_output_tokens: "audio_output_tokens";
169
+ session_milliseconds: "session_milliseconds";
170
+ input_transcription_milliseconds: "input_transcription_milliseconds";
171
+ }>>;
172
+ }, z.core.$strict>;
173
+ /**
174
+ * What a realtime model's session configuration may set, and within which
175
+ * bounds (contract set 5.0.0): the provider's reviewed statement, which Kaana's
176
+ * adapter enforces and the catalogue publishes, so a session built from it is
177
+ * one the model serves. `checkRealtimeSessionOpen` applies it.
178
+ *
179
+ * - `turnDetection` — every detection served.
180
+ * - `outputModalities` — every set of modalities one response may produce
181
+ * (each sorted): a model that answers aloud whatever it is asked does not
182
+ * serve `["text"]`.
183
+ * - `toolChoice` — every kind of tool choice served; always holds `auto`.
184
+ * - `maxOutputTokens` — the largest per-response cap; absent, the model has
185
+ * none and `maxOutputTokens` is refused.
186
+ * - `inputTranscriptionPrompt` — `config.inputAudioTranscription.prompt` is
187
+ * taken.
188
+ */
189
+ export declare const realtimeParametersSchema: z.ZodObject<{
190
+ turnDetection: z.ZodArray<z.ZodObject<{
191
+ type: z.ZodEnum<{
192
+ none: "none";
193
+ server_vad: "server_vad";
194
+ semantic_vad: "semantic_vad";
195
+ }>;
196
+ fixedResponses: z.ZodBoolean;
197
+ threshold: z.ZodOptional<z.ZodObject<{
198
+ min: z.ZodNumber;
199
+ max: z.ZodNumber;
200
+ }, z.core.$strict>>;
201
+ meteredUnits: z.ZodArray<z.ZodEnum<{
202
+ input_tokens: "input_tokens";
203
+ cached_input_tokens: "cached_input_tokens";
204
+ output_tokens: "output_tokens";
205
+ reasoning_tokens: "reasoning_tokens";
206
+ requests: "requests";
207
+ images: "images";
208
+ audio_input_milliseconds: "audio_input_milliseconds";
209
+ audio_output_milliseconds: "audio_output_milliseconds";
210
+ video_milliseconds: "video_milliseconds";
211
+ characters: "characters";
212
+ embeddings: "embeddings";
213
+ audio_input_tokens: "audio_input_tokens";
214
+ cached_audio_input_tokens: "cached_audio_input_tokens";
215
+ audio_output_tokens: "audio_output_tokens";
216
+ session_milliseconds: "session_milliseconds";
217
+ input_transcription_milliseconds: "input_transcription_milliseconds";
218
+ }>>;
219
+ }, z.core.$strict>>;
220
+ outputModalities: z.ZodArray<z.ZodArray<z.ZodEnum<{
221
+ text: "text";
222
+ audio: "audio";
223
+ }>>>;
224
+ toolChoice: z.ZodArray<z.ZodEnum<{
225
+ function: "function";
226
+ none: "none";
227
+ auto: "auto";
228
+ required: "required";
229
+ }>>;
230
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
231
+ inputTranscriptionPrompt: z.ZodBoolean;
232
+ }, z.core.$strict>;
119
233
  /**
120
234
  * What a deployment can execute as a realtime session. Present only on a model
121
235
  * that holds sessions; absent means it holds none, which is the state of every
@@ -133,6 +247,8 @@ export declare const realtimeSessionTransportSchema: z.ZodEnum<{
133
247
  * - `audioFormats` — the realtime encodings a session may name as
134
248
  * `config.inputAudioFormat` and `config.outputAudioFormat`. These are not the
135
249
  * media types of `audio.audioFormats`, which describe files.
250
+ * - `parameters` (contract set 5.0.0) — what a session configuration may set
251
+ * ({@link realtimeParametersSchema}). Absent: undeclared, not checked.
136
252
  */
137
253
  export declare const modelRealtimeCapabilitiesSchema: z.ZodObject<{
138
254
  transports: z.ZodArray<z.ZodEnum<{
@@ -156,6 +272,50 @@ export declare const modelRealtimeCapabilitiesSchema: z.ZodObject<{
156
272
  g711_alaw: "g711_alaw";
157
273
  }>>;
158
274
  }, z.core.$strict>>;
275
+ parameters: z.ZodOptional<z.ZodObject<{
276
+ turnDetection: z.ZodArray<z.ZodObject<{
277
+ type: z.ZodEnum<{
278
+ none: "none";
279
+ server_vad: "server_vad";
280
+ semantic_vad: "semantic_vad";
281
+ }>;
282
+ fixedResponses: z.ZodBoolean;
283
+ threshold: z.ZodOptional<z.ZodObject<{
284
+ min: z.ZodNumber;
285
+ max: z.ZodNumber;
286
+ }, z.core.$strict>>;
287
+ meteredUnits: z.ZodArray<z.ZodEnum<{
288
+ input_tokens: "input_tokens";
289
+ cached_input_tokens: "cached_input_tokens";
290
+ output_tokens: "output_tokens";
291
+ reasoning_tokens: "reasoning_tokens";
292
+ requests: "requests";
293
+ images: "images";
294
+ audio_input_milliseconds: "audio_input_milliseconds";
295
+ audio_output_milliseconds: "audio_output_milliseconds";
296
+ video_milliseconds: "video_milliseconds";
297
+ characters: "characters";
298
+ embeddings: "embeddings";
299
+ audio_input_tokens: "audio_input_tokens";
300
+ cached_audio_input_tokens: "cached_audio_input_tokens";
301
+ audio_output_tokens: "audio_output_tokens";
302
+ session_milliseconds: "session_milliseconds";
303
+ input_transcription_milliseconds: "input_transcription_milliseconds";
304
+ }>>;
305
+ }, z.core.$strict>>;
306
+ outputModalities: z.ZodArray<z.ZodArray<z.ZodEnum<{
307
+ text: "text";
308
+ audio: "audio";
309
+ }>>>;
310
+ toolChoice: z.ZodArray<z.ZodEnum<{
311
+ function: "function";
312
+ none: "none";
313
+ auto: "auto";
314
+ required: "required";
315
+ }>>;
316
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
317
+ inputTranscriptionPrompt: z.ZodBoolean;
318
+ }, z.core.$strict>>;
159
319
  }, z.core.$strict>;
160
320
  /**
161
321
  * What a model can do, in the terms a caller has to decide against before
@@ -225,6 +385,50 @@ export declare const modelCapabilitiesSchema: z.ZodObject<{
225
385
  g711_alaw: "g711_alaw";
226
386
  }>>;
227
387
  }, z.core.$strict>>;
388
+ parameters: z.ZodOptional<z.ZodObject<{
389
+ turnDetection: z.ZodArray<z.ZodObject<{
390
+ type: z.ZodEnum<{
391
+ none: "none";
392
+ server_vad: "server_vad";
393
+ semantic_vad: "semantic_vad";
394
+ }>;
395
+ fixedResponses: z.ZodBoolean;
396
+ threshold: z.ZodOptional<z.ZodObject<{
397
+ min: z.ZodNumber;
398
+ max: z.ZodNumber;
399
+ }, z.core.$strict>>;
400
+ meteredUnits: z.ZodArray<z.ZodEnum<{
401
+ input_tokens: "input_tokens";
402
+ cached_input_tokens: "cached_input_tokens";
403
+ output_tokens: "output_tokens";
404
+ reasoning_tokens: "reasoning_tokens";
405
+ requests: "requests";
406
+ images: "images";
407
+ audio_input_milliseconds: "audio_input_milliseconds";
408
+ audio_output_milliseconds: "audio_output_milliseconds";
409
+ video_milliseconds: "video_milliseconds";
410
+ characters: "characters";
411
+ embeddings: "embeddings";
412
+ audio_input_tokens: "audio_input_tokens";
413
+ cached_audio_input_tokens: "cached_audio_input_tokens";
414
+ audio_output_tokens: "audio_output_tokens";
415
+ session_milliseconds: "session_milliseconds";
416
+ input_transcription_milliseconds: "input_transcription_milliseconds";
417
+ }>>;
418
+ }, z.core.$strict>>;
419
+ outputModalities: z.ZodArray<z.ZodArray<z.ZodEnum<{
420
+ text: "text";
421
+ audio: "audio";
422
+ }>>>;
423
+ toolChoice: z.ZodArray<z.ZodEnum<{
424
+ function: "function";
425
+ none: "none";
426
+ auto: "auto";
427
+ required: "required";
428
+ }>>;
429
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
430
+ inputTranscriptionPrompt: z.ZodBoolean;
431
+ }, z.core.$strict>>;
228
432
  }, z.core.$strict>>;
229
433
  }, z.core.$strict>;
230
434
  /**
@@ -352,6 +556,16 @@ export declare const voiceSchema: z.ZodObject<{
352
556
  * none; a caller that needs a language then cannot choose the model.
353
557
  * `gender` is published only where it has been reviewed against the
354
558
  * provider's own catalogue; absent is unknown.
559
+ *
560
+ * Contract set 5.0.0:
561
+ *
562
+ * - `detectsLanguage` — naming no language lets the model detect it. A caller
563
+ * whose language is not in `languages` omits it rather than losing the
564
+ * model; absent is undeclared.
565
+ * - `transcriptionPrompt` — a transcription request may carry a `prompt`.
566
+ * Absent or `false`: one that does is refused before anything is held.
567
+ * - A TRANSCRIPTION model's `languages` are exactly what a request may name in
568
+ * `language`, and its `audioFormats.input` exactly what it uploads.
355
569
  */
356
570
  export declare const modelAudioCapabilitiesSchema: z.ZodObject<{
357
571
  voices: z.ZodArray<z.ZodObject<{
@@ -365,6 +579,8 @@ export declare const modelAudioCapabilitiesSchema: z.ZodObject<{
365
579
  }>>;
366
580
  }, z.core.$strict>>;
367
581
  languages: z.ZodArray<z.ZodString>;
582
+ detectsLanguage: z.ZodOptional<z.ZodBoolean>;
583
+ transcriptionPrompt: z.ZodOptional<z.ZodBoolean>;
368
584
  audioFormats: z.ZodObject<{
369
585
  input: z.ZodArray<z.ZodEnum<{
370
586
  "audio/mpeg": "audio/mpeg";
@@ -476,6 +692,50 @@ export declare const modelSchema: z.ZodObject<{
476
692
  g711_alaw: "g711_alaw";
477
693
  }>>;
478
694
  }, z.core.$strict>>;
695
+ parameters: z.ZodOptional<z.ZodObject<{
696
+ turnDetection: z.ZodArray<z.ZodObject<{
697
+ type: z.ZodEnum<{
698
+ none: "none";
699
+ server_vad: "server_vad";
700
+ semantic_vad: "semantic_vad";
701
+ }>;
702
+ fixedResponses: z.ZodBoolean;
703
+ threshold: z.ZodOptional<z.ZodObject<{
704
+ min: z.ZodNumber;
705
+ max: z.ZodNumber;
706
+ }, z.core.$strict>>;
707
+ meteredUnits: z.ZodArray<z.ZodEnum<{
708
+ input_tokens: "input_tokens";
709
+ cached_input_tokens: "cached_input_tokens";
710
+ output_tokens: "output_tokens";
711
+ reasoning_tokens: "reasoning_tokens";
712
+ requests: "requests";
713
+ images: "images";
714
+ audio_input_milliseconds: "audio_input_milliseconds";
715
+ audio_output_milliseconds: "audio_output_milliseconds";
716
+ video_milliseconds: "video_milliseconds";
717
+ characters: "characters";
718
+ embeddings: "embeddings";
719
+ audio_input_tokens: "audio_input_tokens";
720
+ cached_audio_input_tokens: "cached_audio_input_tokens";
721
+ audio_output_tokens: "audio_output_tokens";
722
+ session_milliseconds: "session_milliseconds";
723
+ input_transcription_milliseconds: "input_transcription_milliseconds";
724
+ }>>;
725
+ }, z.core.$strict>>;
726
+ outputModalities: z.ZodArray<z.ZodArray<z.ZodEnum<{
727
+ text: "text";
728
+ audio: "audio";
729
+ }>>>;
730
+ toolChoice: z.ZodArray<z.ZodEnum<{
731
+ function: "function";
732
+ none: "none";
733
+ auto: "auto";
734
+ required: "required";
735
+ }>>;
736
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
737
+ inputTranscriptionPrompt: z.ZodBoolean;
738
+ }, z.core.$strict>>;
479
739
  }, z.core.$strict>>;
480
740
  }, z.core.$strict>;
481
741
  audio: z.ZodOptional<z.ZodObject<{
@@ -490,6 +750,8 @@ export declare const modelSchema: z.ZodObject<{
490
750
  }>>;
491
751
  }, z.core.$strict>>;
492
752
  languages: z.ZodArray<z.ZodString>;
753
+ detectsLanguage: z.ZodOptional<z.ZodBoolean>;
754
+ transcriptionPrompt: z.ZodOptional<z.ZodBoolean>;
493
755
  audioFormats: z.ZodObject<{
494
756
  input: z.ZodArray<z.ZodEnum<{
495
757
  "audio/mpeg": "audio/mpeg";
@@ -691,6 +953,50 @@ export declare const modelListSchema: z.ZodObject<{
691
953
  g711_alaw: "g711_alaw";
692
954
  }>>;
693
955
  }, z.core.$strict>>;
956
+ parameters: z.ZodOptional<z.ZodObject<{
957
+ turnDetection: z.ZodArray<z.ZodObject<{
958
+ type: z.ZodEnum<{
959
+ none: "none";
960
+ server_vad: "server_vad";
961
+ semantic_vad: "semantic_vad";
962
+ }>;
963
+ fixedResponses: z.ZodBoolean;
964
+ threshold: z.ZodOptional<z.ZodObject<{
965
+ min: z.ZodNumber;
966
+ max: z.ZodNumber;
967
+ }, z.core.$strict>>;
968
+ meteredUnits: z.ZodArray<z.ZodEnum<{
969
+ input_tokens: "input_tokens";
970
+ cached_input_tokens: "cached_input_tokens";
971
+ output_tokens: "output_tokens";
972
+ reasoning_tokens: "reasoning_tokens";
973
+ requests: "requests";
974
+ images: "images";
975
+ audio_input_milliseconds: "audio_input_milliseconds";
976
+ audio_output_milliseconds: "audio_output_milliseconds";
977
+ video_milliseconds: "video_milliseconds";
978
+ characters: "characters";
979
+ embeddings: "embeddings";
980
+ audio_input_tokens: "audio_input_tokens";
981
+ cached_audio_input_tokens: "cached_audio_input_tokens";
982
+ audio_output_tokens: "audio_output_tokens";
983
+ session_milliseconds: "session_milliseconds";
984
+ input_transcription_milliseconds: "input_transcription_milliseconds";
985
+ }>>;
986
+ }, z.core.$strict>>;
987
+ outputModalities: z.ZodArray<z.ZodArray<z.ZodEnum<{
988
+ text: "text";
989
+ audio: "audio";
990
+ }>>>;
991
+ toolChoice: z.ZodArray<z.ZodEnum<{
992
+ function: "function";
993
+ none: "none";
994
+ auto: "auto";
995
+ required: "required";
996
+ }>>;
997
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
998
+ inputTranscriptionPrompt: z.ZodBoolean;
999
+ }, z.core.$strict>>;
694
1000
  }, z.core.$strict>>;
695
1001
  }, z.core.$strict>;
696
1002
  audio: z.ZodOptional<z.ZodObject<{
@@ -705,6 +1011,8 @@ export declare const modelListSchema: z.ZodObject<{
705
1011
  }>>;
706
1012
  }, z.core.$strict>>;
707
1013
  languages: z.ZodArray<z.ZodString>;
1014
+ detectsLanguage: z.ZodOptional<z.ZodBoolean>;
1015
+ transcriptionPrompt: z.ZodOptional<z.ZodBoolean>;
708
1016
  audioFormats: z.ZodObject<{
709
1017
  input: z.ZodArray<z.ZodEnum<{
710
1018
  "audio/mpeg": "audio/mpeg";
@@ -898,6 +1206,9 @@ export type InferenceApiFormat = z.infer<typeof inferenceApiFormatSchema>;
898
1206
  export type RealtimeSessionKind = z.infer<typeof realtimeSessionKindSchema>;
899
1207
  export type RealtimeSessionTransport = z.infer<typeof realtimeSessionTransportSchema>;
900
1208
  export type ModelRealtimeCapabilities = z.infer<typeof modelRealtimeCapabilitiesSchema>;
1209
+ export type RealtimeParameters = z.infer<typeof realtimeParametersSchema>;
1210
+ export type RealtimeTurnDetectionParameters = z.infer<typeof realtimeTurnDetectionParametersSchema>;
1211
+ export type RealtimeToolChoiceKind = z.infer<typeof realtimeToolChoiceKindSchema>;
901
1212
  export type ModelCapabilities = z.infer<typeof modelCapabilitiesSchema>;
902
1213
  export type ModelLicense = z.infer<typeof modelLicenseSchema>;
903
1214
  export type ModelProvenance = z.infer<typeof modelProvenanceSchema>;
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { z } from 'zod';
7
7
  import { inferenceDateSchema, inferenceHttpsUrlSchema, inferenceRegionSchema, inferenceTimestampSchema, modelIdSchema, modelReferenceSchema, modelRevisionLabelSchema, publisherSlugSchema, } from './identifiers.js';
8
- import { audioInputMediaTypeSchema, languageTagSchema, realtimeAudioFormatSchema, } from './audioFormats.js';
9
- import { priceSnapshotSchema } from './money.js';
8
+ import { audioInputMediaTypeSchema, languageTagSchema, realtimeAudioFormatSchema, realtimeOutputModalitySchema, realtimeTurnDetectionTypeSchema, } from './audioFormats.js';
9
+ import { priceSnapshotSchema, usageUnitSchema } from './money.js';
10
10
  import { inferenceAudioMediaTypeSchema } from './streamEvents.js';
11
11
  /** Input/request modalities; structured decisions are an output, never an input. */
12
12
  export const inferenceModalitySchema = z.enum(['text', 'image', 'audio', 'video', 'embedding']);
@@ -94,6 +94,68 @@ export const realtimeSessionKindSchema = z.enum(['conversation', 'transcription'
94
94
  * deployment can actually execute them.
95
95
  */
96
96
  export const realtimeSessionTransportSchema = z.enum(['websocket']);
97
+ /** A closed interval. */
98
+ export const numberRangeSchema = z.object({ min: z.number(), max: z.number() }).strict();
99
+ /** One kind of tool choice: the modes, and `function` for one that names a tool. */
100
+ export const realtimeToolChoiceKindSchema = z.enum(['auto', 'none', 'required', 'function']);
101
+ /**
102
+ * One turn detection a realtime model serves (contract set 5.0.0).
103
+ *
104
+ * - `fixedResponses` — the detection always answers the turn it detected and
105
+ * lets the caller's speech interrupt the answer: it has neither switch, so a
106
+ * session must state `createResponse: true` and `interruptResponse: true`.
107
+ * - `threshold` — server_vad's `threshold` range; absent, the contract's 0–1.
108
+ * - `meteredUnits` — the units a session under this detection is billed in:
109
+ * what a caller multiplies the model's prices by to estimate a call. A
110
+ * provider that bills by the clock under one detection and by the audio
111
+ * under another states each.
112
+ */
113
+ export const realtimeTurnDetectionParametersSchema = z
114
+ .object({
115
+ type: realtimeTurnDetectionTypeSchema,
116
+ fixedResponses: z.boolean(),
117
+ threshold: numberRangeSchema.optional(),
118
+ meteredUnits: z.array(usageUnitSchema).min(1),
119
+ })
120
+ .strict();
121
+ /**
122
+ * What a realtime model's session configuration may set, and within which
123
+ * bounds (contract set 5.0.0): the provider's reviewed statement, which Kaana's
124
+ * adapter enforces and the catalogue publishes, so a session built from it is
125
+ * one the model serves. `checkRealtimeSessionOpen` applies it.
126
+ *
127
+ * - `turnDetection` — every detection served.
128
+ * - `outputModalities` — every set of modalities one response may produce
129
+ * (each sorted): a model that answers aloud whatever it is asked does not
130
+ * serve `["text"]`.
131
+ * - `toolChoice` — every kind of tool choice served; always holds `auto`.
132
+ * - `maxOutputTokens` — the largest per-response cap; absent, the model has
133
+ * none and `maxOutputTokens` is refused.
134
+ * - `inputTranscriptionPrompt` — `config.inputAudioTranscription.prompt` is
135
+ * taken.
136
+ */
137
+ export const realtimeParametersSchema = z
138
+ .object({
139
+ turnDetection: z.array(realtimeTurnDetectionParametersSchema).min(1),
140
+ outputModalities: z.array(z.array(realtimeOutputModalitySchema).min(1).max(2)).min(1),
141
+ toolChoice: z.array(realtimeToolChoiceKindSchema).min(1),
142
+ maxOutputTokens: z.number().int().positive().safe().optional(),
143
+ inputTranscriptionPrompt: z.boolean(),
144
+ })
145
+ .strict()
146
+ .superRefine((parameters, ctx) => {
147
+ if (!parameters.toolChoice.includes('auto')) {
148
+ ctx.addIssue({ code: 'custom', path: ['toolChoice'], message: 'auto is always served' });
149
+ }
150
+ const kinds = parameters.turnDetection.map((detection) => detection.type);
151
+ if (new Set(kinds).size !== kinds.length) {
152
+ ctx.addIssue({
153
+ code: 'custom',
154
+ path: ['turnDetection'],
155
+ message: 'each detection is declared once',
156
+ });
157
+ }
158
+ });
97
159
  /**
98
160
  * What a deployment can execute as a realtime session. Present only on a model
99
161
  * that holds sessions; absent means it holds none, which is the state of every
@@ -111,6 +173,8 @@ export const realtimeSessionTransportSchema = z.enum(['websocket']);
111
173
  * - `audioFormats` — the realtime encodings a session may name as
112
174
  * `config.inputAudioFormat` and `config.outputAudioFormat`. These are not the
113
175
  * media types of `audio.audioFormats`, which describe files.
176
+ * - `parameters` (contract set 5.0.0) — what a session configuration may set
177
+ * ({@link realtimeParametersSchema}). Absent: undeclared, not checked.
114
178
  */
115
179
  export const modelRealtimeCapabilitiesSchema = z
116
180
  .object({
@@ -124,6 +188,7 @@ export const modelRealtimeCapabilitiesSchema = z
124
188
  })
125
189
  .strict()
126
190
  .optional(),
191
+ parameters: realtimeParametersSchema.optional(),
127
192
  })
128
193
  .strict();
129
194
  /**
@@ -378,11 +443,23 @@ export const voiceSchema = z
378
443
  * none; a caller that needs a language then cannot choose the model.
379
444
  * `gender` is published only where it has been reviewed against the
380
445
  * provider's own catalogue; absent is unknown.
446
+ *
447
+ * Contract set 5.0.0:
448
+ *
449
+ * - `detectsLanguage` — naming no language lets the model detect it. A caller
450
+ * whose language is not in `languages` omits it rather than losing the
451
+ * model; absent is undeclared.
452
+ * - `transcriptionPrompt` — a transcription request may carry a `prompt`.
453
+ * Absent or `false`: one that does is refused before anything is held.
454
+ * - A TRANSCRIPTION model's `languages` are exactly what a request may name in
455
+ * `language`, and its `audioFormats.input` exactly what it uploads.
381
456
  */
382
457
  export const modelAudioCapabilitiesSchema = z
383
458
  .object({
384
459
  voices: z.array(voiceSchema),
385
460
  languages: z.array(languageTagSchema),
461
+ detectsLanguage: z.boolean().optional(),
462
+ transcriptionPrompt: z.boolean().optional(),
386
463
  audioFormats: z
387
464
  .object({
388
465
  input: z.array(audioInputMediaTypeSchema),
@@ -172,8 +172,8 @@ export declare const chatCompletionsRequestSchema: z.ZodObject<{
172
172
  }, z.core.$strict>;
173
173
  }, z.core.$strict>>>;
174
174
  tool_choice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
175
- auto: "auto";
176
175
  none: "none";
176
+ auto: "auto";
177
177
  required: "required";
178
178
  }>, z.ZodObject<{
179
179
  type: z.ZodLiteral<"function">;
@@ -205,8 +205,8 @@ export declare const toolDefinitionSchema: z.ZodObject<{
205
205
  }, z.core.$strict>;
206
206
  /** Whether, and which, tool the model must call. */
207
207
  export declare const toolChoiceSchema: z.ZodUnion<readonly [z.ZodEnum<{
208
- auto: "auto";
209
208
  none: "none";
209
+ auto: "auto";
210
210
  required: "required";
211
211
  }>, z.ZodObject<{
212
212
  type: z.ZodLiteral<"function">;
@@ -250,6 +250,17 @@ export declare const inferenceSpeechParametersSchema: z.ZodObject<{
250
250
  }>;
251
251
  speed: z.ZodOptional<z.ZodNumber>;
252
252
  }, z.core.$strict>;
253
+ /**
254
+ * Parameters for a file transcription, preserved in the signed request
255
+ * (contract set 4.5.0). `language` is the caller's statement of what is spoken,
256
+ * in the tag the model's catalogue `audio.languages` declares; absent lets the
257
+ * model detect it. An adapter whose provider takes no language refuses one
258
+ * rather than dropping it.
259
+ */
260
+ export declare const inferenceTranscriptionParametersSchema: z.ZodObject<{
261
+ language: z.ZodOptional<z.ZodString>;
262
+ prompt: z.ZodOptional<z.ZodString>;
263
+ }, z.core.$strict>;
253
264
  /**
254
265
  * Spoken output from a CONVERSATIONAL model (contract set 3.2.0) — an audio chat
255
266
  * model answering in its own voice, as opposed to `speech`, which reads given
@@ -283,6 +294,7 @@ export declare const inferenceAudioOutputParametersSchema: z.ZodObject<{
283
294
  */
284
295
  export declare const requestLabelsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
285
296
  export type InferenceSpeechParameters = z.infer<typeof inferenceSpeechParametersSchema>;
297
+ export type InferenceTranscriptionParameters = z.infer<typeof inferenceTranscriptionParametersSchema>;
286
298
  export type InferenceAudioOutputParameters = z.infer<typeof inferenceAudioOutputParametersSchema>;
287
299
  export type InferenceContentSource = z.infer<typeof inferenceContentSourceSchema>;
288
300
  export type InferenceContentPart = z.infer<typeof inferenceContentPartSchema>;
@@ -5,6 +5,7 @@
5
5
  * Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/request.ts`) by Kaana ADR 0002.
6
6
  */
7
7
  import { z } from 'zod';
8
+ import { languageTagSchema } from './audioFormats.js';
8
9
  import { reasoningEffortSchema } from './catalogue.js';
9
10
  /**
10
11
  * Where binary or remote content comes from.
@@ -219,6 +220,20 @@ export const inferenceSpeechParametersSchema = z
219
220
  speed: z.number().min(0.25).max(4).optional(),
220
221
  })
221
222
  .strict();
223
+ /**
224
+ * Parameters for a file transcription, preserved in the signed request
225
+ * (contract set 4.5.0). `language` is the caller's statement of what is spoken,
226
+ * in the tag the model's catalogue `audio.languages` declares; absent lets the
227
+ * model detect it. An adapter whose provider takes no language refuses one
228
+ * rather than dropping it.
229
+ */
230
+ export const inferenceTranscriptionParametersSchema = z
231
+ .object({
232
+ language: languageTagSchema.optional(),
233
+ /** Vocabulary or context, never an instruction (contract set 5.0.0). */
234
+ prompt: z.string().max(4096).optional(),
235
+ })
236
+ .strict();
222
237
  /**
223
238
  * Spoken output from a CONVERSATIONAL model (contract set 3.2.0) — an audio chat
224
239
  * model answering in its own voice, as opposed to `speech`, which reads given