1/**
2 * @stability unstable
3 * @since 1.0.0
4 */
5
6import * as Data from "effect/Data"
7import * as Effect from "effect/Effect"
8import * as Sse from "effect/encoding/Sse"
9import * as HttpClient from "effect/http/HttpClient"
10import * as HttpClientError from "effect/http/HttpClientError"
11import * as HttpClientRequest from "effect/http/HttpClientRequest"
12import * as HttpClientResponse from "effect/http/HttpClientResponse"
13import type { SchemaError } from "effect/Schema"
14import * as Schema from "effect/Schema"
15import * as Stream from "effect/Stream"
16// non-recursive definitions
17export type AddUploadPartRequest = { readonly "data": string }
18export const AddUploadPartRequest = Schema.Struct({
19 "data": Schema.String.annotate({ "description": "The chunk of bytes for this Part.\n", "format": "binary" })
20})
21export type AdminApiKey = {
22 readonly "object": "organization.admin_api_key"
23 readonly "id": string
24 readonly "name"?: string | null
25 readonly "redacted_value": string
26 readonly "created_at": number
27 readonly "last_used_at"?: number | null
28 readonly "owner": {
29 readonly "type"?: string
30 readonly "object"?: string
31 readonly "id"?: string
32 readonly "name"?: string
33 readonly "created_at"?: number
34 readonly "role"?: string
35 }
36}
37export const AdminApiKey = Schema.Struct({
38 "object": Schema.Literal("organization.admin_api_key").annotate({
39 "description": "The object type, which is always `organization.admin_api_key`"
40 }),
41 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
42 "name": Schema.optionalKey(
43 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the API key" })
44 ),
45 "redacted_value": Schema.String.annotate({ "description": "The redacted value of the API key" }),
46 "created_at": Schema.Number.annotate({
47 "description": "The Unix timestamp (in seconds) of when the API key was created",
48 "format": "unixtime"
49 }).check(Schema.isInt()),
50 "last_used_at": Schema.optionalKey(
51 Schema.Union([
52 Schema.Number.annotate({
53 "description": "The Unix timestamp (in seconds) of when the API key was last used",
54 "format": "unixtime"
55 }).check(Schema.isInt()),
56 Schema.Null
57 ])
58 ),
59 "owner": Schema.Struct({
60 "type": Schema.optionalKey(Schema.String.annotate({ "description": "Always `user`" })),
61 "object": Schema.optionalKey(
62 Schema.String.annotate({ "description": "The object type, which is always organization.user" })
63 ),
64 "id": Schema.optionalKey(
65 Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" })
66 ),
67 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the user" })),
68 "created_at": Schema.optionalKey(
69 Schema.Number.annotate({
70 "description": "The Unix timestamp (in seconds) of when the user was created",
71 "format": "unixtime"
72 }).check(Schema.isInt())
73 ),
74 "role": Schema.optionalKey(Schema.String.annotate({ "description": "Always `owner`" }))
75 })
76}).annotate({ "description": "Represents an individual Admin API key in an org." })
77export type AdminApiKeyCreateResponse = {
78 readonly "object": "organization.admin_api_key"
79 readonly "id": string
80 readonly "name"?: string | null
81 readonly "redacted_value": string
82 readonly "created_at": number
83 readonly "last_used_at"?: number | null
84 readonly "owner": {
85 readonly "type"?: string
86 readonly "object"?: string
87 readonly "id"?: string
88 readonly "name"?: string
89 readonly "created_at"?: number
90 readonly "role"?: string
91 }
92 readonly "value": string
93}
94export const AdminApiKeyCreateResponse = Schema.Struct({
95 "object": Schema.Literal("organization.admin_api_key").annotate({
96 "description": "The object type, which is always `organization.admin_api_key`"
97 }),
98 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
99 "name": Schema.optionalKey(
100 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the API key" })
101 ),
102 "redacted_value": Schema.String.annotate({ "description": "The redacted value of the API key" }),
103 "created_at": Schema.Number.annotate({
104 "description": "The Unix timestamp (in seconds) of when the API key was created",
105 "format": "unixtime"
106 }).check(Schema.isInt()),
107 "last_used_at": Schema.optionalKey(
108 Schema.Union([
109 Schema.Number.annotate({
110 "description": "The Unix timestamp (in seconds) of when the API key was last used",
111 "format": "unixtime"
112 }).check(Schema.isInt()),
113 Schema.Null
114 ])
115 ),
116 "owner": Schema.Struct({
117 "type": Schema.optionalKey(Schema.String.annotate({ "description": "Always `user`" })),
118 "object": Schema.optionalKey(
119 Schema.String.annotate({ "description": "The object type, which is always organization.user" })
120 ),
121 "id": Schema.optionalKey(
122 Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" })
123 ),
124 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the user" })),
125 "created_at": Schema.optionalKey(
126 Schema.Number.annotate({
127 "description": "The Unix timestamp (in seconds) of when the user was created",
128 "format": "unixtime"
129 }).check(Schema.isInt())
130 ),
131 "role": Schema.optionalKey(Schema.String.annotate({ "description": "Always `owner`" }))
132 }),
133 "value": Schema.String.annotate({ "description": "The value of the API key. Only shown on create." })
134}).annotate({
135 "description": "The newly created admin API key. The `value` field is only returned once, when the key is created."
136})
137export type AssignedRoleDetails = {
138 readonly "id": string
139 readonly "name": string
140 readonly "permissions": ReadonlyArray<string>
141 readonly "resource_type": string
142 readonly "predefined_role": boolean
143 readonly "description": string | null
144 readonly "created_at": number | null
145 readonly "updated_at": number | null
146 readonly "created_by": string | null
147 readonly "created_by_user_obj": {} | null
148 readonly "metadata": {} | null
149}
150export const AssignedRoleDetails = Schema.Struct({
151 "id": Schema.String.annotate({ "description": "Identifier for the role." }),
152 "name": Schema.String.annotate({ "description": "Name of the role." }),
153 "permissions": Schema.Array(Schema.String).annotate({ "description": "Permissions associated with the role." }),
154 "resource_type": Schema.String.annotate({ "description": "Resource type the role applies to." }),
155 "predefined_role": Schema.Boolean.annotate({ "description": "Whether the role is predefined by OpenAI." }),
156 "description": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Description of the role." }),
157 "created_at": Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null])
158 .annotate({ "description": "When the role was created." }),
159 "updated_at": Schema.Union([Schema.Number.annotate({ "format": "int64" }).check(Schema.isInt()), Schema.Null])
160 .annotate({ "description": "When the role was last updated." }),
161 "created_by": Schema.Union([Schema.String, Schema.Null]).annotate({
162 "description": "Identifier of the actor who created the role."
163 }),
164 "created_by_user_obj": Schema.Union([Schema.Struct({}), Schema.Null]).annotate({
165 "description": "User details for the actor that created the role, when available."
166 }),
167 "metadata": Schema.Union([Schema.Struct({}), Schema.Null]).annotate({
168 "description": "Arbitrary metadata stored on the role."
169 })
170}).annotate({ "description": "Detailed information about a role assignment entry returned when listing assignments." })
171export type AssistantSupportedModels =
172 | "gpt-5"
173 | "gpt-5-mini"
174 | "gpt-5-nano"
175 | "gpt-5-2025-08-07"
176 | "gpt-5-mini-2025-08-07"
177 | "gpt-5-nano-2025-08-07"
178 | "gpt-4.1"
179 | "gpt-4.1-mini"
180 | "gpt-4.1-nano"
181 | "gpt-4.1-2025-04-14"
182 | "gpt-4.1-mini-2025-04-14"
183 | "gpt-4.1-nano-2025-04-14"
184 | "o3-mini"
185 | "o3-mini-2025-01-31"
186 | "o1"
187 | "o1-2024-12-17"
188 | "gpt-4o"
189 | "gpt-4o-2024-11-20"
190 | "gpt-4o-2024-08-06"
191 | "gpt-4o-2024-05-13"
192 | "gpt-4o-mini"
193 | "gpt-4o-mini-2024-07-18"
194 | "gpt-4.5-preview"
195 | "gpt-4.5-preview-2025-02-27"
196 | "gpt-4-turbo"
197 | "gpt-4-turbo-2024-04-09"
198 | "gpt-4-0125-preview"
199 | "gpt-4-turbo-preview"
200 | "gpt-4-1106-preview"
201 | "gpt-4-vision-preview"
202 | "gpt-4"
203 | "gpt-4-0314"
204 | "gpt-4-0613"
205 | "gpt-4-32k"
206 | "gpt-4-32k-0314"
207 | "gpt-4-32k-0613"
208 | "gpt-3.5-turbo"
209 | "gpt-3.5-turbo-16k"
210 | "gpt-3.5-turbo-0613"
211 | "gpt-3.5-turbo-1106"
212 | "gpt-3.5-turbo-0125"
213 | "gpt-3.5-turbo-16k-0613"
214export const AssistantSupportedModels = Schema.Literals([
215 "gpt-5",
216 "gpt-5-mini",
217 "gpt-5-nano",
218 "gpt-5-2025-08-07",
219 "gpt-5-mini-2025-08-07",
220 "gpt-5-nano-2025-08-07",
221 "gpt-4.1",
222 "gpt-4.1-mini",
223 "gpt-4.1-nano",
224 "gpt-4.1-2025-04-14",
225 "gpt-4.1-mini-2025-04-14",
226 "gpt-4.1-nano-2025-04-14",
227 "o3-mini",
228 "o3-mini-2025-01-31",
229 "o1",
230 "o1-2024-12-17",
231 "gpt-4o",
232 "gpt-4o-2024-11-20",
233 "gpt-4o-2024-08-06",
234 "gpt-4o-2024-05-13",
235 "gpt-4o-mini",
236 "gpt-4o-mini-2024-07-18",
237 "gpt-4.5-preview",
238 "gpt-4.5-preview-2025-02-27",
239 "gpt-4-turbo",
240 "gpt-4-turbo-2024-04-09",
241 "gpt-4-0125-preview",
242 "gpt-4-turbo-preview",
243 "gpt-4-1106-preview",
244 "gpt-4-vision-preview",
245 "gpt-4",
246 "gpt-4-0314",
247 "gpt-4-0613",
248 "gpt-4-32k",
249 "gpt-4-32k-0314",
250 "gpt-4-32k-0613",
251 "gpt-3.5-turbo",
252 "gpt-3.5-turbo-16k",
253 "gpt-3.5-turbo-0613",
254 "gpt-3.5-turbo-1106",
255 "gpt-3.5-turbo-0125",
256 "gpt-3.5-turbo-16k-0613"
257])
258export type AssistantToolsCode = { readonly "type": "code_interpreter" }
259export const AssistantToolsCode = Schema.Struct({
260 "type": Schema.Literal("code_interpreter").annotate({
261 "description": "The type of tool being defined: `code_interpreter`"
262 })
263}).annotate({ "title": "Code interpreter tool" })
264export type AssistantToolsFileSearchTypeOnly = { readonly "type": "file_search" }
265export const AssistantToolsFileSearchTypeOnly = Schema.Struct({
266 "type": Schema.Literal("file_search").annotate({ "description": "The type of tool being defined: `file_search`" })
267}).annotate({ "title": "FileSearch tool" })
268export type AssistantsNamedToolChoice = {
269 readonly "type": "function" | "code_interpreter" | "file_search"
270 readonly "function"?: { readonly "name": string }
271}
272export const AssistantsNamedToolChoice = Schema.Struct({
273 "type": Schema.Literals(["function", "code_interpreter", "file_search"]).annotate({
274 "description": "The type of the tool. If type is `function`, the function name must be set"
275 }),
276 "function": Schema.optionalKey(
277 Schema.Struct({ "name": Schema.String.annotate({ "description": "The name of the function to call." }) })
278 )
279}).annotate({ "description": "Specifies a tool the model should use. Use to force the model to call a specific tool." })
280export type AudioResponseFormat = "json" | "text" | "srt" | "verbose_json" | "vtt" | "diarized_json"
281export const AudioResponseFormat = Schema.Literals(["json", "text", "srt", "verbose_json", "vtt", "diarized_json"])
282 .annotate({
283 "description":
284 "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.\n"
285 })
286export type AuditLogActorServiceAccount = { readonly "id"?: string }
287export const AuditLogActorServiceAccount = Schema.Struct({
288 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The service account id." }))
289}).annotate({ "description": "The service account that performed the audit logged action." })
290export type AuditLogActorUser = { readonly "id"?: string; readonly "email"?: string }
291export const AuditLogActorUser = Schema.Struct({
292 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The user id." })),
293 "email": Schema.optionalKey(Schema.String.annotate({ "description": "The user email." }))
294}).annotate({ "description": "The user who performed the audit logged action." })
295export type AuditLogEventType =
296 | "api_key.created"
297 | "api_key.updated"
298 | "api_key.deleted"
299 | "certificate.created"
300 | "certificate.updated"
301 | "certificate.deleted"
302 | "certificates.activated"
303 | "certificates.deactivated"
304 | "checkpoint.permission.created"
305 | "checkpoint.permission.deleted"
306 | "external_key.registered"
307 | "external_key.removed"
308 | "group.created"
309 | "group.updated"
310 | "group.deleted"
311 | "invite.sent"
312 | "invite.accepted"
313 | "invite.deleted"
314 | "ip_allowlist.created"
315 | "ip_allowlist.updated"
316 | "ip_allowlist.deleted"
317 | "ip_allowlist.config.activated"
318 | "ip_allowlist.config.deactivated"
319 | "login.succeeded"
320 | "login.failed"
321 | "logout.succeeded"
322 | "logout.failed"
323 | "organization.updated"
324 | "project.created"
325 | "project.updated"
326 | "project.archived"
327 | "project.deleted"
328 | "rate_limit.updated"
329 | "rate_limit.deleted"
330 | "resource.deleted"
331 | "tunnel.created"
332 | "tunnel.updated"
333 | "tunnel.deleted"
334 | "role.created"
335 | "role.updated"
336 | "role.deleted"
337 | "role.assignment.created"
338 | "role.assignment.deleted"
339 | "scim.enabled"
340 | "scim.disabled"
341 | "service_account.created"
342 | "service_account.updated"
343 | "service_account.deleted"
344 | "user.added"
345 | "user.updated"
346 | "user.deleted"
347export const AuditLogEventType = Schema.Literals([
348 "api_key.created",
349 "api_key.updated",
350 "api_key.deleted",
351 "certificate.created",
352 "certificate.updated",
353 "certificate.deleted",
354 "certificates.activated",
355 "certificates.deactivated",
356 "checkpoint.permission.created",
357 "checkpoint.permission.deleted",
358 "external_key.registered",
359 "external_key.removed",
360 "group.created",
361 "group.updated",
362 "group.deleted",
363 "invite.sent",
364 "invite.accepted",
365 "invite.deleted",
366 "ip_allowlist.created",
367 "ip_allowlist.updated",
368 "ip_allowlist.deleted",
369 "ip_allowlist.config.activated",
370 "ip_allowlist.config.deactivated",
371 "login.succeeded",
372 "login.failed",
373 "logout.succeeded",
374 "logout.failed",
375 "organization.updated",
376 "project.created",
377 "project.updated",
378 "project.archived",
379 "project.deleted",
380 "rate_limit.updated",
381 "rate_limit.deleted",
382 "resource.deleted",
383 "tunnel.created",
384 "tunnel.updated",
385 "tunnel.deleted",
386 "role.created",
387 "role.updated",
388 "role.deleted",
389 "role.assignment.created",
390 "role.assignment.deleted",
391 "scim.enabled",
392 "scim.disabled",
393 "service_account.created",
394 "service_account.updated",
395 "service_account.deleted",
396 "user.added",
397 "user.updated",
398 "user.deleted"
399]).annotate({ "description": "The event type." })
400export type BatchFileExpirationAfter = { readonly "anchor": "created_at"; readonly "seconds": number }
401export const BatchFileExpirationAfter = Schema.Struct({
402 "anchor": Schema.Literal("created_at").annotate({
403 "description":
404 "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created."
405 }),
406 "seconds": Schema.Number.annotate({
407 "description":
408 "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).",
409 "format": "int64"
410 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(3600)).check(Schema.isLessThanOrEqualTo(2592000))
411}).annotate({
412 "title": "File expiration policy",
413 "description": "The expiration policy for the output and/or error file that are generated for a batch."
414})
415export type Certificate = {
416 readonly "object": "certificate" | "organization.certificate" | "organization.project.certificate"
417 readonly "id": string
418 readonly "name": string | null
419 readonly "created_at": number
420 readonly "certificate_details": {
421 readonly "valid_at"?: number
422 readonly "expires_at"?: number
423 readonly "content"?: string
424 }
425 readonly "active"?: boolean
426}
427export const Certificate = Schema.Struct({
428 "object": Schema.Literals(["certificate", "organization.certificate", "organization.project.certificate"]).annotate({
429 "description":
430 "The object type.\n\n- If creating, updating, or getting a specific certificate, the object type is `certificate`.\n- If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`.\n- If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`.\n"
431 }),
432 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
433 "name": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the certificate." }),
434 "created_at": Schema.Number.annotate({
435 "description": "The Unix timestamp (in seconds) of when the certificate was uploaded.",
436 "format": "unixtime"
437 }).check(Schema.isInt()),
438 "certificate_details": Schema.Struct({
439 "valid_at": Schema.optionalKey(
440 Schema.Number.annotate({
441 "description": "The Unix timestamp (in seconds) of when the certificate becomes valid.",
442 "format": "unixtime"
443 }).check(Schema.isInt())
444 ),
445 "expires_at": Schema.optionalKey(
446 Schema.Number.annotate({
447 "description": "The Unix timestamp (in seconds) of when the certificate expires.",
448 "format": "unixtime"
449 }).check(Schema.isInt())
450 ),
451 "content": Schema.optionalKey(
452 Schema.String.annotate({ "description": "The content of the certificate in PEM format." })
453 )
454 }),
455 "active": Schema.optionalKey(
456 Schema.Boolean.annotate({
457 "description":
458 "Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate."
459 })
460 )
461}).annotate({ "description": "Represents an individual `certificate` uploaded to the organization." })
462export type ChatCompletionAllowedTools = { readonly "mode": "auto" | "required"; readonly "tools": ReadonlyArray<{}> }
463export const ChatCompletionAllowedTools = Schema.Struct({
464 "mode": Schema.Literals(["auto", "required"]).annotate({
465 "description":
466 "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n"
467 }),
468 "tools": Schema.Array(
469 Schema.Struct({}).annotate({ "description": "A tool definition that the model should be allowed to call.\n" })
470 ).annotate({
471 "description":
472 "A list of tool definitions that the model should be allowed to call.\n\nFor the Chat Completions API, the list of tool definitions might look like:\n```json\n[\n { \"type\": \"function\", \"function\": { \"name\": \"get_weather\" } },\n { \"type\": \"function\", \"function\": { \"name\": \"get_time\" } }\n]\n```\n"
473 })
474}).annotate({
475 "title": "Allowed tools",
476 "description": "Constrains the tools available to the model to a pre-defined set.\n"
477})
478export type ChatCompletionDeleted = {
479 readonly "object": "chat.completion.deleted"
480 readonly "id": string
481 readonly "deleted": boolean
482}
483export const ChatCompletionDeleted = Schema.Struct({
484 "object": Schema.Literal("chat.completion.deleted").annotate({ "description": "The type of object being deleted." }),
485 "id": Schema.String.annotate({ "description": "The ID of the chat completion that was deleted." }),
486 "deleted": Schema.Boolean.annotate({ "description": "Whether the chat completion was deleted." })
487})
488export type ChatCompletionFunctionCallOption = { readonly "name": string }
489export const ChatCompletionFunctionCallOption = Schema.Struct({
490 "name": Schema.String.annotate({ "description": "The name of the function to call." })
491}).annotate({
492 "description":
493 "Specifying a particular function via `{\"name\": \"my_function\"}` forces the model to call that function.\n"
494})
495export type ChatCompletionMessageCustomToolCall = {
496 readonly "id": string
497 readonly "type": "custom"
498 readonly "custom": { readonly "name": string; readonly "input": string }
499}
500export const ChatCompletionMessageCustomToolCall = Schema.Struct({
501 "id": Schema.String.annotate({ "description": "The ID of the tool call." }),
502 "type": Schema.Literal("custom").annotate({ "description": "The type of the tool. Always `custom`." }),
503 "custom": Schema.Struct({
504 "name": Schema.String.annotate({ "description": "The name of the custom tool to call." }),
505 "input": Schema.String.annotate({ "description": "The input for the custom tool call generated by the model." })
506 }).annotate({ "description": "The custom tool that the model called." })
507}).annotate({ "title": "Custom tool call", "description": "A call to a custom tool created by the model.\n" })
508export type ChatCompletionMessageToolCall = {
509 readonly "id": string
510 readonly "type": "function"
511 readonly "function": { readonly "name": string; readonly "arguments": string }
512}
513export const ChatCompletionMessageToolCall = Schema.Struct({
514 "id": Schema.String.annotate({ "description": "The ID of the tool call." }),
515 "type": Schema.Literal("function").annotate({
516 "description": "The type of the tool. Currently, only `function` is supported."
517 }),
518 "function": Schema.Struct({
519 "name": Schema.String.annotate({ "description": "The name of the function to call." }),
520 "arguments": Schema.String.annotate({
521 "description":
522 "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
523 })
524 }).annotate({ "description": "The function that the model called." })
525}).annotate({ "title": "Function tool call", "description": "A call to a function tool created by the model.\n" })
526export type ChatCompletionMessageToolCallChunk = {
527 readonly "index": number
528 readonly "id"?: string
529 readonly "type"?: "function"
530 readonly "function"?: { readonly "name"?: string; readonly "arguments"?: string }
531}
532export const ChatCompletionMessageToolCallChunk = Schema.Struct({
533 "index": Schema.Number.check(Schema.isInt()),
534 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the tool call." })),
535 "type": Schema.optionalKey(
536 Schema.Literal("function").annotate({
537 "description": "The type of the tool. Currently, only `function` is supported."
538 })
539 ),
540 "function": Schema.optionalKey(Schema.Struct({
541 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function to call." })),
542 "arguments": Schema.optionalKey(Schema.String.annotate({
543 "description":
544 "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
545 }))
546 }))
547})
548export type ChatCompletionNamedToolChoice = {
549 readonly "type": "function"
550 readonly "function": { readonly "name": string }
551}
552export const ChatCompletionNamedToolChoice = Schema.Struct({
553 "type": Schema.Literal("function").annotate({
554 "description": "For function calling, the type is always `function`."
555 }),
556 "function": Schema.Struct({ "name": Schema.String.annotate({ "description": "The name of the function to call." }) })
557}).annotate({
558 "title": "Function tool choice",
559 "description": "Specifies a tool the model should use. Use to force the model to call a specific function."
560})
561export type ChatCompletionNamedToolChoiceCustom = {
562 readonly "type": "custom"
563 readonly "custom": { readonly "name": string }
564}
565export const ChatCompletionNamedToolChoiceCustom = Schema.Struct({
566 "type": Schema.Literal("custom").annotate({ "description": "For custom tool calling, the type is always `custom`." }),
567 "custom": Schema.Struct({
568 "name": Schema.String.annotate({ "description": "The name of the custom tool to call." })
569 })
570}).annotate({
571 "title": "Custom tool choice",
572 "description": "Specifies a tool the model should use. Use to force the model to call a specific custom tool."
573})
574export type ChatCompletionRequestFunctionMessage = {
575 readonly "role": "function"
576 readonly "content": string | null
577 readonly "name": string
578}
579export const ChatCompletionRequestFunctionMessage = Schema.Struct({
580 "role": Schema.Literal("function").annotate({
581 "description": "The role of the messages author, in this case `function`."
582 }),
583 "content": Schema.Union([
584 Schema.String.annotate({ "description": "The contents of the function message." }),
585 Schema.Null
586 ]),
587 "name": Schema.String.annotate({ "description": "The name of the function to call." })
588}).annotate({ "title": "Function message" })
589export type ChatCompletionRequestMessageContentPartAudio = {
590 readonly "type": "input_audio"
591 readonly "input_audio": { readonly "data": string; readonly "format": "wav" | "mp3" }
592}
593export const ChatCompletionRequestMessageContentPartAudio = Schema.Struct({
594 "type": Schema.Literal("input_audio").annotate({
595 "description": "The type of the content part. Always `input_audio`."
596 }),
597 "input_audio": Schema.Struct({
598 "data": Schema.String.annotate({ "description": "Base64 encoded audio data." }),
599 "format": Schema.Literals(["wav", "mp3"]).annotate({
600 "description": "The format of the encoded audio data. Currently supports \"wav\" and \"mp3\".\n"
601 })
602 })
603}).annotate({ "title": "Audio content part", "description": "Learn about [audio inputs](/docs/guides/audio).\n" })
604export type ChatCompletionRequestMessageContentPartFile = {
605 readonly "type": "file"
606 readonly "file": { readonly "filename"?: string; readonly "file_data"?: string; readonly "file_id"?: string }
607}
608export const ChatCompletionRequestMessageContentPartFile = Schema.Struct({
609 "type": Schema.Literal("file").annotate({ "description": "The type of the content part. Always `file`." }),
610 "file": Schema.Struct({
611 "filename": Schema.optionalKey(
612 Schema.String.annotate({
613 "description": "The name of the file, used when passing the file to the model as a \nstring.\n"
614 })
615 ),
616 "file_data": Schema.optionalKey(
617 Schema.String.annotate({
618 "description": "The base64 encoded file data, used when passing the file to the model \nas a string.\n"
619 })
620 ),
621 "file_id": Schema.optionalKey(
622 Schema.String.annotate({ "description": "The ID of an uploaded file to use as input.\n" })
623 )
624 })
625}).annotate({
626 "title": "File content part",
627 "description": "Learn about [file inputs](/docs/guides/text) for text generation.\n"
628})
629export type ChatCompletionRequestMessageContentPartImage = {
630 readonly "type": "image_url"
631 readonly "image_url": { readonly "url": string; readonly "detail"?: "auto" | "low" | "high" }
632}
633export const ChatCompletionRequestMessageContentPartImage = Schema.Struct({
634 "type": Schema.Literal("image_url").annotate({ "description": "The type of the content part." }),
635 "image_url": Schema.Struct({
636 "url": Schema.String.annotate({
637 "description": "Either a URL of the image or the base64 encoded image data.",
638 "format": "uri"
639 }),
640 "detail": Schema.optionalKey(
641 Schema.Literals(["auto", "low", "high"]).annotate({
642 "description":
643 "Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision#low-or-high-fidelity-image-understanding)."
644 })
645 )
646 })
647}).annotate({ "title": "Image content part", "description": "Learn about [image inputs](/docs/guides/vision).\n" })
648export type ChatCompletionRequestMessageContentPartRefusal = { readonly "type": "refusal"; readonly "refusal": string }
649export const ChatCompletionRequestMessageContentPartRefusal = Schema.Struct({
650 "type": Schema.Literal("refusal").annotate({ "description": "The type of the content part." }),
651 "refusal": Schema.String.annotate({ "description": "The refusal message generated by the model." })
652}).annotate({ "title": "Refusal content part" })
653export type ChatCompletionRequestMessageContentPartText = { readonly "type": "text"; readonly "text": string }
654export const ChatCompletionRequestMessageContentPartText = Schema.Struct({
655 "type": Schema.Literal("text").annotate({ "description": "The type of the content part." }),
656 "text": Schema.String.annotate({ "description": "The text content." })
657}).annotate({
658 "title": "Text content part",
659 "description": "Learn about [text inputs](/docs/guides/text-generation).\n"
660})
661export type ChatCompletionStreamOptions = {
662 readonly "include_usage"?: boolean
663 readonly "include_obfuscation"?: boolean
664} | null
665export const ChatCompletionStreamOptions = Schema.Union([
666 Schema.Struct({
667 "include_usage": Schema.optionalKey(Schema.Boolean.annotate({
668 "description":
669 "If set, an additional chunk will be streamed before the `data: [DONE]`\nmessage. The `usage` field on this chunk shows the token usage statistics\nfor the entire request, and the `choices` field will always be an empty\narray.\n\nAll other chunks will also include a `usage` field, but with a null\nvalue. **NOTE:** If the stream is interrupted, you may not receive the\nfinal usage chunk which contains the total token usage for the request.\n"
670 })),
671 "include_obfuscation": Schema.optionalKey(Schema.Boolean.annotate({
672 "description":
673 "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n"
674 }))
675 }).annotate({ "description": "Options for streaming response. Only set this when you set `stream: true`.\n" }),
676 Schema.Null
677])
678export type ChatCompletionTokenLogprob = {
679 readonly "token": string
680 readonly "logprob": number
681 readonly "bytes": ReadonlyArray<number> | null
682 readonly "top_logprobs": ReadonlyArray<
683 { readonly "token": string; readonly "logprob": number; readonly "bytes": ReadonlyArray<number> | null }
684 >
685}
686export const ChatCompletionTokenLogprob = Schema.Struct({
687 "token": Schema.String.annotate({ "description": "The token." }),
688 "logprob": Schema.Number.annotate({
689 "description":
690 "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely."
691 }).check(Schema.isFinite()),
692 "bytes": Schema.Union([
693 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
694 "description":
695 "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."
696 }),
697 Schema.Null
698 ]),
699 "top_logprobs": Schema.Array(Schema.Struct({
700 "token": Schema.String.annotate({ "description": "The token." }),
701 "logprob": Schema.Number.annotate({
702 "description":
703 "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely."
704 }).check(Schema.isFinite()),
705 "bytes": Schema.Union([
706 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
707 "description":
708 "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."
709 }),
710 Schema.Null
711 ])
712 })).annotate({
713 "description":
714 "List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`."
715 })
716})
717export type ComparisonFilter = {
718 readonly "type": "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin"
719 readonly "key": string
720 readonly "value": string | number | boolean | ReadonlyArray<string | number>
721}
722export const ComparisonFilter = Schema.Struct({
723 "type": Schema.Literals(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]).annotate({
724 "description":
725 "Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n- `eq`: equals\n- `ne`: not equal\n- `gt`: greater than\n- `gte`: greater than or equal\n- `lt`: less than\n- `lte`: less than or equal\n- `in`: in\n- `nin`: not in\n"
726 }),
727 "key": Schema.String.annotate({ "description": "The key to compare against the value." }),
728 "value": Schema.Union([
729 Schema.String,
730 Schema.Number.check(Schema.isFinite()),
731 Schema.Boolean,
732 Schema.Array(Schema.Union([Schema.String, Schema.Number.check(Schema.isFinite())], { mode: "oneOf" }))
733 ], { mode: "oneOf" }).annotate({
734 "description": "The value to compare against the attribute key; supports string, number, or boolean types."
735 })
736}).annotate({
737 "title": "Comparison Filter",
738 "description":
739 "A filter used to compare a specified attribute key to a given value using a defined comparison operation.\n"
740})
741export type CompleteUploadRequest = { readonly "part_ids": ReadonlyArray<string>; readonly "md5"?: string }
742export const CompleteUploadRequest = Schema.Struct({
743 "part_ids": Schema.Array(Schema.String).annotate({ "description": "The ordered list of Part IDs.\n" }),
744 "md5": Schema.optionalKey(
745 Schema.String.annotate({
746 "description":
747 "The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.\n"
748 })
749 )
750})
751export type CompletionUsage = {
752 readonly "completion_tokens": number
753 readonly "prompt_tokens": number
754 readonly "total_tokens": number
755 readonly "completion_tokens_details"?: {
756 readonly "accepted_prediction_tokens"?: number
757 readonly "audio_tokens"?: number
758 readonly "reasoning_tokens"?: number
759 readonly "rejected_prediction_tokens"?: number
760 }
761 readonly "prompt_tokens_details"?: { readonly "audio_tokens"?: number; readonly "cached_tokens"?: number }
762}
763export const CompletionUsage = Schema.Struct({
764 "completion_tokens": Schema.Number.annotate({ "description": "Number of tokens in the generated completion." }).check(
765 Schema.isInt()
766 ),
767 "prompt_tokens": Schema.Number.annotate({ "description": "Number of tokens in the prompt." }).check(Schema.isInt()),
768 "total_tokens": Schema.Number.annotate({
769 "description": "Total number of tokens used in the request (prompt + completion)."
770 }).check(Schema.isInt()),
771 "completion_tokens_details": Schema.optionalKey(
772 Schema.Struct({
773 "accepted_prediction_tokens": Schema.optionalKey(
774 Schema.Number.annotate({
775 "description":
776 "When using Predicted Outputs, the number of tokens in the\nprediction that appeared in the completion.\n"
777 }).check(Schema.isInt())
778 ),
779 "audio_tokens": Schema.optionalKey(
780 Schema.Number.annotate({ "description": "Audio input tokens generated by the model." }).check(Schema.isInt())
781 ),
782 "reasoning_tokens": Schema.optionalKey(
783 Schema.Number.annotate({ "description": "Tokens generated by the model for reasoning." }).check(Schema.isInt())
784 ),
785 "rejected_prediction_tokens": Schema.optionalKey(
786 Schema.Number.annotate({
787 "description":
788 "When using Predicted Outputs, the number of tokens in the\nprediction that did not appear in the completion. However, like\nreasoning tokens, these tokens are still counted in the total\ncompletion tokens for purposes of billing, output, and context window\nlimits.\n"
789 }).check(Schema.isInt())
790 )
791 }).annotate({ "description": "Breakdown of tokens used in a completion." })
792 ),
793 "prompt_tokens_details": Schema.optionalKey(
794 Schema.Struct({
795 "audio_tokens": Schema.optionalKey(
796 Schema.Number.annotate({ "description": "Audio input tokens present in the prompt." }).check(Schema.isInt())
797 ),
798 "cached_tokens": Schema.optionalKey(
799 Schema.Number.annotate({ "description": "Cached tokens present in the prompt." }).check(Schema.isInt())
800 )
801 }).annotate({ "description": "Breakdown of tokens used in the prompt." })
802 )
803}).annotate({ "description": "Usage statistics for the completion request." })
804export type ComputerScreenshotImage = {
805 readonly "type": "computer_screenshot"
806 readonly "image_url"?: string
807 readonly "file_id"?: string
808}
809export const ComputerScreenshotImage = Schema.Struct({
810 "type": Schema.Literal("computer_screenshot").annotate({
811 "description":
812 "Specifies the event type. For a computer screenshot, this property is \nalways set to `computer_screenshot`.\n"
813 }),
814 "image_url": Schema.optionalKey(
815 Schema.String.annotate({ "description": "The URL of the screenshot image.", "format": "uri" })
816 ),
817 "file_id": Schema.optionalKey(
818 Schema.String.annotate({ "description": "The identifier of an uploaded file that contains the screenshot." })
819 )
820}).annotate({ "description": "A computer screenshot image used with the computer use tool.\n" })
821export type ContainerFileResource = {
822 readonly "id": string
823 readonly "object": string
824 readonly "container_id": string
825 readonly "created_at": number
826 readonly "bytes": number
827 readonly "path": string
828 readonly "source": string
829}
830export const ContainerFileResource = Schema.Struct({
831 "id": Schema.String.annotate({ "description": "Unique identifier for the file." }),
832 "object": Schema.String.annotate({ "description": "The type of this object (`container.file`)." }),
833 "container_id": Schema.String.annotate({ "description": "The container this file belongs to." }),
834 "created_at": Schema.Number.annotate({
835 "description": "Unix timestamp (in seconds) when the file was created.",
836 "format": "unixtime"
837 }).check(Schema.isInt()),
838 "bytes": Schema.Number.annotate({ "description": "Size of the file in bytes." }).check(Schema.isInt()),
839 "path": Schema.String.annotate({ "description": "Path of the file in the container." }),
840 "source": Schema.String.annotate({ "description": "Source of the file (e.g., `user`, `assistant`)." })
841}).annotate({ "title": "The container file object" })
842export type ContainerResource = {
843 readonly "id": string
844 readonly "object": string
845 readonly "name": string
846 readonly "created_at": number
847 readonly "status": string
848 readonly "last_active_at"?: number
849 readonly "expires_after"?: { readonly "anchor"?: "last_active_at"; readonly "minutes"?: number }
850 readonly "memory_limit"?: "1g" | "4g" | "16g" | "64g"
851 readonly "network_policy"?: {
852 readonly "type": "allowlist" | "disabled"
853 readonly "allowed_domains"?: ReadonlyArray<string>
854 }
855}
856export const ContainerResource = Schema.Struct({
857 "id": Schema.String.annotate({ "description": "Unique identifier for the container." }),
858 "object": Schema.String.annotate({ "description": "The type of this object." }),
859 "name": Schema.String.annotate({ "description": "Name of the container." }),
860 "created_at": Schema.Number.annotate({
861 "description": "Unix timestamp (in seconds) when the container was created.",
862 "format": "unixtime"
863 }).check(Schema.isInt()),
864 "status": Schema.String.annotate({ "description": "Status of the container (e.g., active, deleted)." }),
865 "last_active_at": Schema.optionalKey(
866 Schema.Number.annotate({
867 "description": "Unix timestamp (in seconds) when the container was last active.",
868 "format": "unixtime"
869 }).check(Schema.isInt())
870 ),
871 "expires_after": Schema.optionalKey(
872 Schema.Struct({
873 "anchor": Schema.optionalKey(
874 Schema.Literal("last_active_at").annotate({ "description": "The reference point for the expiration." })
875 ),
876 "minutes": Schema.optionalKey(
877 Schema.Number.annotate({
878 "description": "The number of minutes after the anchor before the container expires."
879 }).check(Schema.isInt())
880 )
881 }).annotate({
882 "description":
883 "The container will expire after this time period.\nThe anchor is the reference point for the expiration.\nThe minutes is the number of minutes after the anchor before the container expires.\n"
884 })
885 ),
886 "memory_limit": Schema.optionalKey(
887 Schema.Literals(["1g", "4g", "16g", "64g"]).annotate({
888 "description": "The memory limit configured for the container."
889 })
890 ),
891 "network_policy": Schema.optionalKey(
892 Schema.Struct({
893 "type": Schema.Literals(["allowlist", "disabled"]).annotate({ "description": "The network policy mode." }),
894 "allowed_domains": Schema.optionalKey(
895 Schema.Array(Schema.String).annotate({ "description": "Allowed outbound domains when `type` is `allowlist`." })
896 )
897 }).annotate({ "description": "Network access policy for the container." })
898 )
899}).annotate({ "title": "The container object" })
900export type CostsResult = {
901 readonly "object": "organization.costs.result"
902 readonly "amount"?: { readonly "value"?: number; readonly "currency"?: string }
903 readonly "line_item"?: string | null
904 readonly "project_id"?: string | null
905 readonly "api_key_id"?: string | null
906 readonly "quantity"?: number | null
907}
908export const CostsResult = Schema.Struct({
909 "object": Schema.Literal("organization.costs.result"),
910 "amount": Schema.optionalKey(
911 Schema.Struct({
912 "value": Schema.optionalKey(
913 Schema.Number.annotate({ "description": "The numeric value of the cost." }).check(Schema.isFinite())
914 ),
915 "currency": Schema.optionalKey(
916 Schema.String.annotate({ "description": "Lowercase ISO-4217 currency e.g. \"usd\"" })
917 )
918 }).annotate({ "description": "The monetary value in its associated currency." })
919 ),
920 "line_item": Schema.optionalKey(
921 Schema.Union([
922 Schema.String.annotate({
923 "description": "When `group_by=line_item`, this field provides the line item of the grouped costs result."
924 }),
925 Schema.Null
926 ])
927 ),
928 "project_id": Schema.optionalKey(
929 Schema.Union([
930 Schema.String.annotate({
931 "description": "When `group_by=project_id`, this field provides the project ID of the grouped costs result."
932 }),
933 Schema.Null
934 ])
935 ),
936 "api_key_id": Schema.optionalKey(
937 Schema.Union([
938 Schema.String.annotate({
939 "description": "When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result."
940 }),
941 Schema.Null
942 ])
943 ),
944 "quantity": Schema.optionalKey(
945 Schema.Union([
946 Schema.Number.annotate({
947 "description": "When `group_by=line_item`, this field provides the quantity of the grouped costs result."
948 }).check(Schema.isFinite()),
949 Schema.Null
950 ])
951 )
952}).annotate({ "description": "The aggregated costs details of the specific time bucket." })
953export type CreateContainerFileBody = { readonly "file_id"?: string; readonly "file"?: string }
954export const CreateContainerFileBody = Schema.Struct({
955 "file_id": Schema.optionalKey(Schema.String.annotate({ "description": "Name of the file to create." })),
956 "file": Schema.optionalKey(
957 Schema.String.annotate({ "description": "The File object (not file name) to be uploaded.\n", "format": "binary" })
958 )
959})
960export type CreateEmbeddingRequest = {
961 readonly "input": string | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<ReadonlyArray<number>>
962 readonly "model": string | "text-embedding-ada-002" | "text-embedding-3-small" | "text-embedding-3-large"
963 readonly "encoding_format"?: "float" | "base64"
964 readonly "dimensions"?: number
965 readonly "user"?: string
966}
967export const CreateEmbeddingRequest = Schema.Struct({
968 "input": Schema.Union([
969 Schema.String.annotate({ "title": "string", "description": "The string that will be turned into an embedding." }),
970 Schema.Array(Schema.String).annotate({
971 "title": "array",
972 "description": "The array of strings that will be turned into an embedding."
973 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048)),
974 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
975 "title": "array",
976 "description": "The array of integers that will be turned into an embedding."
977 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048)),
978 Schema.Array(Schema.Array(Schema.Number.check(Schema.isInt())).check(Schema.isMinLength(1))).annotate({
979 "title": "array",
980 "description": "The array of arrays containing integers that will be turned into an embedding."
981 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048))
982 ], { mode: "oneOf" }).annotate({
983 "description":
984 "Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.\n"
985 }),
986 "model": Schema.Union([
987 Schema.String,
988 Schema.Literals(["text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large"])
989 ]).annotate({
990 "description":
991 "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.\n"
992 }),
993 "encoding_format": Schema.optionalKey(
994 Schema.Literals(["float", "base64"]).annotate({
995 "description":
996 "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/)."
997 })
998 ),
999 "dimensions": Schema.optionalKey(
1000 Schema.Number.annotate({
1001 "description":
1002 "The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\n"
1003 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
1004 ),
1005 "user": Schema.optionalKey(
1006 Schema.String.annotate({
1007 "description":
1008 "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).\n"
1009 })
1010 )
1011})
1012export type CreateFineTuningCheckpointPermissionRequest = { readonly "project_ids": ReadonlyArray<string> }
1013export const CreateFineTuningCheckpointPermissionRequest = Schema.Struct({
1014 "project_ids": Schema.Array(Schema.String).annotate({ "description": "The project identifiers to grant access to." })
1015})
1016export type CreateGroupBody = { readonly "name": string }
1017export const CreateGroupBody = Schema.Struct({
1018 "name": Schema.String.annotate({ "description": "Human readable name for the group." }).check(Schema.isMinLength(1))
1019 .check(Schema.isMaxLength(255))
1020}).annotate({ "description": "Request payload for creating a new group in the organization." })
1021export type CreateGroupUserBody = { readonly "user_id": string }
1022export const CreateGroupUserBody = Schema.Struct({
1023 "user_id": Schema.String.annotate({ "description": "Identifier of the user to add to the group." })
1024}).annotate({ "description": "Request payload for adding a user to a group." })
1025export type CreateImageVariationRequest = {
1026 readonly "image": string
1027 readonly "model"?: string | "dall-e-2" | null
1028 readonly "n"?: number
1029 readonly "response_format"?: "url" | "b64_json" | null
1030 readonly "size"?: "256x256" | "512x512" | "1024x1024" | null
1031 readonly "user"?: string
1032}
1033export const CreateImageVariationRequest = Schema.Struct({
1034 "image": Schema.String.annotate({
1035 "description":
1036 "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.",
1037 "format": "binary"
1038 }),
1039 "model": Schema.optionalKey(
1040 Schema.Union([
1041 Schema.Union([Schema.String, Schema.Literal("dall-e-2")]).annotate({
1042 "description": "The model to use for image generation. Only `dall-e-2` is supported at this time."
1043 }),
1044 Schema.Null
1045 ])
1046 ),
1047 "n": Schema.optionalKey(
1048 Schema.Union([
1049 Schema.Number.check(Schema.isInt()).check(
1050 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(10)], {
1051 "description": "The number of images to generate. Must be between 1 and 10."
1052 })
1053 )
1054 ])
1055 ),
1056 "response_format": Schema.optionalKey(
1057 Schema.Union([
1058 Schema.Literals(["url", "b64_json"]).annotate({
1059 "description":
1060 "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."
1061 }),
1062 Schema.Union([Schema.Null]).annotate({
1063 "description":
1064 "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."
1065 })
1066 ])
1067 ),
1068 "size": Schema.optionalKey(
1069 Schema.Union([
1070 Schema.Literals(["256x256", "512x512", "1024x1024"]).annotate({
1071 "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."
1072 }),
1073 Schema.Union([Schema.Null]).annotate({
1074 "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."
1075 })
1076 ])
1077 ),
1078 "user": Schema.optionalKey(
1079 Schema.String.annotate({
1080 "description":
1081 "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).\n"
1082 })
1083 )
1084})
1085export type CreateModerationRequest = {
1086 readonly "input":
1087 | string
1088 | ReadonlyArray<string>
1089 | ReadonlyArray<
1090 { readonly "type": "image_url"; readonly "image_url": { readonly "url": string } } | {
1091 readonly "type": "text"
1092 readonly "text": string
1093 }
1094 >
1095 readonly "model"?:
1096 | string
1097 | "omni-moderation-latest"
1098 | "omni-moderation-2024-09-26"
1099 | "text-moderation-latest"
1100 | "text-moderation-stable"
1101}
1102export const CreateModerationRequest = Schema.Struct({
1103 "input": Schema.Union([
1104 Schema.String.annotate({ "description": "A string of text to classify for moderation." }),
1105 Schema.Array(Schema.String).annotate({ "description": "An array of strings to classify for moderation." }),
1106 Schema.Array(Schema.Union([
1107 Schema.Struct({
1108 "type": Schema.Literal("image_url").annotate({ "description": "Always `image_url`." }),
1109 "image_url": Schema.Struct({
1110 "url": Schema.String.annotate({
1111 "description": "Either a URL of the image or the base64 encoded image data.",
1112 "format": "uri"
1113 })
1114 }).annotate({ "description": "Contains either an image URL or a data URL for a base64 encoded image." })
1115 }).annotate({ "description": "An object describing an image to classify." }),
1116 Schema.Struct({
1117 "type": Schema.Literal("text").annotate({ "description": "Always `text`." }),
1118 "text": Schema.String.annotate({ "description": "A string of text to classify." })
1119 }).annotate({ "description": "An object describing text to classify." })
1120 ], { mode: "oneOf" })).annotate({ "description": "An array of multi-modal inputs to the moderation model." })
1121 ], { mode: "oneOf" }).annotate({
1122 "description":
1123 "Input (or inputs) to classify. Can be a single string, an array of strings, or\nan array of multi-modal input objects similar to other models.\n"
1124 }),
1125 "model": Schema.optionalKey(
1126 Schema.Union([
1127 Schema.String,
1128 Schema.Literals([
1129 "omni-moderation-latest",
1130 "omni-moderation-2024-09-26",
1131 "text-moderation-latest",
1132 "text-moderation-stable"
1133 ])
1134 ]).annotate({
1135 "description":
1136 "The content moderation model you would like to use. Learn more in\n[the moderation guide](/docs/guides/moderation), and learn about\navailable models [here](/docs/models#moderation).\n"
1137 })
1138 )
1139})
1140export type CreateModerationResponse = {
1141 readonly "id": string
1142 readonly "model": string
1143 readonly "results": ReadonlyArray<
1144 {
1145 readonly "flagged": boolean
1146 readonly "categories": {
1147 readonly "hate": boolean
1148 readonly "hate/threatening": boolean
1149 readonly "harassment": boolean
1150 readonly "harassment/threatening": boolean
1151 readonly "illicit": boolean | null
1152 readonly "illicit/violent": boolean | null
1153 readonly "self-harm": boolean
1154 readonly "self-harm/intent": boolean
1155 readonly "self-harm/instructions": boolean
1156 readonly "sexual": boolean
1157 readonly "sexual/minors": boolean
1158 readonly "violence": boolean
1159 readonly "violence/graphic": boolean
1160 }
1161 readonly "category_scores": {
1162 readonly "hate": number
1163 readonly "hate/threatening": number
1164 readonly "harassment": number
1165 readonly "harassment/threatening": number
1166 readonly "illicit": number
1167 readonly "illicit/violent": number
1168 readonly "self-harm": number
1169 readonly "self-harm/intent": number
1170 readonly "self-harm/instructions": number
1171 readonly "sexual": number
1172 readonly "sexual/minors": number
1173 readonly "violence": number
1174 readonly "violence/graphic": number
1175 }
1176 readonly "category_applied_input_types": {
1177 readonly "hate": ReadonlyArray<"text">
1178 readonly "hate/threatening": ReadonlyArray<"text">
1179 readonly "harassment": ReadonlyArray<"text">
1180 readonly "harassment/threatening": ReadonlyArray<"text">
1181 readonly "illicit": ReadonlyArray<"text">
1182 readonly "illicit/violent": ReadonlyArray<"text">
1183 readonly "self-harm": ReadonlyArray<"text" | "image">
1184 readonly "self-harm/intent": ReadonlyArray<"text" | "image">
1185 readonly "self-harm/instructions": ReadonlyArray<"text" | "image">
1186 readonly "sexual": ReadonlyArray<"text" | "image">
1187 readonly "sexual/minors": ReadonlyArray<"text">
1188 readonly "violence": ReadonlyArray<"text" | "image">
1189 readonly "violence/graphic": ReadonlyArray<"text" | "image">
1190 }
1191 }
1192 >
1193}
1194export const CreateModerationResponse = Schema.Struct({
1195 "id": Schema.String.annotate({ "description": "The unique identifier for the moderation request." }),
1196 "model": Schema.String.annotate({ "description": "The model used to generate the moderation results." }),
1197 "results": Schema.Array(Schema.Struct({
1198 "flagged": Schema.Boolean.annotate({ "description": "Whether any of the below categories are flagged." }),
1199 "categories": Schema.Struct({
1200 "hate": Schema.Boolean.annotate({
1201 "description":
1202 "Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment."
1203 }),
1204 "hate/threatening": Schema.Boolean.annotate({
1205 "description":
1206 "Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste."
1207 }),
1208 "harassment": Schema.Boolean.annotate({
1209 "description": "Content that expresses, incites, or promotes harassing language towards any target."
1210 }),
1211 "harassment/threatening": Schema.Boolean.annotate({
1212 "description": "Harassment content that also includes violence or serious harm towards any target."
1213 }),
1214 "illicit": Schema.Union([
1215 Schema.Boolean.annotate({
1216 "description":
1217 "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, \"how to shoplift\" would fit this category."
1218 }),
1219 Schema.Null
1220 ]),
1221 "illicit/violent": Schema.Union([
1222 Schema.Boolean.annotate({
1223 "description":
1224 "Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon."
1225 }),
1226 Schema.Null
1227 ]),
1228 "self-harm": Schema.Boolean.annotate({
1229 "description":
1230 "Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders."
1231 }),
1232 "self-harm/intent": Schema.Boolean.annotate({
1233 "description":
1234 "Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders."
1235 }),
1236 "self-harm/instructions": Schema.Boolean.annotate({
1237 "description":
1238 "Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts."
1239 }),
1240 "sexual": Schema.Boolean.annotate({
1241 "description":
1242 "Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness)."
1243 }),
1244 "sexual/minors": Schema.Boolean.annotate({
1245 "description": "Sexual content that includes an individual who is under 18 years old."
1246 }),
1247 "violence": Schema.Boolean.annotate({
1248 "description": "Content that depicts death, violence, or physical injury."
1249 }),
1250 "violence/graphic": Schema.Boolean.annotate({
1251 "description": "Content that depicts death, violence, or physical injury in graphic detail."
1252 })
1253 }).annotate({ "description": "A list of the categories, and whether they are flagged or not." }),
1254 "category_scores": Schema.Struct({
1255 "hate": Schema.Number.annotate({ "description": "The score for the category 'hate'." }).check(Schema.isFinite()),
1256 "hate/threatening": Schema.Number.annotate({ "description": "The score for the category 'hate/threatening'." })
1257 .check(Schema.isFinite()),
1258 "harassment": Schema.Number.annotate({ "description": "The score for the category 'harassment'." }).check(
1259 Schema.isFinite()
1260 ),
1261 "harassment/threatening": Schema.Number.annotate({
1262 "description": "The score for the category 'harassment/threatening'."
1263 }).check(Schema.isFinite()),
1264 "illicit": Schema.Number.annotate({ "description": "The score for the category 'illicit'." }).check(
1265 Schema.isFinite()
1266 ),
1267 "illicit/violent": Schema.Number.annotate({ "description": "The score for the category 'illicit/violent'." })
1268 .check(Schema.isFinite()),
1269 "self-harm": Schema.Number.annotate({ "description": "The score for the category 'self-harm'." }).check(
1270 Schema.isFinite()
1271 ),
1272 "self-harm/intent": Schema.Number.annotate({ "description": "The score for the category 'self-harm/intent'." })
1273 .check(Schema.isFinite()),
1274 "self-harm/instructions": Schema.Number.annotate({
1275 "description": "The score for the category 'self-harm/instructions'."
1276 }).check(Schema.isFinite()),
1277 "sexual": Schema.Number.annotate({ "description": "The score for the category 'sexual'." }).check(
1278 Schema.isFinite()
1279 ),
1280 "sexual/minors": Schema.Number.annotate({ "description": "The score for the category 'sexual/minors'." }).check(
1281 Schema.isFinite()
1282 ),
1283 "violence": Schema.Number.annotate({ "description": "The score for the category 'violence'." }).check(
1284 Schema.isFinite()
1285 ),
1286 "violence/graphic": Schema.Number.annotate({ "description": "The score for the category 'violence/graphic'." })
1287 .check(Schema.isFinite())
1288 }).annotate({ "description": "A list of the categories along with their scores as predicted by model." }),
1289 "category_applied_input_types": Schema.Struct({
1290 "hate": Schema.Array(Schema.Literal("text")).annotate({
1291 "description": "The applied input type(s) for the category 'hate'."
1292 }),
1293 "hate/threatening": Schema.Array(Schema.Literal("text")).annotate({
1294 "description": "The applied input type(s) for the category 'hate/threatening'."
1295 }),
1296 "harassment": Schema.Array(Schema.Literal("text")).annotate({
1297 "description": "The applied input type(s) for the category 'harassment'."
1298 }),
1299 "harassment/threatening": Schema.Array(Schema.Literal("text")).annotate({
1300 "description": "The applied input type(s) for the category 'harassment/threatening'."
1301 }),
1302 "illicit": Schema.Array(Schema.Literal("text")).annotate({
1303 "description": "The applied input type(s) for the category 'illicit'."
1304 }),
1305 "illicit/violent": Schema.Array(Schema.Literal("text")).annotate({
1306 "description": "The applied input type(s) for the category 'illicit/violent'."
1307 }),
1308 "self-harm": Schema.Array(Schema.Literals(["text", "image"])).annotate({
1309 "description": "The applied input type(s) for the category 'self-harm'."
1310 }),
1311 "self-harm/intent": Schema.Array(Schema.Literals(["text", "image"])).annotate({
1312 "description": "The applied input type(s) for the category 'self-harm/intent'."
1313 }),
1314 "self-harm/instructions": Schema.Array(Schema.Literals(["text", "image"])).annotate({
1315 "description": "The applied input type(s) for the category 'self-harm/instructions'."
1316 }),
1317 "sexual": Schema.Array(Schema.Literals(["text", "image"])).annotate({
1318 "description": "The applied input type(s) for the category 'sexual'."
1319 }),
1320 "sexual/minors": Schema.Array(Schema.Literal("text")).annotate({
1321 "description": "The applied input type(s) for the category 'sexual/minors'."
1322 }),
1323 "violence": Schema.Array(Schema.Literals(["text", "image"])).annotate({
1324 "description": "The applied input type(s) for the category 'violence'."
1325 }),
1326 "violence/graphic": Schema.Array(Schema.Literals(["text", "image"])).annotate({
1327 "description": "The applied input type(s) for the category 'violence/graphic'."
1328 })
1329 }).annotate({ "description": "A list of the categories along with the input type(s) that the score applies to." })
1330 })).annotate({ "description": "A list of moderation objects." })
1331}).annotate({ "description": "Represents if a given text input is potentially harmful." })
1332export type CreateTranscriptionResponseJson = {
1333 readonly "text": string
1334 readonly "logprobs"?: ReadonlyArray<
1335 { readonly "token"?: string; readonly "logprob"?: number; readonly "bytes"?: ReadonlyArray<number> }
1336 >
1337 readonly "usage"?: {
1338 readonly "type": "tokens"
1339 readonly "input_tokens": number
1340 readonly "input_token_details"?: { readonly "text_tokens"?: number; readonly "audio_tokens"?: number }
1341 readonly "output_tokens": number
1342 readonly "total_tokens": number
1343 } | { readonly "type": "duration"; readonly "seconds": number }
1344}
1345export const CreateTranscriptionResponseJson = Schema.Struct({
1346 "text": Schema.String.annotate({ "description": "The transcribed text." }),
1347 "logprobs": Schema.optionalKey(
1348 Schema.Array(Schema.Struct({
1349 "token": Schema.optionalKey(Schema.String.annotate({ "description": "The token in the transcription." })),
1350 "logprob": Schema.optionalKey(
1351 Schema.Number.annotate({ "description": "The log probability of the token." }).check(Schema.isFinite())
1352 ),
1353 "bytes": Schema.optionalKey(
1354 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({ "description": "The bytes of the token." })
1355 )
1356 })).annotate({
1357 "description":
1358 "The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array.\n"
1359 })
1360 ),
1361 "usage": Schema.optionalKey(Schema.Union([
1362 Schema.Struct({
1363 "type": Schema.Literal("tokens").annotate({
1364 "description": "The type of the usage object. Always `tokens` for this variant."
1365 }),
1366 "input_tokens": Schema.Number.annotate({ "description": "Number of input tokens billed for this request." })
1367 .check(Schema.isInt()),
1368 "input_token_details": Schema.optionalKey(
1369 Schema.Struct({
1370 "text_tokens": Schema.optionalKey(
1371 Schema.Number.annotate({ "description": "Number of text tokens billed for this request." }).check(
1372 Schema.isInt()
1373 )
1374 ),
1375 "audio_tokens": Schema.optionalKey(
1376 Schema.Number.annotate({ "description": "Number of audio tokens billed for this request." }).check(
1377 Schema.isInt()
1378 )
1379 )
1380 }).annotate({ "description": "Details about the input tokens billed for this request." })
1381 ),
1382 "output_tokens": Schema.Number.annotate({ "description": "Number of output tokens generated." }).check(
1383 Schema.isInt()
1384 ),
1385 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (input + output)." }).check(
1386 Schema.isInt()
1387 )
1388 }).annotate({ "title": "Token Usage", "description": "Token usage statistics for the request." }),
1389 Schema.Struct({
1390 "type": Schema.Literal("duration").annotate({
1391 "description": "The type of the usage object. Always `duration` for this variant."
1392 }),
1393 "seconds": Schema.Number.annotate({
1394 "description": "Duration of the input audio in seconds.",
1395 "format": "double"
1396 }).check(Schema.isFinite())
1397 }).annotate({ "title": "Duration Usage", "description": "Token usage statistics for the request." })
1398 ], { mode: "oneOf" }))
1399}).annotate({ "description": "Represents a transcription response returned by model, based on the provided input." })
1400export type CreateTranslationRequest = {
1401 readonly "file": string
1402 readonly "model": string | "whisper-1"
1403 readonly "prompt"?: string
1404 readonly "response_format"?: "json" | "text" | "srt" | "verbose_json" | "vtt"
1405 readonly "temperature"?: number
1406}
1407export const CreateTranslationRequest = Schema.Struct({
1408 "file": Schema.String.annotate({
1409 "description":
1410 "The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n",
1411 "format": "binary"
1412 }),
1413 "model": Schema.Union([Schema.String, Schema.Literal("whisper-1")]).annotate({
1414 "description":
1415 "ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.\n"
1416 }),
1417 "prompt": Schema.optionalKey(
1418 Schema.String.annotate({
1419 "description":
1420 "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should be in English.\n"
1421 })
1422 ),
1423 "response_format": Schema.optionalKey(
1424 Schema.Literals(["json", "text", "srt", "verbose_json", "vtt"]).annotate({
1425 "description":
1426 "The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.\n"
1427 })
1428 ),
1429 "temperature": Schema.optionalKey(
1430 Schema.Number.annotate({
1431 "description":
1432 "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n"
1433 }).check(Schema.isFinite())
1434 )
1435})
1436export type CreateTranslationResponseJson = { readonly "text": string }
1437export const CreateTranslationResponseJson = Schema.Struct({ "text": Schema.String })
1438export type CreateVoiceConsentRequest = {
1439 readonly "name": string
1440 readonly "recording": string
1441 readonly "language": string
1442}
1443export const CreateVoiceConsentRequest = Schema.Struct({
1444 "name": Schema.String.annotate({ "description": "The label to use for this consent recording." }),
1445 "recording": Schema.String.annotate({
1446 "description":
1447 "The consent audio recording file. Maximum size is 10 MiB.\n\nSupported MIME types:\n`audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.\n",
1448 "format": "binary"
1449 }),
1450 "language": Schema.String.annotate({
1451 "description": "The BCP 47 language tag for the consent phrase (for example, `en-US`)."
1452 })
1453})
1454export type CreateVoiceRequest = {
1455 readonly "name": string
1456 readonly "audio_sample": string
1457 readonly "consent": string
1458}
1459export const CreateVoiceRequest = Schema.Struct({
1460 "name": Schema.String.annotate({ "description": "The name of the new voice." }),
1461 "audio_sample": Schema.String.annotate({
1462 "description":
1463 "The sample audio recording file. Maximum size is 10 MiB.\n\nSupported MIME types:\n`audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.\n",
1464 "format": "binary"
1465 }),
1466 "consent": Schema.String.annotate({ "description": "The consent recording ID (for example, `cons_1234`)." })
1467})
1468export type CustomToolCall = {
1469 readonly "type": "custom_tool_call"
1470 readonly "id"?: string
1471 readonly "call_id": string
1472 readonly "namespace"?: string
1473 readonly "name": string
1474 readonly "input": string
1475}
1476export const CustomToolCall = Schema.Struct({
1477 "type": Schema.Literal("custom_tool_call").annotate({
1478 "description": "The type of the custom tool call. Always `custom_tool_call`.\n"
1479 }),
1480 "id": Schema.optionalKey(
1481 Schema.String.annotate({ "description": "The unique ID of the custom tool call in the OpenAI platform.\n" })
1482 ),
1483 "call_id": Schema.String.annotate({
1484 "description": "An identifier used to map this custom tool call to a tool call output.\n"
1485 }),
1486 "namespace": Schema.optionalKey(
1487 Schema.String.annotate({ "description": "The namespace of the custom tool being called.\n" })
1488 ),
1489 "name": Schema.String.annotate({ "description": "The name of the custom tool being called.\n" }),
1490 "input": Schema.String.annotate({ "description": "The input for the custom tool call generated by the model.\n" })
1491}).annotate({ "title": "Custom tool call", "description": "A call to a custom tool created by the model.\n" })
1492export type CustomToolCallResource = {
1493 readonly "type": "custom_tool_call"
1494 readonly "id": string
1495 readonly "call_id": string
1496 readonly "namespace"?: string
1497 readonly "name": string
1498 readonly "input": string
1499 readonly "status": "in_progress" | "completed" | "incomplete"
1500 readonly "created_by"?: string
1501}
1502export const CustomToolCallResource = Schema.Struct({
1503 "type": Schema.Literal("custom_tool_call").annotate({
1504 "description": "The type of the custom tool call. Always `custom_tool_call`.\n"
1505 }),
1506 "id": Schema.String.annotate({ "description": "The unique ID of the custom tool call item.\n" }),
1507 "call_id": Schema.String.annotate({
1508 "description": "An identifier used to map this custom tool call to a tool call output.\n"
1509 }),
1510 "namespace": Schema.optionalKey(
1511 Schema.String.annotate({ "description": "The namespace of the custom tool being called.\n" })
1512 ),
1513 "name": Schema.String.annotate({ "description": "The name of the custom tool being called.\n" }),
1514 "input": Schema.String.annotate({ "description": "The input for the custom tool call generated by the model.\n" }),
1515 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
1516 "description":
1517 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
1518 }),
1519 "created_by": Schema.optionalKey(
1520 Schema.String.annotate({ "description": "The identifier of the actor that created the item.\n" })
1521 )
1522}).annotate({ "title": "Custom tool call", "description": "A call to a custom tool created by the model.\n" })
1523export type CustomToolChatCompletions = {
1524 readonly "type": "custom"
1525 readonly "custom": {
1526 readonly "name": string
1527 readonly "description"?: string
1528 readonly "format"?: { readonly "type": "text" } | {
1529 readonly "type": "grammar"
1530 readonly "grammar": { readonly "definition": string; readonly "syntax": "lark" | "regex" }
1531 }
1532 }
1533}
1534export const CustomToolChatCompletions = Schema.Struct({
1535 "type": Schema.Literal("custom").annotate({ "description": "The type of the custom tool. Always `custom`." }),
1536 "custom": Schema.Struct({
1537 "name": Schema.String.annotate({
1538 "description": "The name of the custom tool, used to identify it in tool calls."
1539 }),
1540 "description": Schema.optionalKey(
1541 Schema.String.annotate({
1542 "description": "Optional description of the custom tool, used to provide more context.\n"
1543 })
1544 ),
1545 "format": Schema.optionalKey(
1546 Schema.Union([
1547 Schema.Struct({
1548 "type": Schema.Literal("text").annotate({ "description": "Unconstrained text format. Always `text`." })
1549 }).annotate({ "title": "Text format", "description": "Unconstrained free-form text." }),
1550 Schema.Struct({
1551 "type": Schema.Literal("grammar").annotate({ "description": "Grammar format. Always `grammar`." }),
1552 "grammar": Schema.Struct({
1553 "definition": Schema.String.annotate({ "description": "The grammar definition." }),
1554 "syntax": Schema.Literals(["lark", "regex"]).annotate({
1555 "description": "The syntax of the grammar definition. One of `lark` or `regex`."
1556 })
1557 }).annotate({ "title": "Grammar format", "description": "Your chosen grammar." })
1558 }).annotate({ "title": "Grammar format", "description": "A grammar defined by the user." })
1559 ], { mode: "oneOf" }).annotate({
1560 "description": "The input format for the custom tool. Default is unconstrained text.\n"
1561 })
1562 )
1563 }).annotate({ "title": "Custom tool properties", "description": "Properties of the custom tool.\n" })
1564}).annotate({ "title": "Custom tool", "description": "A custom tool that processes input using a specified format.\n" })
1565export type DeleteAssistantResponse = {
1566 readonly "id": string
1567 readonly "deleted": boolean
1568 readonly "object": "assistant.deleted"
1569}
1570export const DeleteAssistantResponse = Schema.Struct({
1571 "id": Schema.String,
1572 "deleted": Schema.Boolean,
1573 "object": Schema.Literal("assistant.deleted")
1574})
1575export type DeleteCertificateResponse = { readonly "object": "certificate.deleted"; readonly "id": string }
1576export const DeleteCertificateResponse = Schema.Struct({
1577 "object": Schema.Literal("certificate.deleted").annotate({
1578 "description": "The object type, must be `certificate.deleted`."
1579 }),
1580 "id": Schema.String.annotate({ "description": "The ID of the certificate that was deleted." })
1581})
1582export type DeleteFileResponse = { readonly "id": string; readonly "object": "file"; readonly "deleted": boolean }
1583export const DeleteFileResponse = Schema.Struct({
1584 "id": Schema.String,
1585 "object": Schema.Literal("file"),
1586 "deleted": Schema.Boolean
1587})
1588export type DeleteFineTuningCheckpointPermissionResponse = {
1589 readonly "id": string
1590 readonly "object": "checkpoint.permission"
1591 readonly "deleted": boolean
1592}
1593export const DeleteFineTuningCheckpointPermissionResponse = Schema.Struct({
1594 "id": Schema.String.annotate({
1595 "description": "The ID of the fine-tuned model checkpoint permission that was deleted."
1596 }),
1597 "object": Schema.Literal("checkpoint.permission").annotate({
1598 "description": "The object type, which is always \"checkpoint.permission\"."
1599 }),
1600 "deleted": Schema.Boolean.annotate({
1601 "description": "Whether the fine-tuned model checkpoint permission was successfully deleted."
1602 })
1603})
1604export type DeleteMessageResponse = {
1605 readonly "id": string
1606 readonly "deleted": boolean
1607 readonly "object": "thread.message.deleted"
1608}
1609export const DeleteMessageResponse = Schema.Struct({
1610 "id": Schema.String,
1611 "deleted": Schema.Boolean,
1612 "object": Schema.Literal("thread.message.deleted")
1613})
1614export type DeleteModelResponse = { readonly "id": string; readonly "deleted": boolean; readonly "object": string }
1615export const DeleteModelResponse = Schema.Struct({
1616 "id": Schema.String,
1617 "deleted": Schema.Boolean,
1618 "object": Schema.String
1619})
1620export type DeleteThreadResponse = {
1621 readonly "id": string
1622 readonly "deleted": boolean
1623 readonly "object": "thread.deleted"
1624}
1625export const DeleteThreadResponse = Schema.Struct({
1626 "id": Schema.String,
1627 "deleted": Schema.Boolean,
1628 "object": Schema.Literal("thread.deleted")
1629})
1630export type DeleteVectorStoreFileResponse = {
1631 readonly "id": string
1632 readonly "deleted": boolean
1633 readonly "object": "vector_store.file.deleted"
1634}
1635export const DeleteVectorStoreFileResponse = Schema.Struct({
1636 "id": Schema.String,
1637 "deleted": Schema.Boolean,
1638 "object": Schema.Literal("vector_store.file.deleted")
1639})
1640export type DeleteVectorStoreResponse = {
1641 readonly "id": string
1642 readonly "deleted": boolean
1643 readonly "object": "vector_store.deleted"
1644}
1645export const DeleteVectorStoreResponse = Schema.Struct({
1646 "id": Schema.String,
1647 "deleted": Schema.Boolean,
1648 "object": Schema.Literal("vector_store.deleted")
1649})
1650export type DeletedRoleAssignmentResource = { readonly "object": string; readonly "deleted": boolean }
1651export const DeletedRoleAssignmentResource = Schema.Struct({
1652 "object": Schema.String.annotate({
1653 "description": "Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`."
1654 }),
1655 "deleted": Schema.Boolean.annotate({ "description": "Whether the assignment was removed." })
1656}).annotate({ "description": "Confirmation payload returned after unassigning a role." })
1657export type DoneEvent = { readonly "event": "done"; readonly "data": "[DONE]" }
1658export const DoneEvent = Schema.Struct({ "event": Schema.Literal("done"), "data": Schema.Literal("[DONE]") }).annotate({
1659 "description": "Occurs when a stream ends."
1660})
1661export type Embedding = {
1662 readonly "index": number
1663 readonly "embedding": ReadonlyArray<number>
1664 readonly "object": "embedding"
1665}
1666export const Embedding = Schema.Struct({
1667 "index": Schema.Number.annotate({ "description": "The index of the embedding in the list of embeddings." }).check(
1668 Schema.isInt()
1669 ),
1670 "embedding": Schema.Array(Schema.Number.annotate({ "format": "float" }).check(Schema.isFinite())).annotate({
1671 "description":
1672 "The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings).\n"
1673 }),
1674 "object": Schema.Literal("embedding").annotate({ "description": "The object type, which is always \"embedding\"." })
1675}).annotate({ "description": "Represents an embedding vector returned by embedding endpoint.\n" })
1676export type Error = {
1677 readonly "code": string | null
1678 readonly "message": string
1679 readonly "param": string | null
1680 readonly "type": string
1681}
1682export const Error = Schema.Struct({
1683 "code": Schema.Union([Schema.String, Schema.Null]),
1684 "message": Schema.String,
1685 "param": Schema.Union([Schema.String, Schema.Null]),
1686 "type": Schema.String
1687})
1688export type EvalApiError = { readonly "code": string; readonly "message": string }
1689export const EvalApiError = Schema.Struct({
1690 "code": Schema.String.annotate({ "description": "The error code." }),
1691 "message": Schema.String.annotate({ "description": "The error message." })
1692}).annotate({ "title": "EvalApiError", "description": "An object representing an error response from the Eval API.\n" })
1693export type EvalGraderPython = {
1694 readonly "type": "python"
1695 readonly "name": string
1696 readonly "source": string
1697 readonly "image_tag"?: string
1698 readonly "pass_threshold"?: number
1699}
1700export const EvalGraderPython = Schema.Struct({
1701 "type": Schema.Literal("python").annotate({ "description": "The object type, which is always `python`." }),
1702 "name": Schema.String.annotate({ "description": "The name of the grader." }),
1703 "source": Schema.String.annotate({ "description": "The source code of the python script." }),
1704 "image_tag": Schema.optionalKey(
1705 Schema.String.annotate({ "description": "The image tag to use for the python script." })
1706 ),
1707 "pass_threshold": Schema.optionalKey(
1708 Schema.Number.annotate({ "description": "The threshold for the score." }).check(Schema.isFinite())
1709 )
1710}).annotate({
1711 "title": "PythonGrader",
1712 "description": "A PythonGrader object that runs a python script on the input.\n"
1713})
1714export type EvalGraderStringCheck = {
1715 readonly "type": "string_check"
1716 readonly "name": string
1717 readonly "input": string
1718 readonly "reference": string
1719 readonly "operation": "eq" | "ne" | "like" | "ilike"
1720}
1721export const EvalGraderStringCheck = Schema.Struct({
1722 "type": Schema.Literal("string_check").annotate({
1723 "description": "The object type, which is always `string_check`."
1724 }),
1725 "name": Schema.String.annotate({ "description": "The name of the grader." }),
1726 "input": Schema.String.annotate({ "description": "The input text. This may include template strings." }),
1727 "reference": Schema.String.annotate({ "description": "The reference text. This may include template strings." }),
1728 "operation": Schema.Literals(["eq", "ne", "like", "ilike"]).annotate({
1729 "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."
1730 })
1731}).annotate({
1732 "title": "StringCheckGrader",
1733 "description":
1734 "A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.\n"
1735})
1736export type EvalGraderTextSimilarity = {
1737 readonly "type": "text_similarity"
1738 readonly "name": string
1739 readonly "input": string
1740 readonly "reference": string
1741 readonly "evaluation_metric":
1742 | "cosine"
1743 | "fuzzy_match"
1744 | "bleu"
1745 | "gleu"
1746 | "meteor"
1747 | "rouge_1"
1748 | "rouge_2"
1749 | "rouge_3"
1750 | "rouge_4"
1751 | "rouge_5"
1752 | "rouge_l"
1753 readonly "pass_threshold": number
1754}
1755export const EvalGraderTextSimilarity = Schema.Struct({
1756 "type": Schema.Literal("text_similarity").annotate({ "description": "The type of grader." }),
1757 "name": Schema.String.annotate({ "description": "The name of the grader." }),
1758 "input": Schema.String.annotate({ "description": "The text being graded." }),
1759 "reference": Schema.String.annotate({ "description": "The text being graded against." }),
1760 "evaluation_metric": Schema.Literals([
1761 "cosine",
1762 "fuzzy_match",
1763 "bleu",
1764 "gleu",
1765 "meteor",
1766 "rouge_1",
1767 "rouge_2",
1768 "rouge_3",
1769 "rouge_4",
1770 "rouge_5",
1771 "rouge_l"
1772 ]).annotate({
1773 "description":
1774 "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"
1775 }),
1776 "pass_threshold": Schema.Number.annotate({ "description": "The threshold for the score." }).check(Schema.isFinite())
1777}).annotate({
1778 "title": "TextSimilarityGrader",
1779 "description": "A TextSimilarityGrader object which grades text based on similarity metrics.\n"
1780})
1781export type EvalItemContentOutputText = { readonly "type": "output_text"; readonly "text": string }
1782export const EvalItemContentOutputText = Schema.Struct({
1783 "type": Schema.Literal("output_text").annotate({
1784 "description": "The type of the output text. Always `output_text`.\n"
1785 }),
1786 "text": Schema.String.annotate({ "description": "The text output from the model.\n" })
1787}).annotate({ "title": "Output text", "description": "A text output from the model.\n" })
1788export type EvalItemContentText = string
1789export const EvalItemContentText = Schema.String.annotate({
1790 "title": "Text input",
1791 "description": "A text input to the model.\n"
1792})
1793export type EvalItemInputImage = {
1794 readonly "type": "input_image"
1795 readonly "image_url": string
1796 readonly "detail"?: string
1797}
1798export const EvalItemInputImage = Schema.Struct({
1799 "type": Schema.Literal("input_image").annotate({
1800 "description": "The type of the image input. Always `input_image`.\n"
1801 }),
1802 "image_url": Schema.String.annotate({ "description": "The URL of the image input.\n", "format": "uri" }),
1803 "detail": Schema.optionalKey(
1804 Schema.String.annotate({
1805 "description":
1806 "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n"
1807 })
1808 )
1809}).annotate({ "title": "Input image", "description": "An image input block used within EvalItem content arrays." })
1810export type EvalJsonlFileContentSource = {
1811 readonly "type": "file_content"
1812 readonly "content": ReadonlyArray<{ readonly "item": {}; readonly "sample"?: {} }>
1813}
1814export const EvalJsonlFileContentSource = Schema.Struct({
1815 "type": Schema.Literal("file_content").annotate({
1816 "description": "The type of jsonl source. Always `file_content`."
1817 }),
1818 "content": Schema.Array(Schema.Struct({ "item": Schema.Struct({}), "sample": Schema.optionalKey(Schema.Struct({})) }))
1819 .annotate({ "description": "The content of the jsonl file." })
1820}).annotate({ "title": "EvalJsonlFileContentSource" })
1821export type EvalJsonlFileIdSource = { readonly "type": "file_id"; readonly "id": string }
1822export const EvalJsonlFileIdSource = Schema.Struct({
1823 "type": Schema.Literal("file_id").annotate({ "description": "The type of jsonl source. Always `file_id`." }),
1824 "id": Schema.String.annotate({ "description": "The identifier of the file." })
1825}).annotate({ "title": "EvalJsonlFileIdSource" })
1826export type EvalResponsesSource = {
1827 readonly "type": "responses"
1828 readonly "metadata"?: {} | null
1829 readonly "model"?: string | null
1830 readonly "instructions_search"?: string | null
1831 readonly "created_after"?: number | null
1832 readonly "created_before"?: number | null
1833 readonly "reasoning_effort"?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null | null
1834 readonly "temperature"?: number | null
1835 readonly "top_p"?: number | null
1836 readonly "users"?: ReadonlyArray<string> | null
1837 readonly "tools"?: ReadonlyArray<string> | null
1838}
1839export const EvalResponsesSource = Schema.Struct({
1840 "type": Schema.Literal("responses").annotate({ "description": "The type of run data source. Always `responses`." }),
1841 "metadata": Schema.optionalKey(
1842 Schema.Union([
1843 Schema.Struct({}).annotate({
1844 "description": "Metadata filter for the responses. This is a query parameter used to select responses."
1845 }),
1846 Schema.Null
1847 ])
1848 ),
1849 "model": Schema.optionalKey(
1850 Schema.Union([
1851 Schema.String.annotate({
1852 "description":
1853 "The name of the model to find responses for. This is a query parameter used to select responses."
1854 }),
1855 Schema.Null
1856 ])
1857 ),
1858 "instructions_search": Schema.optionalKey(
1859 Schema.Union([
1860 Schema.String.annotate({
1861 "description":
1862 "Optional string to search the 'instructions' field. This is a query parameter used to select responses."
1863 }),
1864 Schema.Null
1865 ])
1866 ),
1867 "created_after": Schema.optionalKey(
1868 Schema.Union([
1869 Schema.Number.annotate({
1870 "description":
1871 "Only include items created after this timestamp (inclusive). This is a query parameter used to select responses."
1872 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
1873 Schema.Null
1874 ])
1875 ),
1876 "created_before": Schema.optionalKey(
1877 Schema.Union([
1878 Schema.Number.annotate({
1879 "description":
1880 "Only include items created before this timestamp (inclusive). This is a query parameter used to select responses."
1881 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
1882 Schema.Null
1883 ])
1884 ),
1885 "reasoning_effort": Schema.optionalKey(
1886 Schema.Union([
1887 Schema.Union([
1888 Schema.Literals(["none", "minimal", "low", "medium", "high", "xhigh"]).annotate({
1889 "description":
1890 "Constrains effort on reasoning for\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\nCurrently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing\nreasoning effort can result in faster responses and fewer tokens used\non reasoning in a response.\n\n- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.\n- All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.\n- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.\n- `xhigh` is supported for all models after `gpt-5.1-codex-max`.\n"
1891 }),
1892 Schema.Null
1893 ]).annotate({
1894 "description": "Optional reasoning effort parameter. This is a query parameter used to select responses."
1895 }),
1896 Schema.Null
1897 ])
1898 ),
1899 "temperature": Schema.optionalKey(
1900 Schema.Union([
1901 Schema.Number.annotate({
1902 "description": "Sampling temperature. This is a query parameter used to select responses."
1903 }).check(Schema.isFinite()),
1904 Schema.Null
1905 ])
1906 ),
1907 "top_p": Schema.optionalKey(
1908 Schema.Union([
1909 Schema.Number.annotate({
1910 "description": "Nucleus sampling parameter. This is a query parameter used to select responses."
1911 }).check(Schema.isFinite()),
1912 Schema.Null
1913 ])
1914 ),
1915 "users": Schema.optionalKey(
1916 Schema.Union([
1917 Schema.Array(Schema.String).annotate({
1918 "description": "List of user identifiers. This is a query parameter used to select responses."
1919 }),
1920 Schema.Null
1921 ])
1922 ),
1923 "tools": Schema.optionalKey(
1924 Schema.Union([
1925 Schema.Array(Schema.String).annotate({
1926 "description": "List of tool names. This is a query parameter used to select responses."
1927 }),
1928 Schema.Null
1929 ])
1930 )
1931}).annotate({
1932 "title": "EvalResponsesSource",
1933 "description": "A EvalResponsesSource object describing a run data source configuration.\n"
1934})
1935export type EvalRunOutputItemResult = {
1936 readonly "name": string
1937 readonly "type"?: string
1938 readonly "score": number
1939 readonly "passed": boolean
1940 readonly "sample"?: {} | null
1941}
1942export const EvalRunOutputItemResult = Schema.Struct({
1943 "name": Schema.String.annotate({ "description": "The name of the grader." }),
1944 "type": Schema.optionalKey(
1945 Schema.String.annotate({ "description": "The grader type (for example, \"string-check-grader\")." })
1946 ),
1947 "score": Schema.Number.annotate({ "description": "The numeric score produced by the grader." }).check(
1948 Schema.isFinite()
1949 ),
1950 "passed": Schema.Boolean.annotate({ "description": "Whether the grader considered the output a pass." }),
1951 "sample": Schema.optionalKey(
1952 Schema.Union([Schema.Struct({}), Schema.Null]).annotate({
1953 "description": "Optional sample or intermediate data produced by the grader."
1954 })
1955 )
1956}).annotate({
1957 "title": "EvalRunOutputItemResult",
1958 "description": "A single grader result for an evaluation run output item.\n"
1959})
1960export type FileExpirationAfter = { readonly "anchor": "created_at"; readonly "seconds": number }
1961export const FileExpirationAfter = Schema.Struct({
1962 "anchor": Schema.Literal("created_at").annotate({
1963 "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`."
1964 }),
1965 "seconds": Schema.Number.annotate({
1966 "description":
1967 "The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).",
1968 "format": "int64"
1969 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(3600)).check(Schema.isLessThanOrEqualTo(2592000))
1970}).annotate({
1971 "title": "File expiration policy",
1972 "description":
1973 "The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted."
1974})
1975export type FilePath = { readonly "type": "file_path"; readonly "file_id": string; readonly "index": number }
1976export const FilePath = Schema.Struct({
1977 "type": Schema.Literal("file_path").annotate({ "description": "The type of the file path. Always `file_path`.\n" }),
1978 "file_id": Schema.String.annotate({ "description": "The ID of the file.\n" }),
1979 "index": Schema.Number.annotate({ "description": "The index of the file in the list of files.\n" }).check(
1980 Schema.isInt()
1981 )
1982}).annotate({ "title": "File path", "description": "A path to a file.\n" })
1983export type FileSearchRanker = "auto" | "default_2024_08_21"
1984export const FileSearchRanker = Schema.Literals(["auto", "default_2024_08_21"]).annotate({
1985 "description": "The ranker to use for the file search. If not specified will use the `auto` ranker."
1986})
1987export type FineTuneDPOHyperparameters = {
1988 readonly "beta"?: "auto" | number
1989 readonly "batch_size"?: "auto" | number
1990 readonly "learning_rate_multiplier"?: "auto" | number
1991 readonly "n_epochs"?: "auto" | number
1992}
1993export const FineTuneDPOHyperparameters = Schema.Struct({
1994 "beta": Schema.optionalKey(
1995 Schema.Union([
1996 Schema.Literal("auto"),
1997 Schema.Number.check(Schema.isFinite()).check(Schema.isLessThanOrEqualTo(2)).check(Schema.isGreaterThan(0))
1998 ], { mode: "oneOf" }).annotate({
1999 "description":
2000 "The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.\n"
2001 })
2002 ),
2003 "batch_size": Schema.optionalKey(
2004 Schema.Union([
2005 Schema.Literal("auto"),
2006 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(256))
2007 ], { mode: "oneOf" }).annotate({
2008 "description":
2009 "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"
2010 })
2011 ),
2012 "learning_rate_multiplier": Schema.optionalKey(
2013 Schema.Union([Schema.Literal("auto"), Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThan(0))], {
2014 mode: "oneOf"
2015 }).annotate({
2016 "description":
2017 "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"
2018 })
2019 ),
2020 "n_epochs": Schema.optionalKey(
2021 Schema.Union([
2022 Schema.Literal("auto"),
2023 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50))
2024 ], { mode: "oneOf" }).annotate({
2025 "description":
2026 "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"
2027 })
2028 )
2029}).annotate({ "description": "The hyperparameters used for the DPO fine-tuning job." })
2030export type FineTuneReinforcementHyperparameters = {
2031 readonly "batch_size"?: "auto" | number
2032 readonly "learning_rate_multiplier"?: "auto" | number
2033 readonly "n_epochs"?: "auto" | number
2034 readonly "reasoning_effort"?: "default" | "low" | "medium" | "high"
2035 readonly "compute_multiplier"?: "auto" | number
2036 readonly "eval_interval"?: "auto" | number
2037 readonly "eval_samples"?: "auto" | number
2038}
2039export const FineTuneReinforcementHyperparameters = Schema.Struct({
2040 "batch_size": Schema.optionalKey(
2041 Schema.Union([
2042 Schema.Literal("auto"),
2043 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(256))
2044 ], { mode: "oneOf" }).annotate({
2045 "description":
2046 "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"
2047 })
2048 ),
2049 "learning_rate_multiplier": Schema.optionalKey(
2050 Schema.Union([Schema.Literal("auto"), Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThan(0))], {
2051 mode: "oneOf"
2052 }).annotate({
2053 "description":
2054 "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"
2055 })
2056 ),
2057 "n_epochs": Schema.optionalKey(
2058 Schema.Union([
2059 Schema.Literal("auto"),
2060 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50))
2061 ], { mode: "oneOf" }).annotate({
2062 "description":
2063 "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"
2064 })
2065 ),
2066 "reasoning_effort": Schema.optionalKey(
2067 Schema.Literals(["default", "low", "medium", "high"]).annotate({ "description": "Level of reasoning effort.\n" })
2068 ),
2069 "compute_multiplier": Schema.optionalKey(
2070 Schema.Union([
2071 Schema.Literal("auto"),
2072 Schema.Number.check(Schema.isFinite()).check(Schema.isLessThanOrEqualTo(10)).check(Schema.isGreaterThan(0.00001))
2073 ], { mode: "oneOf" }).annotate({
2074 "description": "Multiplier on amount of compute used for exploring search space during training.\n"
2075 })
2076 ),
2077 "eval_interval": Schema.optionalKey(
2078 Schema.Union(
2079 [Schema.Literal("auto"), Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))],
2080 { mode: "oneOf" }
2081 ).annotate({ "description": "The number of training steps between evaluation runs.\n" })
2082 ),
2083 "eval_samples": Schema.optionalKey(
2084 Schema.Union(
2085 [Schema.Literal("auto"), Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))],
2086 { mode: "oneOf" }
2087 ).annotate({ "description": "Number of evaluation samples to generate per training step.\n" })
2088 )
2089}).annotate({ "description": "The hyperparameters used for the reinforcement fine-tuning job." })
2090export type FineTuneSupervisedHyperparameters = {
2091 readonly "batch_size"?: "auto" | number
2092 readonly "learning_rate_multiplier"?: "auto" | number
2093 readonly "n_epochs"?: "auto" | number
2094}
2095export const FineTuneSupervisedHyperparameters = Schema.Struct({
2096 "batch_size": Schema.optionalKey(
2097 Schema.Union([
2098 Schema.Literal("auto"),
2099 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(256))
2100 ], { mode: "oneOf" }).annotate({
2101 "description":
2102 "Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.\n"
2103 })
2104 ),
2105 "learning_rate_multiplier": Schema.optionalKey(
2106 Schema.Union([Schema.Literal("auto"), Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThan(0))], {
2107 mode: "oneOf"
2108 }).annotate({
2109 "description":
2110 "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.\n"
2111 })
2112 ),
2113 "n_epochs": Schema.optionalKey(
2114 Schema.Union([
2115 Schema.Literal("auto"),
2116 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50))
2117 ], { mode: "oneOf" }).annotate({
2118 "description":
2119 "The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.\n"
2120 })
2121 )
2122}).annotate({ "description": "The hyperparameters used for the fine-tuning job." })
2123export type FineTuningCheckpointPermission = {
2124 readonly "id": string
2125 readonly "created_at": number
2126 readonly "project_id": string
2127 readonly "object": "checkpoint.permission"
2128}
2129export const FineTuningCheckpointPermission = Schema.Struct({
2130 "id": Schema.String.annotate({
2131 "description": "The permission identifier, which can be referenced in the API endpoints."
2132 }),
2133 "created_at": Schema.Number.annotate({
2134 "description": "The Unix timestamp (in seconds) for when the permission was created.",
2135 "format": "unixtime"
2136 }).check(Schema.isInt()),
2137 "project_id": Schema.String.annotate({ "description": "The project identifier that the permission is for." }),
2138 "object": Schema.Literal("checkpoint.permission").annotate({
2139 "description": "The object type, which is always \"checkpoint.permission\"."
2140 })
2141}).annotate({
2142 "title": "FineTuningCheckpointPermission",
2143 "description": "The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.\n"
2144})
2145export type FineTuningIntegration = {
2146 readonly "type": "wandb"
2147 readonly "wandb": {
2148 readonly "project": string
2149 readonly "name"?: string | null
2150 readonly "entity"?: string | null
2151 readonly "tags"?: ReadonlyArray<string>
2152 }
2153}
2154export const FineTuningIntegration = Schema.Struct({
2155 "type": Schema.Literal("wandb").annotate({
2156 "description": "The type of the integration being enabled for the fine-tuning job"
2157 }),
2158 "wandb": Schema.Struct({
2159 "project": Schema.String.annotate({
2160 "description": "The name of the project that the new run will be created under.\n"
2161 }),
2162 "name": Schema.optionalKey(
2163 Schema.Union([
2164 Schema.String.annotate({
2165 "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n"
2166 }),
2167 Schema.Null
2168 ])
2169 ),
2170 "entity": Schema.optionalKey(
2171 Schema.Union([
2172 Schema.String.annotate({
2173 "description":
2174 "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n"
2175 }),
2176 Schema.Null
2177 ])
2178 ),
2179 "tags": Schema.optionalKey(
2180 Schema.Array(Schema.String).annotate({
2181 "description":
2182 "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n"
2183 })
2184 )
2185 }).annotate({
2186 "description":
2187 "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n"
2188 })
2189}).annotate({ "title": "Fine-Tuning Job Integration" })
2190export type FineTuningJobCheckpoint = {
2191 readonly "id": string
2192 readonly "created_at": number
2193 readonly "fine_tuned_model_checkpoint": string
2194 readonly "step_number": number
2195 readonly "metrics": {
2196 readonly "step"?: number
2197 readonly "train_loss"?: number
2198 readonly "train_mean_token_accuracy"?: number
2199 readonly "valid_loss"?: number
2200 readonly "valid_mean_token_accuracy"?: number
2201 readonly "full_valid_loss"?: number
2202 readonly "full_valid_mean_token_accuracy"?: number
2203 }
2204 readonly "fine_tuning_job_id": string
2205 readonly "object": "fine_tuning.job.checkpoint"
2206}
2207export const FineTuningJobCheckpoint = Schema.Struct({
2208 "id": Schema.String.annotate({
2209 "description": "The checkpoint identifier, which can be referenced in the API endpoints."
2210 }),
2211 "created_at": Schema.Number.annotate({
2212 "description": "The Unix timestamp (in seconds) for when the checkpoint was created.",
2213 "format": "unixtime"
2214 }).check(Schema.isInt()),
2215 "fine_tuned_model_checkpoint": Schema.String.annotate({
2216 "description": "The name of the fine-tuned checkpoint model that is created."
2217 }),
2218 "step_number": Schema.Number.annotate({ "description": "The step number that the checkpoint was created at." }).check(
2219 Schema.isInt()
2220 ),
2221 "metrics": Schema.Struct({
2222 "step": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
2223 "train_loss": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
2224 "train_mean_token_accuracy": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
2225 "valid_loss": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
2226 "valid_mean_token_accuracy": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
2227 "full_valid_loss": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
2228 "full_valid_mean_token_accuracy": Schema.optionalKey(Schema.Number.check(Schema.isFinite()))
2229 }).annotate({ "description": "Metrics at the step number during the fine-tuning job." }),
2230 "fine_tuning_job_id": Schema.String.annotate({
2231 "description": "The name of the fine-tuning job that this checkpoint was created from."
2232 }),
2233 "object": Schema.Literal("fine_tuning.job.checkpoint").annotate({
2234 "description": "The object type, which is always \"fine_tuning.job.checkpoint\"."
2235 })
2236}).annotate({
2237 "title": "FineTuningJobCheckpoint",
2238 "description":
2239 "The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use.\n"
2240})
2241export type FineTuningJobEvent = {
2242 readonly "object": "fine_tuning.job.event"
2243 readonly "id": string
2244 readonly "created_at": number
2245 readonly "level": "info" | "warn" | "error"
2246 readonly "message": string
2247 readonly "type"?: "message" | "metrics"
2248 readonly "data"?: {}
2249}
2250export const FineTuningJobEvent = Schema.Struct({
2251 "object": Schema.Literal("fine_tuning.job.event").annotate({
2252 "description": "The object type, which is always \"fine_tuning.job.event\"."
2253 }),
2254 "id": Schema.String.annotate({ "description": "The object identifier." }),
2255 "created_at": Schema.Number.annotate({
2256 "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created.",
2257 "format": "unixtime"
2258 }).check(Schema.isInt()),
2259 "level": Schema.Literals(["info", "warn", "error"]).annotate({ "description": "The log level of the event." }),
2260 "message": Schema.String.annotate({ "description": "The message of the event." }),
2261 "type": Schema.optionalKey(Schema.Literals(["message", "metrics"]).annotate({ "description": "The type of event." })),
2262 "data": Schema.optionalKey(Schema.Struct({}).annotate({ "description": "The data associated with the event." }))
2263}).annotate({ "description": "Fine-tuning job event object" })
2264export type FunctionParameters = {}
2265export const FunctionParameters = Schema.Struct({}).annotate({
2266 "description":
2267 "The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. \n\nOmitting `parameters` defines a function with an empty parameter list."
2268})
2269export type FunctionToolCall = {
2270 readonly "id"?: string
2271 readonly "type": "function_call"
2272 readonly "call_id": string
2273 readonly "namespace"?: string
2274 readonly "name": string
2275 readonly "arguments": string
2276 readonly "status"?: "in_progress" | "completed" | "incomplete"
2277}
2278export const FunctionToolCall = Schema.Struct({
2279 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the function tool call.\n" })),
2280 "type": Schema.Literal("function_call").annotate({
2281 "description": "The type of the function tool call. Always `function_call`.\n"
2282 }),
2283 "call_id": Schema.String.annotate({
2284 "description": "The unique ID of the function tool call generated by the model.\n"
2285 }),
2286 "namespace": Schema.optionalKey(Schema.String.annotate({ "description": "The namespace of the function to run.\n" })),
2287 "name": Schema.String.annotate({ "description": "The name of the function to run.\n" }),
2288 "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments to pass to the function.\n" }),
2289 "status": Schema.optionalKey(
2290 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
2291 "description":
2292 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
2293 })
2294 )
2295}).annotate({
2296 "title": "Function tool call",
2297 "description":
2298 "A tool call to run a function. See the \n[function calling guide](/docs/guides/function-calling) for more information.\n"
2299})
2300export type FunctionToolCallResource = {
2301 readonly "id": string
2302 readonly "type": "function_call"
2303 readonly "call_id": string
2304 readonly "namespace"?: string
2305 readonly "name": string
2306 readonly "arguments": string
2307 readonly "status": "in_progress" | "completed" | "incomplete"
2308 readonly "created_by"?: string
2309}
2310export const FunctionToolCallResource = Schema.Struct({
2311 "id": Schema.String.annotate({ "description": "The unique ID of the function tool call.\n" }),
2312 "type": Schema.Literal("function_call").annotate({
2313 "description": "The type of the function tool call. Always `function_call`.\n"
2314 }),
2315 "call_id": Schema.String.annotate({
2316 "description": "The unique ID of the function tool call generated by the model.\n"
2317 }),
2318 "namespace": Schema.optionalKey(Schema.String.annotate({ "description": "The namespace of the function to run.\n" })),
2319 "name": Schema.String.annotate({ "description": "The name of the function to run.\n" }),
2320 "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments to pass to the function.\n" }),
2321 "status": Schema.Union([
2322 Schema.Literal("in_progress").annotate({
2323 "description":
2324 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
2325 }),
2326 Schema.Literal("completed").annotate({
2327 "description":
2328 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
2329 }),
2330 Schema.Literal("incomplete").annotate({
2331 "description":
2332 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
2333 })
2334 ]).annotate({
2335 "description":
2336 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
2337 }),
2338 "created_by": Schema.optionalKey(
2339 Schema.String.annotate({ "description": "The identifier of the actor that created the item.\n" })
2340 )
2341}).annotate({
2342 "title": "Function tool call",
2343 "description":
2344 "A tool call to run a function. See the \n[function calling guide](/docs/guides/function-calling) for more information.\n"
2345})
2346export type GraderPython = {
2347 readonly "type": "python"
2348 readonly "name": string
2349 readonly "source": string
2350 readonly "image_tag"?: string
2351}
2352export const GraderPython = Schema.Struct({
2353 "type": Schema.Literal("python").annotate({ "description": "The object type, which is always `python`." }),
2354 "name": Schema.String.annotate({ "description": "The name of the grader." }),
2355 "source": Schema.String.annotate({ "description": "The source code of the python script." }),
2356 "image_tag": Schema.optionalKey(
2357 Schema.String.annotate({ "description": "The image tag to use for the python script." })
2358 )
2359}).annotate({
2360 "title": "PythonGrader",
2361 "description": "A PythonGrader object that runs a python script on the input.\n"
2362})
2363export type GraderStringCheck = {
2364 readonly "type": "string_check"
2365 readonly "name": string
2366 readonly "input": string
2367 readonly "reference": string
2368 readonly "operation": "eq" | "ne" | "like" | "ilike"
2369}
2370export const GraderStringCheck = Schema.Struct({
2371 "type": Schema.Literal("string_check").annotate({
2372 "description": "The object type, which is always `string_check`."
2373 }),
2374 "name": Schema.String.annotate({ "description": "The name of the grader." }),
2375 "input": Schema.String.annotate({ "description": "The input text. This may include template strings." }),
2376 "reference": Schema.String.annotate({ "description": "The reference text. This may include template strings." }),
2377 "operation": Schema.Literals(["eq", "ne", "like", "ilike"]).annotate({
2378 "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."
2379 })
2380}).annotate({
2381 "title": "StringCheckGrader",
2382 "description":
2383 "A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.\n"
2384})
2385export type GraderTextSimilarity = {
2386 readonly "type": "text_similarity"
2387 readonly "name": string
2388 readonly "input": string
2389 readonly "reference": string
2390 readonly "evaluation_metric":
2391 | "cosine"
2392 | "fuzzy_match"
2393 | "bleu"
2394 | "gleu"
2395 | "meteor"
2396 | "rouge_1"
2397 | "rouge_2"
2398 | "rouge_3"
2399 | "rouge_4"
2400 | "rouge_5"
2401 | "rouge_l"
2402}
2403export const GraderTextSimilarity = Schema.Struct({
2404 "type": Schema.Literal("text_similarity").annotate({ "description": "The type of grader." }),
2405 "name": Schema.String.annotate({ "description": "The name of the grader." }),
2406 "input": Schema.String.annotate({ "description": "The text being graded." }),
2407 "reference": Schema.String.annotate({ "description": "The text being graded against." }),
2408 "evaluation_metric": Schema.Literals([
2409 "cosine",
2410 "fuzzy_match",
2411 "bleu",
2412 "gleu",
2413 "meteor",
2414 "rouge_1",
2415 "rouge_2",
2416 "rouge_3",
2417 "rouge_4",
2418 "rouge_5",
2419 "rouge_l"
2420 ]).annotate({
2421 "description":
2422 "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"
2423 })
2424}).annotate({
2425 "title": "TextSimilarityGrader",
2426 "description": "A TextSimilarityGrader object which grades text based on similarity metrics.\n"
2427})
2428export type Group = {
2429 readonly "object": "group"
2430 readonly "id": string
2431 readonly "name": string
2432 readonly "created_at": number
2433 readonly "scim_managed": boolean
2434}
2435export const Group = Schema.Struct({
2436 "object": Schema.Literal("group").annotate({ "description": "Always `group`." }),
2437 "id": Schema.String.annotate({ "description": "Identifier for the group." }),
2438 "name": Schema.String.annotate({ "description": "Display name of the group." }),
2439 "created_at": Schema.Number.annotate({
2440 "description": "Unix timestamp (in seconds) when the group was created.",
2441 "format": "unixtime"
2442 }).check(Schema.isInt()),
2443 "scim_managed": Schema.Boolean.annotate({ "description": "Whether the group is managed through SCIM." })
2444}).annotate({ "description": "Summary information about a group returned in role assignment responses." })
2445export type GroupDeletedResource = {
2446 readonly "object": "group.deleted"
2447 readonly "id": string
2448 readonly "deleted": boolean
2449}
2450export const GroupDeletedResource = Schema.Struct({
2451 "object": Schema.Literal("group.deleted").annotate({ "description": "Always `group.deleted`." }),
2452 "id": Schema.String.annotate({ "description": "Identifier of the deleted group." }),
2453 "deleted": Schema.Boolean.annotate({ "description": "Whether the group was deleted." })
2454}).annotate({ "description": "Confirmation payload returned after deleting a group." })
2455export type GroupResourceWithSuccess = {
2456 readonly "id": string
2457 readonly "name": string
2458 readonly "created_at": number
2459 readonly "is_scim_managed": boolean
2460}
2461export const GroupResourceWithSuccess = Schema.Struct({
2462 "id": Schema.String.annotate({ "description": "Identifier for the group." }),
2463 "name": Schema.String.annotate({ "description": "Updated display name for the group." }),
2464 "created_at": Schema.Number.annotate({
2465 "description": "Unix timestamp (in seconds) when the group was created.",
2466 "format": "unixtime"
2467 }).check(Schema.isInt()),
2468 "is_scim_managed": Schema.Boolean.annotate({
2469 "description": "Whether the group is managed through SCIM and controlled by your identity provider."
2470 })
2471}).annotate({ "description": "Response returned after updating a group." })
2472export type GroupResponse = {
2473 readonly "id": string
2474 readonly "name": string
2475 readonly "created_at": number
2476 readonly "is_scim_managed": boolean
2477 readonly "group_type": string
2478}
2479export const GroupResponse = Schema.Struct({
2480 "id": Schema.String.annotate({ "description": "Identifier for the group." }),
2481 "name": Schema.String.annotate({ "description": "Display name of the group." }),
2482 "created_at": Schema.Number.annotate({
2483 "description": "Unix timestamp (in seconds) when the group was created.",
2484 "format": "unixtime"
2485 }).check(Schema.isInt()),
2486 "is_scim_managed": Schema.Boolean.annotate({
2487 "description": "Whether the group is managed through SCIM and controlled by your identity provider."
2488 }),
2489 "group_type": Schema.String.annotate({ "description": "The type of the group." })
2490}).annotate({ "description": "Details about an organization group." })
2491export type GroupUser = { readonly "id": string; readonly "name": string; readonly "email": string | null }
2492export const GroupUser = Schema.Struct({
2493 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
2494 "name": Schema.String.annotate({ "description": "The name of the user." }),
2495 "email": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The email address of the user." })
2496}).annotate({ "description": "Represents an individual user returned when inspecting group membership." })
2497export type GroupUserAssignment = {
2498 readonly "object": "group.user"
2499 readonly "user_id": string
2500 readonly "group_id": string
2501}
2502export const GroupUserAssignment = Schema.Struct({
2503 "object": Schema.Literal("group.user").annotate({ "description": "Always `group.user`." }),
2504 "user_id": Schema.String.annotate({ "description": "Identifier of the user that was added." }),
2505 "group_id": Schema.String.annotate({ "description": "Identifier of the group the user was added to." })
2506}).annotate({ "description": "Confirmation payload returned after adding a user to a group." })
2507export type GroupUserDeletedResource = { readonly "object": "group.user.deleted"; readonly "deleted": boolean }
2508export const GroupUserDeletedResource = Schema.Struct({
2509 "object": Schema.Literal("group.user.deleted").annotate({ "description": "Always `group.user.deleted`." }),
2510 "deleted": Schema.Boolean.annotate({ "description": "Whether the group membership was removed." })
2511}).annotate({ "description": "Confirmation payload returned after removing a user from a group." })
2512export type HostedToolPermission = { readonly "enabled": boolean }
2513export const HostedToolPermission = Schema.Struct({
2514 "enabled": Schema.Boolean.annotate({ "description": "Whether the hosted tool is enabled for the project." })
2515}).annotate({ "description": "Permission state for a single hosted tool on a project." })
2516export type HostedToolPermissionUpdate = { readonly "enabled": boolean }
2517export const HostedToolPermissionUpdate = Schema.Struct({
2518 "enabled": Schema.Boolean.annotate({ "description": "Whether to enable the hosted tool for the project." })
2519})
2520export type Image = { readonly "b64_json"?: string; readonly "url"?: string; readonly "revised_prompt"?: string }
2521export const Image = Schema.Struct({
2522 "b64_json": Schema.optionalKey(
2523 Schema.String.annotate({
2524 "description":
2525 "The base64-encoded JSON of the generated image. Returned by default for the GPT image models, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`."
2526 })
2527 ),
2528 "url": Schema.optionalKey(
2529 Schema.String.annotate({
2530 "description":
2531 "When using `dall-e-2` or `dall-e-3`, the URL of the generated image if `response_format` is set to `url` (default value). Unsupported for the GPT image models.",
2532 "format": "uri"
2533 })
2534 ),
2535 "revised_prompt": Schema.optionalKey(
2536 Schema.String.annotate({
2537 "description": "For `dall-e-3` only, the revised prompt that was used to generate the image."
2538 })
2539 )
2540}).annotate({ "description": "Represents the content or the URL of an image generated by the OpenAI API." })
2541export type ImageEditPartialImageEvent = {
2542 readonly "type": "image_edit.partial_image"
2543 readonly "b64_json": string
2544 readonly "created_at": number
2545 readonly "size": "1024x1024" | "1024x1536" | "1536x1024" | "auto"
2546 readonly "quality": "low" | "medium" | "high" | "auto"
2547 readonly "background": "transparent" | "opaque" | "auto"
2548 readonly "output_format": "png" | "webp" | "jpeg"
2549 readonly "partial_image_index": number
2550}
2551export const ImageEditPartialImageEvent = Schema.Struct({
2552 "type": Schema.Literal("image_edit.partial_image").annotate({
2553 "description": "The type of the event. Always `image_edit.partial_image`.\n"
2554 }),
2555 "b64_json": Schema.String.annotate({
2556 "description": "Base64-encoded partial image data, suitable for rendering as an image.\n"
2557 }),
2558 "created_at": Schema.Number.annotate({
2559 "description": "The Unix timestamp when the event was created.\n",
2560 "format": "unixtime"
2561 }).check(Schema.isInt()),
2562 "size": Schema.Literals(["1024x1024", "1024x1536", "1536x1024", "auto"]).annotate({
2563 "description": "The size of the requested edited image.\n"
2564 }),
2565 "quality": Schema.Literals(["low", "medium", "high", "auto"]).annotate({
2566 "description": "The quality setting for the requested edited image.\n"
2567 }),
2568 "background": Schema.Literals(["transparent", "opaque", "auto"]).annotate({
2569 "description": "The background setting for the requested edited image.\n"
2570 }),
2571 "output_format": Schema.Literals(["png", "webp", "jpeg"]).annotate({
2572 "description": "The output format for the requested edited image.\n"
2573 }),
2574 "partial_image_index": Schema.Number.annotate({ "description": "0-based index for the partial image (streaming).\n" })
2575 .check(Schema.isInt())
2576}).annotate({ "description": "Emitted when a partial image is available during image editing streaming.\n" })
2577export type ImageGenPartialImageEvent = {
2578 readonly "type": "image_generation.partial_image"
2579 readonly "b64_json": string
2580 readonly "created_at": number
2581 readonly "size": "1024x1024" | "1024x1536" | "1536x1024" | "auto"
2582 readonly "quality": "low" | "medium" | "high" | "auto"
2583 readonly "background": "transparent" | "opaque" | "auto"
2584 readonly "output_format": "png" | "webp" | "jpeg"
2585 readonly "partial_image_index": number
2586}
2587export const ImageGenPartialImageEvent = Schema.Struct({
2588 "type": Schema.Literal("image_generation.partial_image").annotate({
2589 "description": "The type of the event. Always `image_generation.partial_image`.\n"
2590 }),
2591 "b64_json": Schema.String.annotate({
2592 "description": "Base64-encoded partial image data, suitable for rendering as an image.\n"
2593 }),
2594 "created_at": Schema.Number.annotate({
2595 "description": "The Unix timestamp when the event was created.\n",
2596 "format": "unixtime"
2597 }).check(Schema.isInt()),
2598 "size": Schema.Literals(["1024x1024", "1024x1536", "1536x1024", "auto"]).annotate({
2599 "description": "The size of the requested image.\n"
2600 }),
2601 "quality": Schema.Literals(["low", "medium", "high", "auto"]).annotate({
2602 "description": "The quality setting for the requested image.\n"
2603 }),
2604 "background": Schema.Literals(["transparent", "opaque", "auto"]).annotate({
2605 "description": "The background setting for the requested image.\n"
2606 }),
2607 "output_format": Schema.Literals(["png", "webp", "jpeg"]).annotate({
2608 "description": "The output format for the requested image.\n"
2609 }),
2610 "partial_image_index": Schema.Number.annotate({ "description": "0-based index for the partial image (streaming).\n" })
2611 .check(Schema.isInt())
2612}).annotate({ "description": "Emitted when a partial image is available during image generation streaming.\n" })
2613export type ImageGenToolCall = {
2614 readonly "type": "image_generation_call"
2615 readonly "id": string
2616 readonly "status": "in_progress" | "completed" | "generating" | "failed"
2617 readonly "result": string | null
2618}
2619export const ImageGenToolCall = Schema.Struct({
2620 "type": Schema.Literal("image_generation_call").annotate({
2621 "description": "The type of the image generation call. Always `image_generation_call`.\n"
2622 }),
2623 "id": Schema.String.annotate({ "description": "The unique ID of the image generation call.\n" }),
2624 "status": Schema.Literals(["in_progress", "completed", "generating", "failed"]).annotate({
2625 "description": "The status of the image generation call.\n"
2626 }),
2627 "result": Schema.Union([
2628 Schema.String.annotate({ "description": "The generated image encoded in base64.\n" }),
2629 Schema.Null
2630 ])
2631}).annotate({ "title": "Image generation call", "description": "An image generation request made by the model.\n" })
2632export type ImageRefParam = { readonly "image_url": string; readonly "file_id"?: string } | {
2633 readonly "file_id": string
2634 readonly "image_url"?: string
2635}
2636export const ImageRefParam = Schema.Union([
2637 Schema.Struct({
2638 "image_url": Schema.String.annotate({
2639 "description": "A fully qualified URL or base64-encoded data URL.",
2640 "format": "uri"
2641 }).check(Schema.isMaxLength(20971520)),
2642 "file_id": Schema.optionalKey(
2643 Schema.String.annotate({ "description": "The File API ID of an uploaded image to use as input." })
2644 )
2645 }).annotate({
2646 "description":
2647 "Reference an input image by either URL or uploaded file ID.\nProvide exactly one of `image_url` or `file_id`.\n"
2648 }),
2649 Schema.Struct({
2650 "file_id": Schema.String.annotate({ "description": "The File API ID of an uploaded image to use as input." }),
2651 "image_url": Schema.optionalKey(
2652 Schema.String.annotate({ "description": "A fully qualified URL or base64-encoded data URL.", "format": "uri" })
2653 .check(Schema.isMaxLength(20971520))
2654 )
2655 }).annotate({
2656 "description":
2657 "Reference an input image by either URL or uploaded file ID.\nProvide exactly one of `image_url` or `file_id`.\n"
2658 })
2659])
2660export type ImagesUsage = {
2661 readonly "total_tokens": number
2662 readonly "input_tokens": number
2663 readonly "output_tokens": number
2664 readonly "input_tokens_details": { readonly "text_tokens": number; readonly "image_tokens": number }
2665}
2666export const ImagesUsage = Schema.Struct({
2667 "total_tokens": Schema.Number.annotate({
2668 "description": "The total number of tokens (images and text) used for the image generation.\n"
2669 }).check(Schema.isInt()),
2670 "input_tokens": Schema.Number.annotate({
2671 "description": "The number of tokens (images and text) in the input prompt."
2672 }).check(Schema.isInt()),
2673 "output_tokens": Schema.Number.annotate({ "description": "The number of image tokens in the output image." }).check(
2674 Schema.isInt()
2675 ),
2676 "input_tokens_details": Schema.Struct({
2677 "text_tokens": Schema.Number.annotate({ "description": "The number of text tokens in the input prompt." }).check(
2678 Schema.isInt()
2679 ),
2680 "image_tokens": Schema.Number.annotate({ "description": "The number of image tokens in the input prompt." }).check(
2681 Schema.isInt()
2682 )
2683 }).annotate({ "description": "The input tokens detailed information for the image generation." })
2684}).annotate({ "description": "For the GPT image models only, the token usage information for the image generation.\n" })
2685export type InputAudio = {
2686 readonly "type": "input_audio"
2687 readonly "input_audio": { readonly "data": string; readonly "format": "mp3" | "wav" }
2688}
2689export const InputAudio = Schema.Struct({
2690 "type": Schema.Literal("input_audio").annotate({
2691 "description": "The type of the input item. Always `input_audio`.\n"
2692 }),
2693 "input_audio": Schema.Struct({
2694 "data": Schema.String.annotate({ "description": "Base64-encoded audio data.\n" }),
2695 "format": Schema.Literals(["mp3", "wav"]).annotate({
2696 "description": "The format of the audio data. Currently supported formats are `mp3` and\n`wav`.\n"
2697 })
2698 })
2699}).annotate({ "title": "Input audio", "description": "An audio input to the model.\n" })
2700export type Invite = {
2701 readonly "object": "organization.invite"
2702 readonly "id": string
2703 readonly "email": string
2704 readonly "role": "owner" | "reader"
2705 readonly "status": "accepted" | "expired" | "pending"
2706 readonly "created_at": number
2707 readonly "expires_at"?: number | null
2708 readonly "accepted_at"?: number | null
2709 readonly "projects": ReadonlyArray<{ readonly "id": string; readonly "role": "member" | "owner" }>
2710}
2711export const Invite = Schema.Struct({
2712 "object": Schema.Literal("organization.invite").annotate({
2713 "description": "The object type, which is always `organization.invite`"
2714 }),
2715 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
2716 "email": Schema.String.annotate({ "description": "The email address of the individual to whom the invite was sent" }),
2717 "role": Schema.Literals(["owner", "reader"]).annotate({ "description": "`owner` or `reader`" }),
2718 "status": Schema.Literals(["accepted", "expired", "pending"]).annotate({
2719 "description": "`accepted`,`expired`, or `pending`"
2720 }),
2721 "created_at": Schema.Number.annotate({
2722 "description": "The Unix timestamp (in seconds) of when the invite was sent.",
2723 "format": "unixtime"
2724 }).check(Schema.isInt()),
2725 "expires_at": Schema.optionalKey(
2726 Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null]).annotate({
2727 "description": "The Unix timestamp (in seconds) of when the invite expires."
2728 })
2729 ),
2730 "accepted_at": Schema.optionalKey(
2731 Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null]).annotate({
2732 "description": "The Unix timestamp (in seconds) of when the invite was accepted."
2733 })
2734 ),
2735 "projects": Schema.Array(
2736 Schema.Struct({
2737 "id": Schema.String.annotate({ "description": "Project's public ID" }),
2738 "role": Schema.Literals(["member", "owner"]).annotate({ "description": "Project membership role" })
2739 })
2740 ).annotate({ "description": "The projects that were granted membership upon acceptance of the invite." })
2741}).annotate({ "description": "Represents an individual `invite` to the organization." })
2742export type InviteDeleteResponse = {
2743 readonly "object": "organization.invite.deleted"
2744 readonly "id": string
2745 readonly "deleted": boolean
2746}
2747export const InviteDeleteResponse = Schema.Struct({
2748 "object": Schema.Literal("organization.invite.deleted").annotate({
2749 "description": "The object type, which is always `organization.invite.deleted`"
2750 }),
2751 "id": Schema.String,
2752 "deleted": Schema.Boolean
2753})
2754export type InviteProjectGroupBody = { readonly "group_id": string; readonly "role": string }
2755export const InviteProjectGroupBody = Schema.Struct({
2756 "group_id": Schema.String.annotate({ "description": "Identifier of the group to add to the project." }),
2757 "role": Schema.String.annotate({ "description": "Identifier of the project role to grant to the group." })
2758}).annotate({ "description": "Request payload for granting a group access to a project." })
2759export type InviteRequest = {
2760 readonly "email": string
2761 readonly "role": "reader" | "owner"
2762 readonly "projects"?: ReadonlyArray<{ readonly "id": string; readonly "role": "member" | "owner" }>
2763}
2764export const InviteRequest = Schema.Struct({
2765 "email": Schema.String.annotate({ "description": "Send an email to this address" }),
2766 "role": Schema.Literals(["reader", "owner"]).annotate({ "description": "`owner` or `reader`" }),
2767 "projects": Schema.optionalKey(
2768 Schema.Array(
2769 Schema.Struct({
2770 "id": Schema.String.annotate({ "description": "Project's public ID" }),
2771 "role": Schema.Literals(["member", "owner"]).annotate({ "description": "Project membership role" })
2772 })
2773 ).annotate({
2774 "description":
2775 "An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one."
2776 })
2777 )
2778})
2779export type LocalShellToolCallOutput = {
2780 readonly "type": "local_shell_call_output"
2781 readonly "id": string
2782 readonly "output": string
2783 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
2784 readonly "call_id": unknown
2785}
2786export const LocalShellToolCallOutput = Schema.Struct({
2787 "type": Schema.Literal("local_shell_call_output").annotate({
2788 "description": "The type of the local shell tool call output. Always `local_shell_call_output`.\n"
2789 }),
2790 "id": Schema.String.annotate({
2791 "description": "The unique ID of the local shell tool call generated by the model.\n"
2792 }),
2793 "output": Schema.String.annotate({ "description": "A JSON string of the output of the local shell tool call.\n" }),
2794 "status": Schema.optionalKey(
2795 Schema.Union([
2796 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
2797 "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`.\n"
2798 }),
2799 Schema.Null
2800 ])
2801 ),
2802 "call_id": Schema.Unknown
2803}).annotate({ "title": "Local shell call output", "description": "The output of a local shell tool call.\n" })
2804export type LogProbProperties = {
2805 readonly "token": string
2806 readonly "logprob": number
2807 readonly "bytes": ReadonlyArray<number>
2808}
2809export const LogProbProperties = Schema.Struct({
2810 "token": Schema.String.annotate({ "description": "The token that was used to generate the log probability.\n" }),
2811 "logprob": Schema.Number.annotate({ "description": "The log probability of the token.\n" }).check(Schema.isFinite()),
2812 "bytes": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
2813 "description": "The bytes that were used to generate the log probability.\n"
2814 })
2815}).annotate({ "description": "A log probability object.\n" })
2816export type MCPApprovalRequest = {
2817 readonly "type": "mcp_approval_request"
2818 readonly "id": string
2819 readonly "server_label": string
2820 readonly "name": string
2821 readonly "arguments": string
2822}
2823export const MCPApprovalRequest = Schema.Struct({
2824 "type": Schema.Literal("mcp_approval_request").annotate({
2825 "description": "The type of the item. Always `mcp_approval_request`.\n"
2826 }),
2827 "id": Schema.String.annotate({ "description": "The unique ID of the approval request.\n" }),
2828 "server_label": Schema.String.annotate({ "description": "The label of the MCP server making the request.\n" }),
2829 "name": Schema.String.annotate({ "description": "The name of the tool to run.\n" }),
2830 "arguments": Schema.String.annotate({ "description": "A JSON string of arguments for the tool.\n" })
2831}).annotate({ "title": "MCP approval request", "description": "A request for human approval of a tool invocation.\n" })
2832export type MCPApprovalResponseResource = {
2833 readonly "type": "mcp_approval_response"
2834 readonly "id": string
2835 readonly "approval_request_id": string
2836 readonly "approve": boolean
2837 readonly "reason"?: string | null
2838 readonly "request_id": unknown
2839}
2840export const MCPApprovalResponseResource = Schema.Struct({
2841 "type": Schema.Literal("mcp_approval_response").annotate({
2842 "description": "The type of the item. Always `mcp_approval_response`.\n"
2843 }),
2844 "id": Schema.String.annotate({ "description": "The unique ID of the approval response\n" }),
2845 "approval_request_id": Schema.String.annotate({ "description": "The ID of the approval request being answered.\n" }),
2846 "approve": Schema.Boolean.annotate({ "description": "Whether the request was approved.\n" }),
2847 "reason": Schema.optionalKey(
2848 Schema.Union([Schema.String.annotate({ "description": "Optional reason for the decision.\n" }), Schema.Null])
2849 ),
2850 "request_id": Schema.Unknown
2851}).annotate({ "title": "MCP approval response", "description": "A response to an MCP approval request.\n" })
2852export type MCPListToolsTool = {
2853 readonly "name": string
2854 readonly "description"?: string | null
2855 readonly "input_schema": {}
2856 readonly "annotations"?: {} | null
2857}
2858export const MCPListToolsTool = Schema.Struct({
2859 "name": Schema.String.annotate({ "description": "The name of the tool.\n" }),
2860 "description": Schema.optionalKey(
2861 Schema.Union([Schema.String.annotate({ "description": "The description of the tool.\n" }), Schema.Null])
2862 ),
2863 "input_schema": Schema.Struct({}).annotate({ "description": "The JSON schema describing the tool's input.\n" }),
2864 "annotations": Schema.optionalKey(
2865 Schema.Union([
2866 Schema.Struct({}).annotate({ "description": "Additional annotations about the tool.\n" }),
2867 Schema.Null
2868 ])
2869 )
2870}).annotate({ "title": "MCP list tools tool", "description": "A tool available on an MCP server.\n" })
2871export type MCPToolCall = {
2872 readonly "type": "mcp_call"
2873 readonly "id": string
2874 readonly "server_label": string
2875 readonly "name": string
2876 readonly "arguments": string
2877 readonly "output"?: string | null
2878 readonly "error"?: string | null
2879 readonly "status"?: "in_progress" | "completed" | "incomplete" | "calling" | "failed"
2880 readonly "approval_request_id"?: string | null
2881}
2882export const MCPToolCall = Schema.Struct({
2883 "type": Schema.Literal("mcp_call").annotate({ "description": "The type of the item. Always `mcp_call`.\n" }),
2884 "id": Schema.String.annotate({ "description": "The unique ID of the tool call.\n" }),
2885 "server_label": Schema.String.annotate({ "description": "The label of the MCP server running the tool.\n" }),
2886 "name": Schema.String.annotate({ "description": "The name of the tool that was run.\n" }),
2887 "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments passed to the tool.\n" }),
2888 "output": Schema.optionalKey(
2889 Schema.Union([Schema.String.annotate({ "description": "The output from the tool call.\n" }), Schema.Null])
2890 ),
2891 "error": Schema.optionalKey(
2892 Schema.Union([Schema.String.annotate({ "description": "The error from the tool call, if any.\n" }), Schema.Null])
2893 ),
2894 "status": Schema.optionalKey(
2895 Schema.Literals(["in_progress", "completed", "incomplete", "calling", "failed"]).annotate({
2896 "description":
2897 "The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n"
2898 })
2899 ),
2900 "approval_request_id": Schema.optionalKey(
2901 Schema.Union([
2902 Schema.String.annotate({
2903 "description":
2904 "Unique identifier for the MCP tool call approval request.\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\n"
2905 }),
2906 Schema.Null
2907 ])
2908 )
2909}).annotate({ "title": "MCP tool call", "description": "An invocation of a tool on an MCP server.\n" })
2910export type MCPToolFilter = { readonly "tool_names"?: ReadonlyArray<string>; readonly "read_only"?: boolean }
2911export const MCPToolFilter = Schema.Struct({
2912 "tool_names": Schema.optionalKey(
2913 Schema.Array(Schema.String).annotate({ "title": "MCP allowed tools", "description": "List of allowed tool names." })
2914 ),
2915 "read_only": Schema.optionalKey(
2916 Schema.Boolean.annotate({
2917 "description":
2918 "Indicates whether or not a tool modifies data or is read-only. If an\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\nit will match this filter.\n"
2919 })
2920 )
2921}).annotate({ "title": "MCP tool filter", "description": "A filter object to specify which tools are allowed.\n" })
2922export type MessageContentImageFileObject = {
2923 readonly "type": "image_file"
2924 readonly "image_file": { readonly "file_id": string; readonly "detail"?: "auto" | "low" | "high" }
2925}
2926export const MessageContentImageFileObject = Schema.Struct({
2927 "type": Schema.Literal("image_file").annotate({ "description": "Always `image_file`." }),
2928 "image_file": Schema.Struct({
2929 "file_id": Schema.String.annotate({
2930 "description":
2931 "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content."
2932 }),
2933 "detail": Schema.optionalKey(
2934 Schema.Literals(["auto", "low", "high"]).annotate({
2935 "description":
2936 "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`."
2937 })
2938 )
2939 })
2940}).annotate({
2941 "title": "Image file",
2942 "description": "References an image [File](/docs/api-reference/files) in the content of a message."
2943})
2944export type MessageContentImageUrlObject = {
2945 readonly "type": "image_url"
2946 readonly "image_url": { readonly "url": string; readonly "detail"?: "auto" | "low" | "high" }
2947}
2948export const MessageContentImageUrlObject = Schema.Struct({
2949 "type": Schema.Literal("image_url").annotate({ "description": "The type of the content part." }),
2950 "image_url": Schema.Struct({
2951 "url": Schema.String.annotate({
2952 "description": "The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.",
2953 "format": "uri"
2954 }),
2955 "detail": Schema.optionalKey(
2956 Schema.Literals(["auto", "low", "high"]).annotate({
2957 "description":
2958 "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto`"
2959 })
2960 )
2961 })
2962}).annotate({ "title": "Image URL", "description": "References an image URL in the content of a message." })
2963export type MessageContentRefusalObject = { readonly "type": "refusal"; readonly "refusal": string }
2964export const MessageContentRefusalObject = Schema.Struct({
2965 "type": Schema.Literal("refusal").annotate({ "description": "Always `refusal`." }),
2966 "refusal": Schema.String
2967}).annotate({ "title": "Refusal", "description": "The refusal content generated by the assistant." })
2968export type MessageContentTextAnnotationsFileCitationObject = {
2969 readonly "type": "file_citation"
2970 readonly "text": string
2971 readonly "file_citation": { readonly "file_id": string }
2972 readonly "start_index": number
2973 readonly "end_index": number
2974}
2975export const MessageContentTextAnnotationsFileCitationObject = Schema.Struct({
2976 "type": Schema.Literal("file_citation").annotate({ "description": "Always `file_citation`." }),
2977 "text": Schema.String.annotate({ "description": "The text in the message content that needs to be replaced." }),
2978 "file_citation": Schema.Struct({
2979 "file_id": Schema.String.annotate({ "description": "The ID of the specific File the citation is from." })
2980 }),
2981 "start_index": Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
2982 "end_index": Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
2983}).annotate({
2984 "title": "File citation",
2985 "description":
2986 "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files."
2987})
2988export type MessageContentTextAnnotationsFilePathObject = {
2989 readonly "type": "file_path"
2990 readonly "text": string
2991 readonly "file_path": { readonly "file_id": string }
2992 readonly "start_index": number
2993 readonly "end_index": number
2994}
2995export const MessageContentTextAnnotationsFilePathObject = Schema.Struct({
2996 "type": Schema.Literal("file_path").annotate({ "description": "Always `file_path`." }),
2997 "text": Schema.String.annotate({ "description": "The text in the message content that needs to be replaced." }),
2998 "file_path": Schema.Struct({
2999 "file_id": Schema.String.annotate({ "description": "The ID of the file that was generated." })
3000 }),
3001 "start_index": Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)),
3002 "end_index": Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
3003}).annotate({
3004 "title": "File path",
3005 "description":
3006 "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file."
3007})
3008export type MessageDeltaContentImageFileObject = {
3009 readonly "index": number
3010 readonly "type": "image_file"
3011 readonly "image_file"?: { readonly "file_id"?: string; readonly "detail"?: "auto" | "low" | "high" }
3012}
3013export const MessageDeltaContentImageFileObject = Schema.Struct({
3014 "index": Schema.Number.annotate({ "description": "The index of the content part in the message." }).check(
3015 Schema.isInt()
3016 ),
3017 "type": Schema.Literal("image_file").annotate({ "description": "Always `image_file`." }),
3018 "image_file": Schema.optionalKey(Schema.Struct({
3019 "file_id": Schema.optionalKey(
3020 Schema.String.annotate({
3021 "description":
3022 "The [File](/docs/api-reference/files) ID of the image in the message content. Set `purpose=\"vision\"` when uploading the File if you need to later display the file content."
3023 })
3024 ),
3025 "detail": Schema.optionalKey(
3026 Schema.Literals(["auto", "low", "high"]).annotate({
3027 "description":
3028 "Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`."
3029 })
3030 )
3031 }))
3032}).annotate({
3033 "title": "Image file",
3034 "description": "References an image [File](/docs/api-reference/files) in the content of a message."
3035})
3036export type MessageDeltaContentImageUrlObject = {
3037 readonly "index": number
3038 readonly "type": "image_url"
3039 readonly "image_url"?: { readonly "url"?: string; readonly "detail"?: "auto" | "low" | "high" }
3040}
3041export const MessageDeltaContentImageUrlObject = Schema.Struct({
3042 "index": Schema.Number.annotate({ "description": "The index of the content part in the message." }).check(
3043 Schema.isInt()
3044 ),
3045 "type": Schema.Literal("image_url").annotate({ "description": "Always `image_url`." }),
3046 "image_url": Schema.optionalKey(Schema.Struct({
3047 "url": Schema.optionalKey(
3048 Schema.String.annotate({
3049 "description": "The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.",
3050 "format": "uri"
3051 })
3052 ),
3053 "detail": Schema.optionalKey(
3054 Schema.Literals(["auto", "low", "high"]).annotate({
3055 "description":
3056 "Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`."
3057 })
3058 )
3059 }))
3060}).annotate({ "title": "Image URL", "description": "References an image URL in the content of a message." })
3061export type MessageDeltaContentRefusalObject = {
3062 readonly "index": number
3063 readonly "type": "refusal"
3064 readonly "refusal"?: string
3065}
3066export const MessageDeltaContentRefusalObject = Schema.Struct({
3067 "index": Schema.Number.annotate({ "description": "The index of the refusal part in the message." }).check(
3068 Schema.isInt()
3069 ),
3070 "type": Schema.Literal("refusal").annotate({ "description": "Always `refusal`." }),
3071 "refusal": Schema.optionalKey(Schema.String)
3072}).annotate({ "title": "Refusal", "description": "The refusal content that is part of a message." })
3073export type MessageDeltaContentTextAnnotationsFileCitationObject = {
3074 readonly "index": number
3075 readonly "type": "file_citation"
3076 readonly "text"?: string
3077 readonly "file_citation"?: { readonly "file_id"?: string; readonly "quote"?: string }
3078 readonly "start_index"?: number
3079 readonly "end_index"?: number
3080}
3081export const MessageDeltaContentTextAnnotationsFileCitationObject = Schema.Struct({
3082 "index": Schema.Number.annotate({ "description": "The index of the annotation in the text content part." }).check(
3083 Schema.isInt()
3084 ),
3085 "type": Schema.Literal("file_citation").annotate({ "description": "Always `file_citation`." }),
3086 "text": Schema.optionalKey(
3087 Schema.String.annotate({ "description": "The text in the message content that needs to be replaced." })
3088 ),
3089 "file_citation": Schema.optionalKey(
3090 Schema.Struct({
3091 "file_id": Schema.optionalKey(
3092 Schema.String.annotate({ "description": "The ID of the specific File the citation is from." })
3093 ),
3094 "quote": Schema.optionalKey(Schema.String.annotate({ "description": "The specific quote in the file." }))
3095 })
3096 ),
3097 "start_index": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))),
3098 "end_index": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)))
3099}).annotate({
3100 "title": "File citation",
3101 "description":
3102 "A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the \"file_search\" tool to search files."
3103})
3104export type MessageDeltaContentTextAnnotationsFilePathObject = {
3105 readonly "index": number
3106 readonly "type": "file_path"
3107 readonly "text"?: string
3108 readonly "file_path"?: { readonly "file_id"?: string }
3109 readonly "start_index"?: number
3110 readonly "end_index"?: number
3111}
3112export const MessageDeltaContentTextAnnotationsFilePathObject = Schema.Struct({
3113 "index": Schema.Number.annotate({ "description": "The index of the annotation in the text content part." }).check(
3114 Schema.isInt()
3115 ),
3116 "type": Schema.Literal("file_path").annotate({ "description": "Always `file_path`." }),
3117 "text": Schema.optionalKey(
3118 Schema.String.annotate({ "description": "The text in the message content that needs to be replaced." })
3119 ),
3120 "file_path": Schema.optionalKey(
3121 Schema.Struct({
3122 "file_id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the file that was generated." }))
3123 })
3124 ),
3125 "start_index": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))),
3126 "end_index": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)))
3127}).annotate({
3128 "title": "File path",
3129 "description":
3130 "A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file."
3131})
3132export type MessagePhase = "commentary" | "final_answer"
3133export const MessagePhase = Schema.Literals(["commentary", "final_answer"]).annotate({
3134 "description":
3135 "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`).\nFor models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend\nphase on all assistant messages — dropping it can degrade performance. Not used for user messages.\n"
3136})
3137export type MessageRequestContentTextObject = { readonly "type": "text"; readonly "text": string }
3138export const MessageRequestContentTextObject = Schema.Struct({
3139 "type": Schema.Literal("text").annotate({ "description": "Always `text`." }),
3140 "text": Schema.String.annotate({ "description": "Text content to be sent to the model" })
3141}).annotate({ "title": "Text", "description": "The text content that is part of a message." })
3142export type Metadata = {} | null
3143export const Metadata = Schema.Union([
3144 Schema.Struct({}).annotate({
3145 "description":
3146 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
3147 }),
3148 Schema.Null
3149])
3150export type Model = {
3151 readonly "id": string
3152 readonly "created": number
3153 readonly "object": "model"
3154 readonly "owned_by": string
3155 readonly [x: string]: unknown
3156}
3157export const Model = Schema.StructWithRest(
3158 Schema.Struct({
3159 "id": Schema.String.annotate({
3160 "description": "The model identifier, which can be referenced in the API endpoints."
3161 }),
3162 "created": Schema.Number.annotate({
3163 "description": "The Unix timestamp (in seconds) when the model was created.",
3164 "format": "unixtime"
3165 }).check(Schema.isInt()),
3166 "object": Schema.Literal("model").annotate({ "description": "The object type, which is always \"model\"." }),
3167 "owned_by": Schema.String.annotate({ "description": "The organization that owns the model." })
3168 }),
3169 [Schema.Record(Schema.String, Schema.Json)]
3170).annotate({ "title": "Model", "description": "Describes an OpenAI model offering that can be used with the API." })
3171export type ModelIdsShared =
3172 | string
3173 | "gpt-5.4"
3174 | "gpt-5.4-mini"
3175 | "gpt-5.4-nano"
3176 | "gpt-5.4-mini-2026-03-17"
3177 | "gpt-5.4-nano-2026-03-17"
3178 | "gpt-5.3-chat-latest"
3179 | "gpt-5.2"
3180 | "gpt-5.2-2025-12-11"
3181 | "gpt-5.2-chat-latest"
3182 | "gpt-5.2-pro"
3183 | "gpt-5.2-pro-2025-12-11"
3184 | "gpt-5.1"
3185 | "gpt-5.1-2025-11-13"
3186 | "gpt-5.1-codex"
3187 | "gpt-5.1-mini"
3188 | "gpt-5.1-chat-latest"
3189 | "gpt-5"
3190 | "gpt-5-mini"
3191 | "gpt-5-nano"
3192 | "gpt-5-2025-08-07"
3193 | "gpt-5-mini-2025-08-07"
3194 | "gpt-5-nano-2025-08-07"
3195 | "gpt-5-chat-latest"
3196 | "gpt-4.1"
3197 | "gpt-4.1-mini"
3198 | "gpt-4.1-nano"
3199 | "gpt-4.1-2025-04-14"
3200 | "gpt-4.1-mini-2025-04-14"
3201 | "gpt-4.1-nano-2025-04-14"
3202 | "o4-mini"
3203 | "o4-mini-2025-04-16"
3204 | "o3"
3205 | "o3-2025-04-16"
3206 | "o3-mini"
3207 | "o3-mini-2025-01-31"
3208 | "o1"
3209 | "o1-2024-12-17"
3210 | "o1-preview"
3211 | "o1-preview-2024-09-12"
3212 | "o1-mini"
3213 | "o1-mini-2024-09-12"
3214 | "gpt-4o"
3215 | "gpt-4o-2024-11-20"
3216 | "gpt-4o-2024-08-06"
3217 | "gpt-4o-2024-05-13"
3218 | "gpt-4o-audio-preview"
3219 | "gpt-4o-audio-preview-2024-10-01"
3220 | "gpt-4o-audio-preview-2024-12-17"
3221 | "gpt-4o-audio-preview-2025-06-03"
3222 | "gpt-4o-mini-audio-preview"
3223 | "gpt-4o-mini-audio-preview-2024-12-17"
3224 | "gpt-4o-search-preview"
3225 | "gpt-4o-mini-search-preview"
3226 | "gpt-4o-search-preview-2025-03-11"
3227 | "gpt-4o-mini-search-preview-2025-03-11"
3228 | "chatgpt-4o-latest"
3229 | "codex-mini-latest"
3230 | "gpt-4o-mini"
3231 | "gpt-4o-mini-2024-07-18"
3232 | "gpt-4-turbo"
3233 | "gpt-4-turbo-2024-04-09"
3234 | "gpt-4-0125-preview"
3235 | "gpt-4-turbo-preview"
3236 | "gpt-4-1106-preview"
3237 | "gpt-4-vision-preview"
3238 | "gpt-4"
3239 | "gpt-4-0314"
3240 | "gpt-4-0613"
3241 | "gpt-4-32k"
3242 | "gpt-4-32k-0314"
3243 | "gpt-4-32k-0613"
3244 | "gpt-3.5-turbo"
3245 | "gpt-3.5-turbo-16k"
3246 | "gpt-3.5-turbo-0301"
3247 | "gpt-3.5-turbo-0613"
3248 | "gpt-3.5-turbo-1106"
3249 | "gpt-3.5-turbo-0125"
3250 | "gpt-3.5-turbo-16k-0613"
3251export const ModelIdsShared = Schema.Union([
3252 Schema.String,
3253 Schema.Literals([
3254 "gpt-5.4",
3255 "gpt-5.4-mini",
3256 "gpt-5.4-nano",
3257 "gpt-5.4-mini-2026-03-17",
3258 "gpt-5.4-nano-2026-03-17",
3259 "gpt-5.3-chat-latest",
3260 "gpt-5.2",
3261 "gpt-5.2-2025-12-11",
3262 "gpt-5.2-chat-latest",
3263 "gpt-5.2-pro",
3264 "gpt-5.2-pro-2025-12-11",
3265 "gpt-5.1",
3266 "gpt-5.1-2025-11-13",
3267 "gpt-5.1-codex",
3268 "gpt-5.1-mini",
3269 "gpt-5.1-chat-latest",
3270 "gpt-5",
3271 "gpt-5-mini",
3272 "gpt-5-nano",
3273 "gpt-5-2025-08-07",
3274 "gpt-5-mini-2025-08-07",
3275 "gpt-5-nano-2025-08-07",
3276 "gpt-5-chat-latest",
3277 "gpt-4.1",
3278 "gpt-4.1-mini",
3279 "gpt-4.1-nano",
3280 "gpt-4.1-2025-04-14",
3281 "gpt-4.1-mini-2025-04-14",
3282 "gpt-4.1-nano-2025-04-14",
3283 "o4-mini",
3284 "o4-mini-2025-04-16",
3285 "o3",
3286 "o3-2025-04-16",
3287 "o3-mini",
3288 "o3-mini-2025-01-31",
3289 "o1",
3290 "o1-2024-12-17",
3291 "o1-preview",
3292 "o1-preview-2024-09-12",
3293 "o1-mini",
3294 "o1-mini-2024-09-12",
3295 "gpt-4o",
3296 "gpt-4o-2024-11-20",
3297 "gpt-4o-2024-08-06",
3298 "gpt-4o-2024-05-13",
3299 "gpt-4o-audio-preview",
3300 "gpt-4o-audio-preview-2024-10-01",
3301 "gpt-4o-audio-preview-2024-12-17",
3302 "gpt-4o-audio-preview-2025-06-03",
3303 "gpt-4o-mini-audio-preview",
3304 "gpt-4o-mini-audio-preview-2024-12-17",
3305 "gpt-4o-search-preview",
3306 "gpt-4o-mini-search-preview",
3307 "gpt-4o-search-preview-2025-03-11",
3308 "gpt-4o-mini-search-preview-2025-03-11",
3309 "chatgpt-4o-latest",
3310 "codex-mini-latest",
3311 "gpt-4o-mini",
3312 "gpt-4o-mini-2024-07-18",
3313 "gpt-4-turbo",
3314 "gpt-4-turbo-2024-04-09",
3315 "gpt-4-0125-preview",
3316 "gpt-4-turbo-preview",
3317 "gpt-4-1106-preview",
3318 "gpt-4-vision-preview",
3319 "gpt-4",
3320 "gpt-4-0314",
3321 "gpt-4-0613",
3322 "gpt-4-32k",
3323 "gpt-4-32k-0314",
3324 "gpt-4-32k-0613",
3325 "gpt-3.5-turbo",
3326 "gpt-3.5-turbo-16k",
3327 "gpt-3.5-turbo-0301",
3328 "gpt-3.5-turbo-0613",
3329 "gpt-3.5-turbo-1106",
3330 "gpt-3.5-turbo-0125",
3331 "gpt-3.5-turbo-16k-0613"
3332 ])
3333])
3334export type ModifyCertificateRequest = { readonly "name"?: string }
3335export const ModifyCertificateRequest = Schema.Struct({
3336 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The updated name for the certificate" }))
3337})
3338export type NoiseReductionType = "near_field" | "far_field"
3339export const NoiseReductionType = Schema.Literals(["near_field", "far_field"]).annotate({
3340 "description":
3341 "Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.\n"
3342})
3343export type OpenAIFile = {
3344 readonly "id": string
3345 readonly "bytes": number
3346 readonly "created_at": number
3347 readonly "expires_at"?: number | null
3348 readonly "filename": string
3349 readonly "object": "file"
3350 readonly "purpose":
3351 | "assistants"
3352 | "assistants_output"
3353 | "batch"
3354 | "batch_output"
3355 | "fine-tune"
3356 | "fine-tune-results"
3357 | "vision"
3358 | "user_data"
3359 readonly "status": "uploaded" | "processed" | "error"
3360 readonly "status_details"?: string | null
3361 readonly [x: string]: unknown
3362}
3363export const OpenAIFile = Schema.StructWithRest(
3364 Schema.Struct({
3365 "id": Schema.String.annotate({
3366 "description": "The file identifier, which can be referenced in the API endpoints."
3367 }),
3368 "bytes": Schema.Number.annotate({ "description": "The size of the file, in bytes." }).check(Schema.isInt()),
3369 "created_at": Schema.Number.annotate({
3370 "description": "The Unix timestamp (in seconds) for when the file was created.",
3371 "format": "unixtime"
3372 }).check(Schema.isInt()),
3373 "expires_at": Schema.optionalKey(
3374 Schema.Union([
3375 Schema.Number.annotate({
3376 "description": "The Unix timestamp (in seconds) for when the file will expire.",
3377 "format": "unixtime"
3378 }).check(Schema.isInt()),
3379 Schema.Null
3380 ])
3381 ),
3382 "filename": Schema.String.annotate({ "description": "The name of the file." }),
3383 "object": Schema.Literal("file").annotate({ "description": "The object type, which is always `file`." }),
3384 "purpose": Schema.Literals([
3385 "assistants",
3386 "assistants_output",
3387 "batch",
3388 "batch_output",
3389 "fine-tune",
3390 "fine-tune-results",
3391 "vision",
3392 "user_data"
3393 ]).annotate({
3394 "description":
3395 "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`."
3396 }),
3397 "status": Schema.Literals(["uploaded", "processed", "error"]).annotate({
3398 "description":
3399 "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`."
3400 }),
3401 "status_details": Schema.optionalKey(
3402 Schema.Union([Schema.String, Schema.Null]).annotate({
3403 "description":
3404 "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`."
3405 })
3406 )
3407 }),
3408 [Schema.Record(Schema.String, Schema.Json)]
3409).annotate({
3410 "title": "OpenAIFile",
3411 "description": "The `File` object represents a document that has been uploaded to OpenAI."
3412})
3413export type OrganizationCertificate = {
3414 readonly "object": "organization.certificate"
3415 readonly "id": string
3416 readonly "name": string | null
3417 readonly "created_at": number
3418 readonly "certificate_details": { readonly "valid_at"?: number; readonly "expires_at"?: number }
3419 readonly "active": boolean
3420}
3421export const OrganizationCertificate = Schema.Struct({
3422 "object": Schema.Literal("organization.certificate").annotate({
3423 "description": "The object type, which is always `organization.certificate`."
3424 }),
3425 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3426 "name": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the certificate." }),
3427 "created_at": Schema.Number.annotate({
3428 "description": "The Unix timestamp (in seconds) of when the certificate was uploaded.",
3429 "format": "unixtime"
3430 }).check(Schema.isInt()),
3431 "certificate_details": Schema.Struct({
3432 "valid_at": Schema.optionalKey(
3433 Schema.Number.annotate({
3434 "description": "The Unix timestamp (in seconds) of when the certificate becomes valid.",
3435 "format": "unixtime"
3436 }).check(Schema.isInt())
3437 ),
3438 "expires_at": Schema.optionalKey(
3439 Schema.Number.annotate({
3440 "description": "The Unix timestamp (in seconds) of when the certificate expires.",
3441 "format": "unixtime"
3442 }).check(Schema.isInt())
3443 )
3444 }),
3445 "active": Schema.Boolean.annotate({
3446 "description": "Whether the certificate is currently active at the organization level."
3447 })
3448}).annotate({ "description": "Represents an individual certificate configured at the organization level." })
3449export type OrganizationProjectCertificate = {
3450 readonly "object": "organization.project.certificate"
3451 readonly "id": string
3452 readonly "name": string | null
3453 readonly "created_at": number
3454 readonly "certificate_details": { readonly "valid_at"?: number; readonly "expires_at"?: number }
3455 readonly "active": boolean
3456}
3457export const OrganizationProjectCertificate = Schema.Struct({
3458 "object": Schema.Literal("organization.project.certificate").annotate({
3459 "description": "The object type, which is always `organization.project.certificate`."
3460 }),
3461 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3462 "name": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the certificate." }),
3463 "created_at": Schema.Number.annotate({
3464 "description": "The Unix timestamp (in seconds) of when the certificate was uploaded.",
3465 "format": "unixtime"
3466 }).check(Schema.isInt()),
3467 "certificate_details": Schema.Struct({
3468 "valid_at": Schema.optionalKey(
3469 Schema.Number.annotate({
3470 "description": "The Unix timestamp (in seconds) of when the certificate becomes valid.",
3471 "format": "unixtime"
3472 }).check(Schema.isInt())
3473 ),
3474 "expires_at": Schema.optionalKey(
3475 Schema.Number.annotate({
3476 "description": "The Unix timestamp (in seconds) of when the certificate expires.",
3477 "format": "unixtime"
3478 }).check(Schema.isInt())
3479 )
3480 }),
3481 "active": Schema.Boolean.annotate({
3482 "description": "Whether the certificate is currently active at the project level."
3483 })
3484}).annotate({ "description": "Represents an individual certificate configured at the project level." })
3485export type ParallelToolCalls = boolean
3486export const ParallelToolCalls = Schema.Boolean.annotate({
3487 "description":
3488 "Whether to enable [parallel function calling](/docs/guides/function-calling#configuring-parallel-function-calling) during tool use."
3489})
3490export type PartialImages = number | null
3491export const PartialImages = Schema.Union([
3492 Schema.Number.annotate({
3493 "description":
3494 "The number of partial images to generate. This parameter is used for\nstreaming responses that return partial images. Value must be between 0 and 3.\nWhen set to 0, the response will be a single image sent in one streaming event.\n\nNote that the final image may be sent before the full number of partial images\nare generated if the full image is generated more quickly.\n"
3495 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(3)),
3496 Schema.Null
3497])
3498export type Project = {
3499 readonly "id": string
3500 readonly "object": "organization.project"
3501 readonly "name"?: string | null
3502 readonly "created_at": number
3503 readonly "archived_at"?: number | null
3504 readonly "status"?: string | null
3505 readonly "external_key_id"?: string | null
3506}
3507export const Project = Schema.Struct({
3508 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3509 "object": Schema.Literal("organization.project").annotate({
3510 "description": "The object type, which is always `organization.project`"
3511 }),
3512 "name": Schema.optionalKey(
3513 Schema.Union([Schema.String, Schema.Null]).annotate({
3514 "description": "The name of the project. This appears in reporting."
3515 })
3516 ),
3517 "created_at": Schema.Number.annotate({
3518 "description": "The Unix timestamp (in seconds) of when the project was created.",
3519 "format": "unixtime"
3520 }).check(Schema.isInt()),
3521 "archived_at": Schema.optionalKey(
3522 Schema.Union([
3523 Schema.Number.annotate({
3524 "description": "The Unix timestamp (in seconds) of when the project was archived or `null`.",
3525 "format": "unixtime"
3526 }).check(Schema.isInt()),
3527 Schema.Null
3528 ])
3529 ),
3530 "status": Schema.optionalKey(
3531 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "`active` or `archived`" })
3532 ),
3533 "external_key_id": Schema.optionalKey(
3534 Schema.Union([Schema.String, Schema.Null]).annotate({
3535 "description": "The external key associated with the project."
3536 })
3537 )
3538}).annotate({ "description": "Represents an individual project." })
3539export type ProjectApiKeyDeleteResponse = {
3540 readonly "object": "organization.project.api_key.deleted"
3541 readonly "id": string
3542 readonly "deleted": boolean
3543}
3544export const ProjectApiKeyDeleteResponse = Schema.Struct({
3545 "object": Schema.Literal("organization.project.api_key.deleted"),
3546 "id": Schema.String,
3547 "deleted": Schema.Boolean
3548})
3549export type ProjectApiKeyOwnerServiceAccount = {
3550 readonly "id": string
3551 readonly "name": string
3552 readonly "created_at": number
3553 readonly "role": string
3554}
3555export const ProjectApiKeyOwnerServiceAccount = Schema.Struct({
3556 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3557 "name": Schema.String.annotate({ "description": "The name of the service account." }),
3558 "created_at": Schema.Number.annotate({
3559 "description": "The Unix timestamp (in seconds) of when the service account was created.",
3560 "format": "unixtime"
3561 }).check(Schema.isInt()),
3562 "role": Schema.String.annotate({ "description": "The service account's project role." })
3563}).annotate({ "description": "The service account that owns a project API key." })
3564export type ProjectApiKeyOwnerUser = {
3565 readonly "id": string
3566 readonly "email": string
3567 readonly "name": string
3568 readonly "created_at": number
3569 readonly "role": string
3570}
3571export const ProjectApiKeyOwnerUser = Schema.Struct({
3572 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3573 "email": Schema.String.annotate({ "description": "The email address of the user." }),
3574 "name": Schema.String.annotate({ "description": "The name of the user." }),
3575 "created_at": Schema.Number.annotate({
3576 "description": "The Unix timestamp (in seconds) of when the user was created.",
3577 "format": "unixtime"
3578 }).check(Schema.isInt()),
3579 "role": Schema.String.annotate({ "description": "The user's project role." })
3580}).annotate({ "description": "The user that owns a project API key." })
3581export type ProjectCreateRequest = {
3582 readonly "name": string
3583 readonly "geography"?: string | null
3584 readonly "external_key_id"?: string | null
3585}
3586export const ProjectCreateRequest = Schema.Struct({
3587 "name": Schema.String.annotate({ "description": "The friendly name of the project, this name appears in reports." }),
3588 "geography": Schema.optionalKey(
3589 Schema.Union([Schema.String, Schema.Null]).annotate({
3590 "description":
3591 "Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field."
3592 })
3593 ),
3594 "external_key_id": Schema.optionalKey(
3595 Schema.Union([Schema.String, Schema.Null]).annotate({
3596 "description": "External key ID to associate with the project."
3597 })
3598 )
3599})
3600export type ProjectGroup = {
3601 readonly "object": "project.group"
3602 readonly "project_id": string
3603 readonly "group_id": string
3604 readonly "group_name": string
3605 readonly "group_type": string
3606 readonly "created_at": number
3607}
3608export const ProjectGroup = Schema.Struct({
3609 "object": Schema.Literal("project.group").annotate({ "description": "Always `project.group`." }),
3610 "project_id": Schema.String.annotate({ "description": "Identifier of the project." }),
3611 "group_id": Schema.String.annotate({ "description": "Identifier of the group that has access to the project." }),
3612 "group_name": Schema.String.annotate({ "description": "Display name of the group." }),
3613 "group_type": Schema.String.annotate({ "description": "The type of the group." }),
3614 "created_at": Schema.Number.annotate({
3615 "description": "Unix timestamp (in seconds) when the group was granted project access.",
3616 "format": "unixtime"
3617 }).check(Schema.isInt())
3618}).annotate({ "description": "Details about a group's membership in a project." })
3619export type ProjectGroupDeletedResource = { readonly "object": "project.group.deleted"; readonly "deleted": boolean }
3620export const ProjectGroupDeletedResource = Schema.Struct({
3621 "object": Schema.Literal("project.group.deleted").annotate({ "description": "Always `project.group.deleted`." }),
3622 "deleted": Schema.Boolean.annotate({ "description": "Whether the group membership in the project was removed." })
3623}).annotate({ "description": "Confirmation payload returned after removing a group from a project." })
3624export type ProjectModelPermissions = {
3625 readonly "object": "project.model_permissions"
3626 readonly "mode": "allow_list" | "deny_list"
3627 readonly "model_ids": ReadonlyArray<string>
3628}
3629export const ProjectModelPermissions = Schema.Struct({
3630 "object": Schema.Literal("project.model_permissions").annotate({
3631 "description": "The object type, which is always `project.model_permissions`."
3632 }),
3633 "mode": Schema.Literals(["allow_list", "deny_list"]).annotate({
3634 "description": "Whether the project uses an allowlist or a denylist."
3635 }),
3636 "model_ids": Schema.Array(Schema.String).annotate({
3637 "description": "The model IDs included in the model permissions policy."
3638 })
3639}).annotate({ "description": "Represents the model allowlist or denylist policy for a project." })
3640export type ProjectModelPermissionsDeleteResponse = {
3641 readonly "object": "project.model_permissions.deleted"
3642 readonly "deleted": boolean
3643}
3644export const ProjectModelPermissionsDeleteResponse = Schema.Struct({
3645 "object": Schema.Literal("project.model_permissions.deleted").annotate({
3646 "description": "The object type, which is always `project.model_permissions.deleted`."
3647 }),
3648 "deleted": Schema.Boolean.annotate({ "description": "Whether the project model permissions were deleted." })
3649}).annotate({ "description": "Confirmation payload returned after deleting project model permissions." })
3650export type ProjectModelPermissionsUpdateRequest = {
3651 readonly "mode": "allow_list" | "deny_list"
3652 readonly "model_ids": ReadonlyArray<string>
3653}
3654export const ProjectModelPermissionsUpdateRequest = Schema.Struct({
3655 "mode": Schema.Literals(["allow_list", "deny_list"]).annotate({
3656 "description": "The model permissions mode to apply."
3657 }),
3658 "model_ids": Schema.Array(Schema.String).annotate({
3659 "description": "The model IDs included in this permissions policy."
3660 })
3661})
3662export type ProjectRateLimit = {
3663 readonly "object": "project.rate_limit"
3664 readonly "id": string
3665 readonly "model": string
3666 readonly "max_requests_per_1_minute": number
3667 readonly "max_tokens_per_1_minute": number
3668 readonly "max_images_per_1_minute"?: number
3669 readonly "max_audio_megabytes_per_1_minute"?: number
3670 readonly "max_requests_per_1_day"?: number
3671 readonly "batch_1_day_max_input_tokens"?: number
3672}
3673export const ProjectRateLimit = Schema.Struct({
3674 "object": Schema.Literal("project.rate_limit").annotate({
3675 "description": "The object type, which is always `project.rate_limit`"
3676 }),
3677 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
3678 "model": Schema.String.annotate({ "description": "The model this rate limit applies to." }),
3679 "max_requests_per_1_minute": Schema.Number.annotate({ "description": "The maximum requests per minute." }).check(
3680 Schema.isInt()
3681 ),
3682 "max_tokens_per_1_minute": Schema.Number.annotate({ "description": "The maximum tokens per minute." }).check(
3683 Schema.isInt()
3684 ),
3685 "max_images_per_1_minute": Schema.optionalKey(
3686 Schema.Number.annotate({ "description": "The maximum images per minute. Only present for relevant models." }).check(
3687 Schema.isInt()
3688 )
3689 ),
3690 "max_audio_megabytes_per_1_minute": Schema.optionalKey(
3691 Schema.Number.annotate({
3692 "description": "The maximum audio megabytes per minute. Only present for relevant models."
3693 }).check(Schema.isInt())
3694 ),
3695 "max_requests_per_1_day": Schema.optionalKey(
3696 Schema.Number.annotate({ "description": "The maximum requests per day. Only present for relevant models." }).check(
3697 Schema.isInt()
3698 )
3699 ),
3700 "batch_1_day_max_input_tokens": Schema.optionalKey(
3701 Schema.Number.annotate({
3702 "description": "The maximum batch input tokens per day. Only present for relevant models."
3703 }).check(Schema.isInt())
3704 )
3705}).annotate({ "description": "Represents a project rate limit config." })
3706export type ProjectRateLimitUpdateRequest = {
3707 readonly "max_requests_per_1_minute"?: number
3708 readonly "max_tokens_per_1_minute"?: number
3709 readonly "max_images_per_1_minute"?: number
3710 readonly "max_audio_megabytes_per_1_minute"?: number
3711 readonly "max_requests_per_1_day"?: number
3712 readonly "batch_1_day_max_input_tokens"?: number
3713}
3714export const ProjectRateLimitUpdateRequest = Schema.Struct({
3715 "max_requests_per_1_minute": Schema.optionalKey(
3716 Schema.Number.annotate({ "description": "The maximum requests per minute." }).check(Schema.isInt())
3717 ),
3718 "max_tokens_per_1_minute": Schema.optionalKey(
3719 Schema.Number.annotate({ "description": "The maximum tokens per minute." }).check(Schema.isInt())
3720 ),
3721 "max_images_per_1_minute": Schema.optionalKey(
3722 Schema.Number.annotate({ "description": "The maximum images per minute. Only relevant for certain models." }).check(
3723 Schema.isInt()
3724 )
3725 ),
3726 "max_audio_megabytes_per_1_minute": Schema.optionalKey(
3727 Schema.Number.annotate({
3728 "description": "The maximum audio megabytes per minute. Only relevant for certain models."
3729 }).check(Schema.isInt())
3730 ),
3731 "max_requests_per_1_day": Schema.optionalKey(
3732 Schema.Number.annotate({ "description": "The maximum requests per day. Only relevant for certain models." }).check(
3733 Schema.isInt()
3734 )
3735 ),
3736 "batch_1_day_max_input_tokens": Schema.optionalKey(
3737 Schema.Number.annotate({
3738 "description": "The maximum batch input tokens per day. Only relevant for certain models."
3739 }).check(Schema.isInt())
3740 )
3741})
3742export type ProjectServiceAccount = {
3743 readonly "object": "organization.project.service_account"
3744 readonly "id": string
3745 readonly "name": string
3746 readonly "role": "owner" | "member"
3747 readonly "created_at": number
3748}
3749export const ProjectServiceAccount = Schema.Struct({
3750 "object": Schema.Literal("organization.project.service_account").annotate({
3751 "description": "The object type, which is always `organization.project.service_account`"
3752 }),
3753 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3754 "name": Schema.String.annotate({ "description": "The name of the service account" }),
3755 "role": Schema.Literals(["owner", "member"]).annotate({ "description": "`owner` or `member`" }),
3756 "created_at": Schema.Number.annotate({
3757 "description": "The Unix timestamp (in seconds) of when the service account was created",
3758 "format": "unixtime"
3759 }).check(Schema.isInt())
3760}).annotate({ "description": "Represents an individual service account in a project." })
3761export type ProjectServiceAccountApiKey = {
3762 readonly "object": "organization.project.service_account.api_key"
3763 readonly "value": string
3764 readonly "name": string
3765 readonly "created_at": number
3766 readonly "id": string
3767}
3768export const ProjectServiceAccountApiKey = Schema.Struct({
3769 "object": Schema.Literal("organization.project.service_account.api_key").annotate({
3770 "description": "The object type, which is always `organization.project.service_account.api_key`"
3771 }),
3772 "value": Schema.String,
3773 "name": Schema.String,
3774 "created_at": Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()),
3775 "id": Schema.String
3776})
3777export type ProjectServiceAccountCreateRequest = { readonly "name": string }
3778export const ProjectServiceAccountCreateRequest = Schema.Struct({
3779 "name": Schema.String.annotate({ "description": "The name of the service account being created." })
3780})
3781export type ProjectServiceAccountDeleteResponse = {
3782 readonly "object": "organization.project.service_account.deleted"
3783 readonly "id": string
3784 readonly "deleted": boolean
3785}
3786export const ProjectServiceAccountDeleteResponse = Schema.Struct({
3787 "object": Schema.Literal("organization.project.service_account.deleted"),
3788 "id": Schema.String,
3789 "deleted": Schema.Boolean
3790})
3791export type ProjectUpdateRequest = {
3792 readonly "name"?: string | null
3793 readonly "external_key_id"?: string | null
3794 readonly "geography"?: string | null
3795}
3796export const ProjectUpdateRequest = Schema.Struct({
3797 "name": Schema.optionalKey(
3798 Schema.Union([Schema.String, Schema.Null]).annotate({
3799 "description": "The updated name of the project, this name appears in reports."
3800 })
3801 ),
3802 "external_key_id": Schema.optionalKey(
3803 Schema.Union([Schema.String, Schema.Null]).annotate({
3804 "description": "External key ID to associate with the project."
3805 })
3806 ),
3807 "geography": Schema.optionalKey(
3808 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Geography for the project." })
3809 )
3810})
3811export type ProjectUser = {
3812 readonly "object": "organization.project.user"
3813 readonly "id": string
3814 readonly "name"?: string | null
3815 readonly "email"?: string | null
3816 readonly "role": string
3817 readonly "added_at": number
3818}
3819export const ProjectUser = Schema.Struct({
3820 "object": Schema.Literal("organization.project.user").annotate({
3821 "description": "The object type, which is always `organization.project.user`"
3822 }),
3823 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
3824 "name": Schema.optionalKey(
3825 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the user" })
3826 ),
3827 "email": Schema.optionalKey(
3828 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The email address of the user" })
3829 ),
3830 "role": Schema.String.annotate({ "description": "`owner` or `member`" }),
3831 "added_at": Schema.Number.annotate({
3832 "description": "The Unix timestamp (in seconds) of when the project was added.",
3833 "format": "unixtime"
3834 }).check(Schema.isInt())
3835}).annotate({ "description": "Represents an individual user in a project." })
3836export type ProjectUserCreateRequest = {
3837 readonly "user_id"?: string | null
3838 readonly "email"?: string | null
3839 readonly "role": string
3840}
3841export const ProjectUserCreateRequest = Schema.Struct({
3842 "user_id": Schema.optionalKey(
3843 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The ID of the user." })
3844 ),
3845 "email": Schema.optionalKey(
3846 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Email of the user to add." })
3847 ),
3848 "role": Schema.String.annotate({ "description": "`owner` or `member`" })
3849})
3850export type ProjectUserDeleteResponse = {
3851 readonly "object": "organization.project.user.deleted"
3852 readonly "id": string
3853 readonly "deleted": boolean
3854}
3855export const ProjectUserDeleteResponse = Schema.Struct({
3856 "object": Schema.Literal("organization.project.user.deleted"),
3857 "id": Schema.String,
3858 "deleted": Schema.Boolean
3859})
3860export type ProjectUserUpdateRequest = { readonly "role"?: string | null }
3861export const ProjectUserUpdateRequest = Schema.Struct({
3862 "role": Schema.optionalKey(
3863 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "`owner` or `member`" })
3864 )
3865})
3866export type PublicAssignOrganizationGroupRoleBody = { readonly "role_id": string }
3867export const PublicAssignOrganizationGroupRoleBody = Schema.Struct({
3868 "role_id": Schema.String.annotate({ "description": "Identifier of the role to assign." })
3869}).annotate({ "description": "Request payload for assigning a role to a group or user." })
3870export type PublicCreateOrganizationRoleBody = {
3871 readonly "role_name": string
3872 readonly "permissions": ReadonlyArray<string>
3873 readonly "description"?: string | null
3874}
3875export const PublicCreateOrganizationRoleBody = Schema.Struct({
3876 "role_name": Schema.String.annotate({ "description": "Unique name for the role." }),
3877 "permissions": Schema.Array(Schema.String).annotate({ "description": "Permissions to grant to the role." }),
3878 "description": Schema.optionalKey(
3879 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Optional description of the role." })
3880 )
3881}).annotate({ "description": "Request payload for creating a custom role." })
3882export type PublicUpdateOrganizationRoleBody = {
3883 readonly "permissions"?: ReadonlyArray<string> | null
3884 readonly "description"?: string | null
3885 readonly "role_name"?: string | null
3886}
3887export const PublicUpdateOrganizationRoleBody = Schema.Struct({
3888 "permissions": Schema.optionalKey(
3889 Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({
3890 "description": "Updated set of permissions for the role."
3891 })
3892 ),
3893 "description": Schema.optionalKey(
3894 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "New description for the role." })
3895 ),
3896 "role_name": Schema.optionalKey(
3897 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "New name for the role." })
3898 )
3899}).annotate({ "description": "Request payload for updating an existing role." })
3900export type RealtimeAudioFormats = { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
3901 readonly "type"?: "audio/pcmu"
3902} | { readonly "type"?: "audio/pcma" }
3903export const RealtimeAudioFormats = Schema.Union([
3904 Schema.Struct({
3905 "type": Schema.optionalKey(
3906 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
3907 ),
3908 "rate": Schema.optionalKey(
3909 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
3910 )
3911 }).annotate({
3912 "title": "PCM audio format",
3913 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
3914 }),
3915 Schema.Struct({
3916 "type": Schema.optionalKey(
3917 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
3918 )
3919 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
3920 Schema.Struct({
3921 "type": Schema.optionalKey(
3922 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
3923 )
3924 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
3925])
3926export type RealtimeCallReferRequest = { readonly "target_uri": string }
3927export const RealtimeCallReferRequest = Schema.Struct({
3928 "target_uri": Schema.String.annotate({
3929 "description":
3930 "URI that should appear in the SIP Refer-To header. Supports values like\n`tel:+14155550123` or `sip:agent@example.com`."
3931 })
3932}).annotate({
3933 "title": "Realtime call refer request",
3934 "description": "Parameters required to transfer a SIP call to a new destination using the\nRealtime API."
3935})
3936export type RealtimeCallRejectRequest = { readonly "status_code"?: number }
3937export const RealtimeCallRejectRequest = Schema.Struct({
3938 "status_code": Schema.optionalKey(
3939 Schema.Number.annotate({
3940 "description": "SIP response code to send back to the caller. Defaults to `603` (Decline)\nwhen omitted."
3941 }).check(Schema.isInt())
3942 )
3943}).annotate({
3944 "title": "Realtime call reject request",
3945 "description": "Parameters used to decline an incoming SIP call handled by the Realtime API."
3946})
3947export type RealtimeClientEventConversationItemDelete = {
3948 readonly "event_id"?: string
3949 readonly "type": "conversation.item.delete"
3950 readonly "item_id": string
3951}
3952export const RealtimeClientEventConversationItemDelete = Schema.Struct({
3953 "event_id": Schema.optionalKey(
3954 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
3955 Schema.isMaxLength(512)
3956 )
3957 ),
3958 "type": Schema.Literal("conversation.item.delete").annotate({
3959 "description": "The event type, must be `conversation.item.delete`."
3960 }),
3961 "item_id": Schema.String.annotate({ "description": "The ID of the item to delete." })
3962}).annotate({
3963 "description":
3964 "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n"
3965})
3966export type RealtimeClientEventConversationItemRetrieve = {
3967 readonly "event_id"?: string
3968 readonly "type": "conversation.item.retrieve"
3969 readonly "item_id": string
3970}
3971export const RealtimeClientEventConversationItemRetrieve = Schema.Struct({
3972 "event_id": Schema.optionalKey(
3973 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
3974 Schema.isMaxLength(512)
3975 )
3976 ),
3977 "type": Schema.Literal("conversation.item.retrieve").annotate({
3978 "description": "The event type, must be `conversation.item.retrieve`."
3979 }),
3980 "item_id": Schema.String.annotate({ "description": "The ID of the item to retrieve." })
3981}).annotate({
3982 "description":
3983 "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n"
3984})
3985export type RealtimeClientEventConversationItemTruncate = {
3986 readonly "event_id"?: string
3987 readonly "type": "conversation.item.truncate"
3988 readonly "item_id": string
3989 readonly "content_index": number
3990 readonly "audio_end_ms": number
3991}
3992export const RealtimeClientEventConversationItemTruncate = Schema.Struct({
3993 "event_id": Schema.optionalKey(
3994 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
3995 Schema.isMaxLength(512)
3996 )
3997 ),
3998 "type": Schema.Literal("conversation.item.truncate").annotate({
3999 "description": "The event type, must be `conversation.item.truncate`."
4000 }),
4001 "item_id": Schema.String.annotate({
4002 "description":
4003 "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n"
4004 }),
4005 "content_index": Schema.Number.annotate({
4006 "description": "The index of the content part to truncate. Set this to `0`."
4007 }).check(Schema.isInt()),
4008 "audio_end_ms": Schema.Number.annotate({
4009 "description":
4010 "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n"
4011 }).check(Schema.isInt())
4012}).annotate({
4013 "description":
4014 "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n"
4015})
4016export type RealtimeClientEventInputAudioBufferAppend = {
4017 readonly "event_id"?: string
4018 readonly "type": "input_audio_buffer.append"
4019 readonly "audio": string
4020}
4021export const RealtimeClientEventInputAudioBufferAppend = Schema.Struct({
4022 "event_id": Schema.optionalKey(
4023 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
4024 Schema.isMaxLength(512)
4025 )
4026 ),
4027 "type": Schema.Literal("input_audio_buffer.append").annotate({
4028 "description": "The event type, must be `input_audio_buffer.append`."
4029 }),
4030 "audio": Schema.String.annotate({
4031 "description":
4032 "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n"
4033 })
4034}).annotate({
4035 "description":
4036 "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. A \"commit\" will create a new\nuser message item in the conversation history from the buffer content and clear the buffer.\nInput audio transcription (if enabled) will be generated when the buffer is committed.\n\nIf VAD is enabled the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually. Input audio noise reduction operates on writes to the audio buffer.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike most other client events, the server will \nnot send a confirmation response to this event.\n"
4037})
4038export type RealtimeClientEventInputAudioBufferClear = {
4039 readonly "event_id"?: string
4040 readonly "type": "input_audio_buffer.clear"
4041}
4042export const RealtimeClientEventInputAudioBufferClear = Schema.Struct({
4043 "event_id": Schema.optionalKey(
4044 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
4045 Schema.isMaxLength(512)
4046 )
4047 ),
4048 "type": Schema.Literal("input_audio_buffer.clear").annotate({
4049 "description": "The event type, must be `input_audio_buffer.clear`."
4050 })
4051}).annotate({
4052 "description":
4053 "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n"
4054})
4055export type RealtimeClientEventInputAudioBufferCommit = {
4056 readonly "event_id"?: string
4057 readonly "type": "input_audio_buffer.commit"
4058}
4059export const RealtimeClientEventInputAudioBufferCommit = Schema.Struct({
4060 "event_id": Schema.optionalKey(
4061 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
4062 Schema.isMaxLength(512)
4063 )
4064 ),
4065 "type": Schema.Literal("input_audio_buffer.commit").annotate({
4066 "description": "The event type, must be `input_audio_buffer.commit`."
4067 })
4068}).annotate({
4069 "description":
4070 "Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. This event will produce an error if the input audio buffer is empty. When in Server VAD mode, the client does not need to send this event, the server will commit the audio buffer automatically.\n\nCommitting the input audio buffer will trigger input audio transcription (if enabled in session configuration), but it will not create a response from the model. The server will respond with an `input_audio_buffer.committed` event.\n"
4071})
4072export type RealtimeClientEventOutputAudioBufferClear = {
4073 readonly "event_id"?: string
4074 readonly "type": "output_audio_buffer.clear"
4075}
4076export const RealtimeClientEventOutputAudioBufferClear = Schema.Struct({
4077 "event_id": Schema.optionalKey(
4078 Schema.String.annotate({ "description": "The unique ID of the client event used for error handling." })
4079 ),
4080 "type": Schema.Literal("output_audio_buffer.clear").annotate({
4081 "description": "The event type, must be `output_audio_buffer.clear`."
4082 })
4083}).annotate({
4084 "description":
4085 "**WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to\nstop generating audio and emit a `output_audio_buffer.cleared` event. This\nevent should be preceded by a `response.cancel` client event to stop the\ngeneration of the current response.\n[Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"
4086})
4087export type RealtimeClientEventResponseCancel = {
4088 readonly "event_id"?: string
4089 readonly "type": "response.cancel"
4090 readonly "response_id"?: string
4091}
4092export const RealtimeClientEventResponseCancel = Schema.Struct({
4093 "event_id": Schema.optionalKey(
4094 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
4095 Schema.isMaxLength(512)
4096 )
4097 ),
4098 "type": Schema.Literal("response.cancel").annotate({ "description": "The event type, must be `response.cancel`." }),
4099 "response_id": Schema.optionalKey(
4100 Schema.String.annotate({
4101 "description":
4102 "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n"
4103 })
4104 )
4105}).annotate({
4106 "description":
4107 "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error. It's safe\nto call `response.cancel` even if no response is in progress, an error will be\nreturned the session will remain unaffected.\n"
4108})
4109export type RealtimeConversationItemFunctionCall = {
4110 readonly "id"?: string
4111 readonly "object"?: "realtime.item"
4112 readonly "type": "function_call"
4113 readonly "status"?: "completed" | "incomplete" | "in_progress"
4114 readonly "call_id"?: string
4115 readonly "name": string
4116 readonly "arguments": string
4117}
4118export const RealtimeConversationItemFunctionCall = Schema.Struct({
4119 "id": Schema.optionalKey(
4120 Schema.String.annotate({
4121 "description": "The unique ID of the item. This may be provided by the client or generated by the server."
4122 })
4123 ),
4124 "object": Schema.optionalKey(
4125 Schema.Literal("realtime.item").annotate({
4126 "description":
4127 "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item."
4128 })
4129 ),
4130 "type": Schema.Literal("function_call").annotate({ "description": "The type of the item. Always `function_call`." }),
4131 "status": Schema.optionalKey(
4132 Schema.Literals(["completed", "incomplete", "in_progress"]).annotate({
4133 "description": "The status of the item. Has no effect on the conversation."
4134 })
4135 ),
4136 "call_id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the function call." })),
4137 "name": Schema.String.annotate({ "description": "The name of the function being called." }),
4138 "arguments": Schema.String.annotate({
4139 "description":
4140 "The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{\"arg1\": \"value1\", \"arg2\": 42}`."
4141 })
4142}).annotate({
4143 "title": "Realtime function call item",
4144 "description": "A function call item in a Realtime conversation."
4145})
4146export type RealtimeConversationItemFunctionCallOutput = {
4147 readonly "id"?: string
4148 readonly "object"?: "realtime.item"
4149 readonly "type": "function_call_output"
4150 readonly "status"?: "completed" | "incomplete" | "in_progress"
4151 readonly "call_id": string
4152 readonly "output": string
4153}
4154export const RealtimeConversationItemFunctionCallOutput = Schema.Struct({
4155 "id": Schema.optionalKey(
4156 Schema.String.annotate({
4157 "description": "The unique ID of the item. This may be provided by the client or generated by the server."
4158 })
4159 ),
4160 "object": Schema.optionalKey(
4161 Schema.Literal("realtime.item").annotate({
4162 "description":
4163 "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item."
4164 })
4165 ),
4166 "type": Schema.Literal("function_call_output").annotate({
4167 "description": "The type of the item. Always `function_call_output`."
4168 }),
4169 "status": Schema.optionalKey(
4170 Schema.Literals(["completed", "incomplete", "in_progress"]).annotate({
4171 "description": "The status of the item. Has no effect on the conversation."
4172 })
4173 ),
4174 "call_id": Schema.String.annotate({ "description": "The ID of the function call this output is for." }),
4175 "output": Schema.String.annotate({
4176 "description":
4177 "The output of the function call, this is free text and can contain any information or simply be empty."
4178 })
4179}).annotate({
4180 "title": "Realtime function call output item",
4181 "description": "A function call output item in a Realtime conversation."
4182})
4183export type RealtimeConversationItemMessageAssistant = {
4184 readonly "id"?: string
4185 readonly "object"?: "realtime.item"
4186 readonly "type": "message"
4187 readonly "status"?: "completed" | "incomplete" | "in_progress"
4188 readonly "role": "assistant"
4189 readonly "content": ReadonlyArray<
4190 {
4191 readonly "type"?: "output_text" | "output_audio"
4192 readonly "text"?: string
4193 readonly "audio"?: string
4194 readonly "transcript"?: string
4195 }
4196 >
4197}
4198export const RealtimeConversationItemMessageAssistant = Schema.Struct({
4199 "id": Schema.optionalKey(
4200 Schema.String.annotate({
4201 "description": "The unique ID of the item. This may be provided by the client or generated by the server."
4202 })
4203 ),
4204 "object": Schema.optionalKey(
4205 Schema.Literal("realtime.item").annotate({
4206 "description":
4207 "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item."
4208 })
4209 ),
4210 "type": Schema.Literal("message").annotate({ "description": "The type of the item. Always `message`." }),
4211 "status": Schema.optionalKey(
4212 Schema.Literals(["completed", "incomplete", "in_progress"]).annotate({
4213 "description": "The status of the item. Has no effect on the conversation."
4214 })
4215 ),
4216 "role": Schema.Literal("assistant").annotate({
4217 "description": "The role of the message sender. Always `assistant`."
4218 }),
4219 "content": Schema.Array(Schema.Struct({
4220 "type": Schema.optionalKey(
4221 Schema.Literals(["output_text", "output_audio"]).annotate({
4222 "description":
4223 "The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration."
4224 })
4225 ),
4226 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content." })),
4227 "audio": Schema.optionalKey(
4228 Schema.String.annotate({
4229 "description":
4230 "Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified."
4231 })
4232 ),
4233 "transcript": Schema.optionalKey(
4234 Schema.String.annotate({
4235 "description": "The transcript of the audio content, this will always be present if the output type is `audio`."
4236 })
4237 )
4238 })).annotate({ "description": "The content of the message." })
4239}).annotate({
4240 "title": "Realtime assistant message item",
4241 "description": "An assistant message item in a Realtime conversation."
4242})
4243export type RealtimeConversationItemMessageSystem = {
4244 readonly "id"?: string
4245 readonly "object"?: "realtime.item"
4246 readonly "type": "message"
4247 readonly "status"?: "completed" | "incomplete" | "in_progress"
4248 readonly "role": "system"
4249 readonly "content": ReadonlyArray<{ readonly "type"?: "input_text"; readonly "text"?: string }>
4250}
4251export const RealtimeConversationItemMessageSystem = Schema.Struct({
4252 "id": Schema.optionalKey(
4253 Schema.String.annotate({
4254 "description": "The unique ID of the item. This may be provided by the client or generated by the server."
4255 })
4256 ),
4257 "object": Schema.optionalKey(
4258 Schema.Literal("realtime.item").annotate({
4259 "description":
4260 "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item."
4261 })
4262 ),
4263 "type": Schema.Literal("message").annotate({ "description": "The type of the item. Always `message`." }),
4264 "status": Schema.optionalKey(
4265 Schema.Literals(["completed", "incomplete", "in_progress"]).annotate({
4266 "description": "The status of the item. Has no effect on the conversation."
4267 })
4268 ),
4269 "role": Schema.Literal("system").annotate({ "description": "The role of the message sender. Always `system`." }),
4270 "content": Schema.Array(
4271 Schema.Struct({
4272 "type": Schema.optionalKey(
4273 Schema.Literal("input_text").annotate({
4274 "description": "The content type. Always `input_text` for system messages."
4275 })
4276 ),
4277 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content." }))
4278 })
4279 ).annotate({ "description": "The content of the message." })
4280}).annotate({
4281 "title": "Realtime system message item",
4282 "description":
4283 "A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. \"the user is now asking about a different topic\"), use system messages."
4284})
4285export type RealtimeConversationItemMessageUser = {
4286 readonly "id"?: string
4287 readonly "object"?: "realtime.item"
4288 readonly "type": "message"
4289 readonly "status"?: "completed" | "incomplete" | "in_progress"
4290 readonly "role": "user"
4291 readonly "content": ReadonlyArray<
4292 {
4293 readonly "type"?: "input_text" | "input_audio" | "input_image"
4294 readonly "text"?: string
4295 readonly "audio"?: string
4296 readonly "image_url"?: string
4297 readonly "detail"?: "auto" | "low" | "high"
4298 readonly "transcript"?: string
4299 }
4300 >
4301}
4302export const RealtimeConversationItemMessageUser = Schema.Struct({
4303 "id": Schema.optionalKey(
4304 Schema.String.annotate({
4305 "description": "The unique ID of the item. This may be provided by the client or generated by the server."
4306 })
4307 ),
4308 "object": Schema.optionalKey(
4309 Schema.Literal("realtime.item").annotate({
4310 "description":
4311 "Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item."
4312 })
4313 ),
4314 "type": Schema.Literal("message").annotate({ "description": "The type of the item. Always `message`." }),
4315 "status": Schema.optionalKey(
4316 Schema.Literals(["completed", "incomplete", "in_progress"]).annotate({
4317 "description": "The status of the item. Has no effect on the conversation."
4318 })
4319 ),
4320 "role": Schema.Literal("user").annotate({ "description": "The role of the message sender. Always `user`." }),
4321 "content": Schema.Array(Schema.Struct({
4322 "type": Schema.optionalKey(
4323 Schema.Literals(["input_text", "input_audio", "input_image"]).annotate({
4324 "description": "The content type (`input_text`, `input_audio`, or `input_image`)."
4325 })
4326 ),
4327 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content (for `input_text`)." })),
4328 "audio": Schema.optionalKey(
4329 Schema.String.annotate({
4330 "description":
4331 "Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified."
4332 })
4333 ),
4334 "image_url": Schema.optionalKey(
4335 Schema.String.annotate({
4336 "description":
4337 "Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG.",
4338 "format": "uri"
4339 })
4340 ),
4341 "detail": Schema.optionalKey(
4342 Schema.Literals(["auto", "low", "high"]).annotate({
4343 "description": "The detail level of the image (for `input_image`). `auto` will default to `high`."
4344 })
4345 ),
4346 "transcript": Schema.optionalKey(
4347 Schema.String.annotate({
4348 "description":
4349 "Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference."
4350 })
4351 )
4352 })).annotate({ "description": "The content of the message." })
4353}).annotate({ "title": "Realtime user message item", "description": "A user message item in a Realtime conversation." })
4354export type RealtimeFunctionTool = {
4355 readonly "type"?: "function"
4356 readonly "name"?: string
4357 readonly "description"?: string
4358 readonly "parameters"?: {}
4359}
4360export const RealtimeFunctionTool = Schema.Struct({
4361 "type": Schema.optionalKey(
4362 Schema.Literal("function").annotate({ "description": "The type of the tool, i.e. `function`." })
4363 ),
4364 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function." })),
4365 "description": Schema.optionalKey(
4366 Schema.String.annotate({
4367 "description":
4368 "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n"
4369 })
4370 ),
4371 "parameters": Schema.optionalKey(
4372 Schema.Struct({}).annotate({ "description": "Parameters of the function in JSON Schema." })
4373 )
4374}).annotate({ "title": "Function tool" })
4375export type RealtimeMCPApprovalRequest = {
4376 readonly "type": "mcp_approval_request"
4377 readonly "id": string
4378 readonly "server_label": string
4379 readonly "name": string
4380 readonly "arguments": string
4381}
4382export const RealtimeMCPApprovalRequest = Schema.Struct({
4383 "type": Schema.Literal("mcp_approval_request").annotate({
4384 "description": "The type of the item. Always `mcp_approval_request`."
4385 }),
4386 "id": Schema.String.annotate({ "description": "The unique ID of the approval request." }),
4387 "server_label": Schema.String.annotate({ "description": "The label of the MCP server making the request." }),
4388 "name": Schema.String.annotate({ "description": "The name of the tool to run." }),
4389 "arguments": Schema.String.annotate({ "description": "A JSON string of arguments for the tool." })
4390}).annotate({
4391 "title": "Realtime MCP approval request",
4392 "description": "A Realtime item requesting human approval of a tool invocation.\n"
4393})
4394export type RealtimeMCPApprovalResponse = {
4395 readonly "type": "mcp_approval_response"
4396 readonly "id": string
4397 readonly "approval_request_id": string
4398 readonly "approve": boolean
4399 readonly "reason"?: string | null
4400}
4401export const RealtimeMCPApprovalResponse = Schema.Struct({
4402 "type": Schema.Literal("mcp_approval_response").annotate({
4403 "description": "The type of the item. Always `mcp_approval_response`."
4404 }),
4405 "id": Schema.String.annotate({ "description": "The unique ID of the approval response." }),
4406 "approval_request_id": Schema.String.annotate({ "description": "The ID of the approval request being answered." }),
4407 "approve": Schema.Boolean.annotate({ "description": "Whether the request was approved." }),
4408 "reason": Schema.optionalKey(
4409 Schema.Union([Schema.String.annotate({ "description": "Optional reason for the decision." }), Schema.Null])
4410 )
4411}).annotate({
4412 "title": "Realtime MCP approval response",
4413 "description": "A Realtime item responding to an MCP approval request.\n"
4414})
4415export type RealtimeMCPHTTPError = {
4416 readonly "type": "http_error"
4417 readonly "code": number
4418 readonly "message": string
4419}
4420export const RealtimeMCPHTTPError = Schema.Struct({
4421 "type": Schema.Literal("http_error"),
4422 "code": Schema.Number.check(Schema.isInt()),
4423 "message": Schema.String
4424}).annotate({ "title": "Realtime MCP HTTP error" })
4425export type RealtimeMCPProtocolError = {
4426 readonly "type": "protocol_error"
4427 readonly "code": number
4428 readonly "message": string
4429}
4430export const RealtimeMCPProtocolError = Schema.Struct({
4431 "type": Schema.Literal("protocol_error"),
4432 "code": Schema.Number.check(Schema.isInt()),
4433 "message": Schema.String
4434}).annotate({ "title": "Realtime MCP protocol error" })
4435export type RealtimeMCPToolExecutionError = { readonly "type": "tool_execution_error"; readonly "message": string }
4436export const RealtimeMCPToolExecutionError = Schema.Struct({
4437 "type": Schema.Literal("tool_execution_error"),
4438 "message": Schema.String
4439}).annotate({ "title": "Realtime MCP tool execution error" })
4440export type RealtimeReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh"
4441export const RealtimeReasoningEffort = Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
4442 "description": "Constrains effort on reasoning for reasoning-capable Realtime models such as\n`gpt-realtime-2`.\n"
4443})
4444export type RealtimeServerEventConversationCreated = {
4445 readonly "event_id": string
4446 readonly "type": "conversation.created"
4447 readonly "conversation": { readonly "id"?: string; readonly "object"?: string }
4448}
4449export const RealtimeServerEventConversationCreated = Schema.Struct({
4450 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4451 "type": Schema.Literal("conversation.created").annotate({
4452 "description": "The event type, must be `conversation.created`."
4453 }),
4454 "conversation": Schema.Struct({
4455 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the conversation." })),
4456 "object": Schema.optionalKey(
4457 Schema.String.annotate({ "description": "The object type, must be `realtime.conversation`." })
4458 )
4459 }).annotate({ "description": "The conversation resource." })
4460}).annotate({ "description": "Returned when a conversation is created. Emitted right after session creation.\n" })
4461export type RealtimeServerEventConversationItemDeleted = {
4462 readonly "event_id": string
4463 readonly "type": "conversation.item.deleted"
4464 readonly "item_id": string
4465}
4466export const RealtimeServerEventConversationItemDeleted = Schema.Struct({
4467 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4468 "type": Schema.Literal("conversation.item.deleted").annotate({
4469 "description": "The event type, must be `conversation.item.deleted`."
4470 }),
4471 "item_id": Schema.String.annotate({ "description": "The ID of the item that was deleted." })
4472}).annotate({
4473 "description":
4474 "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n"
4475})
4476export type RealtimeServerEventConversationItemInputAudioTranscriptionFailed = {
4477 readonly "event_id": string
4478 readonly "type": "conversation.item.input_audio_transcription.failed"
4479 readonly "item_id": string
4480 readonly "content_index": number
4481 readonly "error": {
4482 readonly "type"?: string
4483 readonly "code"?: string
4484 readonly "message"?: string
4485 readonly "param"?: string
4486 }
4487}
4488export const RealtimeServerEventConversationItemInputAudioTranscriptionFailed = Schema.Struct({
4489 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4490 "type": Schema.Literal("conversation.item.input_audio_transcription.failed").annotate({
4491 "description": "The event type, must be\n`conversation.item.input_audio_transcription.failed`.\n"
4492 }),
4493 "item_id": Schema.String.annotate({ "description": "The ID of the user message item." }),
4494 "content_index": Schema.Number.annotate({ "description": "The index of the content part containing the audio." })
4495 .check(Schema.isInt()),
4496 "error": Schema.Struct({
4497 "type": Schema.optionalKey(Schema.String.annotate({ "description": "The type of error." })),
4498 "code": Schema.optionalKey(Schema.String.annotate({ "description": "Error code, if any." })),
4499 "message": Schema.optionalKey(Schema.String.annotate({ "description": "A human-readable error message." })),
4500 "param": Schema.optionalKey(Schema.String.annotate({ "description": "Parameter related to the error, if any." }))
4501 }).annotate({ "description": "Details of the transcription error." })
4502}).annotate({
4503 "description":
4504 "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n"
4505})
4506export type RealtimeServerEventConversationItemInputAudioTranscriptionSegment = {
4507 readonly "event_id": string
4508 readonly "type": "conversation.item.input_audio_transcription.segment"
4509 readonly "item_id": string
4510 readonly "content_index": number
4511 readonly "text": string
4512 readonly "id": string
4513 readonly "speaker": string
4514 readonly "start": number
4515 readonly "end": number
4516}
4517export const RealtimeServerEventConversationItemInputAudioTranscriptionSegment = Schema.Struct({
4518 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4519 "type": Schema.Literal("conversation.item.input_audio_transcription.segment").annotate({
4520 "description": "The event type, must be `conversation.item.input_audio_transcription.segment`."
4521 }),
4522 "item_id": Schema.String.annotate({ "description": "The ID of the item containing the input audio content." }),
4523 "content_index": Schema.Number.annotate({
4524 "description": "The index of the input audio content part within the item."
4525 }).check(Schema.isInt()),
4526 "text": Schema.String.annotate({ "description": "The text for this segment." }),
4527 "id": Schema.String.annotate({ "description": "The segment identifier." }),
4528 "speaker": Schema.String.annotate({ "description": "The detected speaker label for this segment." }),
4529 "start": Schema.Number.annotate({ "description": "Start time of the segment in seconds.", "format": "double" }).check(
4530 Schema.isFinite()
4531 ),
4532 "end": Schema.Number.annotate({ "description": "End time of the segment in seconds.", "format": "double" }).check(
4533 Schema.isFinite()
4534 )
4535}).annotate({ "description": "Returned when an input audio transcription segment is identified for an item." })
4536export type RealtimeServerEventConversationItemTruncated = {
4537 readonly "event_id": string
4538 readonly "type": "conversation.item.truncated"
4539 readonly "item_id": string
4540 readonly "content_index": number
4541 readonly "audio_end_ms": number
4542}
4543export const RealtimeServerEventConversationItemTruncated = Schema.Struct({
4544 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4545 "type": Schema.Literal("conversation.item.truncated").annotate({
4546 "description": "The event type, must be `conversation.item.truncated`."
4547 }),
4548 "item_id": Schema.String.annotate({ "description": "The ID of the assistant message item that was truncated." }),
4549 "content_index": Schema.Number.annotate({ "description": "The index of the content part that was truncated." }).check(
4550 Schema.isInt()
4551 ),
4552 "audio_end_ms": Schema.Number.annotate({
4553 "description": "The duration up to which the audio was truncated, in milliseconds.\n"
4554 }).check(Schema.isInt())
4555}).annotate({
4556 "description":
4557 "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n"
4558})
4559export type RealtimeServerEventError = {
4560 readonly "event_id": string
4561 readonly "type": "error"
4562 readonly "error": {
4563 readonly "type": string
4564 readonly "code"?: string | null
4565 readonly "message": string
4566 readonly "param"?: string | null
4567 readonly "event_id"?: string | null
4568 }
4569}
4570export const RealtimeServerEventError = Schema.Struct({
4571 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4572 "type": Schema.Literal("error").annotate({ "description": "The event type, must be `error`." }),
4573 "error": Schema.Struct({
4574 "type": Schema.String.annotate({
4575 "description": "The type of error (e.g., \"invalid_request_error\", \"server_error\").\n"
4576 }),
4577 "code": Schema.optionalKey(
4578 Schema.Union([Schema.String.annotate({ "description": "Error code, if any." }), Schema.Null])
4579 ),
4580 "message": Schema.String.annotate({ "description": "A human-readable error message." }),
4581 "param": Schema.optionalKey(
4582 Schema.Union([Schema.String.annotate({ "description": "Parameter related to the error, if any." }), Schema.Null])
4583 ),
4584 "event_id": Schema.optionalKey(
4585 Schema.Union([
4586 Schema.String.annotate({
4587 "description": "The event_id of the client event that caused the error, if applicable.\n"
4588 }),
4589 Schema.Null
4590 ])
4591 )
4592 }).annotate({ "description": "Details of the error." })
4593}).annotate({
4594 "description":
4595 "Returned when an error occurs, which could be a client problem or a server\nproblem. Most errors are recoverable and the session will stay open, we\nrecommend to implementors to monitor and log error messages by default.\n"
4596})
4597export type RealtimeServerEventInputAudioBufferCleared = {
4598 readonly "event_id": string
4599 readonly "type": "input_audio_buffer.cleared"
4600}
4601export const RealtimeServerEventInputAudioBufferCleared = Schema.Struct({
4602 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4603 "type": Schema.Literal("input_audio_buffer.cleared").annotate({
4604 "description": "The event type, must be `input_audio_buffer.cleared`."
4605 })
4606}).annotate({
4607 "description":
4608 "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n"
4609})
4610export type RealtimeServerEventInputAudioBufferCommitted = {
4611 readonly "event_id": string
4612 readonly "type": "input_audio_buffer.committed"
4613 readonly "previous_item_id"?: string | null
4614 readonly "item_id": string
4615}
4616export const RealtimeServerEventInputAudioBufferCommitted = Schema.Struct({
4617 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4618 "type": Schema.Literal("input_audio_buffer.committed").annotate({
4619 "description": "The event type, must be `input_audio_buffer.committed`."
4620 }),
4621 "previous_item_id": Schema.optionalKey(
4622 Schema.Union([
4623 Schema.String.annotate({
4624 "description":
4625 "The ID of the preceding item after which the new item will be inserted.\nCan be `null` if the item has no predecessor.\n"
4626 }),
4627 Schema.Null
4628 ])
4629 ),
4630 "item_id": Schema.String.annotate({ "description": "The ID of the user message item that will be created." })
4631}).annotate({
4632 "description":
4633 "Returned when an input audio buffer is committed, either by the client or\nautomatically in server VAD mode. The `item_id` property is the ID of the user\nmessage item that will be created, thus a `conversation.item.created` event\nwill also be sent to the client.\n"
4634})
4635export type RealtimeServerEventInputAudioBufferDtmfEventReceived = {
4636 readonly "type": "input_audio_buffer.dtmf_event_received"
4637 readonly "event": string
4638 readonly "received_at": number
4639}
4640export const RealtimeServerEventInputAudioBufferDtmfEventReceived = Schema.Struct({
4641 "type": Schema.Literal("input_audio_buffer.dtmf_event_received").annotate({
4642 "description": "The event type, must be `input_audio_buffer.dtmf_event_received`."
4643 }),
4644 "event": Schema.String.annotate({ "description": "The telephone keypad that was pressed by the user." }),
4645 "received_at": Schema.Number.annotate({
4646 "description": "UTC Unix Timestamp when DTMF Event was received by server.\n"
4647 }).check(Schema.isInt())
4648}).annotate({
4649 "description":
4650 "**SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that\nrepresents a telephone keypad press (0–9, *, #, A–D). The `event` property\nis the keypad that the user press. The `received_at` is the UTC Unix Timestamp\nthat the server received the event.\n"
4651})
4652export type RealtimeServerEventInputAudioBufferSpeechStarted = {
4653 readonly "event_id": string
4654 readonly "type": "input_audio_buffer.speech_started"
4655 readonly "audio_start_ms": number
4656 readonly "item_id": string
4657}
4658export const RealtimeServerEventInputAudioBufferSpeechStarted = Schema.Struct({
4659 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4660 "type": Schema.Literal("input_audio_buffer.speech_started").annotate({
4661 "description": "The event type, must be `input_audio_buffer.speech_started`."
4662 }),
4663 "audio_start_ms": Schema.Number.annotate({
4664 "description":
4665 "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n"
4666 }).check(Schema.isInt()),
4667 "item_id": Schema.String.annotate({
4668 "description": "The ID of the user message item that will be created when speech stops.\n"
4669 })
4670}).annotate({
4671 "description":
4672 "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n"
4673})
4674export type RealtimeServerEventInputAudioBufferSpeechStopped = {
4675 readonly "event_id": string
4676 readonly "type": "input_audio_buffer.speech_stopped"
4677 readonly "audio_end_ms": number
4678 readonly "item_id": string
4679}
4680export const RealtimeServerEventInputAudioBufferSpeechStopped = Schema.Struct({
4681 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4682 "type": Schema.Literal("input_audio_buffer.speech_stopped").annotate({
4683 "description": "The event type, must be `input_audio_buffer.speech_stopped`."
4684 }),
4685 "audio_end_ms": Schema.Number.annotate({
4686 "description":
4687 "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n"
4688 }).check(Schema.isInt()),
4689 "item_id": Schema.String.annotate({ "description": "The ID of the user message item that will be created." })
4690}).annotate({
4691 "description":
4692 "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n"
4693})
4694export type RealtimeServerEventInputAudioBufferTimeoutTriggered = {
4695 readonly "event_id": string
4696 readonly "type": "input_audio_buffer.timeout_triggered"
4697 readonly "audio_start_ms": number
4698 readonly "audio_end_ms": number
4699 readonly "item_id": string
4700}
4701export const RealtimeServerEventInputAudioBufferTimeoutTriggered = Schema.Struct({
4702 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4703 "type": Schema.Literal("input_audio_buffer.timeout_triggered").annotate({
4704 "description": "The event type, must be `input_audio_buffer.timeout_triggered`."
4705 }),
4706 "audio_start_ms": Schema.Number.annotate({
4707 "description":
4708 "Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response."
4709 }).check(Schema.isInt()),
4710 "audio_end_ms": Schema.Number.annotate({
4711 "description":
4712 "Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered."
4713 }).check(Schema.isInt()),
4714 "item_id": Schema.String.annotate({ "description": "The ID of the item associated with this segment." })
4715}).annotate({
4716 "description":
4717 "Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured\nwith `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that\nthere hasn't been any speech detected for the configured duration.\n\nThe `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last\nmodel response up to the triggering time, as an offset from the beginning of audio written\nto the input audio buffer. This means it demarcates the segment of audio that was silent and\nthe difference between the start and end values will roughly match the configured timeout.\n\nThe empty audio will be committed to the conversation as an `input_audio` item (there will be a\n`input_audio_buffer.committed` event) and a model response will be generated. There may be speech\nthat didn't trigger VAD but is still detected by the model, so the model may respond with\nsomething relevant to the conversation or a prompt to continue speaking.\n"
4718})
4719export type RealtimeServerEventMCPListToolsCompleted = {
4720 readonly "event_id": string
4721 readonly "type": "mcp_list_tools.completed"
4722 readonly "item_id": string
4723}
4724export const RealtimeServerEventMCPListToolsCompleted = Schema.Struct({
4725 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4726 "type": Schema.Literal("mcp_list_tools.completed").annotate({
4727 "description": "The event type, must be `mcp_list_tools.completed`."
4728 }),
4729 "item_id": Schema.String.annotate({ "description": "The ID of the MCP list tools item." })
4730}).annotate({ "description": "Returned when listing MCP tools has completed for an item." })
4731export type RealtimeServerEventMCPListToolsFailed = {
4732 readonly "event_id": string
4733 readonly "type": "mcp_list_tools.failed"
4734 readonly "item_id": string
4735}
4736export const RealtimeServerEventMCPListToolsFailed = Schema.Struct({
4737 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4738 "type": Schema.Literal("mcp_list_tools.failed").annotate({
4739 "description": "The event type, must be `mcp_list_tools.failed`."
4740 }),
4741 "item_id": Schema.String.annotate({ "description": "The ID of the MCP list tools item." })
4742}).annotate({ "description": "Returned when listing MCP tools has failed for an item." })
4743export type RealtimeServerEventMCPListToolsInProgress = {
4744 readonly "event_id": string
4745 readonly "type": "mcp_list_tools.in_progress"
4746 readonly "item_id": string
4747}
4748export const RealtimeServerEventMCPListToolsInProgress = Schema.Struct({
4749 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4750 "type": Schema.Literal("mcp_list_tools.in_progress").annotate({
4751 "description": "The event type, must be `mcp_list_tools.in_progress`."
4752 }),
4753 "item_id": Schema.String.annotate({ "description": "The ID of the MCP list tools item." })
4754}).annotate({ "description": "Returned when listing MCP tools is in progress for an item." })
4755export type RealtimeServerEventOutputAudioBufferCleared = {
4756 readonly "event_id": string
4757 readonly "type": "output_audio_buffer.cleared"
4758 readonly "response_id": string
4759}
4760export const RealtimeServerEventOutputAudioBufferCleared = Schema.Struct({
4761 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4762 "type": Schema.Literal("output_audio_buffer.cleared").annotate({
4763 "description": "The event type, must be `output_audio_buffer.cleared`."
4764 }),
4765 "response_id": Schema.String.annotate({ "description": "The unique ID of the response that produced the audio." })
4766}).annotate({
4767 "description":
4768 "**WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. This happens either in VAD\nmode when the user has interrupted (`input_audio_buffer.speech_started`),\nor when the client has emitted the `output_audio_buffer.clear` event to manually\ncut off the current audio response.\n[Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"
4769})
4770export type RealtimeServerEventOutputAudioBufferStarted = {
4771 readonly "event_id": string
4772 readonly "type": "output_audio_buffer.started"
4773 readonly "response_id": string
4774}
4775export const RealtimeServerEventOutputAudioBufferStarted = Schema.Struct({
4776 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4777 "type": Schema.Literal("output_audio_buffer.started").annotate({
4778 "description": "The event type, must be `output_audio_buffer.started`."
4779 }),
4780 "response_id": Schema.String.annotate({ "description": "The unique ID of the response that produced the audio." })
4781}).annotate({
4782 "description":
4783 "**WebRTC/SIP Only:** Emitted when the server begins streaming audio to the client. This event is\nemitted after an audio content part has been added (`response.content_part.added`)\nto the response.\n[Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"
4784})
4785export type RealtimeServerEventOutputAudioBufferStopped = {
4786 readonly "event_id": string
4787 readonly "type": "output_audio_buffer.stopped"
4788 readonly "response_id": string
4789}
4790export const RealtimeServerEventOutputAudioBufferStopped = Schema.Struct({
4791 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4792 "type": Schema.Literal("output_audio_buffer.stopped").annotate({
4793 "description": "The event type, must be `output_audio_buffer.stopped`."
4794 }),
4795 "response_id": Schema.String.annotate({ "description": "The unique ID of the response that produced the audio." })
4796}).annotate({
4797 "description":
4798 "**WebRTC/SIP Only:** Emitted when the output audio buffer has been completely drained on the server,\nand no more audio is forthcoming. This event is emitted after the full response\ndata has been sent to the client (`response.done`).\n[Learn more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).\n"
4799})
4800export type RealtimeServerEventRateLimitsUpdated = {
4801 readonly "event_id": string
4802 readonly "type": "rate_limits.updated"
4803 readonly "rate_limits": ReadonlyArray<
4804 {
4805 readonly "name"?: "requests" | "tokens"
4806 readonly "limit"?: number
4807 readonly "remaining"?: number
4808 readonly "reset_seconds"?: number
4809 }
4810 >
4811}
4812export const RealtimeServerEventRateLimitsUpdated = Schema.Struct({
4813 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4814 "type": Schema.Literal("rate_limits.updated").annotate({
4815 "description": "The event type, must be `rate_limits.updated`."
4816 }),
4817 "rate_limits": Schema.Array(Schema.Struct({
4818 "name": Schema.optionalKey(
4819 Schema.Literals(["requests", "tokens"]).annotate({
4820 "description": "The name of the rate limit (`requests`, `tokens`).\n"
4821 })
4822 ),
4823 "limit": Schema.optionalKey(
4824 Schema.Number.annotate({ "description": "The maximum allowed value for the rate limit." }).check(Schema.isInt())
4825 ),
4826 "remaining": Schema.optionalKey(
4827 Schema.Number.annotate({ "description": "The remaining value before the limit is reached." }).check(
4828 Schema.isInt()
4829 )
4830 ),
4831 "reset_seconds": Schema.optionalKey(
4832 Schema.Number.annotate({ "description": "Seconds until the rate limit resets." }).check(Schema.isFinite())
4833 )
4834 })).annotate({ "description": "List of rate limit information." })
4835}).annotate({
4836 "description":
4837 "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n"
4838})
4839export type RealtimeServerEventResponseAudioDelta = {
4840 readonly "event_id": string
4841 readonly "type": "response.output_audio.delta"
4842 readonly "response_id": string
4843 readonly "item_id": string
4844 readonly "output_index": number
4845 readonly "content_index": number
4846 readonly "delta": string
4847}
4848export const RealtimeServerEventResponseAudioDelta = Schema.Struct({
4849 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4850 "type": Schema.Literal("response.output_audio.delta").annotate({
4851 "description": "The event type, must be `response.output_audio.delta`."
4852 }),
4853 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
4854 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
4855 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
4856 Schema.isInt()
4857 ),
4858 "content_index": Schema.Number.annotate({
4859 "description": "The index of the content part in the item's content array."
4860 }).check(Schema.isInt()),
4861 "delta": Schema.String.annotate({ "description": "Base64-encoded audio data delta." })
4862}).annotate({ "description": "Returned when the model-generated audio is updated." })
4863export type RealtimeServerEventResponseAudioDone = {
4864 readonly "event_id": string
4865 readonly "type": "response.output_audio.done"
4866 readonly "response_id": string
4867 readonly "item_id": string
4868 readonly "output_index": number
4869 readonly "content_index": number
4870}
4871export const RealtimeServerEventResponseAudioDone = Schema.Struct({
4872 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4873 "type": Schema.Literal("response.output_audio.done").annotate({
4874 "description": "The event type, must be `response.output_audio.done`."
4875 }),
4876 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
4877 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
4878 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
4879 Schema.isInt()
4880 ),
4881 "content_index": Schema.Number.annotate({
4882 "description": "The index of the content part in the item's content array."
4883 }).check(Schema.isInt())
4884}).annotate({
4885 "description":
4886 "Returned when the model-generated audio is done. Also emitted when a Response\nis interrupted, incomplete, or cancelled.\n"
4887})
4888export type RealtimeServerEventResponseAudioTranscriptDelta = {
4889 readonly "event_id": string
4890 readonly "type": "response.output_audio_transcript.delta"
4891 readonly "response_id": string
4892 readonly "item_id": string
4893 readonly "output_index": number
4894 readonly "content_index": number
4895 readonly "delta": string
4896}
4897export const RealtimeServerEventResponseAudioTranscriptDelta = Schema.Struct({
4898 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4899 "type": Schema.Literal("response.output_audio_transcript.delta").annotate({
4900 "description": "The event type, must be `response.output_audio_transcript.delta`."
4901 }),
4902 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
4903 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
4904 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
4905 Schema.isInt()
4906 ),
4907 "content_index": Schema.Number.annotate({
4908 "description": "The index of the content part in the item's content array."
4909 }).check(Schema.isInt()),
4910 "delta": Schema.String.annotate({ "description": "The transcript delta." })
4911}).annotate({ "description": "Returned when the model-generated transcription of audio output is updated.\n" })
4912export type RealtimeServerEventResponseAudioTranscriptDone = {
4913 readonly "event_id": string
4914 readonly "type": "response.output_audio_transcript.done"
4915 readonly "response_id": string
4916 readonly "item_id": string
4917 readonly "output_index": number
4918 readonly "content_index": number
4919 readonly "transcript": string
4920}
4921export const RealtimeServerEventResponseAudioTranscriptDone = Schema.Struct({
4922 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4923 "type": Schema.Literal("response.output_audio_transcript.done").annotate({
4924 "description": "The event type, must be `response.output_audio_transcript.done`."
4925 }),
4926 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
4927 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
4928 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
4929 Schema.isInt()
4930 ),
4931 "content_index": Schema.Number.annotate({
4932 "description": "The index of the content part in the item's content array."
4933 }).check(Schema.isInt()),
4934 "transcript": Schema.String.annotate({ "description": "The final transcript of the audio." })
4935}).annotate({
4936 "description":
4937 "Returned when the model-generated transcription of audio output is done\nstreaming. Also emitted when a Response is interrupted, incomplete, or\ncancelled.\n"
4938})
4939export type RealtimeServerEventResponseContentPartAdded = {
4940 readonly "event_id": string
4941 readonly "type": "response.content_part.added"
4942 readonly "response_id": string
4943 readonly "item_id": string
4944 readonly "output_index": number
4945 readonly "content_index": number
4946 readonly "part": {
4947 readonly "type"?: "audio" | "text"
4948 readonly "text"?: string
4949 readonly "audio"?: string
4950 readonly "transcript"?: string
4951 }
4952}
4953export const RealtimeServerEventResponseContentPartAdded = Schema.Struct({
4954 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4955 "type": Schema.Literal("response.content_part.added").annotate({
4956 "description": "The event type, must be `response.content_part.added`."
4957 }),
4958 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
4959 "item_id": Schema.String.annotate({ "description": "The ID of the item to which the content part was added." }),
4960 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
4961 Schema.isInt()
4962 ),
4963 "content_index": Schema.Number.annotate({
4964 "description": "The index of the content part in the item's content array."
4965 }).check(Schema.isInt()),
4966 "part": Schema.Struct({
4967 "type": Schema.optionalKey(
4968 Schema.Literals(["audio", "text"]).annotate({ "description": "The content type (\"text\", \"audio\")." })
4969 ),
4970 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content (if type is \"text\")." })),
4971 "audio": Schema.optionalKey(
4972 Schema.String.annotate({ "description": "Base64-encoded audio data (if type is \"audio\")." })
4973 ),
4974 "transcript": Schema.optionalKey(
4975 Schema.String.annotate({ "description": "The transcript of the audio (if type is \"audio\")." })
4976 )
4977 }).annotate({ "description": "The content part that was added." })
4978}).annotate({
4979 "description": "Returned when a new content part is added to an assistant message item during\nresponse generation.\n"
4980})
4981export type RealtimeServerEventResponseContentPartDone = {
4982 readonly "event_id": string
4983 readonly "type": "response.content_part.done"
4984 readonly "response_id": string
4985 readonly "item_id": string
4986 readonly "output_index": number
4987 readonly "content_index": number
4988 readonly "part": {
4989 readonly "type"?: "audio" | "text"
4990 readonly "text"?: string
4991 readonly "audio"?: string
4992 readonly "transcript"?: string
4993 }
4994}
4995export const RealtimeServerEventResponseContentPartDone = Schema.Struct({
4996 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
4997 "type": Schema.Literal("response.content_part.done").annotate({
4998 "description": "The event type, must be `response.content_part.done`."
4999 }),
5000 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5001 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
5002 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5003 Schema.isInt()
5004 ),
5005 "content_index": Schema.Number.annotate({
5006 "description": "The index of the content part in the item's content array."
5007 }).check(Schema.isInt()),
5008 "part": Schema.Struct({
5009 "type": Schema.optionalKey(
5010 Schema.Literals(["audio", "text"]).annotate({ "description": "The content type (\"text\", \"audio\")." })
5011 ),
5012 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content (if type is \"text\")." })),
5013 "audio": Schema.optionalKey(
5014 Schema.String.annotate({ "description": "Base64-encoded audio data (if type is \"audio\")." })
5015 ),
5016 "transcript": Schema.optionalKey(
5017 Schema.String.annotate({ "description": "The transcript of the audio (if type is \"audio\")." })
5018 )
5019 }).annotate({ "description": "The content part that is done." })
5020}).annotate({
5021 "description":
5022 "Returned when a content part is done streaming in an assistant message item.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n"
5023})
5024export type RealtimeServerEventResponseFunctionCallArgumentsDelta = {
5025 readonly "event_id": string
5026 readonly "type": "response.function_call_arguments.delta"
5027 readonly "response_id": string
5028 readonly "item_id": string
5029 readonly "output_index": number
5030 readonly "call_id": string
5031 readonly "delta": string
5032}
5033export const RealtimeServerEventResponseFunctionCallArgumentsDelta = Schema.Struct({
5034 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5035 "type": Schema.Literal("response.function_call_arguments.delta").annotate({
5036 "description": "The event type, must be `response.function_call_arguments.delta`.\n"
5037 }),
5038 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5039 "item_id": Schema.String.annotate({ "description": "The ID of the function call item." }),
5040 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5041 Schema.isInt()
5042 ),
5043 "call_id": Schema.String.annotate({ "description": "The ID of the function call." }),
5044 "delta": Schema.String.annotate({ "description": "The arguments delta as a JSON string." })
5045}).annotate({ "description": "Returned when the model-generated function call arguments are updated.\n" })
5046export type RealtimeServerEventResponseFunctionCallArgumentsDone = {
5047 readonly "event_id": string
5048 readonly "type": "response.function_call_arguments.done"
5049 readonly "response_id": string
5050 readonly "item_id": string
5051 readonly "output_index": number
5052 readonly "call_id": string
5053 readonly "name": string
5054 readonly "arguments": string
5055}
5056export const RealtimeServerEventResponseFunctionCallArgumentsDone = Schema.Struct({
5057 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5058 "type": Schema.Literal("response.function_call_arguments.done").annotate({
5059 "description": "The event type, must be `response.function_call_arguments.done`.\n"
5060 }),
5061 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5062 "item_id": Schema.String.annotate({ "description": "The ID of the function call item." }),
5063 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5064 Schema.isInt()
5065 ),
5066 "call_id": Schema.String.annotate({ "description": "The ID of the function call." }),
5067 "name": Schema.String.annotate({ "description": "The name of the function that was called." }),
5068 "arguments": Schema.String.annotate({ "description": "The final arguments as a JSON string." })
5069}).annotate({
5070 "description":
5071 "Returned when the model-generated function call arguments are done streaming.\nAlso emitted when a Response is interrupted, incomplete, or cancelled.\n"
5072})
5073export type RealtimeServerEventResponseMCPCallArgumentsDelta = {
5074 readonly "event_id": string
5075 readonly "type": "response.mcp_call_arguments.delta"
5076 readonly "response_id": string
5077 readonly "item_id": string
5078 readonly "output_index": number
5079 readonly "delta": string
5080 readonly "obfuscation"?: string | null
5081}
5082export const RealtimeServerEventResponseMCPCallArgumentsDelta = Schema.Struct({
5083 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5084 "type": Schema.Literal("response.mcp_call_arguments.delta").annotate({
5085 "description": "The event type, must be `response.mcp_call_arguments.delta`."
5086 }),
5087 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5088 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item." }),
5089 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5090 Schema.isInt()
5091 ),
5092 "delta": Schema.String.annotate({ "description": "The JSON-encoded arguments delta." }),
5093 "obfuscation": Schema.optionalKey(
5094 Schema.Union([
5095 Schema.String.annotate({ "description": "If present, indicates the delta text was obfuscated." }),
5096 Schema.Null
5097 ])
5098 )
5099}).annotate({ "description": "Returned when MCP tool call arguments are updated during response generation." })
5100export type RealtimeServerEventResponseMCPCallArgumentsDone = {
5101 readonly "event_id": string
5102 readonly "type": "response.mcp_call_arguments.done"
5103 readonly "response_id": string
5104 readonly "item_id": string
5105 readonly "output_index": number
5106 readonly "arguments": string
5107}
5108export const RealtimeServerEventResponseMCPCallArgumentsDone = Schema.Struct({
5109 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5110 "type": Schema.Literal("response.mcp_call_arguments.done").annotate({
5111 "description": "The event type, must be `response.mcp_call_arguments.done`."
5112 }),
5113 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5114 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item." }),
5115 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5116 Schema.isInt()
5117 ),
5118 "arguments": Schema.String.annotate({ "description": "The final JSON-encoded arguments string." })
5119}).annotate({ "description": "Returned when MCP tool call arguments are finalized during response generation." })
5120export type RealtimeServerEventResponseMCPCallCompleted = {
5121 readonly "event_id": string
5122 readonly "type": "response.mcp_call.completed"
5123 readonly "output_index": number
5124 readonly "item_id": string
5125}
5126export const RealtimeServerEventResponseMCPCallCompleted = Schema.Struct({
5127 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5128 "type": Schema.Literal("response.mcp_call.completed").annotate({
5129 "description": "The event type, must be `response.mcp_call.completed`."
5130 }),
5131 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5132 Schema.isInt()
5133 ),
5134 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item." })
5135}).annotate({ "description": "Returned when an MCP tool call has completed successfully." })
5136export type RealtimeServerEventResponseMCPCallFailed = {
5137 readonly "event_id": string
5138 readonly "type": "response.mcp_call.failed"
5139 readonly "output_index": number
5140 readonly "item_id": string
5141}
5142export const RealtimeServerEventResponseMCPCallFailed = Schema.Struct({
5143 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5144 "type": Schema.Literal("response.mcp_call.failed").annotate({
5145 "description": "The event type, must be `response.mcp_call.failed`."
5146 }),
5147 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5148 Schema.isInt()
5149 ),
5150 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item." })
5151}).annotate({ "description": "Returned when an MCP tool call has failed." })
5152export type RealtimeServerEventResponseMCPCallInProgress = {
5153 readonly "event_id": string
5154 readonly "type": "response.mcp_call.in_progress"
5155 readonly "output_index": number
5156 readonly "item_id": string
5157}
5158export const RealtimeServerEventResponseMCPCallInProgress = Schema.Struct({
5159 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5160 "type": Schema.Literal("response.mcp_call.in_progress").annotate({
5161 "description": "The event type, must be `response.mcp_call.in_progress`."
5162 }),
5163 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5164 Schema.isInt()
5165 ),
5166 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item." })
5167}).annotate({ "description": "Returned when an MCP tool call has started and is in progress." })
5168export type RealtimeServerEventResponseTextDelta = {
5169 readonly "event_id": string
5170 readonly "type": "response.output_text.delta"
5171 readonly "response_id": string
5172 readonly "item_id": string
5173 readonly "output_index": number
5174 readonly "content_index": number
5175 readonly "delta": string
5176}
5177export const RealtimeServerEventResponseTextDelta = Schema.Struct({
5178 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5179 "type": Schema.Literal("response.output_text.delta").annotate({
5180 "description": "The event type, must be `response.output_text.delta`."
5181 }),
5182 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5183 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
5184 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5185 Schema.isInt()
5186 ),
5187 "content_index": Schema.Number.annotate({
5188 "description": "The index of the content part in the item's content array."
5189 }).check(Schema.isInt()),
5190 "delta": Schema.String.annotate({ "description": "The text delta." })
5191}).annotate({ "description": "Returned when the text value of an \"output_text\" content part is updated." })
5192export type RealtimeServerEventResponseTextDone = {
5193 readonly "event_id": string
5194 readonly "type": "response.output_text.done"
5195 readonly "response_id": string
5196 readonly "item_id": string
5197 readonly "output_index": number
5198 readonly "content_index": number
5199 readonly "text": string
5200}
5201export const RealtimeServerEventResponseTextDone = Schema.Struct({
5202 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5203 "type": Schema.Literal("response.output_text.done").annotate({
5204 "description": "The event type, must be `response.output_text.done`."
5205 }),
5206 "response_id": Schema.String.annotate({ "description": "The ID of the response." }),
5207 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
5208 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the response." }).check(
5209 Schema.isInt()
5210 ),
5211 "content_index": Schema.Number.annotate({
5212 "description": "The index of the content part in the item's content array."
5213 }).check(Schema.isInt()),
5214 "text": Schema.String.annotate({ "description": "The final text content." })
5215}).annotate({
5216 "description":
5217 "Returned when the text value of an \"output_text\" content part is done streaming. Also\nemitted when a Response is interrupted, incomplete, or cancelled.\n"
5218})
5219export type RealtimeTranscriptionSessionCreateResponse = {
5220 readonly "client_secret": { readonly "value": string; readonly "expires_at": number }
5221 readonly "modalities"?: ReadonlyArray<"text" | "audio">
5222 readonly "input_audio_format"?: string
5223 readonly "input_audio_transcription"?: {
5224 readonly "model"?:
5225 | string
5226 | "whisper-1"
5227 | "gpt-4o-mini-transcribe"
5228 | "gpt-4o-mini-transcribe-2025-12-15"
5229 | "gpt-4o-transcribe"
5230 | "gpt-4o-transcribe-diarize"
5231 | "gpt-realtime-whisper"
5232 readonly "language"?: string
5233 readonly "prompt"?: string
5234 }
5235 readonly "turn_detection"?: {
5236 readonly "type"?: string
5237 readonly "threshold"?: number
5238 readonly "prefix_padding_ms"?: number
5239 readonly "silence_duration_ms"?: number
5240 }
5241}
5242export const RealtimeTranscriptionSessionCreateResponse = Schema.Struct({
5243 "client_secret": Schema.Struct({
5244 "value": Schema.String.annotate({
5245 "description":
5246 "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n"
5247 }),
5248 "expires_at": Schema.Number.annotate({
5249 "description": "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n",
5250 "format": "unixtime"
5251 }).check(Schema.isInt())
5252 }).annotate({
5253 "description":
5254 "Ephemeral key returned by the API. Only present when the session is\ncreated on the server via REST API.\n"
5255 }),
5256 "modalities": Schema.optionalKey(
5257 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
5258 "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"
5259 })
5260 ),
5261 "input_audio_format": Schema.optionalKey(
5262 Schema.String.annotate({
5263 "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"
5264 })
5265 ),
5266 "input_audio_transcription": Schema.optionalKey(
5267 Schema.Struct({
5268 "model": Schema.optionalKey(
5269 Schema.Union([
5270 Schema.String,
5271 Schema.Literals([
5272 "whisper-1",
5273 "gpt-4o-mini-transcribe",
5274 "gpt-4o-mini-transcribe-2025-12-15",
5275 "gpt-4o-transcribe",
5276 "gpt-4o-transcribe-diarize",
5277 "gpt-realtime-whisper"
5278 ])
5279 ]).annotate({
5280 "description":
5281 "The model used for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n"
5282 })
5283 ),
5284 "language": Schema.optionalKey(Schema.String.annotate({ "description": "The language of the input audio.\n" })),
5285 "prompt": Schema.optionalKey(
5286 Schema.String.annotate({
5287 "description": "The prompt configured for input audio transcription, when present.\n"
5288 })
5289 )
5290 }).annotate({ "description": "Configuration of the transcription model.\n" })
5291 ),
5292 "turn_detection": Schema.optionalKey(
5293 Schema.Struct({
5294 "type": Schema.optionalKey(
5295 Schema.String.annotate({ "description": "Type of turn detection, only `server_vad` is currently supported.\n" })
5296 ),
5297 "threshold": Schema.optionalKey(
5298 Schema.Number.annotate({
5299 "description":
5300 "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"
5301 }).check(Schema.isFinite())
5302 ),
5303 "prefix_padding_ms": Schema.optionalKey(
5304 Schema.Number.annotate({
5305 "description":
5306 "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"
5307 }).check(Schema.isInt())
5308 ),
5309 "silence_duration_ms": Schema.optionalKey(
5310 Schema.Number.annotate({
5311 "description":
5312 "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"
5313 }).check(Schema.isInt())
5314 )
5315 }).annotate({
5316 "description":
5317 "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n"
5318 })
5319 )
5320}).annotate({
5321 "description":
5322 "A new Realtime transcription session configuration.\n\nWhen a session is created on the server via REST API, the session object\nalso contains an ephemeral key. Default TTL for keys is 10 minutes. This\nproperty is not present when a session is updated via the WebSocket API.\n"
5323})
5324export type RealtimeTranslationClientEventInputAudioBufferAppend = {
5325 readonly "event_id"?: string
5326 readonly "type": "session.input_audio_buffer.append"
5327 readonly "audio": string
5328}
5329export const RealtimeTranslationClientEventInputAudioBufferAppend = Schema.Struct({
5330 "event_id": Schema.optionalKey(
5331 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
5332 Schema.isMaxLength(512)
5333 )
5334 ),
5335 "type": Schema.Literal("session.input_audio_buffer.append").annotate({
5336 "description": "The event type, must be `session.input_audio_buffer.append`."
5337 }),
5338 "audio": Schema.String.annotate({ "description": "Base64-encoded 24 kHz PCM16 mono audio bytes." })
5339}).annotate({
5340 "description":
5341 "Send this event to append audio bytes to the translation session input audio buffer.\n\nWebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono\nlittle-endian raw audio bytes. Unsupported websocket audio formats return a\nvalidation error because lower-quality audio materially degrades translation\nquality.\n\nTranslation consumes 200 ms engine frames. For best realtime behavior, append\naudio in 200 ms chunks. If a chunk is shorter, the server buffers it until it\nhas enough audio for one frame. If a chunk is longer, the server splits it into\n200 ms frames and enqueues them back-to-back.\n\nKeep appending silence while the session is active. If a client stops sending\naudio and later resumes, model time treats the resumed audio as contiguous with\nthe previous audio rather than as a real-world pause.\n"
5342})
5343export type RealtimeTranslationClientEventSessionClose = {
5344 readonly "event_id"?: string
5345 readonly "type": "session.close"
5346}
5347export const RealtimeTranslationClientEventSessionClose = Schema.Struct({
5348 "event_id": Schema.optionalKey(
5349 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
5350 Schema.isMaxLength(512)
5351 )
5352 ),
5353 "type": Schema.Literal("session.close").annotate({ "description": "The event type, must be `session.close`." })
5354}).annotate({
5355 "description":
5356 "Gracefully close the realtime translation session. The server flushes pending\ninput audio and emits any remaining translated output before closing the\nsession.\n"
5357})
5358export type RealtimeTranslationServerEventSessionClosed = {
5359 readonly "event_id": string
5360 readonly "type": "session.closed"
5361}
5362export const RealtimeTranslationServerEventSessionClosed = Schema.Struct({
5363 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5364 "type": Schema.Literal("session.closed").annotate({ "description": "The event type, must be `session.closed`." })
5365}).annotate({ "description": "Returned when a realtime translation session is closed.\n" })
5366export type RealtimeTranslationServerEventSessionInputTranscriptDelta = {
5367 readonly "event_id": string
5368 readonly "type": "session.input_transcript.delta"
5369 readonly "delta": string
5370 readonly "elapsed_ms"?: number | null
5371}
5372export const RealtimeTranslationServerEventSessionInputTranscriptDelta = Schema.Struct({
5373 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5374 "type": Schema.Literal("session.input_transcript.delta").annotate({
5375 "description": "The event type, must be `session.input_transcript.delta`."
5376 }),
5377 "delta": Schema.String.annotate({ "description": "Append-only source-language transcript text." }),
5378 "elapsed_ms": Schema.optionalKey(Schema.Union([
5379 Schema.Number.annotate({
5380 "description":
5381 "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n"
5382 }).check(Schema.isInt()),
5383 Schema.Null
5384 ]))
5385}).annotate({
5386 "description":
5387 "Returned when optional source-language transcript text is available. This event\nis emitted only when `audio.input.transcription` is configured.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n"
5388})
5389export type RealtimeTranslationServerEventSessionOutputAudioDelta = {
5390 readonly "event_id": string
5391 readonly "type": "session.output_audio.delta"
5392 readonly "delta": string
5393 readonly "sample_rate"?: number
5394 readonly "channels"?: number
5395 readonly "format"?: "pcm16"
5396 readonly "elapsed_ms"?: number | null
5397}
5398export const RealtimeTranslationServerEventSessionOutputAudioDelta = Schema.Struct({
5399 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5400 "type": Schema.Literal("session.output_audio.delta").annotate({
5401 "description": "The event type, must be `session.output_audio.delta`."
5402 }),
5403 "delta": Schema.String.annotate({ "description": "Base64-encoded translated audio data." }),
5404 "sample_rate": Schema.optionalKey(
5405 Schema.Number.annotate({ "description": "Sample rate of the audio delta." }).check(Schema.isInt())
5406 ),
5407 "channels": Schema.optionalKey(
5408 Schema.Number.annotate({ "description": "Number of audio channels." }).check(Schema.isInt())
5409 ),
5410 "format": Schema.optionalKey(Schema.Literal("pcm16").annotate({ "description": "Audio encoding for `delta`." })),
5411 "elapsed_ms": Schema.optionalKey(
5412 Schema.Union([
5413 Schema.Number.annotate({
5414 "description":
5415 "Timing metadata for stream alignment, derived from the translation frame\nwhen available. Treat `elapsed_ms` as alignment metadata, not a unique\nevent identifier.\n"
5416 }).check(Schema.isInt()),
5417 Schema.Null
5418 ])
5419 )
5420}).annotate({
5421 "description":
5422 "Returned when translated output audio is available. Output audio deltas are\n200 ms frames of PCM16 audio.\n"
5423})
5424export type RealtimeTranslationServerEventSessionOutputTranscriptDelta = {
5425 readonly "event_id": string
5426 readonly "type": "session.output_transcript.delta"
5427 readonly "delta": string
5428 readonly "elapsed_ms"?: number | null
5429}
5430export const RealtimeTranslationServerEventSessionOutputTranscriptDelta = Schema.Struct({
5431 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
5432 "type": Schema.Literal("session.output_transcript.delta").annotate({
5433 "description": "The event type, must be `session.output_transcript.delta`."
5434 }),
5435 "delta": Schema.String.annotate({ "description": "Append-only transcript text for the translated output audio." }),
5436 "elapsed_ms": Schema.optionalKey(Schema.Union([
5437 Schema.Number.annotate({
5438 "description":
5439 "Timing metadata for stream alignment, derived from the translation frame\nwhen available. It advances in 200 ms increments, but multiple transcript\ndeltas may share the same `elapsed_ms`. Treat it as alignment metadata,\nnot a unique transcript-delta identifier.\n"
5440 }).check(Schema.isInt()),
5441 Schema.Null
5442 ]))
5443}).annotate({
5444 "description":
5445 "Returned when translated transcript text is available.\n\nTranscript deltas are append-only text fragments. Clients should not insert\nunconditional spaces between deltas.\n"
5446})
5447export type RealtimeTruncation = "auto" | "disabled" | {
5448 readonly "type": "retention_ratio"
5449 readonly "retention_ratio": number
5450 readonly "token_limits"?: { readonly "post_instructions"?: number }
5451}
5452export const RealtimeTruncation = Schema.Union([
5453 Schema.Literals(["auto", "disabled"]).annotate({
5454 "description":
5455 "The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit."
5456 }),
5457 Schema.Struct({
5458 "type": Schema.Literal("retention_ratio").annotate({ "description": "Use retention ratio truncation." }),
5459 "retention_ratio": Schema.Number.annotate({
5460 "description":
5461 "Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.\n"
5462 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
5463 "token_limits": Schema.optionalKey(
5464 Schema.Struct({
5465 "post_instructions": Schema.optionalKey(
5466 Schema.Number.annotate({
5467 "description":
5468 "Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens."
5469 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))
5470 )
5471 }).annotate({
5472 "description":
5473 "Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used."
5474 })
5475 )
5476 }).annotate({
5477 "title": "Retention ratio truncation",
5478 "description":
5479 "Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage."
5480 })
5481], { mode: "oneOf" }).annotate({
5482 "title": "Realtime Truncation Controls",
5483 "description":
5484 "When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.\n\nClients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.\n\nTruncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.\n\nTruncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.\n"
5485})
5486export type RealtimeTurnDetection = {
5487 readonly "type": "server_vad"
5488 readonly "threshold"?: number
5489 readonly "prefix_padding_ms"?: number
5490 readonly "silence_duration_ms"?: number
5491 readonly "create_response"?: boolean
5492 readonly "interrupt_response"?: boolean
5493 readonly "idle_timeout_ms"?: number | null
5494} | {
5495 readonly "type": "semantic_vad"
5496 readonly "eagerness"?: "low" | "medium" | "high" | "auto"
5497 readonly "create_response"?: boolean
5498 readonly "interrupt_response"?: boolean
5499} | null
5500export const RealtimeTurnDetection = Schema.Union([
5501 Schema.Union([
5502 Schema.Struct({
5503 "type": Schema.Literal("server_vad").annotate({
5504 "description": "Type of turn detection, `server_vad` to turn on simple Server VAD.\n"
5505 }),
5506 "threshold": Schema.optionalKey(
5507 Schema.Number.annotate({
5508 "description":
5509 "Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"
5510 }).check(Schema.isFinite())
5511 ),
5512 "prefix_padding_ms": Schema.optionalKey(
5513 Schema.Number.annotate({
5514 "description":
5515 "Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"
5516 }).check(Schema.isInt())
5517 ),
5518 "silence_duration_ms": Schema.optionalKey(
5519 Schema.Number.annotate({
5520 "description":
5521 "Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"
5522 }).check(Schema.isInt())
5523 ),
5524 "create_response": Schema.optionalKey(Schema.Boolean.annotate({
5525 "description":
5526 "Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.\n\nIf both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.\n"
5527 })),
5528 "interrupt_response": Schema.optionalKey(Schema.Boolean.annotate({
5529 "description":
5530 "Whether or not to automatically interrupt (cancel) any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.\n\nIf both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.\n"
5531 })),
5532 "idle_timeout_ms": Schema.optionalKey(Schema.Union([
5533 Schema.Number.annotate({
5534 "description":
5535 "Optional timeout after which a model response will be triggered automatically. This is\nuseful for situations in which a long pause from the user is unexpected, such as a phone\ncall. The model will effectively prompt the user to continue the conversation based\non the current context.\n\nThe timeout value will be applied after the last model response's audio has finished playing,\ni.e. it's set to the `response.done` time plus audio playback duration.\n\nAn `input_audio_buffer.timeout_triggered` event (plus events\nassociated with the Response) will be emitted when the timeout is reached.\nIdle timeout is currently only supported for `server_vad` mode.\n"
5536 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(5000)).check(Schema.isLessThanOrEqualTo(30000)),
5537 Schema.Null
5538 ]))
5539 }).annotate({
5540 "title": "Server VAD",
5541 "description":
5542 "Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence."
5543 }),
5544 Schema.Struct({
5545 "type": Schema.Literal("semantic_vad").annotate({
5546 "description": "Type of turn detection, `semantic_vad` to turn on Semantic VAD.\n"
5547 }),
5548 "eagerness": Schema.optionalKey(
5549 Schema.Literals(["low", "medium", "high", "auto"]).annotate({
5550 "description":
5551 "Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.\n"
5552 })
5553 ),
5554 "create_response": Schema.optionalKey(
5555 Schema.Boolean.annotate({
5556 "description": "Whether or not to automatically generate a response when a VAD stop event occurs.\n"
5557 })
5558 ),
5559 "interrupt_response": Schema.optionalKey(
5560 Schema.Boolean.annotate({
5561 "description":
5562 "Whether or not to automatically interrupt any ongoing response with output to the default\nconversation (i.e. `conversation` of `auto`) when a VAD start event occurs.\n"
5563 })
5564 )
5565 }).annotate({
5566 "title": "Semantic VAD",
5567 "description":
5568 "Server-side semantic turn detection which uses a model to determine when the user has finished speaking."
5569 })
5570 ], { mode: "oneOf" }).annotate({
5571 "title": "Realtime Turn Detection",
5572 "description":
5573 "Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.\n\nServer VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\n\nSemantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with \"uhhm\", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.\n\nFor `gpt-realtime-whisper` transcription sessions, turn detection must be\nset to `null`; VAD is not supported.\n"
5574 }),
5575 Schema.Null
5576])
5577export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null
5578export const ReasoningEffort = Schema.Union([
5579 Schema.Literals(["none", "minimal", "low", "medium", "high", "xhigh"]).annotate({
5580 "description":
5581 "Constrains effort on reasoning for\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\nCurrently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing\nreasoning effort can result in faster responses and fewer tokens used\non reasoning in a response.\n\n- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.\n- All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.\n- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.\n- `xhigh` is supported for all models after `gpt-5.1-codex-max`.\n"
5582 }),
5583 Schema.Null
5584])
5585export type ResponseAudioDeltaEvent = {
5586 readonly "type": "response.audio.delta"
5587 readonly "sequence_number": number
5588 readonly "delta": string
5589}
5590export const ResponseAudioDeltaEvent = Schema.Struct({
5591 "type": Schema.Literal("response.audio.delta").annotate({
5592 "description": "The type of the event. Always `response.audio.delta`.\n"
5593 }),
5594 "sequence_number": Schema.Number.annotate({
5595 "description": "A sequence number for this chunk of the stream response.\n"
5596 }).check(Schema.isInt()),
5597 "delta": Schema.String.annotate({ "description": "A chunk of Base64 encoded response audio bytes.\n" })
5598}).annotate({ "description": "Emitted when there is a partial audio response." })
5599export type ResponseAudioDoneEvent = {
5600 readonly "type": "response.audio.done"
5601 readonly "sequence_number": number
5602 readonly "response_id": unknown
5603}
5604export const ResponseAudioDoneEvent = Schema.Struct({
5605 "type": Schema.Literal("response.audio.done").annotate({
5606 "description": "The type of the event. Always `response.audio.done`.\n"
5607 }),
5608 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of the delta.\n" }).check(
5609 Schema.isInt()
5610 ),
5611 "response_id": Schema.Unknown
5612}).annotate({ "description": "Emitted when the audio response is complete." })
5613export type ResponseAudioTranscriptDeltaEvent = {
5614 readonly "type": "response.audio.transcript.delta"
5615 readonly "delta": string
5616 readonly "sequence_number": number
5617 readonly "response_id": unknown
5618}
5619export const ResponseAudioTranscriptDeltaEvent = Schema.Struct({
5620 "type": Schema.Literal("response.audio.transcript.delta").annotate({
5621 "description": "The type of the event. Always `response.audio.transcript.delta`.\n"
5622 }),
5623 "delta": Schema.String.annotate({ "description": "The partial transcript of the audio response.\n" }),
5624 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5625 Schema.isInt()
5626 ),
5627 "response_id": Schema.Unknown
5628}).annotate({ "description": "Emitted when there is a partial transcript of audio." })
5629export type ResponseAudioTranscriptDoneEvent = {
5630 readonly "type": "response.audio.transcript.done"
5631 readonly "sequence_number": number
5632 readonly "response_id": unknown
5633}
5634export const ResponseAudioTranscriptDoneEvent = Schema.Struct({
5635 "type": Schema.Literal("response.audio.transcript.done").annotate({
5636 "description": "The type of the event. Always `response.audio.transcript.done`.\n"
5637 }),
5638 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5639 Schema.isInt()
5640 ),
5641 "response_id": Schema.Unknown
5642}).annotate({ "description": "Emitted when the full audio transcript is completed." })
5643export type ResponseCodeInterpreterCallCodeDeltaEvent = {
5644 readonly "type": "response.code_interpreter_call_code.delta"
5645 readonly "output_index": number
5646 readonly "item_id": string
5647 readonly "delta": string
5648 readonly "sequence_number": number
5649}
5650export const ResponseCodeInterpreterCallCodeDeltaEvent = Schema.Struct({
5651 "type": Schema.Literal("response.code_interpreter_call_code.delta").annotate({
5652 "description": "The type of the event. Always `response.code_interpreter_call_code.delta`."
5653 }),
5654 "output_index": Schema.Number.annotate({
5655 "description": "The index of the output item in the response for which the code is being streamed."
5656 }).check(Schema.isInt()),
5657 "item_id": Schema.String.annotate({ "description": "The unique identifier of the code interpreter tool call item." }),
5658 "delta": Schema.String.annotate({
5659 "description": "The partial code snippet being streamed by the code interpreter."
5660 }),
5661 "sequence_number": Schema.Number.annotate({
5662 "description": "The sequence number of this event, used to order streaming events."
5663 }).check(Schema.isInt())
5664}).annotate({ "description": "Emitted when a partial code snippet is streamed by the code interpreter." })
5665export type ResponseCodeInterpreterCallCodeDoneEvent = {
5666 readonly "type": "response.code_interpreter_call_code.done"
5667 readonly "output_index": number
5668 readonly "item_id": string
5669 readonly "code": string
5670 readonly "sequence_number": number
5671}
5672export const ResponseCodeInterpreterCallCodeDoneEvent = Schema.Struct({
5673 "type": Schema.Literal("response.code_interpreter_call_code.done").annotate({
5674 "description": "The type of the event. Always `response.code_interpreter_call_code.done`."
5675 }),
5676 "output_index": Schema.Number.annotate({
5677 "description": "The index of the output item in the response for which the code is finalized."
5678 }).check(Schema.isInt()),
5679 "item_id": Schema.String.annotate({ "description": "The unique identifier of the code interpreter tool call item." }),
5680 "code": Schema.String.annotate({ "description": "The final code snippet output by the code interpreter." }),
5681 "sequence_number": Schema.Number.annotate({
5682 "description": "The sequence number of this event, used to order streaming events."
5683 }).check(Schema.isInt())
5684}).annotate({ "description": "Emitted when the code snippet is finalized by the code interpreter." })
5685export type ResponseCodeInterpreterCallCompletedEvent = {
5686 readonly "type": "response.code_interpreter_call.completed"
5687 readonly "output_index": number
5688 readonly "item_id": string
5689 readonly "sequence_number": number
5690}
5691export const ResponseCodeInterpreterCallCompletedEvent = Schema.Struct({
5692 "type": Schema.Literal("response.code_interpreter_call.completed").annotate({
5693 "description": "The type of the event. Always `response.code_interpreter_call.completed`."
5694 }),
5695 "output_index": Schema.Number.annotate({
5696 "description": "The index of the output item in the response for which the code interpreter call is completed."
5697 }).check(Schema.isInt()),
5698 "item_id": Schema.String.annotate({ "description": "The unique identifier of the code interpreter tool call item." }),
5699 "sequence_number": Schema.Number.annotate({
5700 "description": "The sequence number of this event, used to order streaming events."
5701 }).check(Schema.isInt())
5702}).annotate({ "description": "Emitted when the code interpreter call is completed." })
5703export type ResponseCodeInterpreterCallInProgressEvent = {
5704 readonly "type": "response.code_interpreter_call.in_progress"
5705 readonly "output_index": number
5706 readonly "item_id": string
5707 readonly "sequence_number": number
5708}
5709export const ResponseCodeInterpreterCallInProgressEvent = Schema.Struct({
5710 "type": Schema.Literal("response.code_interpreter_call.in_progress").annotate({
5711 "description": "The type of the event. Always `response.code_interpreter_call.in_progress`."
5712 }),
5713 "output_index": Schema.Number.annotate({
5714 "description": "The index of the output item in the response for which the code interpreter call is in progress."
5715 }).check(Schema.isInt()),
5716 "item_id": Schema.String.annotate({ "description": "The unique identifier of the code interpreter tool call item." }),
5717 "sequence_number": Schema.Number.annotate({
5718 "description": "The sequence number of this event, used to order streaming events."
5719 }).check(Schema.isInt())
5720}).annotate({ "description": "Emitted when a code interpreter call is in progress." })
5721export type ResponseCodeInterpreterCallInterpretingEvent = {
5722 readonly "type": "response.code_interpreter_call.interpreting"
5723 readonly "output_index": number
5724 readonly "item_id": string
5725 readonly "sequence_number": number
5726}
5727export const ResponseCodeInterpreterCallInterpretingEvent = Schema.Struct({
5728 "type": Schema.Literal("response.code_interpreter_call.interpreting").annotate({
5729 "description": "The type of the event. Always `response.code_interpreter_call.interpreting`."
5730 }),
5731 "output_index": Schema.Number.annotate({
5732 "description": "The index of the output item in the response for which the code interpreter is interpreting code."
5733 }).check(Schema.isInt()),
5734 "item_id": Schema.String.annotate({ "description": "The unique identifier of the code interpreter tool call item." }),
5735 "sequence_number": Schema.Number.annotate({
5736 "description": "The sequence number of this event, used to order streaming events."
5737 }).check(Schema.isInt())
5738}).annotate({ "description": "Emitted when the code interpreter is actively interpreting the code snippet." })
5739export type ResponseCustomToolCallInputDeltaEvent = {
5740 readonly "type": "response.custom_tool_call_input.delta"
5741 readonly "sequence_number": number
5742 readonly "output_index": number
5743 readonly "item_id": string
5744 readonly "delta": string
5745}
5746export const ResponseCustomToolCallInputDeltaEvent = Schema.Struct({
5747 "type": Schema.Literal("response.custom_tool_call_input.delta").annotate({
5748 "description": "The event type identifier."
5749 }),
5750 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5751 Schema.isInt()
5752 ),
5753 "output_index": Schema.Number.annotate({ "description": "The index of the output this delta applies to." }).check(
5754 Schema.isInt()
5755 ),
5756 "item_id": Schema.String.annotate({
5757 "description": "Unique identifier for the API item associated with this event."
5758 }),
5759 "delta": Schema.String.annotate({ "description": "The incremental input data (delta) for the custom tool call." })
5760}).annotate({
5761 "title": "ResponseCustomToolCallInputDelta",
5762 "description": "Event representing a delta (partial update) to the input of a custom tool call.\n"
5763})
5764export type ResponseCustomToolCallInputDoneEvent = {
5765 readonly "type": "response.custom_tool_call_input.done"
5766 readonly "sequence_number": number
5767 readonly "output_index": number
5768 readonly "item_id": string
5769 readonly "input": string
5770}
5771export const ResponseCustomToolCallInputDoneEvent = Schema.Struct({
5772 "type": Schema.Literal("response.custom_tool_call_input.done").annotate({
5773 "description": "The event type identifier."
5774 }),
5775 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5776 Schema.isInt()
5777 ),
5778 "output_index": Schema.Number.annotate({ "description": "The index of the output this event applies to." }).check(
5779 Schema.isInt()
5780 ),
5781 "item_id": Schema.String.annotate({
5782 "description": "Unique identifier for the API item associated with this event."
5783 }),
5784 "input": Schema.String.annotate({ "description": "The complete input data for the custom tool call." })
5785}).annotate({
5786 "title": "ResponseCustomToolCallInputDone",
5787 "description": "Event indicating that input for a custom tool call is complete.\n"
5788})
5789export type ResponseErrorCode =
5790 | "server_error"
5791 | "rate_limit_exceeded"
5792 | "invalid_prompt"
5793 | "vector_store_timeout"
5794 | "invalid_image"
5795 | "invalid_image_format"
5796 | "invalid_base64_image"
5797 | "invalid_image_url"
5798 | "image_too_large"
5799 | "image_too_small"
5800 | "image_parse_error"
5801 | "image_content_policy_violation"
5802 | "invalid_image_mode"
5803 | "image_file_too_large"
5804 | "unsupported_image_media_type"
5805 | "empty_image_file"
5806 | "failed_to_download_image"
5807 | "image_file_not_found"
5808export const ResponseErrorCode = Schema.Literals([
5809 "server_error",
5810 "rate_limit_exceeded",
5811 "invalid_prompt",
5812 "vector_store_timeout",
5813 "invalid_image",
5814 "invalid_image_format",
5815 "invalid_base64_image",
5816 "invalid_image_url",
5817 "image_too_large",
5818 "image_too_small",
5819 "image_parse_error",
5820 "image_content_policy_violation",
5821 "invalid_image_mode",
5822 "image_file_too_large",
5823 "unsupported_image_media_type",
5824 "empty_image_file",
5825 "failed_to_download_image",
5826 "image_file_not_found"
5827]).annotate({ "description": "The error code for the response.\n" })
5828export type ResponseErrorEvent = {
5829 readonly "type": "error"
5830 readonly "code": string | null
5831 readonly "message": string
5832 readonly "param": string | null
5833 readonly "sequence_number": number
5834}
5835export const ResponseErrorEvent = Schema.Struct({
5836 "type": Schema.Literal("error").annotate({ "description": "The type of the event. Always `error`.\n" }),
5837 "code": Schema.Union([Schema.String.annotate({ "description": "The error code.\n" }), Schema.Null]),
5838 "message": Schema.String.annotate({ "description": "The error message.\n" }),
5839 "param": Schema.Union([Schema.String.annotate({ "description": "The error parameter.\n" }), Schema.Null]),
5840 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5841 Schema.isInt()
5842 )
5843}).annotate({ "description": "Emitted when an error occurs." })
5844export type ResponseFileSearchCallCompletedEvent = {
5845 readonly "type": "response.file_search_call.completed"
5846 readonly "output_index": number
5847 readonly "item_id": string
5848 readonly "sequence_number": number
5849}
5850export const ResponseFileSearchCallCompletedEvent = Schema.Struct({
5851 "type": Schema.Literal("response.file_search_call.completed").annotate({
5852 "description": "The type of the event. Always `response.file_search_call.completed`.\n"
5853 }),
5854 "output_index": Schema.Number.annotate({
5855 "description": "The index of the output item that the file search call is initiated.\n"
5856 }).check(Schema.isInt()),
5857 "item_id": Schema.String.annotate({
5858 "description": "The ID of the output item that the file search call is initiated.\n"
5859 }),
5860 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5861 Schema.isInt()
5862 )
5863}).annotate({ "description": "Emitted when a file search call is completed (results found)." })
5864export type ResponseFileSearchCallInProgressEvent = {
5865 readonly "type": "response.file_search_call.in_progress"
5866 readonly "output_index": number
5867 readonly "item_id": string
5868 readonly "sequence_number": number
5869}
5870export const ResponseFileSearchCallInProgressEvent = Schema.Struct({
5871 "type": Schema.Literal("response.file_search_call.in_progress").annotate({
5872 "description": "The type of the event. Always `response.file_search_call.in_progress`.\n"
5873 }),
5874 "output_index": Schema.Number.annotate({
5875 "description": "The index of the output item that the file search call is initiated.\n"
5876 }).check(Schema.isInt()),
5877 "item_id": Schema.String.annotate({
5878 "description": "The ID of the output item that the file search call is initiated.\n"
5879 }),
5880 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5881 Schema.isInt()
5882 )
5883}).annotate({ "description": "Emitted when a file search call is initiated." })
5884export type ResponseFileSearchCallSearchingEvent = {
5885 readonly "type": "response.file_search_call.searching"
5886 readonly "output_index": number
5887 readonly "item_id": string
5888 readonly "sequence_number": number
5889}
5890export const ResponseFileSearchCallSearchingEvent = Schema.Struct({
5891 "type": Schema.Literal("response.file_search_call.searching").annotate({
5892 "description": "The type of the event. Always `response.file_search_call.searching`.\n"
5893 }),
5894 "output_index": Schema.Number.annotate({
5895 "description": "The index of the output item that the file search call is searching.\n"
5896 }).check(Schema.isInt()),
5897 "item_id": Schema.String.annotate({
5898 "description": "The ID of the output item that the file search call is initiated.\n"
5899 }),
5900 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5901 Schema.isInt()
5902 )
5903}).annotate({ "description": "Emitted when a file search is currently searching." })
5904export type ResponseFormatJsonObject = { readonly "type": "json_object" }
5905export const ResponseFormatJsonObject = Schema.Struct({
5906 "type": Schema.Literal("json_object").annotate({
5907 "description": "The type of response format being defined. Always `json_object`."
5908 })
5909}).annotate({
5910 "title": "JSON object",
5911 "description":
5912 "JSON object response format. An older method of generating JSON responses.\nUsing `json_schema` is recommended for models that support it. Note that the\nmodel will not generate JSON without a system or user message instructing it\nto do so.\n"
5913})
5914export type ResponseFormatJsonSchemaSchema = {}
5915export const ResponseFormatJsonSchemaSchema = Schema.Struct({}).annotate({
5916 "title": "JSON schema",
5917 "description":
5918 "The schema for the response format, described as a JSON Schema object.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"
5919})
5920export type ResponseFormatText = { readonly "type": "text" }
5921export const ResponseFormatText = Schema.Struct({
5922 "type": Schema.Literal("text").annotate({
5923 "description": "The type of response format being defined. Always `text`."
5924 })
5925}).annotate({ "title": "Text", "description": "Default response format. Used to generate text responses.\n" })
5926export type ResponseFunctionCallArgumentsDeltaEvent = {
5927 readonly "type": "response.function_call_arguments.delta"
5928 readonly "item_id": string
5929 readonly "output_index": number
5930 readonly "sequence_number": number
5931 readonly "delta": string
5932}
5933export const ResponseFunctionCallArgumentsDeltaEvent = Schema.Struct({
5934 "type": Schema.Literal("response.function_call_arguments.delta").annotate({
5935 "description": "The type of the event. Always `response.function_call_arguments.delta`.\n"
5936 }),
5937 "item_id": Schema.String.annotate({
5938 "description": "The ID of the output item that the function-call arguments delta is added to.\n"
5939 }),
5940 "output_index": Schema.Number.annotate({
5941 "description": "The index of the output item that the function-call arguments delta is added to.\n"
5942 }).check(Schema.isInt()),
5943 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5944 Schema.isInt()
5945 ),
5946 "delta": Schema.String.annotate({ "description": "The function-call arguments delta that is added.\n" })
5947}).annotate({ "description": "Emitted when there is a partial function-call arguments delta." })
5948export type ResponseFunctionCallArgumentsDoneEvent = {
5949 readonly "type": "response.function_call_arguments.done"
5950 readonly "item_id": string
5951 readonly "name"?: string
5952 readonly "output_index": number
5953 readonly "sequence_number": number
5954 readonly "arguments": string
5955}
5956export const ResponseFunctionCallArgumentsDoneEvent = Schema.Struct({
5957 "type": Schema.Literal("response.function_call_arguments.done"),
5958 "item_id": Schema.String.annotate({ "description": "The ID of the item." }),
5959 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function that was called." })),
5960 "output_index": Schema.Number.annotate({ "description": "The index of the output item." }).check(Schema.isInt()),
5961 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5962 Schema.isInt()
5963 ),
5964 "arguments": Schema.String.annotate({ "description": "The function-call arguments." })
5965}).annotate({ "description": "Emitted when function-call arguments are finalized." })
5966export type ResponseImageGenCallCompletedEvent = {
5967 readonly "type": "response.image_generation_call.completed"
5968 readonly "output_index": number
5969 readonly "sequence_number": number
5970 readonly "item_id": string
5971}
5972export const ResponseImageGenCallCompletedEvent = Schema.Struct({
5973 "type": Schema.Literal("response.image_generation_call.completed").annotate({
5974 "description": "The type of the event. Always 'response.image_generation_call.completed'."
5975 }),
5976 "output_index": Schema.Number.annotate({
5977 "description": "The index of the output item in the response's output array."
5978 }).check(Schema.isInt()),
5979 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
5980 Schema.isInt()
5981 ),
5982 "item_id": Schema.String.annotate({
5983 "description": "The unique identifier of the image generation item being processed."
5984 })
5985}).annotate({
5986 "title": "ResponseImageGenCallCompletedEvent",
5987 "description": "Emitted when an image generation tool call has completed and the final image is available.\n"
5988})
5989export type ResponseImageGenCallGeneratingEvent = {
5990 readonly "type": "response.image_generation_call.generating"
5991 readonly "output_index": number
5992 readonly "item_id": string
5993 readonly "sequence_number": number
5994}
5995export const ResponseImageGenCallGeneratingEvent = Schema.Struct({
5996 "type": Schema.Literal("response.image_generation_call.generating").annotate({
5997 "description": "The type of the event. Always 'response.image_generation_call.generating'."
5998 }),
5999 "output_index": Schema.Number.annotate({
6000 "description": "The index of the output item in the response's output array."
6001 }).check(Schema.isInt()),
6002 "item_id": Schema.String.annotate({
6003 "description": "The unique identifier of the image generation item being processed."
6004 }),
6005 "sequence_number": Schema.Number.annotate({
6006 "description": "The sequence number of the image generation item being processed."
6007 }).check(Schema.isInt())
6008}).annotate({
6009 "title": "ResponseImageGenCallGeneratingEvent",
6010 "description": "Emitted when an image generation tool call is actively generating an image (intermediate state).\n"
6011})
6012export type ResponseImageGenCallInProgressEvent = {
6013 readonly "type": "response.image_generation_call.in_progress"
6014 readonly "output_index": number
6015 readonly "item_id": string
6016 readonly "sequence_number": number
6017}
6018export const ResponseImageGenCallInProgressEvent = Schema.Struct({
6019 "type": Schema.Literal("response.image_generation_call.in_progress").annotate({
6020 "description": "The type of the event. Always 'response.image_generation_call.in_progress'."
6021 }),
6022 "output_index": Schema.Number.annotate({
6023 "description": "The index of the output item in the response's output array."
6024 }).check(Schema.isInt()),
6025 "item_id": Schema.String.annotate({
6026 "description": "The unique identifier of the image generation item being processed."
6027 }),
6028 "sequence_number": Schema.Number.annotate({
6029 "description": "The sequence number of the image generation item being processed."
6030 }).check(Schema.isInt())
6031}).annotate({
6032 "title": "ResponseImageGenCallInProgressEvent",
6033 "description": "Emitted when an image generation tool call is in progress.\n"
6034})
6035export type ResponseImageGenCallPartialImageEvent = {
6036 readonly "type": "response.image_generation_call.partial_image"
6037 readonly "output_index": number
6038 readonly "item_id": string
6039 readonly "sequence_number": number
6040 readonly "partial_image_index": number
6041 readonly "partial_image_b64": string
6042}
6043export const ResponseImageGenCallPartialImageEvent = Schema.Struct({
6044 "type": Schema.Literal("response.image_generation_call.partial_image").annotate({
6045 "description": "The type of the event. Always 'response.image_generation_call.partial_image'."
6046 }),
6047 "output_index": Schema.Number.annotate({
6048 "description": "The index of the output item in the response's output array."
6049 }).check(Schema.isInt()),
6050 "item_id": Schema.String.annotate({
6051 "description": "The unique identifier of the image generation item being processed."
6052 }),
6053 "sequence_number": Schema.Number.annotate({
6054 "description": "The sequence number of the image generation item being processed."
6055 }).check(Schema.isInt()),
6056 "partial_image_index": Schema.Number.annotate({
6057 "description": "0-based index for the partial image (backend is 1-based, but this is 0-based for the user)."
6058 }).check(Schema.isInt()),
6059 "partial_image_b64": Schema.String.annotate({
6060 "description": "Base64-encoded partial image data, suitable for rendering as an image."
6061 })
6062}).annotate({
6063 "title": "ResponseImageGenCallPartialImageEvent",
6064 "description": "Emitted when a partial image is available during image generation streaming.\n"
6065})
6066export type ResponseLogProb = {
6067 readonly "token": string
6068 readonly "logprob": number
6069 readonly "top_logprobs"?: ReadonlyArray<{ readonly "token"?: string; readonly "logprob"?: number }>
6070}
6071export const ResponseLogProb = Schema.Struct({
6072 "token": Schema.String.annotate({ "description": "A possible text token." }),
6073 "logprob": Schema.Number.annotate({ "description": "The log probability of this token.\n" }).check(Schema.isFinite()),
6074 "top_logprobs": Schema.optionalKey(
6075 Schema.Array(
6076 Schema.Struct({
6077 "token": Schema.optionalKey(Schema.String.annotate({ "description": "A possible text token." })),
6078 "logprob": Schema.optionalKey(
6079 Schema.Number.annotate({ "description": "The log probability of this token." }).check(Schema.isFinite())
6080 )
6081 })
6082 ).annotate({ "description": "The log probabilities of up to 20 of the most likely tokens.\n" })
6083 )
6084}).annotate({
6085 "description":
6086 "A logprob is the logarithmic probability that the model assigns to producing \na particular token at a given position in the sequence. Less-negative (higher) \nlogprob values indicate greater model confidence in that token choice.\n"
6087})
6088export type ResponseMCPCallArgumentsDeltaEvent = {
6089 readonly "type": "response.mcp_call_arguments.delta"
6090 readonly "output_index": number
6091 readonly "item_id": string
6092 readonly "delta": string
6093 readonly "sequence_number": number
6094}
6095export const ResponseMCPCallArgumentsDeltaEvent = Schema.Struct({
6096 "type": Schema.Literal("response.mcp_call_arguments.delta").annotate({
6097 "description": "The type of the event. Always 'response.mcp_call_arguments.delta'."
6098 }),
6099 "output_index": Schema.Number.annotate({
6100 "description": "The index of the output item in the response's output array."
6101 }).check(Schema.isInt()),
6102 "item_id": Schema.String.annotate({
6103 "description": "The unique identifier of the MCP tool call item being processed."
6104 }),
6105 "delta": Schema.String.annotate({
6106 "description": "A JSON string containing the partial update to the arguments for the MCP tool call.\n"
6107 }),
6108 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6109 Schema.isInt()
6110 )
6111}).annotate({
6112 "title": "ResponseMCPCallArgumentsDeltaEvent",
6113 "description": "Emitted when there is a delta (partial update) to the arguments of an MCP tool call.\n"
6114})
6115export type ResponseMCPCallArgumentsDoneEvent = {
6116 readonly "type": "response.mcp_call_arguments.done"
6117 readonly "output_index": number
6118 readonly "item_id": string
6119 readonly "arguments": string
6120 readonly "sequence_number": number
6121}
6122export const ResponseMCPCallArgumentsDoneEvent = Schema.Struct({
6123 "type": Schema.Literal("response.mcp_call_arguments.done").annotate({
6124 "description": "The type of the event. Always 'response.mcp_call_arguments.done'."
6125 }),
6126 "output_index": Schema.Number.annotate({
6127 "description": "The index of the output item in the response's output array."
6128 }).check(Schema.isInt()),
6129 "item_id": Schema.String.annotate({
6130 "description": "The unique identifier of the MCP tool call item being processed."
6131 }),
6132 "arguments": Schema.String.annotate({
6133 "description": "A JSON string containing the finalized arguments for the MCP tool call.\n"
6134 }),
6135 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6136 Schema.isInt()
6137 )
6138}).annotate({
6139 "title": "ResponseMCPCallArgumentsDoneEvent",
6140 "description": "Emitted when the arguments for an MCP tool call are finalized.\n"
6141})
6142export type ResponseMCPCallCompletedEvent = {
6143 readonly "type": "response.mcp_call.completed"
6144 readonly "item_id": string
6145 readonly "output_index": number
6146 readonly "sequence_number": number
6147}
6148export const ResponseMCPCallCompletedEvent = Schema.Struct({
6149 "type": Schema.Literal("response.mcp_call.completed").annotate({
6150 "description": "The type of the event. Always 'response.mcp_call.completed'."
6151 }),
6152 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item that completed." }),
6153 "output_index": Schema.Number.annotate({ "description": "The index of the output item that completed." }).check(
6154 Schema.isInt()
6155 ),
6156 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6157 Schema.isInt()
6158 )
6159}).annotate({
6160 "title": "ResponseMCPCallCompletedEvent",
6161 "description": "Emitted when an MCP tool call has completed successfully.\n"
6162})
6163export type ResponseMCPCallFailedEvent = {
6164 readonly "type": "response.mcp_call.failed"
6165 readonly "item_id": string
6166 readonly "output_index": number
6167 readonly "sequence_number": number
6168}
6169export const ResponseMCPCallFailedEvent = Schema.Struct({
6170 "type": Schema.Literal("response.mcp_call.failed").annotate({
6171 "description": "The type of the event. Always 'response.mcp_call.failed'."
6172 }),
6173 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item that failed." }),
6174 "output_index": Schema.Number.annotate({ "description": "The index of the output item that failed." }).check(
6175 Schema.isInt()
6176 ),
6177 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6178 Schema.isInt()
6179 )
6180}).annotate({ "title": "ResponseMCPCallFailedEvent", "description": "Emitted when an MCP tool call has failed.\n" })
6181export type ResponseMCPCallInProgressEvent = {
6182 readonly "type": "response.mcp_call.in_progress"
6183 readonly "sequence_number": number
6184 readonly "output_index": number
6185 readonly "item_id": string
6186}
6187export const ResponseMCPCallInProgressEvent = Schema.Struct({
6188 "type": Schema.Literal("response.mcp_call.in_progress").annotate({
6189 "description": "The type of the event. Always 'response.mcp_call.in_progress'."
6190 }),
6191 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6192 Schema.isInt()
6193 ),
6194 "output_index": Schema.Number.annotate({
6195 "description": "The index of the output item in the response's output array."
6196 }).check(Schema.isInt()),
6197 "item_id": Schema.String.annotate({
6198 "description": "The unique identifier of the MCP tool call item being processed."
6199 })
6200}).annotate({
6201 "title": "ResponseMCPCallInProgressEvent",
6202 "description": "Emitted when an MCP tool call is in progress.\n"
6203})
6204export type ResponseMCPListToolsCompletedEvent = {
6205 readonly "type": "response.mcp_list_tools.completed"
6206 readonly "item_id": string
6207 readonly "output_index": number
6208 readonly "sequence_number": number
6209}
6210export const ResponseMCPListToolsCompletedEvent = Schema.Struct({
6211 "type": Schema.Literal("response.mcp_list_tools.completed").annotate({
6212 "description": "The type of the event. Always 'response.mcp_list_tools.completed'."
6213 }),
6214 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item that produced this output." }),
6215 "output_index": Schema.Number.annotate({ "description": "The index of the output item that was processed." }).check(
6216 Schema.isInt()
6217 ),
6218 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6219 Schema.isInt()
6220 )
6221}).annotate({
6222 "title": "ResponseMCPListToolsCompletedEvent",
6223 "description": "Emitted when the list of available MCP tools has been successfully retrieved.\n"
6224})
6225export type ResponseMCPListToolsFailedEvent = {
6226 readonly "type": "response.mcp_list_tools.failed"
6227 readonly "item_id": string
6228 readonly "output_index": number
6229 readonly "sequence_number": number
6230}
6231export const ResponseMCPListToolsFailedEvent = Schema.Struct({
6232 "type": Schema.Literal("response.mcp_list_tools.failed").annotate({
6233 "description": "The type of the event. Always 'response.mcp_list_tools.failed'."
6234 }),
6235 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item that failed." }),
6236 "output_index": Schema.Number.annotate({ "description": "The index of the output item that failed." }).check(
6237 Schema.isInt()
6238 ),
6239 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6240 Schema.isInt()
6241 )
6242}).annotate({
6243 "title": "ResponseMCPListToolsFailedEvent",
6244 "description": "Emitted when the attempt to list available MCP tools has failed.\n"
6245})
6246export type ResponseMCPListToolsInProgressEvent = {
6247 readonly "type": "response.mcp_list_tools.in_progress"
6248 readonly "item_id": string
6249 readonly "output_index": number
6250 readonly "sequence_number": number
6251}
6252export const ResponseMCPListToolsInProgressEvent = Schema.Struct({
6253 "type": Schema.Literal("response.mcp_list_tools.in_progress").annotate({
6254 "description": "The type of the event. Always 'response.mcp_list_tools.in_progress'."
6255 }),
6256 "item_id": Schema.String.annotate({ "description": "The ID of the MCP tool call item that is being processed." }),
6257 "output_index": Schema.Number.annotate({ "description": "The index of the output item that is being processed." })
6258 .check(Schema.isInt()),
6259 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6260 Schema.isInt()
6261 )
6262}).annotate({
6263 "title": "ResponseMCPListToolsInProgressEvent",
6264 "description": "Emitted when the system is in the process of retrieving the list of available MCP tools.\n"
6265})
6266export type ResponseModalities = ReadonlyArray<"text" | "audio"> | null
6267export const ResponseModalities = Schema.Union([
6268 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
6269 "description":
6270 "Output types that you would like the model to generate.\nMost models are capable of generating text, which is the default:\n\n`[\"text\"]`\n\nThe `gpt-4o-audio-preview` model can also be used to\n[generate audio](/docs/guides/audio). To request that this model generate\nboth text and audio responses, you can use:\n\n`[\"text\", \"audio\"]`\n"
6271 }),
6272 Schema.Null
6273])
6274export type ResponseOutputTextAnnotationAddedEvent = {
6275 readonly "type": "response.output_text.annotation.added"
6276 readonly "item_id": string
6277 readonly "output_index": number
6278 readonly "content_index": number
6279 readonly "annotation_index": number
6280 readonly "sequence_number": number
6281 readonly "annotation": {}
6282}
6283export const ResponseOutputTextAnnotationAddedEvent = Schema.Struct({
6284 "type": Schema.Literal("response.output_text.annotation.added").annotate({
6285 "description": "The type of the event. Always 'response.output_text.annotation.added'."
6286 }),
6287 "item_id": Schema.String.annotate({
6288 "description": "The unique identifier of the item to which the annotation is being added."
6289 }),
6290 "output_index": Schema.Number.annotate({
6291 "description": "The index of the output item in the response's output array."
6292 }).check(Schema.isInt()),
6293 "content_index": Schema.Number.annotate({ "description": "The index of the content part within the output item." })
6294 .check(Schema.isInt()),
6295 "annotation_index": Schema.Number.annotate({ "description": "The index of the annotation within the content part." })
6296 .check(Schema.isInt()),
6297 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
6298 Schema.isInt()
6299 ),
6300 "annotation": Schema.Struct({}).annotate({
6301 "description": "The annotation object being added. (See annotation schema for details.)"
6302 })
6303}).annotate({
6304 "title": "ResponseOutputTextAnnotationAddedEvent",
6305 "description": "Emitted when an annotation is added to output text content.\n"
6306})
6307export type ResponsePromptVariables = {} | null
6308export const ResponsePromptVariables = Schema.Union([
6309 Schema.Struct({}).annotate({
6310 "title": "Prompt Variables",
6311 "description":
6312 "Optional map of values to substitute in for variables in your\nprompt. The substitution values can either be strings, or other\nResponse input types like images or files.\n"
6313 }),
6314 Schema.Null
6315])
6316export type ResponseReasoningSummaryPartAddedEvent = {
6317 readonly "type": "response.reasoning_summary_part.added"
6318 readonly "item_id": string
6319 readonly "output_index": number
6320 readonly "summary_index": number
6321 readonly "sequence_number": number
6322 readonly "part": { readonly "type": "summary_text"; readonly "text": string }
6323}
6324export const ResponseReasoningSummaryPartAddedEvent = Schema.Struct({
6325 "type": Schema.Literal("response.reasoning_summary_part.added").annotate({
6326 "description": "The type of the event. Always `response.reasoning_summary_part.added`.\n"
6327 }),
6328 "item_id": Schema.String.annotate({ "description": "The ID of the item this summary part is associated with.\n" }),
6329 "output_index": Schema.Number.annotate({
6330 "description": "The index of the output item this summary part is associated with.\n"
6331 }).check(Schema.isInt()),
6332 "summary_index": Schema.Number.annotate({
6333 "description": "The index of the summary part within the reasoning summary.\n"
6334 }).check(Schema.isInt()),
6335 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6336 Schema.isInt()
6337 ),
6338 "part": Schema.Struct({
6339 "type": Schema.Literal("summary_text").annotate({
6340 "description": "The type of the summary part. Always `summary_text`."
6341 }),
6342 "text": Schema.String.annotate({ "description": "The text of the summary part." })
6343 }).annotate({ "description": "The summary part that was added.\n" })
6344}).annotate({ "description": "Emitted when a new reasoning summary part is added." })
6345export type ResponseReasoningSummaryPartDoneEvent = {
6346 readonly "type": "response.reasoning_summary_part.done"
6347 readonly "item_id": string
6348 readonly "output_index": number
6349 readonly "summary_index": number
6350 readonly "sequence_number": number
6351 readonly "part": { readonly "type": "summary_text"; readonly "text": string }
6352}
6353export const ResponseReasoningSummaryPartDoneEvent = Schema.Struct({
6354 "type": Schema.Literal("response.reasoning_summary_part.done").annotate({
6355 "description": "The type of the event. Always `response.reasoning_summary_part.done`.\n"
6356 }),
6357 "item_id": Schema.String.annotate({ "description": "The ID of the item this summary part is associated with.\n" }),
6358 "output_index": Schema.Number.annotate({
6359 "description": "The index of the output item this summary part is associated with.\n"
6360 }).check(Schema.isInt()),
6361 "summary_index": Schema.Number.annotate({
6362 "description": "The index of the summary part within the reasoning summary.\n"
6363 }).check(Schema.isInt()),
6364 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6365 Schema.isInt()
6366 ),
6367 "part": Schema.Struct({
6368 "type": Schema.Literal("summary_text").annotate({
6369 "description": "The type of the summary part. Always `summary_text`."
6370 }),
6371 "text": Schema.String.annotate({ "description": "The text of the summary part." })
6372 }).annotate({ "description": "The completed summary part.\n" })
6373}).annotate({ "description": "Emitted when a reasoning summary part is completed." })
6374export type ResponseReasoningSummaryTextDeltaEvent = {
6375 readonly "type": "response.reasoning_summary_text.delta"
6376 readonly "item_id": string
6377 readonly "output_index": number
6378 readonly "summary_index": number
6379 readonly "delta": string
6380 readonly "sequence_number": number
6381}
6382export const ResponseReasoningSummaryTextDeltaEvent = Schema.Struct({
6383 "type": Schema.Literal("response.reasoning_summary_text.delta").annotate({
6384 "description": "The type of the event. Always `response.reasoning_summary_text.delta`.\n"
6385 }),
6386 "item_id": Schema.String.annotate({
6387 "description": "The ID of the item this summary text delta is associated with.\n"
6388 }),
6389 "output_index": Schema.Number.annotate({
6390 "description": "The index of the output item this summary text delta is associated with.\n"
6391 }).check(Schema.isInt()),
6392 "summary_index": Schema.Number.annotate({
6393 "description": "The index of the summary part within the reasoning summary.\n"
6394 }).check(Schema.isInt()),
6395 "delta": Schema.String.annotate({ "description": "The text delta that was added to the summary.\n" }),
6396 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6397 Schema.isInt()
6398 )
6399}).annotate({ "description": "Emitted when a delta is added to a reasoning summary text." })
6400export type ResponseReasoningSummaryTextDoneEvent = {
6401 readonly "type": "response.reasoning_summary_text.done"
6402 readonly "item_id": string
6403 readonly "output_index": number
6404 readonly "summary_index": number
6405 readonly "text": string
6406 readonly "sequence_number": number
6407}
6408export const ResponseReasoningSummaryTextDoneEvent = Schema.Struct({
6409 "type": Schema.Literal("response.reasoning_summary_text.done").annotate({
6410 "description": "The type of the event. Always `response.reasoning_summary_text.done`.\n"
6411 }),
6412 "item_id": Schema.String.annotate({ "description": "The ID of the item this summary text is associated with.\n" }),
6413 "output_index": Schema.Number.annotate({
6414 "description": "The index of the output item this summary text is associated with.\n"
6415 }).check(Schema.isInt()),
6416 "summary_index": Schema.Number.annotate({
6417 "description": "The index of the summary part within the reasoning summary.\n"
6418 }).check(Schema.isInt()),
6419 "text": Schema.String.annotate({ "description": "The full text of the completed reasoning summary.\n" }),
6420 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6421 Schema.isInt()
6422 )
6423}).annotate({ "description": "Emitted when a reasoning summary text is completed." })
6424export type ResponseReasoningTextDeltaEvent = {
6425 readonly "type": "response.reasoning_text.delta"
6426 readonly "item_id": string
6427 readonly "output_index": number
6428 readonly "content_index": number
6429 readonly "delta": string
6430 readonly "sequence_number": number
6431}
6432export const ResponseReasoningTextDeltaEvent = Schema.Struct({
6433 "type": Schema.Literal("response.reasoning_text.delta").annotate({
6434 "description": "The type of the event. Always `response.reasoning_text.delta`.\n"
6435 }),
6436 "item_id": Schema.String.annotate({
6437 "description": "The ID of the item this reasoning text delta is associated with.\n"
6438 }),
6439 "output_index": Schema.Number.annotate({
6440 "description": "The index of the output item this reasoning text delta is associated with.\n"
6441 }).check(Schema.isInt()),
6442 "content_index": Schema.Number.annotate({
6443 "description": "The index of the reasoning content part this delta is associated with.\n"
6444 }).check(Schema.isInt()),
6445 "delta": Schema.String.annotate({ "description": "The text delta that was added to the reasoning content.\n" }),
6446 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6447 Schema.isInt()
6448 )
6449}).annotate({ "description": "Emitted when a delta is added to a reasoning text." })
6450export type ResponseReasoningTextDoneEvent = {
6451 readonly "type": "response.reasoning_text.done"
6452 readonly "item_id": string
6453 readonly "output_index": number
6454 readonly "content_index": number
6455 readonly "text": string
6456 readonly "sequence_number": number
6457}
6458export const ResponseReasoningTextDoneEvent = Schema.Struct({
6459 "type": Schema.Literal("response.reasoning_text.done").annotate({
6460 "description": "The type of the event. Always `response.reasoning_text.done`.\n"
6461 }),
6462 "item_id": Schema.String.annotate({ "description": "The ID of the item this reasoning text is associated with.\n" }),
6463 "output_index": Schema.Number.annotate({
6464 "description": "The index of the output item this reasoning text is associated with.\n"
6465 }).check(Schema.isInt()),
6466 "content_index": Schema.Number.annotate({ "description": "The index of the reasoning content part.\n" }).check(
6467 Schema.isInt()
6468 ),
6469 "text": Schema.String.annotate({ "description": "The full text of the completed reasoning content.\n" }),
6470 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6471 Schema.isInt()
6472 )
6473}).annotate({ "description": "Emitted when a reasoning text is completed." })
6474export type ResponseRefusalDeltaEvent = {
6475 readonly "type": "response.refusal.delta"
6476 readonly "item_id": string
6477 readonly "output_index": number
6478 readonly "content_index": number
6479 readonly "delta": string
6480 readonly "sequence_number": number
6481}
6482export const ResponseRefusalDeltaEvent = Schema.Struct({
6483 "type": Schema.Literal("response.refusal.delta").annotate({
6484 "description": "The type of the event. Always `response.refusal.delta`.\n"
6485 }),
6486 "item_id": Schema.String.annotate({
6487 "description": "The ID of the output item that the refusal text is added to.\n"
6488 }),
6489 "output_index": Schema.Number.annotate({
6490 "description": "The index of the output item that the refusal text is added to.\n"
6491 }).check(Schema.isInt()),
6492 "content_index": Schema.Number.annotate({
6493 "description": "The index of the content part that the refusal text is added to.\n"
6494 }).check(Schema.isInt()),
6495 "delta": Schema.String.annotate({ "description": "The refusal text that is added.\n" }),
6496 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6497 Schema.isInt()
6498 )
6499}).annotate({ "description": "Emitted when there is a partial refusal text." })
6500export type ResponseRefusalDoneEvent = {
6501 readonly "type": "response.refusal.done"
6502 readonly "item_id": string
6503 readonly "output_index": number
6504 readonly "content_index": number
6505 readonly "refusal": string
6506 readonly "sequence_number": number
6507}
6508export const ResponseRefusalDoneEvent = Schema.Struct({
6509 "type": Schema.Literal("response.refusal.done").annotate({
6510 "description": "The type of the event. Always `response.refusal.done`.\n"
6511 }),
6512 "item_id": Schema.String.annotate({
6513 "description": "The ID of the output item that the refusal text is finalized.\n"
6514 }),
6515 "output_index": Schema.Number.annotate({
6516 "description": "The index of the output item that the refusal text is finalized.\n"
6517 }).check(Schema.isInt()),
6518 "content_index": Schema.Number.annotate({
6519 "description": "The index of the content part that the refusal text is finalized.\n"
6520 }).check(Schema.isInt()),
6521 "refusal": Schema.String.annotate({ "description": "The refusal text that is finalized.\n" }),
6522 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
6523 Schema.isInt()
6524 )
6525}).annotate({ "description": "Emitted when refusal text is finalized." })
6526export type ResponseStreamOptions = { readonly "include_obfuscation"?: boolean } | null
6527export const ResponseStreamOptions = Schema.Union([
6528 Schema.Struct({
6529 "include_obfuscation": Schema.optionalKey(Schema.Boolean.annotate({
6530 "description":
6531 "When true, stream obfuscation will be enabled. Stream obfuscation adds\nrandom characters to an `obfuscation` field on streaming delta events to\nnormalize payload sizes as a mitigation to certain side-channel attacks.\nThese obfuscation fields are included by default, but add a small amount\nof overhead to the data stream. You can set `include_obfuscation` to\nfalse to optimize for bandwidth if you trust the network links between\nyour application and the OpenAI API.\n"
6532 }))
6533 }).annotate({ "description": "Options for streaming responses. Only set this when you set `stream: true`.\n" }),
6534 Schema.Null
6535])
6536export type ResponseUsage = {
6537 readonly "input_tokens": number
6538 readonly "input_tokens_details": { readonly "cached_tokens": number }
6539 readonly "output_tokens": number
6540 readonly "output_tokens_details": { readonly "reasoning_tokens": number }
6541 readonly "total_tokens": number
6542}
6543export const ResponseUsage = Schema.Struct({
6544 "input_tokens": Schema.Number.annotate({ "description": "The number of input tokens." }).check(Schema.isInt()),
6545 "input_tokens_details": Schema.Struct({
6546 "cached_tokens": Schema.Number.annotate({
6547 "description":
6548 "The number of tokens that were retrieved from the cache. \n[More on prompt caching](/docs/guides/prompt-caching).\n"
6549 }).check(Schema.isInt())
6550 }).annotate({ "description": "A detailed breakdown of the input tokens." }),
6551 "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens." }).check(Schema.isInt()),
6552 "output_tokens_details": Schema.Struct({
6553 "reasoning_tokens": Schema.Number.annotate({ "description": "The number of reasoning tokens." }).check(
6554 Schema.isInt()
6555 )
6556 }).annotate({ "description": "A detailed breakdown of the output tokens." }),
6557 "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(Schema.isInt())
6558}).annotate({
6559 "description":
6560 "Represents token usage details including input tokens, output tokens,\na breakdown of output tokens, and the total tokens used.\n"
6561})
6562export type ResponseWebSearchCallCompletedEvent = {
6563 readonly "type": "response.web_search_call.completed"
6564 readonly "output_index": number
6565 readonly "item_id": string
6566 readonly "sequence_number": number
6567}
6568export const ResponseWebSearchCallCompletedEvent = Schema.Struct({
6569 "type": Schema.Literal("response.web_search_call.completed").annotate({
6570 "description": "The type of the event. Always `response.web_search_call.completed`.\n"
6571 }),
6572 "output_index": Schema.Number.annotate({
6573 "description": "The index of the output item that the web search call is associated with.\n"
6574 }).check(Schema.isInt()),
6575 "item_id": Schema.String.annotate({
6576 "description": "Unique ID for the output item associated with the web search call.\n"
6577 }),
6578 "sequence_number": Schema.Number.annotate({
6579 "description": "The sequence number of the web search call being processed."
6580 }).check(Schema.isInt())
6581}).annotate({ "description": "Emitted when a web search call is completed." })
6582export type ResponseWebSearchCallInProgressEvent = {
6583 readonly "type": "response.web_search_call.in_progress"
6584 readonly "output_index": number
6585 readonly "item_id": string
6586 readonly "sequence_number": number
6587}
6588export const ResponseWebSearchCallInProgressEvent = Schema.Struct({
6589 "type": Schema.Literal("response.web_search_call.in_progress").annotate({
6590 "description": "The type of the event. Always `response.web_search_call.in_progress`.\n"
6591 }),
6592 "output_index": Schema.Number.annotate({
6593 "description": "The index of the output item that the web search call is associated with.\n"
6594 }).check(Schema.isInt()),
6595 "item_id": Schema.String.annotate({
6596 "description": "Unique ID for the output item associated with the web search call.\n"
6597 }),
6598 "sequence_number": Schema.Number.annotate({
6599 "description": "The sequence number of the web search call being processed."
6600 }).check(Schema.isInt())
6601}).annotate({ "description": "Emitted when a web search call is initiated." })
6602export type ResponseWebSearchCallSearchingEvent = {
6603 readonly "type": "response.web_search_call.searching"
6604 readonly "output_index": number
6605 readonly "item_id": string
6606 readonly "sequence_number": number
6607}
6608export const ResponseWebSearchCallSearchingEvent = Schema.Struct({
6609 "type": Schema.Literal("response.web_search_call.searching").annotate({
6610 "description": "The type of the event. Always `response.web_search_call.searching`.\n"
6611 }),
6612 "output_index": Schema.Number.annotate({
6613 "description": "The index of the output item that the web search call is associated with.\n"
6614 }).check(Schema.isInt()),
6615 "item_id": Schema.String.annotate({
6616 "description": "Unique ID for the output item associated with the web search call.\n"
6617 }),
6618 "sequence_number": Schema.Number.annotate({
6619 "description": "The sequence number of the web search call being processed."
6620 }).check(Schema.isInt())
6621}).annotate({ "description": "Emitted when a web search call is executing." })
6622export type Role = {
6623 readonly "object": "role"
6624 readonly "id": string
6625 readonly "name": string
6626 readonly "description": string | null
6627 readonly "permissions": ReadonlyArray<string>
6628 readonly "resource_type": string
6629 readonly "predefined_role": boolean
6630}
6631export const Role = Schema.Struct({
6632 "object": Schema.Literal("role").annotate({ "description": "Always `role`." }),
6633 "id": Schema.String.annotate({ "description": "Identifier for the role." }),
6634 "name": Schema.String.annotate({ "description": "Unique name for the role." }),
6635 "description": Schema.Union([Schema.String, Schema.Null]).annotate({
6636 "description": "Optional description of the role."
6637 }),
6638 "permissions": Schema.Array(Schema.String).annotate({ "description": "Permissions granted by the role." }),
6639 "resource_type": Schema.String.annotate({
6640 "description": "Resource type the role is bound to (for example `api.organization` or `api.project`)."
6641 }),
6642 "predefined_role": Schema.Boolean.annotate({ "description": "Whether the role is predefined and managed by OpenAI." })
6643}).annotate({ "description": "Details about a role that can be assigned through the public Roles API." })
6644export type RoleDeletedResource = {
6645 readonly "object": "role.deleted"
6646 readonly "id": string
6647 readonly "deleted": boolean
6648}
6649export const RoleDeletedResource = Schema.Struct({
6650 "object": Schema.Literal("role.deleted").annotate({ "description": "Always `role.deleted`." }),
6651 "id": Schema.String.annotate({ "description": "Identifier of the deleted role." }),
6652 "deleted": Schema.Boolean.annotate({ "description": "Whether the role was deleted." })
6653}).annotate({ "description": "Confirmation payload returned after deleting a role." })
6654export type RunCompletionUsage = {
6655 readonly "completion_tokens": number
6656 readonly "prompt_tokens": number
6657 readonly "total_tokens": number
6658} | null
6659export const RunCompletionUsage = Schema.Union([
6660 Schema.Struct({
6661 "completion_tokens": Schema.Number.annotate({
6662 "description": "Number of completion tokens used over the course of the run."
6663 }).check(Schema.isInt()),
6664 "prompt_tokens": Schema.Number.annotate({
6665 "description": "Number of prompt tokens used over the course of the run."
6666 }).check(Schema.isInt()),
6667 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (prompt + completion)." })
6668 .check(Schema.isInt())
6669 }).annotate({
6670 "description":
6671 "Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.)."
6672 }),
6673 Schema.Null
6674])
6675export type RunGraderResponse = {
6676 readonly "reward": number
6677 readonly "metadata": {
6678 readonly "name": string
6679 readonly "type": string
6680 readonly "errors": {
6681 readonly "formula_parse_error": boolean
6682 readonly "sample_parse_error": boolean
6683 readonly "truncated_observation_error": boolean
6684 readonly "unresponsive_reward_error": boolean
6685 readonly "invalid_variable_error": boolean
6686 readonly "other_error": boolean
6687 readonly "python_grader_server_error": boolean
6688 readonly "python_grader_server_error_type": string | null
6689 readonly "python_grader_runtime_error": boolean
6690 readonly "python_grader_runtime_error_details": string | null
6691 readonly "model_grader_server_error": boolean
6692 readonly "model_grader_refusal_error": boolean
6693 readonly "model_grader_parse_error": boolean
6694 readonly "model_grader_server_error_details": string | null
6695 }
6696 readonly "execution_time": number
6697 readonly "scores": {}
6698 readonly "token_usage": number | null
6699 readonly "sampled_model_name": string | null
6700 }
6701 readonly "sub_rewards": {}
6702 readonly "model_grader_token_usage_per_model": {}
6703}
6704export const RunGraderResponse = Schema.Struct({
6705 "reward": Schema.Number.check(Schema.isFinite()),
6706 "metadata": Schema.Struct({
6707 "name": Schema.String,
6708 "type": Schema.String,
6709 "errors": Schema.Struct({
6710 "formula_parse_error": Schema.Boolean,
6711 "sample_parse_error": Schema.Boolean,
6712 "truncated_observation_error": Schema.Boolean,
6713 "unresponsive_reward_error": Schema.Boolean,
6714 "invalid_variable_error": Schema.Boolean,
6715 "other_error": Schema.Boolean,
6716 "python_grader_server_error": Schema.Boolean,
6717 "python_grader_server_error_type": Schema.Union([Schema.String, Schema.Null]),
6718 "python_grader_runtime_error": Schema.Boolean,
6719 "python_grader_runtime_error_details": Schema.Union([Schema.String, Schema.Null]),
6720 "model_grader_server_error": Schema.Boolean,
6721 "model_grader_refusal_error": Schema.Boolean,
6722 "model_grader_parse_error": Schema.Boolean,
6723 "model_grader_server_error_details": Schema.Union([Schema.String, Schema.Null])
6724 }),
6725 "execution_time": Schema.Number.check(Schema.isFinite()),
6726 "scores": Schema.Struct({}),
6727 "token_usage": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]),
6728 "sampled_model_name": Schema.Union([Schema.String, Schema.Null])
6729 }),
6730 "sub_rewards": Schema.Struct({}),
6731 "model_grader_token_usage_per_model": Schema.Struct({})
6732})
6733export type RunStepCompletionUsage = {
6734 readonly "completion_tokens": number
6735 readonly "prompt_tokens": number
6736 readonly "total_tokens": number
6737} | null
6738export const RunStepCompletionUsage = Schema.Union([
6739 Schema.Struct({
6740 "completion_tokens": Schema.Number.annotate({
6741 "description": "Number of completion tokens used over the course of the run step."
6742 }).check(Schema.isInt()),
6743 "prompt_tokens": Schema.Number.annotate({
6744 "description": "Number of prompt tokens used over the course of the run step."
6745 }).check(Schema.isInt()),
6746 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (prompt + completion)." })
6747 .check(Schema.isInt())
6748 }).annotate({
6749 "description":
6750 "Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`."
6751 }),
6752 Schema.Null
6753])
6754export type RunStepDeltaStepDetailsToolCallsCodeObject = {
6755 readonly "index": number
6756 readonly "id"?: string
6757 readonly "type": "code_interpreter"
6758 readonly "code_interpreter"?: {
6759 readonly "input"?: string
6760 readonly "outputs"?: ReadonlyArray<
6761 { readonly "index": number; readonly "type": "logs"; readonly "logs"?: string } | {
6762 readonly "index": number
6763 readonly "type": "image"
6764 readonly "image"?: { readonly "file_id"?: string }
6765 }
6766 >
6767 }
6768}
6769export const RunStepDeltaStepDetailsToolCallsCodeObject = Schema.Struct({
6770 "index": Schema.Number.annotate({ "description": "The index of the tool call in the tool calls array." }).check(
6771 Schema.isInt()
6772 ),
6773 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the tool call." })),
6774 "type": Schema.Literal("code_interpreter").annotate({
6775 "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call."
6776 }),
6777 "code_interpreter": Schema.optionalKey(
6778 Schema.Struct({
6779 "input": Schema.optionalKey(
6780 Schema.String.annotate({ "description": "The input to the Code Interpreter tool call." })
6781 ),
6782 "outputs": Schema.optionalKey(
6783 Schema.Array(Schema.Union([
6784 Schema.Struct({
6785 "index": Schema.Number.annotate({ "description": "The index of the output in the outputs array." }).check(
6786 Schema.isInt()
6787 ),
6788 "type": Schema.Literal("logs").annotate({ "description": "Always `logs`." }),
6789 "logs": Schema.optionalKey(
6790 Schema.String.annotate({ "description": "The text output from the Code Interpreter tool call." })
6791 )
6792 }).annotate({
6793 "title": "Code interpreter log output",
6794 "description": "Text output from the Code Interpreter tool call as part of a run step."
6795 }),
6796 Schema.Struct({
6797 "index": Schema.Number.annotate({ "description": "The index of the output in the outputs array." }).check(
6798 Schema.isInt()
6799 ),
6800 "type": Schema.Literal("image").annotate({ "description": "Always `image`." }),
6801 "image": Schema.optionalKey(
6802 Schema.Struct({
6803 "file_id": Schema.optionalKey(
6804 Schema.String.annotate({ "description": "The [file](/docs/api-reference/files) ID of the image." })
6805 )
6806 })
6807 )
6808 }).annotate({ "title": "Code interpreter image output" })
6809 ], { mode: "oneOf" })).annotate({
6810 "description":
6811 "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type."
6812 })
6813 )
6814 }).annotate({ "description": "The Code Interpreter tool call definition." })
6815 )
6816}).annotate({
6817 "title": "Code interpreter tool call",
6818 "description": "Details of the Code Interpreter tool call the run step was involved in."
6819})
6820export type RunStepDeltaStepDetailsToolCallsFileSearchObject = {
6821 readonly "index": number
6822 readonly "id"?: string
6823 readonly "type": "file_search"
6824 readonly "file_search": {}
6825}
6826export const RunStepDeltaStepDetailsToolCallsFileSearchObject = Schema.Struct({
6827 "index": Schema.Number.annotate({ "description": "The index of the tool call in the tool calls array." }).check(
6828 Schema.isInt()
6829 ),
6830 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the tool call object." })),
6831 "type": Schema.Literal("file_search").annotate({
6832 "description": "The type of tool call. This is always going to be `file_search` for this type of tool call."
6833 }),
6834 "file_search": Schema.Struct({}).annotate({ "description": "For now, this is always going to be an empty object." })
6835}).annotate({ "title": "File search tool call" })
6836export type RunStepDeltaStepDetailsToolCallsFunctionObject = {
6837 readonly "index": number
6838 readonly "id"?: string
6839 readonly "type": "function"
6840 readonly "function"?: { readonly "name"?: string; readonly "arguments"?: string; readonly "output"?: string | null }
6841}
6842export const RunStepDeltaStepDetailsToolCallsFunctionObject = Schema.Struct({
6843 "index": Schema.Number.annotate({ "description": "The index of the tool call in the tool calls array." }).check(
6844 Schema.isInt()
6845 ),
6846 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the tool call object." })),
6847 "type": Schema.Literal("function").annotate({
6848 "description": "The type of tool call. This is always going to be `function` for this type of tool call."
6849 }),
6850 "function": Schema.optionalKey(
6851 Schema.Struct({
6852 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function." })),
6853 "arguments": Schema.optionalKey(
6854 Schema.String.annotate({ "description": "The arguments passed to the function." })
6855 ),
6856 "output": Schema.optionalKey(
6857 Schema.Union([
6858 Schema.String.annotate({
6859 "description":
6860 "The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet."
6861 }),
6862 Schema.Null
6863 ])
6864 )
6865 }).annotate({ "description": "The definition of the function that was called." })
6866 )
6867}).annotate({ "title": "Function tool call" })
6868export type RunStepDetailsToolCallsCodeObject = {
6869 readonly "id": string
6870 readonly "type": "code_interpreter"
6871 readonly "code_interpreter": {
6872 readonly "input": string
6873 readonly "outputs": ReadonlyArray<
6874 { readonly "type": "logs"; readonly "logs": string } | {
6875 readonly "type": "image"
6876 readonly "image": { readonly "file_id": string }
6877 }
6878 >
6879 }
6880}
6881export const RunStepDetailsToolCallsCodeObject = Schema.Struct({
6882 "id": Schema.String.annotate({ "description": "The ID of the tool call." }),
6883 "type": Schema.Literal("code_interpreter").annotate({
6884 "description": "The type of tool call. This is always going to be `code_interpreter` for this type of tool call."
6885 }),
6886 "code_interpreter": Schema.Struct({
6887 "input": Schema.String.annotate({ "description": "The input to the Code Interpreter tool call." }),
6888 "outputs": Schema.Array(
6889 Schema.Union([
6890 Schema.Struct({
6891 "type": Schema.Literal("logs").annotate({ "description": "Always `logs`." }),
6892 "logs": Schema.String.annotate({ "description": "The text output from the Code Interpreter tool call." })
6893 }).annotate({
6894 "title": "Code Interpreter log output",
6895 "description": "Text output from the Code Interpreter tool call as part of a run step."
6896 }),
6897 Schema.Struct({
6898 "type": Schema.Literal("image").annotate({ "description": "Always `image`." }),
6899 "image": Schema.Struct({
6900 "file_id": Schema.String.annotate({
6901 "description": "The [file](/docs/api-reference/files) ID of the image."
6902 })
6903 })
6904 }).annotate({ "title": "Code Interpreter image output" })
6905 ], { mode: "oneOf" })
6906 ).annotate({
6907 "description":
6908 "The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type."
6909 })
6910 }).annotate({ "description": "The Code Interpreter tool call definition." })
6911}).annotate({
6912 "title": "Code Interpreter tool call",
6913 "description": "Details of the Code Interpreter tool call the run step was involved in."
6914})
6915export type RunStepDetailsToolCallsFileSearchResultObject = {
6916 readonly "file_id": string
6917 readonly "file_name": string
6918 readonly "score": number
6919 readonly "content"?: ReadonlyArray<{ readonly "type"?: "text"; readonly "text"?: string }>
6920}
6921export const RunStepDetailsToolCallsFileSearchResultObject = Schema.Struct({
6922 "file_id": Schema.String.annotate({ "description": "The ID of the file that result was found in." }),
6923 "file_name": Schema.String.annotate({ "description": "The name of the file that result was found in." }),
6924 "score": Schema.Number.annotate({
6925 "description": "The score of the result. All values must be a floating point number between 0 and 1."
6926 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
6927 "content": Schema.optionalKey(
6928 Schema.Array(
6929 Schema.Struct({
6930 "type": Schema.optionalKey(Schema.Literal("text").annotate({ "description": "The type of the content." })),
6931 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content of the file." }))
6932 })
6933 ).annotate({
6934 "description":
6935 "The content of the result that was found. The content is only included if requested via the include query parameter."
6936 })
6937 )
6938}).annotate({ "title": "File search tool call result", "description": "A result instance of the file search." })
6939export type RunStepDetailsToolCallsFunctionObject = {
6940 readonly "id": string
6941 readonly "type": "function"
6942 readonly "function": { readonly "name": string; readonly "arguments": string; readonly "output": string | null }
6943}
6944export const RunStepDetailsToolCallsFunctionObject = Schema.Struct({
6945 "id": Schema.String.annotate({ "description": "The ID of the tool call object." }),
6946 "type": Schema.Literal("function").annotate({
6947 "description": "The type of tool call. This is always going to be `function` for this type of tool call."
6948 }),
6949 "function": Schema.Struct({
6950 "name": Schema.String.annotate({ "description": "The name of the function." }),
6951 "arguments": Schema.String.annotate({ "description": "The arguments passed to the function." }),
6952 "output": Schema.Union([
6953 Schema.String.annotate({
6954 "description":
6955 "The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet."
6956 }),
6957 Schema.Null
6958 ])
6959 }).annotate({ "description": "The definition of the function that was called." })
6960}).annotate({ "title": "Function tool call" })
6961export type RunToolCallObject = {
6962 readonly "id": string
6963 readonly "type": "function"
6964 readonly "function": { readonly "name": string; readonly "arguments": string }
6965}
6966export const RunToolCallObject = Schema.Struct({
6967 "id": Schema.String.annotate({
6968 "description":
6969 "The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint."
6970 }),
6971 "type": Schema.Literal("function").annotate({
6972 "description": "The type of tool call the output is required for. For now, this is always `function`."
6973 }),
6974 "function": Schema.Struct({
6975 "name": Schema.String.annotate({ "description": "The name of the function." }),
6976 "arguments": Schema.String.annotate({
6977 "description": "The arguments that the model expects you to pass to the function."
6978 })
6979 }).annotate({ "description": "The function definition." })
6980}).annotate({ "description": "Tool call objects" })
6981export type ServiceTier = "auto" | "default" | "flex" | "scale" | "priority" | null
6982export const ServiceTier = Schema.Union([
6983 Schema.Literals(["auto", "default", "flex", "scale", "priority"]).annotate({
6984 "description":
6985 "Specifies the processing type used for serving the request.\n - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\n - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.\n - When not set, the default behavior is 'auto'.\n\n When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.\n"
6986 }),
6987 Schema.Null
6988])
6989export type SpeechAudioDeltaEvent = { readonly "type": "speech.audio.delta"; readonly "audio": string }
6990export const SpeechAudioDeltaEvent = Schema.Struct({
6991 "type": Schema.Literal("speech.audio.delta").annotate({
6992 "description": "The type of the event. Always `speech.audio.delta`.\n"
6993 }),
6994 "audio": Schema.String.annotate({ "description": "A chunk of Base64-encoded audio data.\n" })
6995}).annotate({ "description": "Emitted for each chunk of audio data generated during speech synthesis." })
6996export type SpeechAudioDoneEvent = {
6997 readonly "type": "speech.audio.done"
6998 readonly "usage": {
6999 readonly "input_tokens": number
7000 readonly "output_tokens": number
7001 readonly "total_tokens": number
7002 }
7003}
7004export const SpeechAudioDoneEvent = Schema.Struct({
7005 "type": Schema.Literal("speech.audio.done").annotate({
7006 "description": "The type of the event. Always `speech.audio.done`.\n"
7007 }),
7008 "usage": Schema.Struct({
7009 "input_tokens": Schema.Number.annotate({ "description": "Number of input tokens in the prompt." }).check(
7010 Schema.isInt()
7011 ),
7012 "output_tokens": Schema.Number.annotate({ "description": "Number of output tokens generated." }).check(
7013 Schema.isInt()
7014 ),
7015 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (input + output)." }).check(
7016 Schema.isInt()
7017 )
7018 }).annotate({ "description": "Token usage statistics for the request.\n" })
7019}).annotate({ "description": "Emitted when the speech synthesis is complete and all audio has been streamed." })
7020export type StaticChunkingStrategy = {
7021 readonly "max_chunk_size_tokens": number
7022 readonly "chunk_overlap_tokens": number
7023}
7024export const StaticChunkingStrategy = Schema.Struct({
7025 "max_chunk_size_tokens": Schema.Number.annotate({
7026 "description":
7027 "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."
7028 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(100)).check(Schema.isLessThanOrEqualTo(4096)),
7029 "chunk_overlap_tokens": Schema.Number.annotate({
7030 "description":
7031 "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"
7032 }).check(Schema.isInt())
7033})
7034export type StopConfiguration = string | null | ReadonlyArray<string> | null
7035export const StopConfiguration = Schema.Union([
7036 Schema.Union([
7037 Schema.Union([Schema.String, Schema.Null]),
7038 Schema.Array(Schema.String).check(Schema.isMinLength(1)).check(Schema.isMaxLength(4))
7039 ], { mode: "oneOf" }).annotate({
7040 "description":
7041 "Not supported with latest reasoning models `o3` and `o4-mini`.\n\nUp to 4 sequences where the API will stop generating further tokens. The\nreturned text will not contain the stop sequence.\n"
7042 }),
7043 Schema.Null
7044])
7045export type SubmitToolOutputsRunRequest = {
7046 readonly "tool_outputs": ReadonlyArray<{ readonly "tool_call_id"?: string; readonly "output"?: string }>
7047 readonly "stream"?: boolean | null
7048}
7049export const SubmitToolOutputsRunRequest = Schema.Struct({
7050 "tool_outputs": Schema.Array(Schema.Struct({
7051 "tool_call_id": Schema.optionalKey(
7052 Schema.String.annotate({
7053 "description":
7054 "The ID of the tool call in the `required_action` object within the run object the output is being submitted for."
7055 })
7056 ),
7057 "output": Schema.optionalKey(
7058 Schema.String.annotate({ "description": "The output of the tool call to be submitted to continue the run." })
7059 )
7060 })).annotate({ "description": "A list of tools for which the outputs are being submitted." }),
7061 "stream": Schema.optionalKey(
7062 Schema.Union([
7063 Schema.Boolean.annotate({
7064 "description":
7065 "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n"
7066 }),
7067 Schema.Null
7068 ])
7069 )
7070})
7071export type ToggleCertificatesRequest = { readonly "certificate_ids": ReadonlyArray<string> }
7072export const ToggleCertificatesRequest = Schema.Struct({
7073 "certificate_ids": Schema.Array(Schema.String).check(Schema.isMinLength(1)).check(Schema.isMaxLength(10))
7074})
7075export type ToolChoiceAllowed = {
7076 readonly "type": "allowed_tools"
7077 readonly "mode": "auto" | "required"
7078 readonly "tools": ReadonlyArray<{}>
7079}
7080export const ToolChoiceAllowed = Schema.Struct({
7081 "type": Schema.Literal("allowed_tools").annotate({
7082 "description": "Allowed tool configuration type. Always `allowed_tools`."
7083 }),
7084 "mode": Schema.Literals(["auto", "required"]).annotate({
7085 "description":
7086 "Constrains the tools available to the model to a pre-defined set.\n\n`auto` allows the model to pick from among the allowed tools and generate a\nmessage.\n\n`required` requires the model to call one or more of the allowed tools.\n"
7087 }),
7088 "tools": Schema.Array(
7089 Schema.Struct({}).annotate({ "description": "A tool definition that the model should be allowed to call.\n" })
7090 ).annotate({
7091 "description":
7092 "A list of tool definitions that the model should be allowed to call.\n\nFor the Responses API, the list of tool definitions might look like:\n```json\n[\n { \"type\": \"function\", \"name\": \"get_weather\" },\n { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\n { \"type\": \"image_generation\" }\n]\n```\n"
7093 })
7094}).annotate({
7095 "title": "Allowed tools",
7096 "description": "Constrains the tools available to the model to a pre-defined set.\n"
7097})
7098export type ToolChoiceCustom = { readonly "type": "custom"; readonly "name": string }
7099export const ToolChoiceCustom = Schema.Struct({
7100 "type": Schema.Literal("custom").annotate({ "description": "For custom tool calling, the type is always `custom`." }),
7101 "name": Schema.String.annotate({ "description": "The name of the custom tool to call." })
7102}).annotate({
7103 "title": "Custom tool",
7104 "description": "Use this option to force the model to call a specific custom tool.\n"
7105})
7106export type ToolChoiceFunction = { readonly "type": "function"; readonly "name": string }
7107export const ToolChoiceFunction = Schema.Struct({
7108 "type": Schema.Literal("function").annotate({
7109 "description": "For function calling, the type is always `function`."
7110 }),
7111 "name": Schema.String.annotate({ "description": "The name of the function to call." })
7112}).annotate({
7113 "title": "Function tool",
7114 "description": "Use this option to force the model to call a specific function.\n"
7115})
7116export type ToolChoiceMCP = { readonly "type": "mcp"; readonly "server_label": string; readonly "name"?: string | null }
7117export const ToolChoiceMCP = Schema.Struct({
7118 "type": Schema.Literal("mcp").annotate({ "description": "For MCP tools, the type is always `mcp`." }),
7119 "server_label": Schema.String.annotate({ "description": "The label of the MCP server to use.\n" }),
7120 "name": Schema.optionalKey(
7121 Schema.Union([
7122 Schema.String.annotate({ "description": "The name of the tool to call on the server.\n" }),
7123 Schema.Null
7124 ])
7125 )
7126}).annotate({
7127 "title": "MCP tool",
7128 "description": "Use this option to force the model to call a specific tool on a remote MCP server.\n"
7129})
7130export type ToolChoiceOptions = "none" | "auto" | "required"
7131export const ToolChoiceOptions = Schema.Literals(["none", "auto", "required"]).annotate({
7132 "title": "Tool choice mode",
7133 "description":
7134 "Controls which (if any) tool is called by the model.\n\n`none` means the model will not call any tool and instead generates a message.\n\n`auto` means the model can pick between generating a message or calling one or\nmore tools.\n\n`required` means the model must call one or more tools.\n"
7135})
7136export type ToolChoiceTypes = {
7137 readonly "type":
7138 | "file_search"
7139 | "web_search_preview"
7140 | "computer"
7141 | "computer_use_preview"
7142 | "computer_use"
7143 | "web_search_preview_2025_03_11"
7144 | "image_generation"
7145 | "code_interpreter"
7146}
7147export const ToolChoiceTypes = Schema.Struct({
7148 "type": Schema.Literals([
7149 "file_search",
7150 "web_search_preview",
7151 "computer",
7152 "computer_use_preview",
7153 "computer_use",
7154 "web_search_preview_2025_03_11",
7155 "image_generation",
7156 "code_interpreter"
7157 ]).annotate({
7158 "description":
7159 "The type of hosted tool the model should to use. Learn more about\n[built-in tools](/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer`\n- `computer_use_preview`\n- `computer_use`\n- `code_interpreter`\n- `image_generation`\n"
7160 })
7161}).annotate({
7162 "title": "Hosted tool",
7163 "description":
7164 "Indicates that the model should use a built-in tool to generate a response.\n[Learn more about built-in tools](/docs/guides/tools).\n"
7165})
7166export type TranscriptTextDeltaEvent = {
7167 readonly "type": "transcript.text.delta"
7168 readonly "delta": string
7169 readonly "logprobs"?: ReadonlyArray<
7170 { readonly "token"?: string; readonly "logprob"?: number; readonly "bytes"?: ReadonlyArray<number> }
7171 >
7172 readonly "segment_id"?: string
7173}
7174export const TranscriptTextDeltaEvent = Schema.Struct({
7175 "type": Schema.Literal("transcript.text.delta").annotate({
7176 "description": "The type of the event. Always `transcript.text.delta`.\n"
7177 }),
7178 "delta": Schema.String.annotate({ "description": "The text delta that was additionally transcribed.\n" }),
7179 "logprobs": Schema.optionalKey(
7180 Schema.Array(Schema.Struct({
7181 "token": Schema.optionalKey(
7182 Schema.String.annotate({ "description": "The token that was used to generate the log probability.\n" })
7183 ),
7184 "logprob": Schema.optionalKey(
7185 Schema.Number.annotate({ "description": "The log probability of the token.\n" }).check(Schema.isFinite())
7186 ),
7187 "bytes": Schema.optionalKey(
7188 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
7189 "description": "The bytes that were used to generate the log probability.\n"
7190 })
7191 )
7192 })).annotate({
7193 "description":
7194 "The log probabilities of the delta. Only included if you [create a transcription](/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.\n"
7195 })
7196 ),
7197 "segment_id": Schema.optionalKey(
7198 Schema.String.annotate({
7199 "description":
7200 "Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`.\n"
7201 })
7202 )
7203}).annotate({
7204 "description":
7205 "Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`."
7206})
7207export type TranscriptTextSegmentEvent = {
7208 readonly "type": "transcript.text.segment"
7209 readonly "id": string
7210 readonly "start": number
7211 readonly "end": number
7212 readonly "text": string
7213 readonly "speaker": string
7214}
7215export const TranscriptTextSegmentEvent = Schema.Struct({
7216 "type": Schema.Literal("transcript.text.segment").annotate({
7217 "description": "The type of the event. Always `transcript.text.segment`."
7218 }),
7219 "id": Schema.String.annotate({ "description": "Unique identifier for the segment." }),
7220 "start": Schema.Number.annotate({ "description": "Start timestamp of the segment in seconds.", "format": "double" })
7221 .check(Schema.isFinite()),
7222 "end": Schema.Number.annotate({ "description": "End timestamp of the segment in seconds.", "format": "double" })
7223 .check(Schema.isFinite()),
7224 "text": Schema.String.annotate({ "description": "Transcript text for this segment." }),
7225 "speaker": Schema.String.annotate({ "description": "Speaker label for this segment." })
7226}).annotate({
7227 "description":
7228 "Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](/docs/api-reference/audio/create-transcription) with `stream` set to `true` and `response_format` set to `diarized_json`.\n"
7229})
7230export type TranscriptTextUsageDuration = { readonly "type": "duration"; readonly "seconds": number }
7231export const TranscriptTextUsageDuration = Schema.Struct({
7232 "type": Schema.Literal("duration").annotate({
7233 "description": "The type of the usage object. Always `duration` for this variant."
7234 }),
7235 "seconds": Schema.Number.annotate({ "description": "Duration of the input audio in seconds.", "format": "double" })
7236 .check(Schema.isFinite())
7237}).annotate({ "title": "Duration Usage", "description": "Usage statistics for models billed by audio input duration." })
7238export type TranscriptTextUsageTokens = {
7239 readonly "type": "tokens"
7240 readonly "input_tokens": number
7241 readonly "input_token_details"?: { readonly "text_tokens"?: number; readonly "audio_tokens"?: number }
7242 readonly "output_tokens": number
7243 readonly "total_tokens": number
7244}
7245export const TranscriptTextUsageTokens = Schema.Struct({
7246 "type": Schema.Literal("tokens").annotate({
7247 "description": "The type of the usage object. Always `tokens` for this variant."
7248 }),
7249 "input_tokens": Schema.Number.annotate({ "description": "Number of input tokens billed for this request." }).check(
7250 Schema.isInt()
7251 ),
7252 "input_token_details": Schema.optionalKey(
7253 Schema.Struct({
7254 "text_tokens": Schema.optionalKey(
7255 Schema.Number.annotate({ "description": "Number of text tokens billed for this request." }).check(
7256 Schema.isInt()
7257 )
7258 ),
7259 "audio_tokens": Schema.optionalKey(
7260 Schema.Number.annotate({ "description": "Number of audio tokens billed for this request." }).check(
7261 Schema.isInt()
7262 )
7263 )
7264 }).annotate({ "description": "Details about the input tokens billed for this request." })
7265 ),
7266 "output_tokens": Schema.Number.annotate({ "description": "Number of output tokens generated." }).check(
7267 Schema.isInt()
7268 ),
7269 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (input + output)." }).check(
7270 Schema.isInt()
7271 )
7272}).annotate({ "title": "Token Usage", "description": "Usage statistics for models billed by token usage." })
7273export type TranscriptionDiarizedSegment = {
7274 readonly "type": "transcript.text.segment"
7275 readonly "id": string
7276 readonly "start": number
7277 readonly "end": number
7278 readonly "text": string
7279 readonly "speaker": string
7280}
7281export const TranscriptionDiarizedSegment = Schema.Struct({
7282 "type": Schema.Literal("transcript.text.segment").annotate({
7283 "description": "The type of the segment. Always `transcript.text.segment`.\n"
7284 }),
7285 "id": Schema.String.annotate({ "description": "Unique identifier for the segment." }),
7286 "start": Schema.Number.annotate({ "description": "Start timestamp of the segment in seconds.", "format": "double" })
7287 .check(Schema.isFinite()),
7288 "end": Schema.Number.annotate({ "description": "End timestamp of the segment in seconds.", "format": "double" })
7289 .check(Schema.isFinite()),
7290 "text": Schema.String.annotate({ "description": "Transcript text for this segment." }),
7291 "speaker": Schema.String.annotate({
7292 "description":
7293 "Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...).\n"
7294 })
7295}).annotate({ "description": "A segment of diarized transcript text with speaker metadata." })
7296export type TranscriptionInclude = "logprobs"
7297export const TranscriptionInclude = Schema.Literal("logprobs")
7298export type TranscriptionSegment = {
7299 readonly "id": number
7300 readonly "seek": number
7301 readonly "start": number
7302 readonly "end": number
7303 readonly "text": string
7304 readonly "tokens": ReadonlyArray<number>
7305 readonly "temperature": number
7306 readonly "avg_logprob": number
7307 readonly "compression_ratio": number
7308 readonly "no_speech_prob": number
7309}
7310export const TranscriptionSegment = Schema.Struct({
7311 "id": Schema.Number.annotate({ "description": "Unique identifier of the segment." }).check(Schema.isInt()),
7312 "seek": Schema.Number.annotate({ "description": "Seek offset of the segment." }).check(Schema.isInt()),
7313 "start": Schema.Number.annotate({ "description": "Start time of the segment in seconds.", "format": "double" }).check(
7314 Schema.isFinite()
7315 ),
7316 "end": Schema.Number.annotate({ "description": "End time of the segment in seconds.", "format": "double" }).check(
7317 Schema.isFinite()
7318 ),
7319 "text": Schema.String.annotate({ "description": "Text content of the segment." }),
7320 "tokens": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
7321 "description": "Array of token IDs for the text content."
7322 }),
7323 "temperature": Schema.Number.annotate({
7324 "description": "Temperature parameter used for generating the segment.",
7325 "format": "float"
7326 }).check(Schema.isFinite()),
7327 "avg_logprob": Schema.Number.annotate({
7328 "description": "Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.",
7329 "format": "float"
7330 }).check(Schema.isFinite()),
7331 "compression_ratio": Schema.Number.annotate({
7332 "description":
7333 "Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.",
7334 "format": "float"
7335 }).check(Schema.isFinite()),
7336 "no_speech_prob": Schema.Number.annotate({
7337 "description":
7338 "Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.",
7339 "format": "float"
7340 }).check(Schema.isFinite())
7341})
7342export type TranscriptionWord = { readonly "word": string; readonly "start": number; readonly "end": number }
7343export const TranscriptionWord = Schema.Struct({
7344 "word": Schema.String.annotate({ "description": "The text content of the word." }),
7345 "start": Schema.Number.annotate({ "description": "Start time of the word in seconds.", "format": "double" }).check(
7346 Schema.isFinite()
7347 ),
7348 "end": Schema.Number.annotate({ "description": "End time of the word in seconds.", "format": "double" }).check(
7349 Schema.isFinite()
7350 )
7351})
7352export type UpdateGroupBody = { readonly "name": string }
7353export const UpdateGroupBody = Schema.Struct({
7354 "name": Schema.String.annotate({ "description": "New display name for the group." }).check(Schema.isMinLength(1))
7355 .check(Schema.isMaxLength(255))
7356}).annotate({ "description": "Request payload for updating the details of an existing group." })
7357export type UpdateVoiceConsentRequest = { readonly "name": string }
7358export const UpdateVoiceConsentRequest = Schema.Struct({
7359 "name": Schema.String.annotate({ "description": "The updated label for this consent recording." })
7360})
7361export type Upload = {
7362 readonly "id": string
7363 readonly "created_at": number
7364 readonly "filename": string
7365 readonly "bytes": number
7366 readonly "purpose": string
7367 readonly "status": "pending" | "completed" | "cancelled" | "expired"
7368 readonly "expires_at": number
7369 readonly "object"?: "upload"
7370 readonly "file"?: {
7371 readonly "id": string
7372 readonly "bytes": number
7373 readonly "created_at": number
7374 readonly "expires_at"?: number | null
7375 readonly "filename": string
7376 readonly "object": "file"
7377 readonly "purpose":
7378 | "assistants"
7379 | "assistants_output"
7380 | "batch"
7381 | "batch_output"
7382 | "fine-tune"
7383 | "fine-tune-results"
7384 | "vision"
7385 | "user_data"
7386 readonly "status": "uploaded" | "processed" | "error"
7387 readonly "status_details"?: string | null
7388 readonly [x: string]: unknown
7389 }
7390}
7391export const Upload = Schema.Struct({
7392 "id": Schema.String.annotate({
7393 "description": "The Upload unique identifier, which can be referenced in API endpoints."
7394 }),
7395 "created_at": Schema.Number.annotate({
7396 "description": "The Unix timestamp (in seconds) for when the Upload was created.",
7397 "format": "unixtime"
7398 }).check(Schema.isInt()),
7399 "filename": Schema.String.annotate({ "description": "The name of the file to be uploaded." }),
7400 "bytes": Schema.Number.annotate({ "description": "The intended number of bytes to be uploaded." }).check(
7401 Schema.isInt()
7402 ),
7403 "purpose": Schema.String.annotate({
7404 "description":
7405 "The intended purpose of the file. [Please refer here](/docs/api-reference/files/object#files/object-purpose) for acceptable values."
7406 }),
7407 "status": Schema.Literals(["pending", "completed", "cancelled", "expired"]).annotate({
7408 "description": "The status of the Upload."
7409 }),
7410 "expires_at": Schema.Number.annotate({
7411 "description": "The Unix timestamp (in seconds) for when the Upload will expire.",
7412 "format": "unixtime"
7413 }).check(Schema.isInt()),
7414 "object": Schema.optionalKey(
7415 Schema.Literal("upload").annotate({ "description": "The object type, which is always \"upload\"." })
7416 ),
7417 "file": Schema.optionalKey(Schema.Union([
7418 Schema.StructWithRest(
7419 Schema.Struct({
7420 "id": Schema.String.annotate({
7421 "description": "The file identifier, which can be referenced in the API endpoints."
7422 }),
7423 "bytes": Schema.Number.annotate({ "description": "The size of the file, in bytes." }).check(Schema.isInt()),
7424 "created_at": Schema.Number.annotate({
7425 "description": "The Unix timestamp (in seconds) for when the file was created.",
7426 "format": "unixtime"
7427 }).check(Schema.isInt()),
7428 "expires_at": Schema.optionalKey(
7429 Schema.Union([
7430 Schema.Number.annotate({
7431 "description": "The Unix timestamp (in seconds) for when the file will expire.",
7432 "format": "unixtime"
7433 }).check(Schema.isInt()),
7434 Schema.Null
7435 ])
7436 ),
7437 "filename": Schema.String.annotate({ "description": "The name of the file." }),
7438 "object": Schema.Literal("file").annotate({ "description": "The object type, which is always `file`." }),
7439 "purpose": Schema.Literals([
7440 "assistants",
7441 "assistants_output",
7442 "batch",
7443 "batch_output",
7444 "fine-tune",
7445 "fine-tune-results",
7446 "vision",
7447 "user_data"
7448 ]).annotate({
7449 "description":
7450 "The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`."
7451 }),
7452 "status": Schema.Literals(["uploaded", "processed", "error"]).annotate({
7453 "description":
7454 "Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`."
7455 }),
7456 "status_details": Schema.optionalKey(
7457 Schema.Union([Schema.String, Schema.Null]).annotate({
7458 "description":
7459 "Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`."
7460 })
7461 )
7462 }),
7463 [Schema.Record(Schema.String, Schema.Json)]
7464 ).annotate({
7465 "description": "The `File` object represents a document that has been uploaded to OpenAI.",
7466 "title": "OpenAIFile"
7467 })
7468 ]))
7469}).annotate({ "title": "Upload", "description": "The Upload object can accept byte chunks in the form of Parts.\n" })
7470export type UploadCertificateRequest = { readonly "name"?: string; readonly "certificate": string }
7471export const UploadCertificateRequest = Schema.Struct({
7472 "name": Schema.optionalKey(Schema.String.annotate({ "description": "An optional name for the certificate" })),
7473 "certificate": Schema.String.annotate({ "description": "The certificate content in PEM format" })
7474})
7475export type UploadPart = {
7476 readonly "id": string
7477 readonly "created_at": number
7478 readonly "upload_id": string
7479 readonly "object": "upload.part"
7480}
7481export const UploadPart = Schema.Struct({
7482 "id": Schema.String.annotate({
7483 "description": "The upload Part unique identifier, which can be referenced in API endpoints."
7484 }),
7485 "created_at": Schema.Number.annotate({
7486 "description": "The Unix timestamp (in seconds) for when the Part was created.",
7487 "format": "unixtime"
7488 }).check(Schema.isInt()),
7489 "upload_id": Schema.String.annotate({ "description": "The ID of the Upload object that this Part was added to." }),
7490 "object": Schema.Literal("upload.part").annotate({ "description": "The object type, which is always `upload.part`." })
7491}).annotate({
7492 "title": "UploadPart",
7493 "description": "The upload Part represents a chunk of bytes we can add to an Upload object.\n"
7494})
7495export type UsageAudioSpeechesResult = {
7496 readonly "object": "organization.usage.audio_speeches.result"
7497 readonly "characters": number
7498 readonly "num_model_requests": number
7499 readonly "project_id"?: string | null
7500 readonly "user_id"?: string | null
7501 readonly "api_key_id"?: string | null
7502 readonly "model"?: string | null
7503}
7504export const UsageAudioSpeechesResult = Schema.Struct({
7505 "object": Schema.Literal("organization.usage.audio_speeches.result"),
7506 "characters": Schema.Number.annotate({ "description": "The number of characters processed." }).check(Schema.isInt()),
7507 "num_model_requests": Schema.Number.annotate({ "description": "The count of requests made to the model." }).check(
7508 Schema.isInt()
7509 ),
7510 "project_id": Schema.optionalKey(
7511 Schema.Union([
7512 Schema.String.annotate({
7513 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7514 }),
7515 Schema.Null
7516 ])
7517 ),
7518 "user_id": Schema.optionalKey(
7519 Schema.Union([
7520 Schema.String.annotate({
7521 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7522 }),
7523 Schema.Null
7524 ])
7525 ),
7526 "api_key_id": Schema.optionalKey(
7527 Schema.Union([
7528 Schema.String.annotate({
7529 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7530 }),
7531 Schema.Null
7532 ])
7533 ),
7534 "model": Schema.optionalKey(
7535 Schema.Union([
7536 Schema.String.annotate({
7537 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7538 }),
7539 Schema.Null
7540 ])
7541 )
7542}).annotate({ "description": "The aggregated audio speeches usage details of the specific time bucket." })
7543export type UsageAudioTranscriptionsResult = {
7544 readonly "object": "organization.usage.audio_transcriptions.result"
7545 readonly "seconds": number
7546 readonly "num_model_requests": number
7547 readonly "project_id"?: string | null
7548 readonly "user_id"?: string | null
7549 readonly "api_key_id"?: string | null
7550 readonly "model"?: string | null
7551}
7552export const UsageAudioTranscriptionsResult = Schema.Struct({
7553 "object": Schema.Literal("organization.usage.audio_transcriptions.result"),
7554 "seconds": Schema.Number.annotate({ "description": "The number of seconds processed.", "format": "int64" }).check(
7555 Schema.isInt()
7556 ),
7557 "num_model_requests": Schema.Number.annotate({ "description": "The count of requests made to the model." }).check(
7558 Schema.isInt()
7559 ),
7560 "project_id": Schema.optionalKey(
7561 Schema.Union([
7562 Schema.String.annotate({
7563 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7564 }),
7565 Schema.Null
7566 ])
7567 ),
7568 "user_id": Schema.optionalKey(
7569 Schema.Union([
7570 Schema.String.annotate({
7571 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7572 }),
7573 Schema.Null
7574 ])
7575 ),
7576 "api_key_id": Schema.optionalKey(
7577 Schema.Union([
7578 Schema.String.annotate({
7579 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7580 }),
7581 Schema.Null
7582 ])
7583 ),
7584 "model": Schema.optionalKey(
7585 Schema.Union([
7586 Schema.String.annotate({
7587 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7588 }),
7589 Schema.Null
7590 ])
7591 )
7592}).annotate({ "description": "The aggregated audio transcriptions usage details of the specific time bucket." })
7593export type UsageCodeInterpreterSessionsResult = {
7594 readonly "object": "organization.usage.code_interpreter_sessions.result"
7595 readonly "num_sessions": number
7596 readonly "project_id"?: string | null
7597}
7598export const UsageCodeInterpreterSessionsResult = Schema.Struct({
7599 "object": Schema.Literal("organization.usage.code_interpreter_sessions.result"),
7600 "num_sessions": Schema.Number.annotate({ "description": "The number of code interpreter sessions." }).check(
7601 Schema.isInt()
7602 ),
7603 "project_id": Schema.optionalKey(
7604 Schema.Union([
7605 Schema.String.annotate({
7606 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7607 }),
7608 Schema.Null
7609 ])
7610 )
7611}).annotate({ "description": "The aggregated code interpreter sessions usage details of the specific time bucket." })
7612export type UsageCompletionsResult = {
7613 readonly "object": "organization.usage.completions.result"
7614 readonly "input_tokens": number
7615 readonly "input_cached_tokens"?: number
7616 readonly "output_tokens": number
7617 readonly "input_audio_tokens"?: number
7618 readonly "output_audio_tokens"?: number
7619 readonly "num_model_requests": number
7620 readonly "project_id"?: string | null
7621 readonly "user_id"?: string | null
7622 readonly "api_key_id"?: string | null
7623 readonly "model"?: string | null
7624 readonly "batch"?: boolean | null
7625 readonly "service_tier"?: string | null
7626}
7627export const UsageCompletionsResult = Schema.Struct({
7628 "object": Schema.Literal("organization.usage.completions.result"),
7629 "input_tokens": Schema.Number.annotate({
7630 "description":
7631 "The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens."
7632 }).check(Schema.isInt()),
7633 "input_cached_tokens": Schema.optionalKey(
7634 Schema.Number.annotate({
7635 "description":
7636 "The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens."
7637 }).check(Schema.isInt())
7638 ),
7639 "output_tokens": Schema.Number.annotate({
7640 "description":
7641 "The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens."
7642 }).check(Schema.isInt()),
7643 "input_audio_tokens": Schema.optionalKey(
7644 Schema.Number.annotate({
7645 "description": "The aggregated number of audio input tokens used, including cached tokens."
7646 }).check(Schema.isInt())
7647 ),
7648 "output_audio_tokens": Schema.optionalKey(
7649 Schema.Number.annotate({ "description": "The aggregated number of audio output tokens used." }).check(
7650 Schema.isInt()
7651 )
7652 ),
7653 "num_model_requests": Schema.Number.annotate({ "description": "The count of requests made to the model." }).check(
7654 Schema.isInt()
7655 ),
7656 "project_id": Schema.optionalKey(
7657 Schema.Union([
7658 Schema.String.annotate({
7659 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7660 }),
7661 Schema.Null
7662 ])
7663 ),
7664 "user_id": Schema.optionalKey(
7665 Schema.Union([
7666 Schema.String.annotate({
7667 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7668 }),
7669 Schema.Null
7670 ])
7671 ),
7672 "api_key_id": Schema.optionalKey(
7673 Schema.Union([
7674 Schema.String.annotate({
7675 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7676 }),
7677 Schema.Null
7678 ])
7679 ),
7680 "model": Schema.optionalKey(
7681 Schema.Union([
7682 Schema.String.annotate({
7683 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7684 }),
7685 Schema.Null
7686 ])
7687 ),
7688 "batch": Schema.optionalKey(
7689 Schema.Union([
7690 Schema.Boolean.annotate({
7691 "description": "When `group_by=batch`, this field tells whether the grouped usage result is batch or not."
7692 }),
7693 Schema.Null
7694 ])
7695 ),
7696 "service_tier": Schema.optionalKey(
7697 Schema.Union([
7698 Schema.String.annotate({
7699 "description": "When `group_by=service_tier`, this field provides the service tier of the grouped usage result."
7700 }),
7701 Schema.Null
7702 ])
7703 )
7704}).annotate({ "description": "The aggregated completions usage details of the specific time bucket." })
7705export type UsageEmbeddingsResult = {
7706 readonly "object": "organization.usage.embeddings.result"
7707 readonly "input_tokens": number
7708 readonly "num_model_requests": number
7709 readonly "project_id"?: string | null
7710 readonly "user_id"?: string | null
7711 readonly "api_key_id"?: string | null
7712 readonly "model"?: string | null
7713}
7714export const UsageEmbeddingsResult = Schema.Struct({
7715 "object": Schema.Literal("organization.usage.embeddings.result"),
7716 "input_tokens": Schema.Number.annotate({ "description": "The aggregated number of input tokens used." }).check(
7717 Schema.isInt()
7718 ),
7719 "num_model_requests": Schema.Number.annotate({ "description": "The count of requests made to the model." }).check(
7720 Schema.isInt()
7721 ),
7722 "project_id": Schema.optionalKey(
7723 Schema.Union([
7724 Schema.String.annotate({
7725 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7726 }),
7727 Schema.Null
7728 ])
7729 ),
7730 "user_id": Schema.optionalKey(
7731 Schema.Union([
7732 Schema.String.annotate({
7733 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7734 }),
7735 Schema.Null
7736 ])
7737 ),
7738 "api_key_id": Schema.optionalKey(
7739 Schema.Union([
7740 Schema.String.annotate({
7741 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7742 }),
7743 Schema.Null
7744 ])
7745 ),
7746 "model": Schema.optionalKey(
7747 Schema.Union([
7748 Schema.String.annotate({
7749 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7750 }),
7751 Schema.Null
7752 ])
7753 )
7754}).annotate({ "description": "The aggregated embeddings usage details of the specific time bucket." })
7755export type UsageFileSearchCallsResult = {
7756 readonly "object": "organization.usage.file_searches.result"
7757 readonly "num_requests": number
7758 readonly "project_id"?: string | null
7759 readonly "user_id"?: string | null
7760 readonly "api_key_id"?: string | null
7761 readonly "vector_store_id"?: string | null
7762}
7763export const UsageFileSearchCallsResult = Schema.Struct({
7764 "object": Schema.Literal("organization.usage.file_searches.result"),
7765 "num_requests": Schema.Number.annotate({ "description": "The count of file search calls." }).check(Schema.isInt()),
7766 "project_id": Schema.optionalKey(
7767 Schema.Union([
7768 Schema.String.annotate({
7769 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7770 }),
7771 Schema.Null
7772 ])
7773 ),
7774 "user_id": Schema.optionalKey(
7775 Schema.Union([
7776 Schema.String.annotate({
7777 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7778 }),
7779 Schema.Null
7780 ])
7781 ),
7782 "api_key_id": Schema.optionalKey(
7783 Schema.Union([
7784 Schema.String.annotate({
7785 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7786 }),
7787 Schema.Null
7788 ])
7789 ),
7790 "vector_store_id": Schema.optionalKey(
7791 Schema.Union([
7792 Schema.String.annotate({
7793 "description":
7794 "When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result."
7795 }),
7796 Schema.Null
7797 ])
7798 )
7799}).annotate({ "description": "The aggregated file search calls usage details of the specific time bucket." })
7800export type UsageImagesResult = {
7801 readonly "object": "organization.usage.images.result"
7802 readonly "images": number
7803 readonly "num_model_requests": number
7804 readonly "source"?: string | null
7805 readonly "size"?: string | null
7806 readonly "project_id"?: string | null
7807 readonly "user_id"?: string | null
7808 readonly "api_key_id"?: string | null
7809 readonly "model"?: string | null
7810}
7811export const UsageImagesResult = Schema.Struct({
7812 "object": Schema.Literal("organization.usage.images.result"),
7813 "images": Schema.Number.annotate({ "description": "The number of images processed." }).check(Schema.isInt()),
7814 "num_model_requests": Schema.Number.annotate({ "description": "The count of requests made to the model." }).check(
7815 Schema.isInt()
7816 ),
7817 "source": Schema.optionalKey(
7818 Schema.Union([
7819 Schema.String.annotate({
7820 "description":
7821 "When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`."
7822 }),
7823 Schema.Null
7824 ])
7825 ),
7826 "size": Schema.optionalKey(
7827 Schema.Union([
7828 Schema.String.annotate({
7829 "description": "When `group_by=size`, this field provides the image size of the grouped usage result."
7830 }),
7831 Schema.Null
7832 ])
7833 ),
7834 "project_id": Schema.optionalKey(
7835 Schema.Union([
7836 Schema.String.annotate({
7837 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7838 }),
7839 Schema.Null
7840 ])
7841 ),
7842 "user_id": Schema.optionalKey(
7843 Schema.Union([
7844 Schema.String.annotate({
7845 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7846 }),
7847 Schema.Null
7848 ])
7849 ),
7850 "api_key_id": Schema.optionalKey(
7851 Schema.Union([
7852 Schema.String.annotate({
7853 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7854 }),
7855 Schema.Null
7856 ])
7857 ),
7858 "model": Schema.optionalKey(
7859 Schema.Union([
7860 Schema.String.annotate({
7861 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7862 }),
7863 Schema.Null
7864 ])
7865 )
7866}).annotate({ "description": "The aggregated images usage details of the specific time bucket." })
7867export type UsageModerationsResult = {
7868 readonly "object": "organization.usage.moderations.result"
7869 readonly "input_tokens": number
7870 readonly "num_model_requests": number
7871 readonly "project_id"?: string | null
7872 readonly "user_id"?: string | null
7873 readonly "api_key_id"?: string | null
7874 readonly "model"?: string | null
7875}
7876export const UsageModerationsResult = Schema.Struct({
7877 "object": Schema.Literal("organization.usage.moderations.result"),
7878 "input_tokens": Schema.Number.annotate({ "description": "The aggregated number of input tokens used." }).check(
7879 Schema.isInt()
7880 ),
7881 "num_model_requests": Schema.Number.annotate({ "description": "The count of requests made to the model." }).check(
7882 Schema.isInt()
7883 ),
7884 "project_id": Schema.optionalKey(
7885 Schema.Union([
7886 Schema.String.annotate({
7887 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7888 }),
7889 Schema.Null
7890 ])
7891 ),
7892 "user_id": Schema.optionalKey(
7893 Schema.Union([
7894 Schema.String.annotate({
7895 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7896 }),
7897 Schema.Null
7898 ])
7899 ),
7900 "api_key_id": Schema.optionalKey(
7901 Schema.Union([
7902 Schema.String.annotate({
7903 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7904 }),
7905 Schema.Null
7906 ])
7907 ),
7908 "model": Schema.optionalKey(
7909 Schema.Union([
7910 Schema.String.annotate({
7911 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7912 }),
7913 Schema.Null
7914 ])
7915 )
7916}).annotate({ "description": "The aggregated moderations usage details of the specific time bucket." })
7917export type UsageVectorStoresResult = {
7918 readonly "object": "organization.usage.vector_stores.result"
7919 readonly "usage_bytes": number
7920 readonly "project_id"?: string | null
7921}
7922export const UsageVectorStoresResult = Schema.Struct({
7923 "object": Schema.Literal("organization.usage.vector_stores.result"),
7924 "usage_bytes": Schema.Number.annotate({ "description": "The vector stores usage in bytes." }).check(Schema.isInt()),
7925 "project_id": Schema.optionalKey(
7926 Schema.Union([
7927 Schema.String.annotate({
7928 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7929 }),
7930 Schema.Null
7931 ])
7932 )
7933}).annotate({ "description": "The aggregated vector stores usage details of the specific time bucket." })
7934export type UsageWebSearchCallsResult = {
7935 readonly "object": "organization.usage.web_searches.result"
7936 readonly "num_model_requests": number
7937 readonly "num_requests": number
7938 readonly "project_id"?: string | null
7939 readonly "user_id"?: string | null
7940 readonly "api_key_id"?: string | null
7941 readonly "model"?: string | null
7942 readonly "context_level"?: string | null
7943}
7944export const UsageWebSearchCallsResult = Schema.Struct({
7945 "object": Schema.Literal("organization.usage.web_searches.result"),
7946 "num_model_requests": Schema.Number.annotate({ "description": "The count of model requests." }).check(Schema.isInt()),
7947 "num_requests": Schema.Number.annotate({ "description": "The count of web search calls." }).check(Schema.isInt()),
7948 "project_id": Schema.optionalKey(
7949 Schema.Union([
7950 Schema.String.annotate({
7951 "description": "When `group_by=project_id`, this field provides the project ID of the grouped usage result."
7952 }),
7953 Schema.Null
7954 ])
7955 ),
7956 "user_id": Schema.optionalKey(
7957 Schema.Union([
7958 Schema.String.annotate({
7959 "description": "When `group_by=user_id`, this field provides the user ID of the grouped usage result."
7960 }),
7961 Schema.Null
7962 ])
7963 ),
7964 "api_key_id": Schema.optionalKey(
7965 Schema.Union([
7966 Schema.String.annotate({
7967 "description": "When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result."
7968 }),
7969 Schema.Null
7970 ])
7971 ),
7972 "model": Schema.optionalKey(
7973 Schema.Union([
7974 Schema.String.annotate({
7975 "description": "When `group_by=model`, this field provides the model name of the grouped usage result."
7976 }),
7977 Schema.Null
7978 ])
7979 ),
7980 "context_level": Schema.optionalKey(
7981 Schema.Union([
7982 Schema.String.annotate({
7983 "description":
7984 "When `group_by=context_level`, this field provides the search context size of the grouped usage result."
7985 }),
7986 Schema.Null
7987 ])
7988 )
7989}).annotate({ "description": "The aggregated web search calls usage details of the specific time bucket." })
7990export type User = {
7991 readonly "object": "organization.user"
7992 readonly "id": string
7993 readonly "name"?: string | null
7994 readonly "email"?: string | null
7995 readonly "role"?: string | null
7996 readonly "added_at": number
7997 readonly "is_default"?: boolean
7998 readonly "created"?: number
7999 readonly "user"?: {
8000 readonly "object": "user"
8001 readonly "id": string
8002 readonly "email"?: string | null
8003 readonly "name"?: string | null
8004 readonly "picture"?: string | null
8005 readonly "enabled"?: boolean | null
8006 readonly "banned"?: boolean | null
8007 readonly "banned_at"?: number | null
8008 }
8009 readonly "is_service_account"?: boolean
8010 readonly "is_scale_tier_authorized_purchaser"?: boolean | null
8011 readonly "is_scim_managed"?: boolean
8012 readonly "api_key_last_used_at"?: number | null
8013 readonly "technical_level"?: string | null
8014 readonly "developer_persona"?: string | null
8015 readonly "projects"?: {
8016 readonly "object": "list"
8017 readonly "data": ReadonlyArray<
8018 { readonly "id"?: string | null; readonly "name"?: string | null; readonly "role"?: string | null }
8019 >
8020 } | null
8021}
8022export const User = Schema.Struct({
8023 "object": Schema.Literal("organization.user").annotate({
8024 "description": "The object type, which is always `organization.user`"
8025 }),
8026 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
8027 "name": Schema.optionalKey(
8028 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the user" })
8029 ),
8030 "email": Schema.optionalKey(
8031 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The email address of the user" })
8032 ),
8033 "role": Schema.optionalKey(
8034 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "`owner` or `reader`" })
8035 ),
8036 "added_at": Schema.Number.annotate({
8037 "description": "The Unix timestamp (in seconds) of when the user was added.",
8038 "format": "unixtime"
8039 }).check(Schema.isInt()),
8040 "is_default": Schema.optionalKey(
8041 Schema.Boolean.annotate({ "description": "Whether this is the organization's default user." })
8042 ),
8043 "created": Schema.optionalKey(
8044 Schema.Number.annotate({
8045 "description": "The Unix timestamp (in seconds) of when the user was created.",
8046 "format": "unixtime"
8047 }).check(Schema.isInt())
8048 ),
8049 "user": Schema.optionalKey(
8050 Schema.Struct({
8051 "object": Schema.Literal("user"),
8052 "id": Schema.String,
8053 "email": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
8054 "name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
8055 "picture": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
8056 "enabled": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
8057 "banned": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
8058 "banned_at": Schema.optionalKey(
8059 Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null])
8060 )
8061 }).annotate({ "description": "Nested user details." })
8062 ),
8063 "is_service_account": Schema.optionalKey(
8064 Schema.Boolean.annotate({ "description": "Whether the user is a service account." })
8065 ),
8066 "is_scale_tier_authorized_purchaser": Schema.optionalKey(
8067 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
8068 "description": "Whether the user is an authorized purchaser for Scale Tier."
8069 })
8070 ),
8071 "is_scim_managed": Schema.optionalKey(
8072 Schema.Boolean.annotate({ "description": "Whether the user is managed through SCIM." })
8073 ),
8074 "api_key_last_used_at": Schema.optionalKey(
8075 Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null]).annotate({
8076 "description": "The Unix timestamp (in seconds) of the user's last API key usage."
8077 })
8078 ),
8079 "technical_level": Schema.optionalKey(
8080 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The technical level metadata for the user." })
8081 ),
8082 "developer_persona": Schema.optionalKey(
8083 Schema.Union([Schema.String, Schema.Null]).annotate({
8084 "description": "The developer persona metadata for the user."
8085 })
8086 ),
8087 "projects": Schema.optionalKey(
8088 Schema.Union([
8089 Schema.Struct({
8090 "object": Schema.Literal("list"),
8091 "data": Schema.Array(
8092 Schema.Struct({
8093 "id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
8094 "name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
8095 "role": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]))
8096 })
8097 )
8098 }),
8099 Schema.Null
8100 ]).annotate({ "description": "Projects associated with the user, if included." })
8101 )
8102}).annotate({ "description": "Represents an individual `user` within an organization." })
8103export type UserDeleteResponse = {
8104 readonly "object": "organization.user.deleted"
8105 readonly "id": string
8106 readonly "deleted": boolean
8107}
8108export const UserDeleteResponse = Schema.Struct({
8109 "object": Schema.Literal("organization.user.deleted"),
8110 "id": Schema.String,
8111 "deleted": Schema.Boolean
8112})
8113export type UserRoleUpdateRequest = {
8114 readonly "role"?: string | null
8115 readonly "role_id"?: string | null
8116 readonly "technical_level"?: string | null
8117 readonly "developer_persona"?: string | null
8118}
8119export const UserRoleUpdateRequest = Schema.Struct({
8120 "role": Schema.optionalKey(
8121 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "`owner` or `reader`" })
8122 ),
8123 "role_id": Schema.optionalKey(
8124 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Role ID to assign to the user." })
8125 ),
8126 "technical_level": Schema.optionalKey(
8127 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Technical level metadata." })
8128 ),
8129 "developer_persona": Schema.optionalKey(
8130 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Developer persona metadata." })
8131 )
8132})
8133export type VadConfig = {
8134 readonly "type": "server_vad"
8135 readonly "prefix_padding_ms"?: number
8136 readonly "silence_duration_ms"?: number
8137 readonly "threshold"?: number
8138}
8139export const VadConfig = Schema.Struct({
8140 "type": Schema.Literal("server_vad").annotate({
8141 "description": "Must be set to `server_vad` to enable manual chunking using server side VAD."
8142 }),
8143 "prefix_padding_ms": Schema.optionalKey(
8144 Schema.Number.annotate({
8145 "description": "Amount of audio to include before the VAD detected speech (in \nmilliseconds).\n"
8146 }).check(Schema.isInt())
8147 ),
8148 "silence_duration_ms": Schema.optionalKey(
8149 Schema.Number.annotate({
8150 "description":
8151 "Duration of silence to detect speech stop (in milliseconds).\nWith shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n"
8152 }).check(Schema.isInt())
8153 ),
8154 "threshold": Schema.optionalKey(
8155 Schema.Number.annotate({
8156 "description":
8157 "Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n"
8158 }).check(Schema.isFinite())
8159 )
8160})
8161export type VectorStoreExpirationAfter = { readonly "anchor": "last_active_at"; readonly "days": number }
8162export const VectorStoreExpirationAfter = Schema.Struct({
8163 "anchor": Schema.Literal("last_active_at").annotate({
8164 "description": "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`."
8165 }),
8166 "days": Schema.Number.annotate({
8167 "description": "The number of days after the anchor time that the vector store will expire."
8168 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(365))
8169}).annotate({ "title": "Vector store expiration policy", "description": "The expiration policy for a vector store." })
8170export type VectorStoreFileAttributes = {} | null
8171export const VectorStoreFileAttributes = Schema.Union([
8172 Schema.Struct({}).annotate({
8173 "description":
8174 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard. Keys are strings\nwith a maximum length of 64 characters. Values are strings with a maximum\nlength of 512 characters, booleans, or numbers.\n"
8175 }).check(Schema.isMaxProperties(16)).check(Schema.isPropertyNames(Schema.String.check(Schema.isMaxLength(64)))),
8176 Schema.Null
8177])
8178export type VectorStoreFileBatchObject = {
8179 readonly "id": string
8180 readonly "object": "vector_store.files_batch"
8181 readonly "created_at": number
8182 readonly "vector_store_id": string
8183 readonly "status": "in_progress" | "completed" | "cancelled" | "failed"
8184 readonly "file_counts": {
8185 readonly "in_progress": number
8186 readonly "completed": number
8187 readonly "failed": number
8188 readonly "cancelled": number
8189 readonly "total": number
8190 }
8191}
8192export const VectorStoreFileBatchObject = Schema.Struct({
8193 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
8194 "object": Schema.Literal("vector_store.files_batch").annotate({
8195 "description": "The object type, which is always `vector_store.file_batch`."
8196 }),
8197 "created_at": Schema.Number.annotate({
8198 "description": "The Unix timestamp (in seconds) for when the vector store files batch was created.",
8199 "format": "unixtime"
8200 }).check(Schema.isInt()),
8201 "vector_store_id": Schema.String.annotate({
8202 "description":
8203 "The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to."
8204 }),
8205 "status": Schema.Literals(["in_progress", "completed", "cancelled", "failed"]).annotate({
8206 "description":
8207 "The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`."
8208 }),
8209 "file_counts": Schema.Struct({
8210 "in_progress": Schema.Number.annotate({ "description": "The number of files that are currently being processed." })
8211 .check(Schema.isInt()),
8212 "completed": Schema.Number.annotate({ "description": "The number of files that have been processed." }).check(
8213 Schema.isInt()
8214 ),
8215 "failed": Schema.Number.annotate({ "description": "The number of files that have failed to process." }).check(
8216 Schema.isInt()
8217 ),
8218 "cancelled": Schema.Number.annotate({ "description": "The number of files that where cancelled." }).check(
8219 Schema.isInt()
8220 ),
8221 "total": Schema.Number.annotate({ "description": "The total number of files." }).check(Schema.isInt())
8222 })
8223}).annotate({ "title": "Vector store file batch", "description": "A batch of files attached to a vector store." })
8224export type VectorStoreFileContentResponse = {
8225 readonly "object": "vector_store.file_content.page"
8226 readonly "data": ReadonlyArray<{ readonly "type"?: string; readonly "text"?: string }>
8227 readonly "has_more": boolean
8228 readonly "next_page": string | null
8229}
8230export const VectorStoreFileContentResponse = Schema.Struct({
8231 "object": Schema.Literal("vector_store.file_content.page").annotate({
8232 "description": "The object type, which is always `vector_store.file_content.page`"
8233 }),
8234 "data": Schema.Array(
8235 Schema.Struct({
8236 "type": Schema.optionalKey(
8237 Schema.String.annotate({ "description": "The content type (currently only `\"text\"`)" })
8238 ),
8239 "text": Schema.optionalKey(Schema.String.annotate({ "description": "The text content" }))
8240 })
8241 ).annotate({ "description": "Parsed content of the file." }),
8242 "has_more": Schema.Boolean.annotate({ "description": "Indicates if there are more content pages to fetch." }),
8243 "next_page": Schema.Union([
8244 Schema.String.annotate({ "description": "The token for the next page, if any." }),
8245 Schema.Null
8246 ])
8247}).annotate({ "description": "Represents the parsed content of a vector store file." })
8248export type VectorStoreSearchResultContentObject = { readonly "type": "text"; readonly "text": string }
8249export const VectorStoreSearchResultContentObject = Schema.Struct({
8250 "type": Schema.Literal("text").annotate({ "description": "The type of content." }),
8251 "text": Schema.String.annotate({ "description": "The text content returned from search." })
8252})
8253export type Verbosity = "low" | "medium" | "high" | null
8254export const Verbosity = Schema.Union([
8255 Schema.Literals(["low", "medium", "high"]).annotate({
8256 "description":
8257 "Constrains the verbosity of the model's response. Lower values will result in\nmore concise responses, while higher values will result in more verbose responses.\nCurrently supported values are `low`, `medium`, and `high`.\n"
8258 }),
8259 Schema.Null
8260])
8261export type VoiceConsentDeletedResource = {
8262 readonly "id": string
8263 readonly "object": "audio.voice_consent"
8264 readonly "deleted": boolean
8265}
8266export const VoiceConsentDeletedResource = Schema.Struct({
8267 "id": Schema.String.annotate({ "description": "The consent recording identifier." }),
8268 "object": Schema.Literal("audio.voice_consent"),
8269 "deleted": Schema.Boolean
8270})
8271export type VoiceConsentResource = {
8272 readonly "object": "audio.voice_consent"
8273 readonly "id": string
8274 readonly "name": string
8275 readonly "language": string
8276 readonly "created_at": number
8277}
8278export const VoiceConsentResource = Schema.Struct({
8279 "object": Schema.Literal("audio.voice_consent").annotate({
8280 "description": "The object type, which is always `audio.voice_consent`."
8281 }),
8282 "id": Schema.String.annotate({ "description": "The consent recording identifier." }),
8283 "name": Schema.String.annotate({ "description": "The label provided when the consent recording was uploaded." }),
8284 "language": Schema.String.annotate({
8285 "description": "The BCP 47 language tag for the consent phrase (for example, `en-US`)."
8286 }),
8287 "created_at": Schema.Number.annotate({
8288 "description": "The Unix timestamp (in seconds) for when the consent recording was created.",
8289 "format": "unixtime"
8290 }).check(Schema.isInt())
8291}).annotate({
8292 "title": "Voice consent",
8293 "description": "A consent recording used to authorize creation of a custom voice."
8294})
8295export type VoiceIdsShared =
8296 | string
8297 | "alloy"
8298 | "ash"
8299 | "ballad"
8300 | "coral"
8301 | "echo"
8302 | "sage"
8303 | "shimmer"
8304 | "verse"
8305 | "marin"
8306 | "cedar"
8307export const VoiceIdsShared = Schema.Union([
8308 Schema.String,
8309 Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"])
8310])
8311export type VoiceResource = {
8312 readonly "object": "audio.voice"
8313 readonly "id": string
8314 readonly "name": string
8315 readonly "created_at": number
8316}
8317export const VoiceResource = Schema.Struct({
8318 "object": Schema.Literal("audio.voice").annotate({
8319 "description": "The object type, which is always `audio.voice`."
8320 }),
8321 "id": Schema.String.annotate({ "description": "The voice identifier, which can be referenced in API endpoints." }),
8322 "name": Schema.String.annotate({ "description": "The name of the voice." }),
8323 "created_at": Schema.Number.annotate({
8324 "description": "The Unix timestamp (in seconds) for when the voice was created.",
8325 "format": "unixtime"
8326 }).check(Schema.isInt())
8327}).annotate({ "title": "Voice", "description": "A custom voice that can be used for audio output." })
8328export type WebSearchApproximateLocation = {
8329 readonly "type"?: "approximate"
8330 readonly "country"?: string | null
8331 readonly "region"?: string | null
8332 readonly "city"?: string | null
8333 readonly "timezone"?: string | null
8334} | null
8335export const WebSearchApproximateLocation = Schema.Union([
8336 Schema.Struct({
8337 "type": Schema.optionalKey(
8338 Schema.Literal("approximate").annotate({
8339 "description": "The type of location approximation. Always `approximate`."
8340 })
8341 ),
8342 "country": Schema.optionalKey(
8343 Schema.Union([
8344 Schema.String.annotate({
8345 "description":
8346 "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`."
8347 }),
8348 Schema.Null
8349 ])
8350 ),
8351 "region": Schema.optionalKey(
8352 Schema.Union([
8353 Schema.String.annotate({ "description": "Free text input for the region of the user, e.g. `California`." }),
8354 Schema.Null
8355 ])
8356 ),
8357 "city": Schema.optionalKey(
8358 Schema.Union([
8359 Schema.String.annotate({ "description": "Free text input for the city of the user, e.g. `San Francisco`." }),
8360 Schema.Null
8361 ])
8362 ),
8363 "timezone": Schema.optionalKey(
8364 Schema.Union([
8365 Schema.String.annotate({
8366 "description":
8367 "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`."
8368 }),
8369 Schema.Null
8370 ])
8371 )
8372 }).annotate({ "title": "Web search approximate location", "description": "The approximate location of the user.\n" }),
8373 Schema.Null
8374])
8375export type WebSearchContextSize = "low" | "medium" | "high"
8376export const WebSearchContextSize = Schema.Literals(["low", "medium", "high"]).annotate({
8377 "description":
8378 "High level guidance for the amount of context window space to use for the \nsearch. One of `low`, `medium`, or `high`. `medium` is the default.\n"
8379})
8380export type WebSearchLocation = {
8381 readonly "country"?: string
8382 readonly "region"?: string
8383 readonly "city"?: string
8384 readonly "timezone"?: string
8385}
8386export const WebSearchLocation = Schema.Struct({
8387 "country": Schema.optionalKey(
8388 Schema.String.annotate({
8389 "description":
8390 "The two-letter \n[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,\ne.g. `US`.\n"
8391 })
8392 ),
8393 "region": Schema.optionalKey(
8394 Schema.String.annotate({ "description": "Free text input for the region of the user, e.g. `California`.\n" })
8395 ),
8396 "city": Schema.optionalKey(
8397 Schema.String.annotate({ "description": "Free text input for the city of the user, e.g. `San Francisco`.\n" })
8398 ),
8399 "timezone": Schema.optionalKey(
8400 Schema.String.annotate({
8401 "description":
8402 "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) \nof the user, e.g. `America/Los_Angeles`.\n"
8403 })
8404 )
8405}).annotate({ "title": "Web search location", "description": "Approximate location parameters for the search." })
8406export type WebSearchToolCall = {
8407 readonly "id": string
8408 readonly "type": "web_search_call"
8409 readonly "status": "in_progress" | "searching" | "completed" | "failed" | "incomplete"
8410 readonly "action"?:
8411 | {
8412 readonly "type": "search"
8413 readonly "query"?: string
8414 readonly "queries"?: ReadonlyArray<string>
8415 readonly "sources"?: ReadonlyArray<
8416 { readonly "type": "url"; readonly "url": string } | { readonly "type": "api"; readonly "name": string }
8417 >
8418 }
8419 | { readonly "type": "open_page"; readonly "url"?: string | null }
8420 | { readonly "type": "find_in_page"; readonly "url": string; readonly "pattern": string }
8421}
8422export const WebSearchToolCall = Schema.Struct({
8423 "id": Schema.String.annotate({ "description": "The unique ID of the web search tool call.\n" }),
8424 "type": Schema.Literal("web_search_call").annotate({
8425 "description": "The type of the web search tool call. Always `web_search_call`.\n"
8426 }),
8427 "status": Schema.Literals(["in_progress", "searching", "completed", "failed", "incomplete"]).annotate({
8428 "description": "The status of the web search tool call.\n"
8429 }),
8430 "action": Schema.optionalKey(Schema.Union([
8431 Schema.Struct({
8432 "type": Schema.Literal("search").annotate({ "description": "The action type.\n" }),
8433 "query": Schema.optionalKey(Schema.String.annotate({ "description": "[DEPRECATED] The search query.\n" })),
8434 "queries": Schema.optionalKey(
8435 Schema.Array(Schema.String.annotate({ "description": "A search query.\n" })).annotate({
8436 "title": "Search queries",
8437 "description": "The search queries.\n"
8438 })
8439 ),
8440 "sources": Schema.optionalKey(
8441 Schema.Array(
8442 Schema.Union([
8443 Schema.Struct({
8444 "type": Schema.Literal("url").annotate({ "description": "The type of source. Always `url`.\n" }),
8445 "url": Schema.String.annotate({ "description": "The URL of the source.\n", "format": "uri" })
8446 }).annotate({ "title": "Web search source", "description": "A source used in the search.\n" }),
8447 Schema.Struct({
8448 "type": Schema.Literal("api").annotate({ "description": "The type of source. Always `api`.\n" }),
8449 "name": Schema.String.annotate({
8450 "description": "The name of the API source, such as `oai-weather`, `oai-sports`, or `oai-finance`.\n"
8451 })
8452 }).annotate({ "title": "Web search API source", "description": "An API source used in the search.\n" })
8453 ])
8454 ).annotate({ "title": "Web search sources", "description": "The sources used in the search.\n" })
8455 )
8456 }).annotate({
8457 "title": "Search action",
8458 "description":
8459 "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n"
8460 }),
8461 Schema.Struct({
8462 "type": Schema.Literal("open_page").annotate({ "description": "The action type. Always `open_page`.\n" }),
8463 "url": Schema.optionalKey(
8464 Schema.Union([Schema.String.annotate({ "format": "uri" }), Schema.Null]).annotate({
8465 "description": "The URL opened by the model.\n"
8466 })
8467 )
8468 }).annotate({
8469 "title": "Open page action",
8470 "description":
8471 "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n"
8472 }),
8473 Schema.Struct({
8474 "type": Schema.Literal("find_in_page").annotate({ "description": "The action type.\n" }),
8475 "url": Schema.String.annotate({
8476 "description": "The URL of the page searched for the pattern.\n",
8477 "format": "uri"
8478 }),
8479 "pattern": Schema.String.annotate({ "description": "The pattern or text to search for within the page.\n" })
8480 }).annotate({
8481 "title": "Find action",
8482 "description":
8483 "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n"
8484 })
8485 ], { mode: "oneOf" }))
8486}).annotate({
8487 "title": "Web search tool call",
8488 "description":
8489 "The results of a web search tool call. See the\n[web search guide](/docs/guides/tools-web-search) for more information.\n"
8490})
8491export type SkillReferenceParam = {
8492 readonly "type": "skill_reference"
8493 readonly "skill_id": string
8494 readonly "version"?: string
8495}
8496export const SkillReferenceParam = Schema.Struct({
8497 "type": Schema.Literal("skill_reference").annotate({
8498 "description": "References a skill created with the /v1/skills endpoint."
8499 }),
8500 "skill_id": Schema.String.annotate({ "description": "The ID of the referenced skill." }).check(Schema.isMinLength(1))
8501 .check(Schema.isMaxLength(64)),
8502 "version": Schema.optionalKey(
8503 Schema.String.annotate({
8504 "description": "Optional skill version. Use a positive integer or 'latest'. Omit for default."
8505 })
8506 )
8507})
8508export type InlineSkillParam = {
8509 readonly "type": "inline"
8510 readonly "name": string
8511 readonly "description": string
8512 readonly "source": { readonly "type": "base64"; readonly "media_type": "application/zip"; readonly "data": string }
8513}
8514export const InlineSkillParam = Schema.Struct({
8515 "type": Schema.Literal("inline").annotate({ "description": "Defines an inline skill for this request." }),
8516 "name": Schema.String.annotate({ "description": "The name of the skill." }),
8517 "description": Schema.String.annotate({ "description": "The description of the skill." }),
8518 "source": Schema.Struct({
8519 "type": Schema.Literal("base64").annotate({
8520 "description": "The type of the inline skill source. Must be `base64`."
8521 }),
8522 "media_type": Schema.Literal("application/zip").annotate({
8523 "description": "The media type of the inline skill payload. Must be `application/zip`."
8524 }),
8525 "data": Schema.String.annotate({ "description": "Base64-encoded skill zip bundle." }).check(Schema.isMinLength(1))
8526 .check(Schema.isMaxLength(70254592))
8527 }).annotate({ "description": "Inline skill payload" })
8528})
8529export type ContainerNetworkPolicyDisabledParam = { readonly "type": "disabled" }
8530export const ContainerNetworkPolicyDisabledParam = Schema.Struct({
8531 "type": Schema.Literal("disabled").annotate({ "description": "Disable outbound network access. Always `disabled`." })
8532})
8533export type ContainerNetworkPolicyDomainSecretParam = {
8534 readonly "domain": string
8535 readonly "name": string
8536 readonly "value": string
8537}
8538export const ContainerNetworkPolicyDomainSecretParam = Schema.Struct({
8539 "domain": Schema.String.annotate({ "description": "The domain associated with the secret." }).check(
8540 Schema.isMinLength(1)
8541 ),
8542 "name": Schema.String.annotate({ "description": "The name of the secret to inject for the domain." }).check(
8543 Schema.isMinLength(1)
8544 ),
8545 "value": Schema.String.annotate({ "description": "The secret value to inject for the domain." }).check(
8546 Schema.isMinLength(1)
8547 ).check(Schema.isMaxLength(10485760))
8548})
8549export type IncludeEnum =
8550 | "file_search_call.results"
8551 | "web_search_call.results"
8552 | "web_search_call.action.sources"
8553 | "message.input_image.image_url"
8554 | "computer_call_output.output.image_url"
8555 | "code_interpreter_call.outputs"
8556 | "reasoning.encrypted_content"
8557 | "message.output_text.logprobs"
8558export const IncludeEnum = Schema.Literals([
8559 "file_search_call.results",
8560 "web_search_call.results",
8561 "web_search_call.action.sources",
8562 "message.input_image.image_url",
8563 "computer_call_output.output.image_url",
8564 "code_interpreter_call.outputs",
8565 "reasoning.encrypted_content",
8566 "message.output_text.logprobs"
8567]).annotate({
8568 "description":
8569 "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.results`: Include the search results of the web search tool call.\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program)."
8570})
8571export type InputTextContent = { readonly "type": "input_text"; readonly "text": string }
8572export const InputTextContent = Schema.Struct({
8573 "type": Schema.Literal("input_text").annotate({ "description": "The type of the input item. Always `input_text`." }),
8574 "text": Schema.String.annotate({ "description": "The text input to the model." })
8575}).annotate({ "title": "Input text", "description": "A text input to the model." })
8576export type FileCitationBody = {
8577 readonly "type": "file_citation"
8578 readonly "file_id": string
8579 readonly "index": number
8580 readonly "filename": string
8581}
8582export const FileCitationBody = Schema.Struct({
8583 "type": Schema.Literal("file_citation").annotate({
8584 "description": "The type of the file citation. Always `file_citation`."
8585 }),
8586 "file_id": Schema.String.annotate({ "description": "The ID of the file." }),
8587 "index": Schema.Number.annotate({ "description": "The index of the file in the list of files." }).check(
8588 Schema.isInt()
8589 ),
8590 "filename": Schema.String.annotate({ "description": "The filename of the file cited." })
8591}).annotate({ "title": "File citation", "description": "A citation to a file." })
8592export type UrlCitationBody = {
8593 readonly "type": "url_citation"
8594 readonly "url": string
8595 readonly "start_index": number
8596 readonly "end_index": number
8597 readonly "title": string
8598}
8599export const UrlCitationBody = Schema.Struct({
8600 "type": Schema.Literal("url_citation").annotate({
8601 "description": "The type of the URL citation. Always `url_citation`."
8602 }),
8603 "url": Schema.String.annotate({ "description": "The URL of the web resource.", "format": "uri" }),
8604 "start_index": Schema.Number.annotate({
8605 "description": "The index of the first character of the URL citation in the message."
8606 }).check(Schema.isInt()),
8607 "end_index": Schema.Number.annotate({
8608 "description": "The index of the last character of the URL citation in the message."
8609 }).check(Schema.isInt()),
8610 "title": Schema.String.annotate({ "description": "The title of the web resource." })
8611}).annotate({
8612 "title": "URL citation",
8613 "description": "A citation for a web resource used to generate a model response."
8614})
8615export type ContainerFileCitationBody = {
8616 readonly "type": "container_file_citation"
8617 readonly "container_id": string
8618 readonly "file_id": string
8619 readonly "start_index": number
8620 readonly "end_index": number
8621 readonly "filename": string
8622}
8623export const ContainerFileCitationBody = Schema.Struct({
8624 "type": Schema.Literal("container_file_citation").annotate({
8625 "description": "The type of the container file citation. Always `container_file_citation`."
8626 }),
8627 "container_id": Schema.String.annotate({ "description": "The ID of the container file." }),
8628 "file_id": Schema.String.annotate({ "description": "The ID of the file." }),
8629 "start_index": Schema.Number.annotate({
8630 "description": "The index of the first character of the container file citation in the message."
8631 }).check(Schema.isInt()),
8632 "end_index": Schema.Number.annotate({
8633 "description": "The index of the last character of the container file citation in the message."
8634 }).check(Schema.isInt()),
8635 "filename": Schema.String.annotate({ "description": "The filename of the container file cited." })
8636}).annotate({
8637 "title": "Container file citation",
8638 "description": "A citation for a container file used to generate a model response."
8639})
8640export type TopLogProb = {
8641 readonly "token": string
8642 readonly "logprob": number
8643 readonly "bytes": ReadonlyArray<number>
8644}
8645export const TopLogProb = Schema.Struct({
8646 "token": Schema.String,
8647 "logprob": Schema.Number.check(Schema.isFinite()),
8648 "bytes": Schema.Array(Schema.Number.check(Schema.isInt()))
8649}).annotate({ "title": "Top log probability", "description": "The top log probability of a token." })
8650export type TextContent = { readonly "type": "text"; readonly "text": string }
8651export const TextContent = Schema.Struct({ "type": Schema.Literal("text"), "text": Schema.String }).annotate({
8652 "title": "Text Content",
8653 "description": "A text content."
8654})
8655export type SummaryTextContent = { readonly "type": "summary_text"; readonly "text": string }
8656export const SummaryTextContent = Schema.Struct({
8657 "type": Schema.Literal("summary_text").annotate({ "description": "The type of the object. Always `summary_text`." }),
8658 "text": Schema.String.annotate({ "description": "A summary of the reasoning output from the model so far." })
8659}).annotate({ "title": "Summary text", "description": "A summary text from the model." })
8660export type ReasoningTextContent = { readonly "type": "reasoning_text"; readonly "text": string }
8661export const ReasoningTextContent = Schema.Struct({
8662 "type": Schema.Literal("reasoning_text").annotate({
8663 "description": "The type of the reasoning text. Always `reasoning_text`."
8664 }),
8665 "text": Schema.String.annotate({ "description": "The reasoning text from the model." })
8666}).annotate({ "title": "Reasoning text", "description": "Reasoning text from the model." })
8667export type RefusalContent = { readonly "type": "refusal"; readonly "refusal": string }
8668export const RefusalContent = Schema.Struct({
8669 "type": Schema.Literal("refusal").annotate({ "description": "The type of the refusal. Always `refusal`." }),
8670 "refusal": Schema.String.annotate({ "description": "The refusal explanation from the model." })
8671}).annotate({ "title": "Refusal", "description": "A refusal from the model." })
8672export type InputImageContent = {
8673 readonly "type": "input_image"
8674 readonly "image_url"?: string | null
8675 readonly "file_id"?: string | null
8676 readonly "detail": "low" | "high" | "auto" | "original"
8677}
8678export const InputImageContent = Schema.Struct({
8679 "type": Schema.Literal("input_image").annotate({
8680 "description": "The type of the input item. Always `input_image`."
8681 }),
8682 "image_url": Schema.optionalKey(
8683 Schema.Union([
8684 Schema.String.annotate({
8685 "description":
8686 "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.",
8687 "format": "uri"
8688 }),
8689 Schema.Null
8690 ])
8691 ),
8692 "file_id": Schema.optionalKey(
8693 Schema.Union([
8694 Schema.String.annotate({ "description": "The ID of the file to be sent to the model." }),
8695 Schema.Null
8696 ])
8697 ),
8698 "detail": Schema.Literals(["low", "high", "auto", "original"]).annotate({
8699 "description":
8700 "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`."
8701 })
8702}).annotate({
8703 "title": "Input image",
8704 "description": "An image input to the model. Learn about [image inputs](/docs/guides/vision)."
8705})
8706export type ComputerScreenshotContent = {
8707 readonly "type": "computer_screenshot"
8708 readonly "image_url": string | null
8709 readonly "file_id": string | null
8710 readonly "detail": "low" | "high" | "auto" | "original"
8711}
8712export const ComputerScreenshotContent = Schema.Struct({
8713 "type": Schema.Literal("computer_screenshot").annotate({
8714 "description":
8715 "Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`."
8716 }),
8717 "image_url": Schema.Union([
8718 Schema.String.annotate({ "description": "The URL of the screenshot image.", "format": "uri" }),
8719 Schema.Null
8720 ]),
8721 "file_id": Schema.Union([
8722 Schema.String.annotate({ "description": "The identifier of an uploaded file that contains the screenshot." }),
8723 Schema.Null
8724 ]),
8725 "detail": Schema.Literals(["low", "high", "auto", "original"]).annotate({
8726 "description":
8727 "The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`."
8728 })
8729}).annotate({ "title": "Computer screenshot", "description": "A screenshot of a computer." })
8730export type InputFileContent = {
8731 readonly "type": "input_file"
8732 readonly "file_id"?: string | null
8733 readonly "filename"?: string
8734 readonly "file_data"?: string
8735 readonly "file_url"?: string
8736 readonly "detail"?: "low" | "high"
8737}
8738export const InputFileContent = Schema.Struct({
8739 "type": Schema.Literal("input_file").annotate({ "description": "The type of the input item. Always `input_file`." }),
8740 "file_id": Schema.optionalKey(
8741 Schema.Union([
8742 Schema.String.annotate({ "description": "The ID of the file to be sent to the model." }),
8743 Schema.Null
8744 ])
8745 ),
8746 "filename": Schema.optionalKey(
8747 Schema.String.annotate({ "description": "The name of the file to be sent to the model." })
8748 ),
8749 "file_data": Schema.optionalKey(
8750 Schema.String.annotate({ "description": "The content of the file to be sent to the model.\n" })
8751 ),
8752 "file_url": Schema.optionalKey(
8753 Schema.String.annotate({ "description": "The URL of the file to be sent to the model.", "format": "uri" })
8754 ),
8755 "detail": Schema.optionalKey(
8756 Schema.Literals(["low", "high"]).annotate({
8757 "description":
8758 "The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`."
8759 })
8760 )
8761}).annotate({ "title": "Input file", "description": "A file input to the model." })
8762export type ClickParam = {
8763 readonly "type": "click"
8764 readonly "button": "left" | "right" | "wheel" | "back" | "forward"
8765 readonly "x": number
8766 readonly "y": number
8767 readonly "keys"?: ReadonlyArray<string> | null
8768}
8769export const ClickParam = Schema.Struct({
8770 "type": Schema.Literal("click").annotate({
8771 "description": "Specifies the event type. For a click action, this property is always `click`."
8772 }),
8773 "button": Schema.Literals(["left", "right", "wheel", "back", "forward"]).annotate({
8774 "description":
8775 "Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`."
8776 }),
8777 "x": Schema.Number.annotate({ "description": "The x-coordinate where the click occurred." }).check(Schema.isInt()),
8778 "y": Schema.Number.annotate({ "description": "The y-coordinate where the click occurred." }).check(Schema.isInt()),
8779 "keys": Schema.optionalKey(
8780 Schema.Union([
8781 Schema.Array(Schema.String).annotate({ "description": "The keys being held while clicking." }),
8782 Schema.Null
8783 ])
8784 )
8785}).annotate({ "title": "Click", "description": "A click action." })
8786export type DoubleClickAction = {
8787 readonly "type": "double_click"
8788 readonly "x": number
8789 readonly "y": number
8790 readonly "keys": ReadonlyArray<string> | null
8791}
8792export const DoubleClickAction = Schema.Struct({
8793 "type": Schema.Literal("double_click").annotate({
8794 "description": "Specifies the event type. For a double click action, this property is always set to `double_click`."
8795 }),
8796 "x": Schema.Number.annotate({ "description": "The x-coordinate where the double click occurred." }).check(
8797 Schema.isInt()
8798 ),
8799 "y": Schema.Number.annotate({ "description": "The y-coordinate where the double click occurred." }).check(
8800 Schema.isInt()
8801 ),
8802 "keys": Schema.Union([
8803 Schema.Array(Schema.String).annotate({ "description": "The keys being held while double-clicking." }),
8804 Schema.Null
8805 ])
8806}).annotate({ "title": "DoubleClick", "description": "A double click action." })
8807export type CoordParam = { readonly "x": number; readonly "y": number }
8808export const CoordParam = Schema.Struct({
8809 "x": Schema.Number.annotate({ "description": "The x-coordinate." }).check(Schema.isInt()),
8810 "y": Schema.Number.annotate({ "description": "The y-coordinate." }).check(Schema.isInt())
8811}).annotate({ "title": "Coordinate", "description": "An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`." })
8812export type KeyPressAction = { readonly "type": "keypress"; readonly "keys": ReadonlyArray<string> }
8813export const KeyPressAction = Schema.Struct({
8814 "type": Schema.Literal("keypress").annotate({
8815 "description": "Specifies the event type. For a keypress action, this property is always set to `keypress`."
8816 }),
8817 "keys": Schema.Array(
8818 Schema.String.annotate({ "description": "One of the keys the model is requesting to be pressed." })
8819 ).annotate({
8820 "description":
8821 "The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key."
8822 })
8823}).annotate({ "title": "KeyPress", "description": "A collection of keypresses the model would like to perform." })
8824export type MoveParam = {
8825 readonly "type": "move"
8826 readonly "x": number
8827 readonly "y": number
8828 readonly "keys"?: ReadonlyArray<string> | null
8829}
8830export const MoveParam = Schema.Struct({
8831 "type": Schema.Literal("move").annotate({
8832 "description": "Specifies the event type. For a move action, this property is always set to `move`."
8833 }),
8834 "x": Schema.Number.annotate({ "description": "The x-coordinate to move to." }).check(Schema.isInt()),
8835 "y": Schema.Number.annotate({ "description": "The y-coordinate to move to." }).check(Schema.isInt()),
8836 "keys": Schema.optionalKey(
8837 Schema.Union([
8838 Schema.Array(Schema.String).annotate({ "description": "The keys being held while moving the mouse." }),
8839 Schema.Null
8840 ])
8841 )
8842}).annotate({ "title": "Move", "description": "A mouse move action." })
8843export type ScreenshotParam = { readonly "type": "screenshot" }
8844export const ScreenshotParam = Schema.Struct({
8845 "type": Schema.Literal("screenshot").annotate({
8846 "description": "Specifies the event type. For a screenshot action, this property is always set to `screenshot`."
8847 })
8848}).annotate({ "title": "Screenshot", "description": "A screenshot action." })
8849export type ScrollParam = {
8850 readonly "type": "scroll"
8851 readonly "x": number
8852 readonly "y": number
8853 readonly "scroll_x": number
8854 readonly "scroll_y": number
8855 readonly "keys"?: ReadonlyArray<string> | null
8856}
8857export const ScrollParam = Schema.Struct({
8858 "type": Schema.Literal("scroll").annotate({
8859 "description": "Specifies the event type. For a scroll action, this property is always set to `scroll`."
8860 }),
8861 "x": Schema.Number.annotate({ "description": "The x-coordinate where the scroll occurred." }).check(Schema.isInt()),
8862 "y": Schema.Number.annotate({ "description": "The y-coordinate where the scroll occurred." }).check(Schema.isInt()),
8863 "scroll_x": Schema.Number.annotate({ "description": "The horizontal scroll distance." }).check(Schema.isInt()),
8864 "scroll_y": Schema.Number.annotate({ "description": "The vertical scroll distance." }).check(Schema.isInt()),
8865 "keys": Schema.optionalKey(
8866 Schema.Union([
8867 Schema.Array(Schema.String).annotate({ "description": "The keys being held while scrolling." }),
8868 Schema.Null
8869 ])
8870 )
8871}).annotate({ "title": "Scroll", "description": "A scroll action." })
8872export type TypeParam = { readonly "type": "type"; readonly "text": string }
8873export const TypeParam = Schema.Struct({
8874 "type": Schema.Literal("type").annotate({
8875 "description": "Specifies the event type. For a type action, this property is always set to `type`."
8876 }),
8877 "text": Schema.String.annotate({ "description": "The text to type." })
8878}).annotate({ "title": "Type", "description": "An action to type in text." })
8879export type WaitParam = { readonly "type": "wait" }
8880export const WaitParam = Schema.Struct({
8881 "type": Schema.Literal("wait").annotate({
8882 "description": "Specifies the event type. For a wait action, this property is always set to `wait`."
8883 })
8884}).annotate({ "title": "Wait", "description": "A wait action." })
8885export type ComputerCallSafetyCheckParam = {
8886 readonly "id": string
8887 readonly "code"?: string | null
8888 readonly "message"?: string | null
8889}
8890export const ComputerCallSafetyCheckParam = Schema.Struct({
8891 "id": Schema.String.annotate({ "description": "The ID of the pending safety check." }),
8892 "code": Schema.optionalKey(
8893 Schema.Union([Schema.String.annotate({ "description": "The type of the pending safety check." }), Schema.Null])
8894 ),
8895 "message": Schema.optionalKey(
8896 Schema.Union([Schema.String.annotate({ "description": "Details about the pending safety check." }), Schema.Null])
8897 )
8898}).annotate({ "description": "A pending safety check for the computer call." })
8899export type ToolSearchCall = {
8900 readonly "type": "tool_search_call"
8901 readonly "id": string
8902 readonly "call_id": string | null
8903 readonly "execution": "server" | "client"
8904 readonly "arguments": unknown
8905 readonly "status": "in_progress" | "completed" | "incomplete"
8906 readonly "created_by"?: string
8907}
8908export const ToolSearchCall = Schema.Struct({
8909 "type": Schema.Literal("tool_search_call").annotate({
8910 "description": "The type of the item. Always `tool_search_call`."
8911 }),
8912 "id": Schema.String.annotate({ "description": "The unique ID of the tool search call item." }),
8913 "call_id": Schema.Union([
8914 Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." }),
8915 Schema.Null
8916 ]),
8917 "execution": Schema.Literals(["server", "client"]).annotate({
8918 "description": "Whether tool search was executed by the server or by the client."
8919 }),
8920 "arguments": Schema.Unknown.annotate({ "description": "Arguments used for the tool search call." }),
8921 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
8922 "description": "The status of the tool search call item that was recorded."
8923 }),
8924 "created_by": Schema.optionalKey(
8925 Schema.String.annotate({ "description": "The identifier of the actor that created the item." })
8926 )
8927})
8928export type FunctionTool = {
8929 readonly "type": "function"
8930 readonly "name": string
8931 readonly "description"?: string | null
8932 readonly "parameters": {} | null
8933 readonly "strict": boolean | null
8934 readonly "defer_loading"?: boolean
8935}
8936export const FunctionTool = Schema.Struct({
8937 "type": Schema.Literal("function").annotate({ "description": "The type of the function tool. Always `function`." }),
8938 "name": Schema.String.annotate({ "description": "The name of the function to call." }),
8939 "description": Schema.optionalKey(
8940 Schema.Union([
8941 Schema.String.annotate({
8942 "description":
8943 "A description of the function. Used by the model to determine whether or not to call the function."
8944 }),
8945 Schema.Null
8946 ])
8947 ),
8948 "parameters": Schema.Union([
8949 Schema.Struct({}).annotate({ "description": "A JSON schema object describing the parameters of the function." }),
8950 Schema.Null
8951 ]),
8952 "strict": Schema.Union([
8953 Schema.Boolean.annotate({ "description": "Whether to enforce strict parameter validation. Default `true`." }),
8954 Schema.Null
8955 ]),
8956 "defer_loading": Schema.optionalKey(
8957 Schema.Boolean.annotate({ "description": "Whether this function is deferred and loaded via tool search." })
8958 )
8959}).annotate({
8960 "title": "Function",
8961 "description":
8962 "Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling)."
8963})
8964export type ComputerTool = { readonly "type": "computer" }
8965export const ComputerTool = Schema.Struct({
8966 "type": Schema.Literal("computer").annotate({ "description": "The type of the computer tool. Always `computer`." })
8967}).annotate({
8968 "title": "Computer",
8969 "description":
8970 "A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use)."
8971})
8972export type ComputerUsePreviewTool = {
8973 readonly "type": "computer_use_preview"
8974 readonly "environment": "windows" | "mac" | "linux" | "ubuntu" | "browser"
8975 readonly "display_width": number
8976 readonly "display_height": number
8977}
8978export const ComputerUsePreviewTool = Schema.Struct({
8979 "type": Schema.Literal("computer_use_preview").annotate({
8980 "description": "The type of the computer use tool. Always `computer_use_preview`."
8981 }),
8982 "environment": Schema.Literals(["windows", "mac", "linux", "ubuntu", "browser"]).annotate({
8983 "description": "The type of computer environment to control."
8984 }),
8985 "display_width": Schema.Number.annotate({ "description": "The width of the computer display." }).check(
8986 Schema.isInt()
8987 ),
8988 "display_height": Schema.Number.annotate({ "description": "The height of the computer display." }).check(
8989 Schema.isInt()
8990 )
8991}).annotate({
8992 "title": "Computer use preview",
8993 "description":
8994 "A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use)."
8995})
8996export type InputFidelity = "high" | "low"
8997export const InputFidelity = Schema.Literals(["high", "low"]).annotate({
8998 "description":
8999 "Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`."
9000})
9001export type LocalShellToolParam = { readonly "type": "local_shell" }
9002export const LocalShellToolParam = Schema.Struct({
9003 "type": Schema.Literal("local_shell").annotate({
9004 "description": "The type of the local shell tool. Always `local_shell`."
9005 })
9006}).annotate({
9007 "title": "Local shell tool",
9008 "description": "A tool that allows the model to execute shell commands in a local environment."
9009})
9010export type LocalSkillParam = { readonly "name": string; readonly "description": string; readonly "path": string }
9011export const LocalSkillParam = Schema.Struct({
9012 "name": Schema.String.annotate({ "description": "The name of the skill." }),
9013 "description": Schema.String.annotate({ "description": "The description of the skill." }),
9014 "path": Schema.String.annotate({ "description": "The path to the directory containing the skill." })
9015})
9016export type ContainerReferenceParam = { readonly "type": "container_reference"; readonly "container_id": string }
9017export const ContainerReferenceParam = Schema.Struct({
9018 "type": Schema.Literal("container_reference").annotate({
9019 "description": "References a container created with the /v1/containers endpoint"
9020 }),
9021 "container_id": Schema.String.annotate({ "description": "The ID of the referenced container." })
9022})
9023export type CustomTextFormatParam = { readonly "type": "text" }
9024export const CustomTextFormatParam = Schema.Struct({
9025 "type": Schema.Literal("text").annotate({ "description": "Unconstrained text format. Always `text`." })
9026}).annotate({ "title": "Text format", "description": "Unconstrained free-form text." })
9027export type CustomGrammarFormatParam = {
9028 readonly "type": "grammar"
9029 readonly "syntax": "lark" | "regex"
9030 readonly "definition": string
9031}
9032export const CustomGrammarFormatParam = Schema.Struct({
9033 "type": Schema.Literal("grammar").annotate({ "description": "Grammar format. Always `grammar`." }),
9034 "syntax": Schema.Literals(["lark", "regex"]).annotate({
9035 "description": "The syntax of the grammar definition. One of `lark` or `regex`."
9036 }),
9037 "definition": Schema.String.annotate({ "description": "The grammar definition." })
9038}).annotate({ "title": "Grammar format", "description": "A grammar defined by the user." })
9039export type EmptyModelParam = {}
9040export const EmptyModelParam = Schema.Struct({})
9041export type ToolSearchToolParam = {
9042 readonly "type": "tool_search"
9043 readonly "execution"?: "server" | "client"
9044 readonly "description"?: string | null
9045 readonly "parameters"?: {} | null
9046}
9047export const ToolSearchToolParam = Schema.Struct({
9048 "type": Schema.Literal("tool_search").annotate({ "description": "The type of the tool. Always `tool_search`." }),
9049 "execution": Schema.optionalKey(
9050 Schema.Literals(["server", "client"]).annotate({
9051 "description": "Whether tool search is executed by the server or by the client."
9052 })
9053 ),
9054 "description": Schema.optionalKey(
9055 Schema.Union([
9056 Schema.String.annotate({
9057 "description": "Description shown to the model for a client-executed tool search tool."
9058 }),
9059 Schema.Null
9060 ])
9061 ),
9062 "parameters": Schema.optionalKey(
9063 Schema.Union([
9064 Schema.Struct({}).annotate({ "description": "Parameter schema for a client-executed tool search tool." }),
9065 Schema.Null
9066 ])
9067 )
9068}).annotate({
9069 "title": "Tool search tool",
9070 "description": "Hosted or BYOT tool search configuration for deferred tools."
9071})
9072export type SearchContentType = "text" | "image"
9073export const SearchContentType = Schema.Literals(["text", "image"])
9074export type ApplyPatchToolParam = { readonly "type": "apply_patch" }
9075export const ApplyPatchToolParam = Schema.Struct({
9076 "type": Schema.Literal("apply_patch").annotate({ "description": "The type of the tool. Always `apply_patch`." })
9077}).annotate({
9078 "title": "Apply patch tool",
9079 "description": "Allows the assistant to create, delete, or update files using unified diffs."
9080})
9081export type CompactionBody = {
9082 readonly "type": "compaction"
9083 readonly "id": string
9084 readonly "encrypted_content": string
9085 readonly "created_by"?: string
9086}
9087export const CompactionBody = Schema.Struct({
9088 "type": Schema.Literal("compaction").annotate({ "description": "The type of the item. Always `compaction`." }),
9089 "id": Schema.String.annotate({ "description": "The unique ID of the compaction item." }),
9090 "encrypted_content": Schema.String.annotate({
9091 "description": "The encrypted content that was produced by compaction."
9092 }),
9093 "created_by": Schema.optionalKey(
9094 Schema.String.annotate({ "description": "The identifier of the actor that created the item." })
9095 )
9096}).annotate({
9097 "title": "Compaction item",
9098 "description":
9099 "A compaction item generated by the [`v1/responses/compact` API](/docs/api-reference/responses/compact)."
9100})
9101export type CodeInterpreterOutputLogs = { readonly "type": "logs"; readonly "logs": string }
9102export const CodeInterpreterOutputLogs = Schema.Struct({
9103 "type": Schema.Literal("logs").annotate({ "description": "The type of the output. Always `logs`." }),
9104 "logs": Schema.String.annotate({ "description": "The logs output from the code interpreter." })
9105}).annotate({ "title": "Code interpreter output logs", "description": "The logs output from the code interpreter." })
9106export type CodeInterpreterOutputImage = { readonly "type": "image"; readonly "url": string }
9107export const CodeInterpreterOutputImage = Schema.Struct({
9108 "type": Schema.Literal("image").annotate({ "description": "The type of the output. Always `image`." }),
9109 "url": Schema.String.annotate({
9110 "description": "The URL of the image output from the code interpreter.",
9111 "format": "uri"
9112 })
9113}).annotate({ "title": "Code interpreter output image", "description": "The image output from the code interpreter." })
9114export type LocalShellExecAction = {
9115 readonly "type": "exec"
9116 readonly "command": ReadonlyArray<string>
9117 readonly "timeout_ms"?: number | null
9118 readonly "working_directory"?: string | null
9119 readonly "env": {}
9120 readonly "user"?: string | null
9121}
9122export const LocalShellExecAction = Schema.Struct({
9123 "type": Schema.Literal("exec").annotate({ "description": "The type of the local shell action. Always `exec`." }),
9124 "command": Schema.Array(Schema.String).annotate({ "description": "The command to run." }),
9125 "timeout_ms": Schema.optionalKey(
9126 Schema.Union([
9127 Schema.Number.annotate({ "description": "Optional timeout in milliseconds for the command." }).check(
9128 Schema.isInt()
9129 ),
9130 Schema.Null
9131 ])
9132 ),
9133 "working_directory": Schema.optionalKey(
9134 Schema.Union([
9135 Schema.String.annotate({ "description": "Optional working directory to run the command in." }),
9136 Schema.Null
9137 ])
9138 ),
9139 "env": Schema.Struct({}).annotate({ "description": "Environment variables to set for the command." }),
9140 "user": Schema.optionalKey(
9141 Schema.Union([Schema.String.annotate({ "description": "Optional user to run the command as." }), Schema.Null])
9142 )
9143}).annotate({ "title": "Local shell exec action", "description": "Execute a shell command on the server." })
9144export type LocalEnvironmentResource = { readonly "type": "local" }
9145export const LocalEnvironmentResource = Schema.Struct({
9146 "type": Schema.Literal("local").annotate({ "description": "The environment type. Always `local`." })
9147}).annotate({
9148 "title": "Local Environment",
9149 "description": "Represents the use of a local environment to perform shell actions."
9150})
9151export type ContainerReferenceResource = { readonly "type": "container_reference"; readonly "container_id": string }
9152export const ContainerReferenceResource = Schema.Struct({
9153 "type": Schema.Literal("container_reference").annotate({
9154 "description": "The environment type. Always `container_reference`."
9155 }),
9156 "container_id": Schema.String
9157}).annotate({ "title": "Container Reference", "description": "Represents a container created with /v1/containers." })
9158export type FunctionShellCallOutputTimeoutOutcome = { readonly "type": "timeout" }
9159export const FunctionShellCallOutputTimeoutOutcome = Schema.Struct({
9160 "type": Schema.Literal("timeout").annotate({ "description": "The outcome type. Always `timeout`." })
9161}).annotate({
9162 "title": "Shell call timeout outcome",
9163 "description": "Indicates that the shell call exceeded its configured time limit."
9164})
9165export type FunctionShellCallOutputExitOutcome = { readonly "type": "exit"; readonly "exit_code": number }
9166export const FunctionShellCallOutputExitOutcome = Schema.Struct({
9167 "type": Schema.Literal("exit").annotate({ "description": "The outcome type. Always `exit`." }),
9168 "exit_code": Schema.Number.annotate({ "description": "Exit code from the shell process." }).check(Schema.isInt())
9169}).annotate({
9170 "title": "Shell call exit outcome",
9171 "description": "Indicates that the shell commands finished and returned an exit code."
9172})
9173export type ApplyPatchCreateFileOperation = {
9174 readonly "type": "create_file"
9175 readonly "path": string
9176 readonly "diff": string
9177}
9178export const ApplyPatchCreateFileOperation = Schema.Struct({
9179 "type": Schema.Literal("create_file").annotate({ "description": "Create a new file with the provided diff." }),
9180 "path": Schema.String.annotate({ "description": "Path of the file to create." }),
9181 "diff": Schema.String.annotate({ "description": "Diff to apply." })
9182}).annotate({
9183 "title": "Apply patch create file operation",
9184 "description": "Instruction describing how to create a file via the apply_patch tool."
9185})
9186export type ApplyPatchDeleteFileOperation = { readonly "type": "delete_file"; readonly "path": string }
9187export const ApplyPatchDeleteFileOperation = Schema.Struct({
9188 "type": Schema.Literal("delete_file").annotate({ "description": "Delete the specified file." }),
9189 "path": Schema.String.annotate({ "description": "Path of the file to delete." })
9190}).annotate({
9191 "title": "Apply patch delete file operation",
9192 "description": "Instruction describing how to delete a file via the apply_patch tool."
9193})
9194export type ApplyPatchUpdateFileOperation = {
9195 readonly "type": "update_file"
9196 readonly "path": string
9197 readonly "diff": string
9198}
9199export const ApplyPatchUpdateFileOperation = Schema.Struct({
9200 "type": Schema.Literal("update_file").annotate({ "description": "Update an existing file with the provided diff." }),
9201 "path": Schema.String.annotate({ "description": "Path of the file to update." }),
9202 "diff": Schema.String.annotate({ "description": "Diff to apply." })
9203}).annotate({
9204 "title": "Apply patch update file operation",
9205 "description": "Instruction describing how to update a file via the apply_patch tool."
9206})
9207export type ApplyPatchToolCallOutput = {
9208 readonly "type": "apply_patch_call_output"
9209 readonly "id": string
9210 readonly "call_id": string
9211 readonly "status": "completed" | "failed"
9212 readonly "output"?: string | null
9213 readonly "created_by"?: string
9214}
9215export const ApplyPatchToolCallOutput = Schema.Struct({
9216 "type": Schema.Literal("apply_patch_call_output").annotate({
9217 "description": "The type of the item. Always `apply_patch_call_output`."
9218 }),
9219 "id": Schema.String.annotate({
9220 "description": "The unique ID of the apply patch tool call output. Populated when this item is returned via API."
9221 }),
9222 "call_id": Schema.String.annotate({
9223 "description": "The unique ID of the apply patch tool call generated by the model."
9224 }),
9225 "status": Schema.Literals(["completed", "failed"]).annotate({
9226 "description": "The status of the apply patch tool call output. One of `completed` or `failed`."
9227 }),
9228 "output": Schema.optionalKey(
9229 Schema.Union([
9230 Schema.String.annotate({ "description": "Optional textual output returned by the apply patch tool." }),
9231 Schema.Null
9232 ])
9233 ),
9234 "created_by": Schema.optionalKey(
9235 Schema.String.annotate({ "description": "The ID of the entity that created this tool call output." })
9236 )
9237}).annotate({
9238 "title": "Apply patch tool call output",
9239 "description": "The output emitted by an apply patch tool call."
9240})
9241export type InputTextContentParam = { readonly "type": "input_text"; readonly "text": string }
9242export const InputTextContentParam = Schema.Struct({
9243 "type": Schema.Literal("input_text").annotate({ "description": "The type of the input item. Always `input_text`." }),
9244 "text": Schema.String.annotate({ "description": "The text input to the model." }).check(Schema.isMaxLength(10485760))
9245}).annotate({ "title": "Input text", "description": "A text input to the model." })
9246export type InputImageContentParamAutoParam = {
9247 readonly "type": "input_image"
9248 readonly "image_url"?: string | null
9249 readonly "file_id"?: string | null
9250 readonly "detail"?: "low" | "high" | "auto" | "original" | null
9251}
9252export const InputImageContentParamAutoParam = Schema.Struct({
9253 "type": Schema.Literal("input_image").annotate({
9254 "description": "The type of the input item. Always `input_image`."
9255 }),
9256 "image_url": Schema.optionalKey(
9257 Schema.Union([
9258 Schema.String.annotate({
9259 "description":
9260 "The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.",
9261 "format": "uri"
9262 }).check(Schema.isMaxLength(20971520)),
9263 Schema.Null
9264 ])
9265 ),
9266 "file_id": Schema.optionalKey(
9267 Schema.Union([
9268 Schema.String.annotate({ "description": "The ID of the file to be sent to the model." }),
9269 Schema.Null
9270 ])
9271 ),
9272 "detail": Schema.optionalKey(
9273 Schema.Union([
9274 Schema.Literals(["low", "high", "auto", "original"]).annotate({
9275 "description":
9276 "The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`."
9277 }),
9278 Schema.Null
9279 ])
9280 )
9281}).annotate({
9282 "title": "Input image",
9283 "description": "An image input to the model. Learn about [image inputs](/docs/guides/vision)"
9284})
9285export type InputFileContentParam = {
9286 readonly "type": "input_file"
9287 readonly "file_id"?: string | null
9288 readonly "filename"?: string | null
9289 readonly "file_data"?: string | null
9290 readonly "file_url"?: string | null
9291 readonly "detail"?: "low" | "high"
9292}
9293export const InputFileContentParam = Schema.Struct({
9294 "type": Schema.Literal("input_file").annotate({ "description": "The type of the input item. Always `input_file`." }),
9295 "file_id": Schema.optionalKey(
9296 Schema.Union([
9297 Schema.String.annotate({ "description": "The ID of the file to be sent to the model." }),
9298 Schema.Null
9299 ])
9300 ),
9301 "filename": Schema.optionalKey(
9302 Schema.Union([
9303 Schema.String.annotate({ "description": "The name of the file to be sent to the model." }),
9304 Schema.Null
9305 ])
9306 ),
9307 "file_data": Schema.optionalKey(
9308 Schema.Union([
9309 Schema.String.annotate({ "description": "The base64-encoded data of the file to be sent to the model." }).check(
9310 Schema.isMaxLength(73400320)
9311 ),
9312 Schema.Null
9313 ])
9314 ),
9315 "file_url": Schema.optionalKey(
9316 Schema.Union([
9317 Schema.String.annotate({ "description": "The URL of the file to be sent to the model.", "format": "uri" }),
9318 Schema.Null
9319 ])
9320 ),
9321 "detail": Schema.optionalKey(
9322 Schema.Literals(["low", "high"]).annotate({
9323 "description":
9324 "The detail level of the file to be sent to the model. Use `low` for the default rendering behavior, or `high` to render the file at higher quality. Defaults to `low`."
9325 })
9326 )
9327}).annotate({ "title": "Input file", "description": "A file input to the model." })
9328export type FunctionShellCallOutputTimeoutOutcomeParam = { readonly "type": "timeout" }
9329export const FunctionShellCallOutputTimeoutOutcomeParam = Schema.Struct({
9330 "type": Schema.Literal("timeout").annotate({ "description": "The outcome type. Always `timeout`." })
9331}).annotate({
9332 "title": "Shell call timeout outcome",
9333 "description": "Indicates that the shell call exceeded its configured time limit."
9334})
9335export type FunctionShellCallOutputExitOutcomeParam = { readonly "type": "exit"; readonly "exit_code": number }
9336export const FunctionShellCallOutputExitOutcomeParam = Schema.Struct({
9337 "type": Schema.Literal("exit").annotate({ "description": "The outcome type. Always `exit`." }),
9338 "exit_code": Schema.Number.annotate({ "description": "The exit code returned by the shell process." }).check(
9339 Schema.isInt()
9340 )
9341}).annotate({
9342 "title": "Shell call exit outcome",
9343 "description": "Indicates that the shell commands finished and returned an exit code."
9344})
9345export type ApplyPatchCreateFileOperationParam = {
9346 readonly "type": "create_file"
9347 readonly "path": string
9348 readonly "diff": string
9349}
9350export const ApplyPatchCreateFileOperationParam = Schema.Struct({
9351 "type": Schema.Literal("create_file").annotate({ "description": "The operation type. Always `create_file`." }),
9352 "path": Schema.String.annotate({ "description": "Path of the file to create relative to the workspace root." }).check(
9353 Schema.isMinLength(1)
9354 ),
9355 "diff": Schema.String.annotate({ "description": "Unified diff content to apply when creating the file." }).check(
9356 Schema.isMaxLength(10485760)
9357 )
9358}).annotate({
9359 "title": "Apply patch create file operation",
9360 "description": "Instruction for creating a new file via the apply_patch tool."
9361})
9362export type ApplyPatchDeleteFileOperationParam = { readonly "type": "delete_file"; readonly "path": string }
9363export const ApplyPatchDeleteFileOperationParam = Schema.Struct({
9364 "type": Schema.Literal("delete_file").annotate({ "description": "The operation type. Always `delete_file`." }),
9365 "path": Schema.String.annotate({ "description": "Path of the file to delete relative to the workspace root." }).check(
9366 Schema.isMinLength(1)
9367 )
9368}).annotate({
9369 "title": "Apply patch delete file operation",
9370 "description": "Instruction for deleting an existing file via the apply_patch tool."
9371})
9372export type ApplyPatchUpdateFileOperationParam = {
9373 readonly "type": "update_file"
9374 readonly "path": string
9375 readonly "diff": string
9376}
9377export const ApplyPatchUpdateFileOperationParam = Schema.Struct({
9378 "type": Schema.Literal("update_file").annotate({ "description": "The operation type. Always `update_file`." }),
9379 "path": Schema.String.annotate({ "description": "Path of the file to update relative to the workspace root." }).check(
9380 Schema.isMinLength(1)
9381 ),
9382 "diff": Schema.String.annotate({ "description": "Unified diff content to apply to the existing file." }).check(
9383 Schema.isMaxLength(10485760)
9384 )
9385}).annotate({
9386 "title": "Apply patch update file operation",
9387 "description": "Instruction for updating an existing file via the apply_patch tool."
9388})
9389export type CompactionTriggerItemParam = { readonly "type": "compaction_trigger" }
9390export const CompactionTriggerItemParam = Schema.Struct({
9391 "type": Schema.Literal("compaction_trigger").annotate({
9392 "description": "The type of the item. Always `compaction_trigger`."
9393 })
9394}).annotate({
9395 "title": "Compaction trigger",
9396 "description": "Compacts the current context. Must be the final input item."
9397})
9398export type ItemReferenceParam = { readonly "type"?: "item_reference" | null; readonly "id": string }
9399export const ItemReferenceParam = Schema.Struct({
9400 "type": Schema.optionalKey(
9401 Schema.Union([
9402 Schema.Literal("item_reference").annotate({
9403 "description": "The type of item to reference. Always `item_reference`."
9404 }),
9405 Schema.Null
9406 ])
9407 ),
9408 "id": Schema.String.annotate({ "description": "The ID of the item to reference." })
9409}).annotate({ "title": "Item reference", "description": "An internal identifier for an item to reference." })
9410export type ConversationResource = {
9411 readonly "id": string
9412 readonly "object": "conversation"
9413 readonly "metadata": unknown
9414 readonly "created_at": number
9415}
9416export const ConversationResource = Schema.Struct({
9417 "id": Schema.String.annotate({ "description": "The unique ID of the conversation." }),
9418 "object": Schema.Literal("conversation").annotate({
9419 "description": "The object type, which is always `conversation`."
9420 }),
9421 "metadata": Schema.Unknown.annotate({
9422 "description":
9423 "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters."
9424 }),
9425 "created_at": Schema.Number.annotate({
9426 "description": "The time at which the conversation was created, measured in seconds since the Unix epoch.",
9427 "format": "unixtime"
9428 }).check(Schema.isInt())
9429})
9430export type ImageGenOutputTokensDetails = { readonly "image_tokens": number; readonly "text_tokens": number }
9431export const ImageGenOutputTokensDetails = Schema.Struct({
9432 "image_tokens": Schema.Number.annotate({ "description": "The number of image output tokens generated by the model." })
9433 .check(Schema.isInt()),
9434 "text_tokens": Schema.Number.annotate({ "description": "The number of text output tokens generated by the model." })
9435 .check(Schema.isInt())
9436}).annotate({
9437 "title": "Image generation output token details",
9438 "description": "The output token details for the image generation."
9439})
9440export type ImageGenInputUsageDetails = { readonly "text_tokens": number; readonly "image_tokens": number }
9441export const ImageGenInputUsageDetails = Schema.Struct({
9442 "text_tokens": Schema.Number.annotate({ "description": "The number of text tokens in the input prompt." }).check(
9443 Schema.isInt()
9444 ),
9445 "image_tokens": Schema.Number.annotate({ "description": "The number of image tokens in the input prompt." }).check(
9446 Schema.isInt()
9447 )
9448}).annotate({
9449 "title": "Input usage details",
9450 "description": "The input tokens detailed information for the image generation."
9451})
9452export type SpecificApplyPatchParam = { readonly "type": "apply_patch" }
9453export const SpecificApplyPatchParam = Schema.Struct({
9454 "type": Schema.Literal("apply_patch").annotate({ "description": "The tool to call. Always `apply_patch`." })
9455}).annotate({
9456 "title": "Specific apply patch tool choice",
9457 "description": "Forces the model to call the apply_patch tool when executing a tool call."
9458})
9459export type SpecificFunctionShellParam = { readonly "type": "shell" }
9460export const SpecificFunctionShellParam = Schema.Struct({
9461 "type": Schema.Literal("shell").annotate({ "description": "The tool to call. Always `shell`." })
9462}).annotate({
9463 "title": "Specific shell tool choice",
9464 "description": "Forces the model to call the shell tool when a tool call is required."
9465})
9466export type ConversationParam_2 = { readonly "id": string }
9467export const ConversationParam_2 = Schema.Struct({
9468 "id": Schema.String.annotate({ "description": "The unique ID of the conversation." })
9469}).annotate({ "title": "Conversation object", "description": "The conversation that this response belongs to." })
9470export type ContextManagementParam = { readonly "type": string; readonly "compact_threshold"?: number | null }
9471export const ContextManagementParam = Schema.Struct({
9472 "type": Schema.String.annotate({
9473 "description": "The context management entry type. Currently only 'compaction' is supported."
9474 }),
9475 "compact_threshold": Schema.optionalKey(
9476 Schema.Union([
9477 Schema.Number.annotate({
9478 "description": "Token threshold at which compaction should be triggered for this entry."
9479 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1000)),
9480 Schema.Null
9481 ])
9482 )
9483})
9484export type Conversation_2 = { readonly "id": string }
9485export const Conversation_2 = Schema.Struct({
9486 "id": Schema.String.annotate({
9487 "description": "The unique ID of the conversation that this response was associated with."
9488 })
9489}).annotate({
9490 "title": "Conversation",
9491 "description":
9492 "The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation."
9493})
9494export type UpdateConversationBody = { readonly "metadata": {} | null }
9495export const UpdateConversationBody = Schema.Struct({
9496 "metadata": Schema.Union([
9497 Schema.Struct({}).annotate({
9498 "description":
9499 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
9500 }),
9501 Schema.Null
9502 ]).annotate({
9503 "description":
9504 "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters."
9505 })
9506})
9507export type DeletedConversationResource = {
9508 readonly "object": "conversation.deleted"
9509 readonly "deleted": boolean
9510 readonly "id": string
9511}
9512export const DeletedConversationResource = Schema.Struct({
9513 "object": Schema.Literal("conversation.deleted"),
9514 "deleted": Schema.Boolean,
9515 "id": Schema.String
9516})
9517export type OrderEnum = "asc" | "desc"
9518export const OrderEnum = Schema.Literals(["asc", "desc"])
9519export type VideoResource = {
9520 readonly "id": string
9521 readonly "object": "video"
9522 readonly "model":
9523 | string
9524 | "sora-2"
9525 | "sora-2-pro"
9526 | "sora-2-2025-10-06"
9527 | "sora-2-pro-2025-10-06"
9528 | "sora-2-2025-12-08"
9529 readonly "status": "queued" | "in_progress" | "completed" | "failed"
9530 readonly "progress": number
9531 readonly "created_at": number
9532 readonly "completed_at": number | null
9533 readonly "expires_at": number | null
9534 readonly "prompt": string | null
9535 readonly "size": "720x1280" | "1280x720" | "1024x1792" | "1792x1024"
9536 readonly "seconds": string
9537 readonly "remixed_from_video_id": string | null
9538 readonly "error": { readonly "code": string; readonly "message": string } | null
9539}
9540export const VideoResource = Schema.Struct({
9541 "id": Schema.String.annotate({ "description": "Unique identifier for the video job." }),
9542 "object": Schema.Literal("video").annotate({ "description": "The object type, which is always `video`." }),
9543 "model": Schema.Union([
9544 Schema.String,
9545 Schema.Literals(["sora-2", "sora-2-pro", "sora-2-2025-10-06", "sora-2-pro-2025-10-06", "sora-2-2025-12-08"])
9546 ]).annotate({ "description": "The video generation model that produced the job." }),
9547 "status": Schema.Literals(["queued", "in_progress", "completed", "failed"]).annotate({
9548 "description": "Current lifecycle status of the video job."
9549 }),
9550 "progress": Schema.Number.annotate({ "description": "Approximate completion percentage for the generation task." })
9551 .check(Schema.isInt()),
9552 "created_at": Schema.Number.annotate({
9553 "description": "Unix timestamp (seconds) for when the job was created.",
9554 "format": "unixtime"
9555 }).check(Schema.isInt()),
9556 "completed_at": Schema.Union([
9557 Schema.Number.annotate({
9558 "description": "Unix timestamp (seconds) for when the job completed, if finished.",
9559 "format": "unixtime"
9560 }).check(Schema.isInt()),
9561 Schema.Null
9562 ]),
9563 "expires_at": Schema.Union([
9564 Schema.Number.annotate({
9565 "description": "Unix timestamp (seconds) for when the downloadable assets expire, if set.",
9566 "format": "unixtime"
9567 }).check(Schema.isInt()),
9568 Schema.Null
9569 ]),
9570 "prompt": Schema.Union([
9571 Schema.String.annotate({ "description": "The prompt that was used to generate the video." }),
9572 Schema.Null
9573 ]),
9574 "size": Schema.Literals(["720x1280", "1280x720", "1024x1792", "1792x1024"]).annotate({
9575 "description": "The resolution of the generated video."
9576 }),
9577 "seconds": Schema.String.annotate({
9578 "description": "Duration of the generated clip in seconds. For extensions, this is the stitched total duration."
9579 }),
9580 "remixed_from_video_id": Schema.Union([
9581 Schema.String.annotate({ "description": "Identifier of the source video if this video is a remix." }),
9582 Schema.Null
9583 ]),
9584 "error": Schema.Union([
9585 Schema.Struct({
9586 "code": Schema.String.annotate({ "description": "A machine-readable error code that was returned." }),
9587 "message": Schema.String.annotate({
9588 "description": "A human-readable description of the error that was returned."
9589 })
9590 }).annotate({
9591 "title": "Error",
9592 "description": "Error payload that explains why generation failed, if applicable."
9593 }),
9594 Schema.Null
9595 ])
9596}).annotate({ "title": "Video job", "description": "Structured information describing a generated video job." })
9597export type ImageRefParam_2 = { readonly "image_url"?: string; readonly "file_id"?: string }
9598export const ImageRefParam_2 = Schema.Struct({
9599 "image_url": Schema.optionalKey(
9600 Schema.String.annotate({ "description": "A fully qualified URL or base64-encoded data URL.", "format": "uri" })
9601 .check(Schema.isMaxLength(20971520))
9602 ),
9603 "file_id": Schema.optionalKey(Schema.String)
9604})
9605export type CreateVideoJsonBody = {
9606 readonly "model"?:
9607 | string
9608 | "sora-2"
9609 | "sora-2-pro"
9610 | "sora-2-2025-10-06"
9611 | "sora-2-pro-2025-10-06"
9612 | "sora-2-2025-12-08"
9613 readonly "prompt": string
9614 readonly "input_reference"?: { readonly "image_url"?: string; readonly "file_id"?: string }
9615 readonly "seconds"?: "4" | "8" | "12"
9616 readonly "size"?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024"
9617}
9618export const CreateVideoJsonBody = Schema.Struct({
9619 "model": Schema.optionalKey(
9620 Schema.Union([
9621 Schema.String,
9622 Schema.Literals(["sora-2", "sora-2-pro", "sora-2-2025-10-06", "sora-2-pro-2025-10-06", "sora-2-2025-12-08"])
9623 ]).annotate({
9624 "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`."
9625 })
9626 ),
9627 "prompt": Schema.String.annotate({ "description": "Text prompt that describes the video to generate." }).check(
9628 Schema.isMinLength(1)
9629 ).check(Schema.isMaxLength(32000)),
9630 "input_reference": Schema.optionalKey(
9631 Schema.Struct({
9632 "image_url": Schema.optionalKey(
9633 Schema.String.annotate({ "description": "A fully qualified URL or base64-encoded data URL.", "format": "uri" })
9634 .check(Schema.isMaxLength(20971520))
9635 ),
9636 "file_id": Schema.optionalKey(Schema.String)
9637 }).annotate({
9638 "description":
9639 "Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`."
9640 })
9641 ),
9642 "seconds": Schema.optionalKey(
9643 Schema.Literals(["4", "8", "12"]).annotate({
9644 "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds."
9645 })
9646 ),
9647 "size": Schema.optionalKey(
9648 Schema.Literals(["720x1280", "1280x720", "1024x1792", "1792x1024"]).annotate({
9649 "description":
9650 "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280."
9651 })
9652 )
9653}).annotate({
9654 "title": "Create video JSON request",
9655 "description": "JSON parameters for creating a new video generation job."
9656})
9657export type CreateVideoCharacterBody = { readonly "video": string; readonly "name": string }
9658export const CreateVideoCharacterBody = Schema.Struct({
9659 "video": Schema.String.annotate({ "description": "Video file used to create a character.", "format": "binary" }),
9660 "name": Schema.String.annotate({ "description": "Display name for this API character." }).check(Schema.isMinLength(1))
9661 .check(Schema.isMaxLength(80))
9662}).annotate({
9663 "title": "Create character request",
9664 "description": "Parameters for creating a character from an uploaded video."
9665})
9666export type VideoCharacterResource = {
9667 readonly "id": string | null
9668 readonly "name": string | null
9669 readonly "created_at": number
9670}
9671export const VideoCharacterResource = Schema.Struct({
9672 "id": Schema.Union([
9673 Schema.String.annotate({ "description": "Identifier for the character creation cameo." }),
9674 Schema.Null
9675 ]),
9676 "name": Schema.Union([Schema.String.annotate({ "description": "Display name for the character." }), Schema.Null]),
9677 "created_at": Schema.Number.annotate({
9678 "description": "Unix timestamp (in seconds) when the character was created.",
9679 "format": "unixtime"
9680 }).check(Schema.isInt())
9681})
9682export type VideoReferenceInputParam = { readonly "id": string }
9683export const VideoReferenceInputParam = Schema.Struct({
9684 "id": Schema.String.annotate({ "description": "The identifier of the completed video." })
9685}).annotate({ "description": "Reference to the completed video." })
9686export type CreateVideoEditJsonBody = { readonly "video": { readonly "id": string }; readonly "prompt": string }
9687export const CreateVideoEditJsonBody = Schema.Struct({
9688 "video": Schema.Struct({ "id": Schema.String.annotate({ "description": "The identifier of the completed video." }) })
9689 .annotate({ "description": "Reference to the completed video to edit." }),
9690 "prompt": Schema.String.annotate({ "description": "Text prompt that describes how to edit the source video." }).check(
9691 Schema.isMinLength(1)
9692 ).check(Schema.isMaxLength(32000))
9693}).annotate({
9694 "title": "Create video edit JSON request",
9695 "description": "JSON parameters for editing an existing generated video."
9696})
9697export type CreateVideoExtendJsonBody = {
9698 readonly "video": { readonly "id": string }
9699 readonly "prompt": string
9700 readonly "seconds": "4" | "8" | "12"
9701}
9702export const CreateVideoExtendJsonBody = Schema.Struct({
9703 "video": Schema.Struct({ "id": Schema.String.annotate({ "description": "The identifier of the completed video." }) })
9704 .annotate({ "description": "Reference to the completed video to extend." }),
9705 "prompt": Schema.String.annotate({ "description": "Updated text prompt that directs the extension generation." })
9706 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(32000)),
9707 "seconds": Schema.Literals(["4", "8", "12"]).annotate({
9708 "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)."
9709 })
9710}).annotate({
9711 "title": "Create video extension JSON request",
9712 "description": "JSON parameters for extending an existing generated video."
9713})
9714export type DeletedVideoResource = {
9715 readonly "object": "video.deleted"
9716 readonly "deleted": boolean
9717 readonly "id": string
9718}
9719export const DeletedVideoResource = Schema.Struct({
9720 "object": Schema.Literal("video.deleted").annotate({
9721 "description": "The object type that signals the deletion response."
9722 }),
9723 "deleted": Schema.Boolean.annotate({ "description": "Indicates that the video resource was deleted." }),
9724 "id": Schema.String.annotate({ "description": "Identifier of the deleted video." })
9725}).annotate({
9726 "title": "Deleted video response",
9727 "description": "Confirmation payload returned after deleting a video."
9728})
9729export type VideoContentVariant = "video" | "thumbnail" | "spritesheet"
9730export const VideoContentVariant = Schema.Literals(["video", "thumbnail", "spritesheet"])
9731export type CreateVideoRemixBody = { readonly "prompt": string }
9732export const CreateVideoRemixBody = Schema.Struct({
9733 "prompt": Schema.String.annotate({ "description": "Updated text prompt that directs the remix generation." }).check(
9734 Schema.isMinLength(1)
9735 ).check(Schema.isMaxLength(32000))
9736}).annotate({
9737 "title": "Create video remix request",
9738 "description": "Parameters for remixing an existing generated video."
9739})
9740export type TokenCountsResource = { readonly "object": "response.input_tokens"; readonly "input_tokens": number }
9741export const TokenCountsResource = Schema.Struct({
9742 "object": Schema.Literal("response.input_tokens"),
9743 "input_tokens": Schema.Number.check(Schema.isInt())
9744}).annotate({ "title": "Token counts" })
9745export type SkillResource = {
9746 readonly "id": string
9747 readonly "object": "skill"
9748 readonly "name": string
9749 readonly "description": string
9750 readonly "created_at": number
9751 readonly "default_version": string
9752 readonly "latest_version": string
9753}
9754export const SkillResource = Schema.Struct({
9755 "id": Schema.String.annotate({ "description": "Unique identifier for the skill." }),
9756 "object": Schema.Literal("skill").annotate({ "description": "The object type, which is `skill`." }),
9757 "name": Schema.String.annotate({ "description": "Name of the skill." }),
9758 "description": Schema.String.annotate({ "description": "Description of the skill." }),
9759 "created_at": Schema.Number.annotate({
9760 "description": "Unix timestamp (seconds) for when the skill was created.",
9761 "format": "unixtime"
9762 }).check(Schema.isInt()),
9763 "default_version": Schema.String.annotate({ "description": "Default version for the skill." }),
9764 "latest_version": Schema.String.annotate({ "description": "Latest version for the skill." })
9765})
9766export type CreateSkillBody = { readonly "files": ReadonlyArray<string> | string }
9767export const CreateSkillBody = Schema.Struct({
9768 "files": Schema.Union([
9769 Schema.Array(Schema.String.annotate({ "format": "binary" })).annotate({
9770 "description": "Skill files to upload (directory upload) or a single zip file."
9771 }).check(Schema.isMaxLength(500)),
9772 Schema.String.annotate({ "description": "Skill zip file to upload.", "format": "binary" })
9773 ], { mode: "oneOf" })
9774}).annotate({
9775 "title": "Create skill request",
9776 "description": "Uploads a skill either as a directory (multipart `files[]`) or as a single zip file."
9777})
9778export type SetDefaultSkillVersionBody = { readonly "default_version": string }
9779export const SetDefaultSkillVersionBody = Schema.Struct({
9780 "default_version": Schema.String.annotate({ "description": "The skill version number to set as default." })
9781}).annotate({ "title": "Update skill request", "description": "Updates the default version pointer for a skill." })
9782export type DeletedSkillResource = {
9783 readonly "object": "skill.deleted"
9784 readonly "deleted": boolean
9785 readonly "id": string
9786}
9787export const DeletedSkillResource = Schema.Struct({
9788 "object": Schema.Literal("skill.deleted"),
9789 "deleted": Schema.Boolean,
9790 "id": Schema.String
9791})
9792export type SkillVersionResource = {
9793 readonly "object": "skill.version"
9794 readonly "id": string
9795 readonly "skill_id": string
9796 readonly "version": string
9797 readonly "created_at": number
9798 readonly "name": string
9799 readonly "description": string
9800}
9801export const SkillVersionResource = Schema.Struct({
9802 "object": Schema.Literal("skill.version").annotate({ "description": "The object type, which is `skill.version`." }),
9803 "id": Schema.String.annotate({ "description": "Unique identifier for the skill version." }),
9804 "skill_id": Schema.String.annotate({ "description": "Identifier of the skill for this version." }),
9805 "version": Schema.String.annotate({ "description": "Version number for this skill." }),
9806 "created_at": Schema.Number.annotate({
9807 "description": "Unix timestamp (seconds) for when the version was created.",
9808 "format": "unixtime"
9809 }).check(Schema.isInt()),
9810 "name": Schema.String.annotate({ "description": "Name of the skill version." }),
9811 "description": Schema.String.annotate({ "description": "Description of the skill version." })
9812})
9813export type CreateSkillVersionBody = { readonly "files": ReadonlyArray<string> | string; readonly "default"?: boolean }
9814export const CreateSkillVersionBody = Schema.Struct({
9815 "files": Schema.Union([
9816 Schema.Array(Schema.String.annotate({ "format": "binary" })).annotate({
9817 "description": "Skill files to upload (directory upload) or a single zip file."
9818 }).check(Schema.isMaxLength(500)),
9819 Schema.String.annotate({ "description": "Skill zip file to upload.", "format": "binary" })
9820 ], { mode: "oneOf" }),
9821 "default": Schema.optionalKey(
9822 Schema.Boolean.annotate({ "description": "Whether to set this version as the default." })
9823 )
9824}).annotate({ "title": "Create skill version request", "description": "Uploads a new immutable version of a skill." })
9825export type DeletedSkillVersionResource = {
9826 readonly "object": "skill.version.deleted"
9827 readonly "deleted": boolean
9828 readonly "id": string
9829 readonly "version": string
9830}
9831export const DeletedSkillVersionResource = Schema.Struct({
9832 "object": Schema.Literal("skill.version.deleted"),
9833 "deleted": Schema.Boolean,
9834 "id": Schema.String,
9835 "version": Schema.String.annotate({ "description": "The deleted skill version." })
9836})
9837export type ChatSessionResource = {
9838 readonly "id": string
9839 readonly "object": "chatkit.session"
9840 readonly "expires_at": number
9841 readonly "client_secret": string
9842 readonly "workflow": {
9843 readonly "id": string
9844 readonly "version": string | null
9845 readonly "state_variables": {} | null
9846 readonly "tracing": { readonly "enabled": boolean }
9847 }
9848 readonly "user": string
9849 readonly "rate_limits": { readonly "max_requests_per_1_minute": number }
9850 readonly "max_requests_per_1_minute": number
9851 readonly "status": "active" | "expired" | "cancelled"
9852 readonly "chatkit_configuration": {
9853 readonly "automatic_thread_titling": { readonly "enabled": boolean }
9854 readonly "file_upload": {
9855 readonly "enabled": boolean
9856 readonly "max_file_size": number | null
9857 readonly "max_files": number | null
9858 }
9859 readonly "history": { readonly "enabled": boolean; readonly "recent_threads": number | null }
9860 }
9861}
9862export const ChatSessionResource = Schema.Struct({
9863 "id": Schema.String.annotate({ "description": "Identifier for the ChatKit session." }),
9864 "object": Schema.Literal("chatkit.session").annotate({
9865 "description": "Type discriminator that is always `chatkit.session`."
9866 }),
9867 "expires_at": Schema.Number.annotate({
9868 "description": "Unix timestamp (in seconds) for when the session expires.",
9869 "format": "unixtime"
9870 }).check(Schema.isInt()),
9871 "client_secret": Schema.String.annotate({
9872 "description": "Ephemeral client secret that authenticates session requests."
9873 }),
9874 "workflow": Schema.Struct({
9875 "id": Schema.String.annotate({ "description": "Identifier of the workflow backing the session." }),
9876 "version": Schema.Union([
9877 Schema.String.annotate({
9878 "description":
9879 "Specific workflow version used for the session. Defaults to null when using the latest deployment."
9880 }),
9881 Schema.Null
9882 ]),
9883 "state_variables": Schema.Union([
9884 Schema.Struct({}).annotate({
9885 "description":
9886 "State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided."
9887 }),
9888 Schema.Null
9889 ]),
9890 "tracing": Schema.Struct({
9891 "enabled": Schema.Boolean.annotate({ "description": "Indicates whether tracing is enabled." })
9892 }).annotate({ "title": "Tracing Configuration", "description": "Tracing settings applied to the workflow." })
9893 }).annotate({ "title": "Workflow", "description": "Workflow metadata for the session." }),
9894 "user": Schema.String.annotate({ "description": "User identifier associated with the session." }),
9895 "rate_limits": Schema.Struct({
9896 "max_requests_per_1_minute": Schema.Number.annotate({
9897 "description": "Maximum allowed requests per one-minute window."
9898 }).check(Schema.isInt())
9899 }).annotate({ "title": "Rate limits", "description": "Resolved rate limit values." }),
9900 "max_requests_per_1_minute": Schema.Number.annotate({
9901 "description": "Convenience copy of the per-minute request limit."
9902 }).check(Schema.isInt()),
9903 "status": Schema.Literals(["active", "expired", "cancelled"]).annotate({
9904 "description": "Current lifecycle state of the session."
9905 }),
9906 "chatkit_configuration": Schema.Struct({
9907 "automatic_thread_titling": Schema.Struct({
9908 "enabled": Schema.Boolean.annotate({ "description": "Whether automatic thread titling is enabled." })
9909 }).annotate({ "title": "Automatic thread titling", "description": "Automatic thread titling preferences." }),
9910 "file_upload": Schema.Struct({
9911 "enabled": Schema.Boolean.annotate({ "description": "Indicates if uploads are enabled for the session." }),
9912 "max_file_size": Schema.Union([
9913 Schema.Number.annotate({ "description": "Maximum upload size in megabytes." }).check(Schema.isInt()),
9914 Schema.Null
9915 ]),
9916 "max_files": Schema.Union([
9917 Schema.Number.annotate({ "description": "Maximum number of uploads allowed during the session." }).check(
9918 Schema.isInt()
9919 ),
9920 Schema.Null
9921 ])
9922 }).annotate({ "title": "File upload settings", "description": "Upload settings for the session." }),
9923 "history": Schema.Struct({
9924 "enabled": Schema.Boolean.annotate({ "description": "Indicates if chat history is persisted for the session." }),
9925 "recent_threads": Schema.Union([
9926 Schema.Number.annotate({
9927 "description":
9928 "Number of prior threads surfaced in history views. Defaults to null when all history is retained."
9929 }).check(Schema.isInt()),
9930 Schema.Null
9931 ])
9932 }).annotate({ "title": "History settings", "description": "History retention configuration." })
9933 }).annotate({
9934 "title": "ChatKit configuration",
9935 "description": "Resolved ChatKit feature configuration for the session."
9936 })
9937}).annotate({
9938 "title": "The chat session object",
9939 "description": "Represents a ChatKit session and its resolved configuration."
9940})
9941export type CreateChatSessionBody = {
9942 readonly "workflow": {
9943 readonly "id": string
9944 readonly "version"?: string
9945 readonly "state_variables"?: {}
9946 readonly "tracing"?: { readonly "enabled"?: boolean }
9947 }
9948 readonly "user": string
9949 readonly "expires_after"?: { readonly "anchor": "created_at"; readonly "seconds": number }
9950 readonly "rate_limits"?: { readonly "max_requests_per_1_minute"?: number }
9951 readonly "chatkit_configuration"?: {
9952 readonly "automatic_thread_titling"?: { readonly "enabled"?: boolean }
9953 readonly "file_upload"?: {
9954 readonly "enabled"?: boolean
9955 readonly "max_file_size"?: number
9956 readonly "max_files"?: number
9957 }
9958 readonly "history"?: { readonly "enabled"?: boolean; readonly "recent_threads"?: number }
9959 }
9960}
9961export const CreateChatSessionBody = Schema.Struct({
9962 "workflow": Schema.Struct({
9963 "id": Schema.String.annotate({ "description": "Identifier for the workflow invoked by the session." }),
9964 "version": Schema.optionalKey(
9965 Schema.String.annotate({
9966 "description": "Specific workflow version to run. Defaults to the latest deployed version."
9967 })
9968 ),
9969 "state_variables": Schema.optionalKey(
9970 Schema.Struct({}).annotate({
9971 "description":
9972 "State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object."
9973 }).check(Schema.isMaxProperties(64))
9974 ),
9975 "tracing": Schema.optionalKey(
9976 Schema.Struct({
9977 "enabled": Schema.optionalKey(
9978 Schema.Boolean.annotate({ "description": "Whether tracing is enabled during the session. Defaults to true." })
9979 )
9980 }).annotate({
9981 "title": "Tracing Configuration",
9982 "description":
9983 "Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default."
9984 })
9985 )
9986 }).annotate({ "title": "Workflow settings", "description": "Workflow that powers the session." }),
9987 "user": Schema.String.annotate({
9988 "description":
9989 "A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope."
9990 }).check(Schema.isMinLength(1)),
9991 "expires_after": Schema.optionalKey(
9992 Schema.Struct({
9993 "anchor": Schema.Literal("created_at").annotate({
9994 "description": "Base timestamp used to calculate expiration. Currently fixed to `created_at`."
9995 }),
9996 "seconds": Schema.Number.annotate({
9997 "description": "Number of seconds after the anchor when the session expires.",
9998 "format": "int64"
9999 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(600))
10000 }).annotate({
10001 "title": "Expiration overrides",
10002 "description": "Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes."
10003 })
10004 ),
10005 "rate_limits": Schema.optionalKey(
10006 Schema.Struct({
10007 "max_requests_per_1_minute": Schema.optionalKey(
10008 Schema.Number.annotate({
10009 "description": "Maximum number of requests allowed per minute for the session. Defaults to 10."
10010 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
10011 )
10012 }).annotate({
10013 "title": "Rate limit overrides",
10014 "description": "Optional override for per-minute request limits. When omitted, defaults to 10."
10015 })
10016 ),
10017 "chatkit_configuration": Schema.optionalKey(
10018 Schema.Struct({
10019 "automatic_thread_titling": Schema.optionalKey(
10020 Schema.Struct({
10021 "enabled": Schema.optionalKey(
10022 Schema.Boolean.annotate({ "description": "Enable automatic thread title generation. Defaults to true." })
10023 )
10024 }).annotate({
10025 "title": "Automatic thread titling configuration",
10026 "description":
10027 "Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default."
10028 })
10029 ),
10030 "file_upload": Schema.optionalKey(
10031 Schema.Struct({
10032 "enabled": Schema.optionalKey(
10033 Schema.Boolean.annotate({ "description": "Enable uploads for this session. Defaults to false." })
10034 ),
10035 "max_file_size": Schema.optionalKey(
10036 Schema.Number.annotate({
10037 "description":
10038 "Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size."
10039 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(512))
10040 ),
10041 "max_files": Schema.optionalKey(
10042 Schema.Number.annotate({
10043 "description": "Maximum number of files that can be uploaded to the session. Defaults to 10."
10044 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
10045 )
10046 }).annotate({
10047 "title": "File upload configuration",
10048 "description":
10049 "Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB)."
10050 })
10051 ),
10052 "history": Schema.optionalKey(
10053 Schema.Struct({
10054 "enabled": Schema.optionalKey(
10055 Schema.Boolean.annotate({
10056 "description": "Enables chat users to access previous ChatKit threads. Defaults to true."
10057 })
10058 ),
10059 "recent_threads": Schema.optionalKey(
10060 Schema.Number.annotate({
10061 "description": "Number of recent ChatKit threads users have access to. Defaults to unlimited when unset."
10062 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1))
10063 )
10064 }).annotate({
10065 "title": "Chat history configuration",
10066 "description":
10067 "Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null)."
10068 })
10069 )
10070 }).annotate({
10071 "title": "ChatKit configuration overrides",
10072 "description": "Optional overrides for ChatKit runtime configuration features"
10073 })
10074 )
10075}).annotate({
10076 "title": "Create chat session request",
10077 "description": "Parameters for provisioning a new ChatKit session."
10078})
10079export type UserMessageInputText = { readonly "type": "input_text"; readonly "text": string }
10080export const UserMessageInputText = Schema.Struct({
10081 "type": Schema.Literal("input_text").annotate({ "description": "Type discriminator that is always `input_text`." }),
10082 "text": Schema.String.annotate({ "description": "Plain-text content supplied by the user." })
10083}).annotate({ "title": "User message input", "description": "Text block that a user contributed to the thread." })
10084export type UserMessageQuotedText = { readonly "type": "quoted_text"; readonly "text": string }
10085export const UserMessageQuotedText = Schema.Struct({
10086 "type": Schema.Literal("quoted_text").annotate({ "description": "Type discriminator that is always `quoted_text`." }),
10087 "text": Schema.String.annotate({ "description": "Quoted text content." })
10088}).annotate({
10089 "title": "User message quoted text",
10090 "description": "Quoted snippet that the user referenced in their message."
10091})
10092export type Attachment = {
10093 readonly "type": "image" | "file"
10094 readonly "id": string
10095 readonly "name": string
10096 readonly "mime_type": string
10097 readonly "preview_url": string | null
10098}
10099export const Attachment = Schema.Struct({
10100 "type": Schema.Literals(["image", "file"]).annotate({ "description": "Attachment discriminator." }),
10101 "id": Schema.String.annotate({ "description": "Identifier for the attachment." }),
10102 "name": Schema.String.annotate({ "description": "Original display name for the attachment." }),
10103 "mime_type": Schema.String.annotate({ "description": "MIME type of the attachment." }),
10104 "preview_url": Schema.Union([
10105 Schema.String.annotate({ "description": "Preview URL for rendering the attachment inline.", "format": "uri" }),
10106 Schema.Null
10107 ])
10108}).annotate({ "title": "Attachment", "description": "Attachment metadata included on thread items." })
10109export type FileAnnotation = {
10110 readonly "type": "file"
10111 readonly "source": { readonly "type": "file"; readonly "filename": string }
10112}
10113export const FileAnnotation = Schema.Struct({
10114 "type": Schema.Literal("file").annotate({
10115 "description": "Type discriminator that is always `file` for this annotation."
10116 }),
10117 "source": Schema.Struct({
10118 "type": Schema.Literal("file").annotate({ "description": "Type discriminator that is always `file`." }),
10119 "filename": Schema.String.annotate({ "description": "Filename referenced by the annotation." })
10120 }).annotate({ "title": "File annotation source", "description": "File attachment referenced by the annotation." })
10121}).annotate({ "title": "File annotation", "description": "Annotation that references an uploaded file." })
10122export type UrlAnnotation = {
10123 readonly "type": "url"
10124 readonly "source": { readonly "type": "url"; readonly "url": string }
10125}
10126export const UrlAnnotation = Schema.Struct({
10127 "type": Schema.Literal("url").annotate({
10128 "description": "Type discriminator that is always `url` for this annotation."
10129 }),
10130 "source": Schema.Struct({
10131 "type": Schema.Literal("url").annotate({ "description": "Type discriminator that is always `url`." }),
10132 "url": Schema.String.annotate({ "description": "URL referenced by the annotation.", "format": "uri" })
10133 }).annotate({ "title": "URL annotation source", "description": "URL referenced by the annotation." })
10134}).annotate({ "title": "URL annotation", "description": "Annotation that references a URL." })
10135export type WidgetMessageItem = {
10136 readonly "id": string
10137 readonly "object": "chatkit.thread_item"
10138 readonly "created_at": number
10139 readonly "thread_id": string
10140 readonly "type": "chatkit.widget"
10141 readonly "widget": string
10142}
10143export const WidgetMessageItem = Schema.Struct({
10144 "id": Schema.String.annotate({ "description": "Identifier of the thread item." }),
10145 "object": Schema.Literal("chatkit.thread_item").annotate({
10146 "description": "Type discriminator that is always `chatkit.thread_item`."
10147 }),
10148 "created_at": Schema.Number.annotate({
10149 "description": "Unix timestamp (in seconds) for when the item was created.",
10150 "format": "unixtime"
10151 }).check(Schema.isInt()),
10152 "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }),
10153 "type": Schema.Literal("chatkit.widget").annotate({
10154 "description": "Type discriminator that is always `chatkit.widget`."
10155 }),
10156 "widget": Schema.String.annotate({ "description": "Serialized widget payload rendered in the UI." })
10157}).annotate({ "title": "Widget message", "description": "Thread item that renders a widget payload." })
10158export type ClientToolCallItem = {
10159 readonly "id": string
10160 readonly "object": "chatkit.thread_item"
10161 readonly "created_at": number
10162 readonly "thread_id": string
10163 readonly "type": "chatkit.client_tool_call"
10164 readonly "status": "in_progress" | "completed"
10165 readonly "call_id": string
10166 readonly "name": string
10167 readonly "arguments": string
10168 readonly "output": string | null
10169}
10170export const ClientToolCallItem = Schema.Struct({
10171 "id": Schema.String.annotate({ "description": "Identifier of the thread item." }),
10172 "object": Schema.Literal("chatkit.thread_item").annotate({
10173 "description": "Type discriminator that is always `chatkit.thread_item`."
10174 }),
10175 "created_at": Schema.Number.annotate({
10176 "description": "Unix timestamp (in seconds) for when the item was created.",
10177 "format": "unixtime"
10178 }).check(Schema.isInt()),
10179 "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }),
10180 "type": Schema.Literal("chatkit.client_tool_call").annotate({
10181 "description": "Type discriminator that is always `chatkit.client_tool_call`."
10182 }),
10183 "status": Schema.Literals(["in_progress", "completed"]).annotate({
10184 "description": "Execution status for the tool call."
10185 }),
10186 "call_id": Schema.String.annotate({ "description": "Identifier for the client tool call." }),
10187 "name": Schema.String.annotate({ "description": "Tool name that was invoked." }),
10188 "arguments": Schema.String.annotate({ "description": "JSON-encoded arguments that were sent to the tool." }),
10189 "output": Schema.Union([
10190 Schema.String.annotate({
10191 "description": "JSON-encoded output captured from the tool. Defaults to null while execution is in progress."
10192 }),
10193 Schema.Null
10194 ])
10195}).annotate({
10196 "title": "Client tool call",
10197 "description": "Record of a client side tool invocation initiated by the assistant."
10198})
10199export type TaskItem = {
10200 readonly "id": string
10201 readonly "object": "chatkit.thread_item"
10202 readonly "created_at": number
10203 readonly "thread_id": string
10204 readonly "type": "chatkit.task"
10205 readonly "task_type": "custom" | "thought"
10206 readonly "heading": string | null
10207 readonly "summary": string | null
10208}
10209export const TaskItem = Schema.Struct({
10210 "id": Schema.String.annotate({ "description": "Identifier of the thread item." }),
10211 "object": Schema.Literal("chatkit.thread_item").annotate({
10212 "description": "Type discriminator that is always `chatkit.thread_item`."
10213 }),
10214 "created_at": Schema.Number.annotate({
10215 "description": "Unix timestamp (in seconds) for when the item was created.",
10216 "format": "unixtime"
10217 }).check(Schema.isInt()),
10218 "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }),
10219 "type": Schema.Literal("chatkit.task").annotate({
10220 "description": "Type discriminator that is always `chatkit.task`."
10221 }),
10222 "task_type": Schema.Literals(["custom", "thought"]).annotate({ "description": "Subtype for the task." }),
10223 "heading": Schema.Union([
10224 Schema.String.annotate({ "description": "Optional heading for the task. Defaults to null when not provided." }),
10225 Schema.Null
10226 ]),
10227 "summary": Schema.Union([
10228 Schema.String.annotate({
10229 "description": "Optional summary that describes the task. Defaults to null when omitted."
10230 }),
10231 Schema.Null
10232 ])
10233}).annotate({
10234 "title": "Task item",
10235 "description": "Task emitted by the workflow to show progress and status updates."
10236})
10237export type TaskGroupTask = {
10238 readonly "type": "custom" | "thought"
10239 readonly "heading": string | null
10240 readonly "summary": string | null
10241}
10242export const TaskGroupTask = Schema.Struct({
10243 "type": Schema.Literals(["custom", "thought"]).annotate({ "description": "Subtype for the grouped task." }),
10244 "heading": Schema.Union([
10245 Schema.String.annotate({
10246 "description": "Optional heading for the grouped task. Defaults to null when not provided."
10247 }),
10248 Schema.Null
10249 ]),
10250 "summary": Schema.Union([
10251 Schema.String.annotate({
10252 "description": "Optional summary that describes the grouped task. Defaults to null when omitted."
10253 }),
10254 Schema.Null
10255 ])
10256}).annotate({ "title": "Task group task", "description": "Task entry that appears within a TaskGroup." })
10257export type ActiveStatus = { readonly "type": "active" }
10258export const ActiveStatus = Schema.Struct({
10259 "type": Schema.Literal("active").annotate({ "description": "Status discriminator that is always `active`." })
10260}).annotate({ "title": "Active thread status", "description": "Indicates that a thread is active." })
10261export type LockedStatus = { readonly "type": "locked"; readonly "reason": string | null }
10262export const LockedStatus = Schema.Struct({
10263 "type": Schema.Literal("locked").annotate({ "description": "Status discriminator that is always `locked`." }),
10264 "reason": Schema.Union([
10265 Schema.String.annotate({
10266 "description": "Reason that the thread was locked. Defaults to null when no reason is recorded."
10267 }),
10268 Schema.Null
10269 ])
10270}).annotate({
10271 "title": "Locked thread status",
10272 "description": "Indicates that a thread is locked and cannot accept new input."
10273})
10274export type ClosedStatus = { readonly "type": "closed"; readonly "reason": string | null }
10275export const ClosedStatus = Schema.Struct({
10276 "type": Schema.Literal("closed").annotate({ "description": "Status discriminator that is always `closed`." }),
10277 "reason": Schema.Union([
10278 Schema.String.annotate({
10279 "description": "Reason that the thread was closed. Defaults to null when no reason is recorded."
10280 }),
10281 Schema.Null
10282 ])
10283}).annotate({ "title": "Closed thread status", "description": "Indicates that a thread has been closed." })
10284export type DeletedThreadResource = {
10285 readonly "id": string
10286 readonly "object": "chatkit.thread.deleted"
10287 readonly "deleted": boolean
10288}
10289export const DeletedThreadResource = Schema.Struct({
10290 "id": Schema.String.annotate({ "description": "Identifier of the deleted thread." }),
10291 "object": Schema.Literal("chatkit.thread.deleted").annotate({
10292 "description": "Type discriminator that is always `chatkit.thread.deleted`."
10293 }),
10294 "deleted": Schema.Boolean.annotate({ "description": "Indicates that the thread has been deleted." })
10295}).annotate({ "title": "Deleted thread", "description": "Confirmation payload returned after deleting a thread." })
10296export type ResponseKeepAliveEvent = { readonly "type": "keepalive"; readonly "sequence_number": number }
10297export const ResponseKeepAliveEvent = Schema.Struct({
10298 "type": Schema.Literal("keepalive").annotate({
10299 "description": "The type of the keepalive event. Always `keepalive`."
10300 }),
10301 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this keepalive event." }).check(
10302 Schema.isInt()
10303 )
10304}).annotate({ "title": "Keep alive", "description": "A keepalive event emitted during long-running response streams." })
10305export type ResponseApplyPatchCallOperationDiffDeltaEvent = {
10306 readonly "type": "response.apply_patch_call_operation_diff.delta"
10307 readonly "sequence_number": number
10308 readonly "output_index": number
10309 readonly "item_id": string
10310 readonly "delta": string
10311}
10312export const ResponseApplyPatchCallOperationDiffDeltaEvent = Schema.Struct({
10313 "type": Schema.Literal("response.apply_patch_call_operation_diff.delta").annotate({
10314 "description": "The event type identifier."
10315 }),
10316 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
10317 Schema.isInt()
10318 ),
10319 "output_index": Schema.Number.annotate({ "description": "The index of the output this delta applies to." }).check(
10320 Schema.isInt()
10321 ),
10322 "item_id": Schema.String.annotate({
10323 "description": "Unique identifier for the API item associated with this event."
10324 }),
10325 "delta": Schema.String.annotate({ "description": "The incremental diff data for the apply_patch tool call." })
10326}).annotate({
10327 "title": "ResponseApplyPatchCallOperationDiffDelta",
10328 "description": "Event representing a delta for an apply_patch tool call operation diff."
10329})
10330export type ResponseApplyPatchCallOperationDiffDoneEvent = {
10331 readonly "type": "response.apply_patch_call_operation_diff.done"
10332 readonly "sequence_number": number
10333 readonly "output_index": number
10334 readonly "item_id": string
10335 readonly "delta"?: string
10336}
10337export const ResponseApplyPatchCallOperationDiffDoneEvent = Schema.Struct({
10338 "type": Schema.Literal("response.apply_patch_call_operation_diff.done").annotate({
10339 "description": "The event type identifier."
10340 }),
10341 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
10342 Schema.isInt()
10343 ),
10344 "output_index": Schema.Number.annotate({ "description": "The index of the output this event applies to." }).check(
10345 Schema.isInt()
10346 ),
10347 "item_id": Schema.String.annotate({
10348 "description": "Unique identifier for the API item associated with this event."
10349 }),
10350 "delta": Schema.optionalKey(
10351 Schema.String.annotate({ "description": "The final diff data for the apply_patch tool call." })
10352 )
10353}).annotate({
10354 "title": "ResponseApplyPatchCallOperationDiffDone",
10355 "description": "Event indicating that the operation diff for an apply_patch tool call is complete."
10356})
10357export type ApiKeyList = {
10358 readonly "object": "list"
10359 readonly "data": ReadonlyArray<AdminApiKey>
10360 readonly "has_more": boolean
10361 readonly "first_id"?: string | null
10362 readonly "last_id"?: string | null
10363}
10364export const ApiKeyList = Schema.Struct({
10365 "object": Schema.Literal("list"),
10366 "data": Schema.Array(AdminApiKey),
10367 "has_more": Schema.Boolean,
10368 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
10369 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]))
10370})
10371export type RoleListResource = {
10372 readonly "object": "list"
10373 readonly "data": ReadonlyArray<AssignedRoleDetails>
10374 readonly "has_more": boolean
10375 readonly "next": string | null
10376}
10377export const RoleListResource = Schema.Struct({
10378 "object": Schema.Literal("list").annotate({ "description": "Always `list`." }),
10379 "data": Schema.Array(AssignedRoleDetails).annotate({
10380 "description": "Role assignments returned in the current page."
10381 }),
10382 "has_more": Schema.Boolean.annotate({
10383 "description": "Whether additional assignments are available when paginating."
10384 }),
10385 "next": Schema.Union([Schema.String, Schema.Null]).annotate({
10386 "description": "Cursor to fetch the next page of results, or `null` when there are no more assignments."
10387 })
10388}).annotate({ "description": "Paginated list of roles assigned to a principal." })
10389export type AuditLogActorApiKey = {
10390 readonly "id"?: string
10391 readonly "type"?: "user" | "service_account"
10392 readonly "user"?: AuditLogActorUser
10393 readonly "service_account"?: AuditLogActorServiceAccount
10394}
10395export const AuditLogActorApiKey = Schema.Struct({
10396 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The tracking id of the API key." })),
10397 "type": Schema.optionalKey(
10398 Schema.Literals(["user", "service_account"]).annotate({
10399 "description": "The type of API key. Can be either `user` or `service_account`."
10400 })
10401 ),
10402 "user": Schema.optionalKey(AuditLogActorUser),
10403 "service_account": Schema.optionalKey(AuditLogActorServiceAccount)
10404}).annotate({ "description": "The API Key used to perform the audit logged action." })
10405export type AuditLogActorSession = { readonly "user"?: AuditLogActorUser; readonly "ip_address"?: string }
10406export const AuditLogActorSession = Schema.Struct({
10407 "user": Schema.optionalKey(AuditLogActorUser),
10408 "ip_address": Schema.optionalKey(
10409 Schema.String.annotate({ "description": "The IP address from which the action was performed." })
10410 )
10411}).annotate({ "description": "The session in which the audit logged action was performed." })
10412export type ChatCompletionAllowedToolsChoice = {
10413 readonly "type": "allowed_tools"
10414 readonly "allowed_tools": ChatCompletionAllowedTools
10415}
10416export const ChatCompletionAllowedToolsChoice = Schema.Struct({
10417 "type": Schema.Literal("allowed_tools").annotate({
10418 "description": "Allowed tool configuration type. Always `allowed_tools`."
10419 }),
10420 "allowed_tools": ChatCompletionAllowedTools
10421}).annotate({
10422 "title": "Allowed tools",
10423 "description": "Constrains the tools available to the model to a pre-defined set.\n"
10424})
10425export type ChatCompletionMessageToolCalls = ReadonlyArray<
10426 ChatCompletionMessageToolCall | ChatCompletionMessageCustomToolCall
10427>
10428export const ChatCompletionMessageToolCalls = Schema.Array(
10429 Schema.Union([ChatCompletionMessageToolCall, ChatCompletionMessageCustomToolCall], { mode: "oneOf" })
10430).annotate({ "description": "The tool calls generated by the model, such as function calls." })
10431export type ChatCompletionStreamResponseDelta = {
10432 readonly "content"?: string | null
10433 readonly "function_call"?: { readonly "arguments"?: string; readonly "name"?: string }
10434 readonly "tool_calls"?: ReadonlyArray<ChatCompletionMessageToolCallChunk>
10435 readonly "role"?: "developer" | "system" | "user" | "assistant" | "tool"
10436 readonly "refusal"?: string | null
10437}
10438export const ChatCompletionStreamResponseDelta = Schema.Struct({
10439 "content": Schema.optionalKey(
10440 Schema.Union([Schema.String.annotate({ "description": "The contents of the chunk message." }), Schema.Null])
10441 ),
10442 "function_call": Schema.optionalKey(
10443 Schema.Struct({
10444 "arguments": Schema.optionalKey(Schema.String.annotate({
10445 "description":
10446 "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
10447 })),
10448 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function to call." }))
10449 }).annotate({
10450 "description":
10451 "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."
10452 })
10453 ),
10454 "tool_calls": Schema.optionalKey(Schema.Array(ChatCompletionMessageToolCallChunk)),
10455 "role": Schema.optionalKey(
10456 Schema.Literals(["developer", "system", "user", "assistant", "tool"]).annotate({
10457 "description": "The role of the author of this message."
10458 })
10459 ),
10460 "refusal": Schema.optionalKey(
10461 Schema.Union([
10462 Schema.String.annotate({ "description": "The refusal message generated by the model." }),
10463 Schema.Null
10464 ])
10465 )
10466}).annotate({ "description": "A chat completion delta generated by streamed model responses." })
10467export type ChatCompletionRequestAssistantMessageContentPart =
10468 | ChatCompletionRequestMessageContentPartText
10469 | ChatCompletionRequestMessageContentPartRefusal
10470export const ChatCompletionRequestAssistantMessageContentPart = Schema.Union([
10471 ChatCompletionRequestMessageContentPartText,
10472 ChatCompletionRequestMessageContentPartRefusal
10473], { mode: "oneOf" })
10474export type ChatCompletionRequestDeveloperMessage = {
10475 readonly "content": string | ReadonlyArray<ChatCompletionRequestMessageContentPartText>
10476 readonly "role": "developer"
10477 readonly "name"?: string
10478}
10479export const ChatCompletionRequestDeveloperMessage = Schema.Struct({
10480 "content": Schema.Union([
10481 Schema.String.annotate({ "title": "Text content", "description": "The contents of the developer message." }),
10482 Schema.Array(ChatCompletionRequestMessageContentPartText).annotate({
10483 "title": "Array of content parts",
10484 "description":
10485 "An array of content parts with a defined type. For developer messages, only type `text` is supported."
10486 }).check(Schema.isMinLength(1))
10487 ], { mode: "oneOf" }).annotate({ "description": "The contents of the developer message." }),
10488 "role": Schema.Literal("developer").annotate({
10489 "description": "The role of the messages author, in this case `developer`."
10490 }),
10491 "name": Schema.optionalKey(
10492 Schema.String.annotate({
10493 "description":
10494 "An optional name for the participant. Provides the model information to differentiate between participants of the same role."
10495 })
10496 )
10497}).annotate({
10498 "title": "Developer message",
10499 "description":
10500 "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, `developer` messages\nreplace the previous `system` messages.\n"
10501})
10502export type ChatCompletionRequestSystemMessageContentPart = ChatCompletionRequestMessageContentPartText
10503export const ChatCompletionRequestSystemMessageContentPart = Schema.Union(
10504 [ChatCompletionRequestMessageContentPartText],
10505 { mode: "oneOf" }
10506)
10507export type ChatCompletionRequestToolMessageContentPart = ChatCompletionRequestMessageContentPartText
10508export const ChatCompletionRequestToolMessageContentPart = Schema.Union([ChatCompletionRequestMessageContentPartText], {
10509 mode: "oneOf"
10510})
10511export type ChatCompletionRequestUserMessageContentPart =
10512 | ChatCompletionRequestMessageContentPartText
10513 | ChatCompletionRequestMessageContentPartImage
10514 | ChatCompletionRequestMessageContentPartAudio
10515 | ChatCompletionRequestMessageContentPartFile
10516export const ChatCompletionRequestUserMessageContentPart = Schema.Union([
10517 ChatCompletionRequestMessageContentPartText,
10518 ChatCompletionRequestMessageContentPartImage,
10519 ChatCompletionRequestMessageContentPartAudio,
10520 ChatCompletionRequestMessageContentPartFile
10521], { mode: "oneOf" })
10522export type PredictionContent = {
10523 readonly "type": "content"
10524 readonly "content": string | ReadonlyArray<ChatCompletionRequestMessageContentPartText>
10525}
10526export const PredictionContent = Schema.Struct({
10527 "type": Schema.Literal("content").annotate({
10528 "description": "The type of the predicted content you want to provide. This type is\ncurrently always `content`.\n"
10529 }),
10530 "content": Schema.Union([
10531 Schema.String.annotate({
10532 "title": "Text content",
10533 "description":
10534 "The content used for a Predicted Output. This is often the\ntext of a file you are regenerating with minor changes.\n"
10535 }),
10536 Schema.Array(ChatCompletionRequestMessageContentPartText).annotate({
10537 "title": "Array of content parts",
10538 "description":
10539 "An array of content parts with a defined type. Supported options differ based on the [model](/docs/models) being used to generate the response. Can contain text inputs."
10540 }).check(Schema.isMinLength(1))
10541 ], { mode: "oneOf" }).annotate({
10542 "description":
10543 "The content that should be matched when generating a model response.\nIf generated tokens would match this content, the entire model response\ncan be returned much more quickly.\n"
10544 })
10545}).annotate({
10546 "title": "Static Content",
10547 "description": "Static predicted output content, such as the content of a text file that is\nbeing regenerated.\n"
10548})
10549export type CompoundFilter = {
10550 readonly "type": "and" | "or"
10551 readonly "filters": ReadonlyArray<ComparisonFilter | unknown>
10552}
10553export const CompoundFilter = Schema.Struct({
10554 "type": Schema.Literals(["and", "or"]).annotate({ "description": "Type of operation: `and` or `or`." }),
10555 "filters": Schema.Array(Schema.Union([ComparisonFilter, Schema.Unknown], { mode: "oneOf" })).annotate({
10556 "description": "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`."
10557 })
10558}).annotate({ "title": "Compound Filter", "description": "Combine multiple filters using `and` or `or`." })
10559export type CreateCompletionResponse = {
10560 readonly "id": string
10561 readonly "choices": ReadonlyArray<
10562 {
10563 readonly "finish_reason": "stop" | "length" | "content_filter"
10564 readonly "index": number
10565 readonly "logprobs": {
10566 readonly "text_offset"?: ReadonlyArray<number>
10567 readonly "token_logprobs"?: ReadonlyArray<number>
10568 readonly "tokens"?: ReadonlyArray<string>
10569 readonly "top_logprobs"?: ReadonlyArray<{}>
10570 } | null
10571 readonly "text": string
10572 }
10573 >
10574 readonly "created": number
10575 readonly "model": string
10576 readonly "system_fingerprint"?: string
10577 readonly "object": "text_completion"
10578 readonly "usage"?: CompletionUsage
10579}
10580export const CreateCompletionResponse = Schema.Struct({
10581 "id": Schema.String.annotate({ "description": "A unique identifier for the completion." }),
10582 "choices": Schema.Array(Schema.Struct({
10583 "finish_reason": Schema.Literals(["stop", "length", "content_filter"]).annotate({
10584 "description":
10585 "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\nor `content_filter` if content was omitted due to a flag from our content filters.\n"
10586 }),
10587 "index": Schema.Number.check(Schema.isInt()),
10588 "logprobs": Schema.Union([
10589 Schema.Struct({
10590 "text_offset": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))),
10591 "token_logprobs": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isFinite()))),
10592 "tokens": Schema.optionalKey(Schema.Array(Schema.String)),
10593 "top_logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({})))
10594 }),
10595 Schema.Null
10596 ]),
10597 "text": Schema.String
10598 })).annotate({ "description": "The list of completion choices the model generated for the input prompt." }),
10599 "created": Schema.Number.annotate({
10600 "description": "The Unix timestamp (in seconds) of when the completion was created.",
10601 "format": "unixtime"
10602 }).check(Schema.isInt()),
10603 "model": Schema.String.annotate({ "description": "The model used for completion." }),
10604 "system_fingerprint": Schema.optionalKey(
10605 Schema.String.annotate({
10606 "description":
10607 "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"
10608 })
10609 ),
10610 "object": Schema.Literal("text_completion").annotate({
10611 "description": "The object type, which is always \"text_completion\""
10612 }),
10613 "usage": Schema.optionalKey(CompletionUsage)
10614}).annotate({
10615 "description":
10616 "Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).\n"
10617})
10618export type ContainerFileListResource = {
10619 readonly "object": "list"
10620 readonly "data": ReadonlyArray<ContainerFileResource>
10621 readonly "first_id": string
10622 readonly "last_id": string
10623 readonly "has_more": boolean
10624}
10625export const ContainerFileListResource = Schema.Struct({
10626 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be 'list'." }),
10627 "data": Schema.Array(ContainerFileResource).annotate({ "description": "A list of container files." }),
10628 "first_id": Schema.String.annotate({ "description": "The ID of the first file in the list." }),
10629 "last_id": Schema.String.annotate({ "description": "The ID of the last file in the list." }),
10630 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more files available." })
10631})
10632export type ContainerListResource = {
10633 readonly "object": "list"
10634 readonly "data": ReadonlyArray<ContainerResource>
10635 readonly "first_id": string
10636 readonly "last_id": string
10637 readonly "has_more": boolean
10638}
10639export const ContainerListResource = Schema.Struct({
10640 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be 'list'." }),
10641 "data": Schema.Array(ContainerResource).annotate({ "description": "A list of containers." }),
10642 "first_id": Schema.String.annotate({ "description": "The ID of the first container in the list." }),
10643 "last_id": Schema.String.annotate({ "description": "The ID of the last container in the list." }),
10644 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more containers available." })
10645})
10646export type CreateEmbeddingResponse = {
10647 readonly "data": ReadonlyArray<Embedding>
10648 readonly "model": string
10649 readonly "object": "list"
10650 readonly "usage": { readonly "prompt_tokens": number; readonly "total_tokens": number }
10651}
10652export const CreateEmbeddingResponse = Schema.Struct({
10653 "data": Schema.Array(Embedding).annotate({ "description": "The list of embeddings generated by the model." }),
10654 "model": Schema.String.annotate({ "description": "The name of the model used to generate the embedding." }),
10655 "object": Schema.Literal("list").annotate({ "description": "The object type, which is always \"list\"." }),
10656 "usage": Schema.Struct({
10657 "prompt_tokens": Schema.Number.annotate({ "description": "The number of tokens used by the prompt." }).check(
10658 Schema.isInt()
10659 ),
10660 "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used by the request." }).check(
10661 Schema.isInt()
10662 )
10663 }).annotate({ "description": "The usage information for the request." })
10664})
10665export type ErrorEvent = { readonly "event": "error"; readonly "data": Error }
10666export const ErrorEvent = Schema.Struct({ "event": Schema.Literal("error"), "data": Error }).annotate({
10667 "description":
10668 "Occurs when an [error](/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout."
10669})
10670export type ErrorResponse = { readonly "error": Error }
10671export const ErrorResponse = Schema.Struct({ "error": Error })
10672export type EvalRunOutputItem = {
10673 readonly "object": "eval.run.output_item"
10674 readonly "id": string
10675 readonly "run_id": string
10676 readonly "eval_id": string
10677 readonly "created_at": number
10678 readonly "status": string
10679 readonly "datasource_item_id": number
10680 readonly "datasource_item": {}
10681 readonly "results": ReadonlyArray<EvalRunOutputItemResult>
10682 readonly "sample": {
10683 readonly "input": ReadonlyArray<{ readonly "role": string; readonly "content": string }>
10684 readonly "output": ReadonlyArray<{ readonly "role"?: string; readonly "content"?: string }>
10685 readonly "finish_reason": string
10686 readonly "model": string
10687 readonly "usage": {
10688 readonly "total_tokens": number
10689 readonly "completion_tokens": number
10690 readonly "prompt_tokens": number
10691 readonly "cached_tokens": number
10692 }
10693 readonly "error": EvalApiError
10694 readonly "temperature": number
10695 readonly "max_completion_tokens": number
10696 readonly "top_p": number
10697 readonly "seed": number
10698 }
10699}
10700export const EvalRunOutputItem = Schema.Struct({
10701 "object": Schema.Literal("eval.run.output_item").annotate({
10702 "description": "The type of the object. Always \"eval.run.output_item\"."
10703 }),
10704 "id": Schema.String.annotate({ "description": "Unique identifier for the evaluation run output item." }),
10705 "run_id": Schema.String.annotate({
10706 "description": "The identifier of the evaluation run associated with this output item."
10707 }),
10708 "eval_id": Schema.String.annotate({ "description": "The identifier of the evaluation group." }),
10709 "created_at": Schema.Number.annotate({
10710 "description": "Unix timestamp (in seconds) when the evaluation run was created.",
10711 "format": "unixtime"
10712 }).check(Schema.isInt()),
10713 "status": Schema.String.annotate({ "description": "The status of the evaluation run." }),
10714 "datasource_item_id": Schema.Number.annotate({ "description": "The identifier for the data source item." }).check(
10715 Schema.isInt()
10716 ),
10717 "datasource_item": Schema.Struct({}).annotate({ "description": "Details of the input data source item." }),
10718 "results": Schema.Array(EvalRunOutputItemResult).annotate({
10719 "description": "A list of grader results for this output item."
10720 }),
10721 "sample": Schema.Struct({
10722 "input": Schema.Array(
10723 Schema.Struct({
10724 "role": Schema.String.annotate({
10725 "description": "The role of the message sender (e.g., system, user, developer)."
10726 }),
10727 "content": Schema.String.annotate({ "description": "The content of the message." })
10728 }).annotate({ "description": "An input message." })
10729 ).annotate({ "description": "An array of input messages." }),
10730 "output": Schema.Array(
10731 Schema.Struct({
10732 "role": Schema.optionalKey(
10733 Schema.String.annotate({
10734 "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")."
10735 })
10736 ),
10737 "content": Schema.optionalKey(Schema.String.annotate({ "description": "The content of the message." }))
10738 })
10739 ).annotate({ "description": "An array of output messages." }),
10740 "finish_reason": Schema.String.annotate({ "description": "The reason why the sample generation was finished." }),
10741 "model": Schema.String.annotate({ "description": "The model used for generating the sample." }),
10742 "usage": Schema.Struct({
10743 "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(
10744 Schema.isInt()
10745 ),
10746 "completion_tokens": Schema.Number.annotate({ "description": "The number of completion tokens generated." })
10747 .check(Schema.isInt()),
10748 "prompt_tokens": Schema.Number.annotate({ "description": "The number of prompt tokens used." }).check(
10749 Schema.isInt()
10750 ),
10751 "cached_tokens": Schema.Number.annotate({ "description": "The number of tokens retrieved from cache." }).check(
10752 Schema.isInt()
10753 )
10754 }).annotate({ "description": "Token usage details for the sample." }),
10755 "error": EvalApiError,
10756 "temperature": Schema.Number.annotate({ "description": "The sampling temperature used." }).check(Schema.isFinite()),
10757 "max_completion_tokens": Schema.Number.annotate({
10758 "description": "The maximum number of tokens allowed for completion."
10759 }).check(Schema.isInt()),
10760 "top_p": Schema.Number.annotate({ "description": "The top_p value used for sampling." }).check(Schema.isFinite()),
10761 "seed": Schema.Number.annotate({ "description": "The seed used for generating the sample." }).check(Schema.isInt())
10762 }).annotate({ "description": "A sample containing the input and output of the evaluation run." })
10763}).annotate({ "title": "EvalRunOutputItem", "description": "A schema representing an evaluation run output item.\n" })
10764export type CreateFileRequest = {
10765 readonly "file": string
10766 readonly "purpose": "assistants" | "batch" | "fine-tune" | "vision" | "user_data" | "evals"
10767 readonly "expires_after"?: FileExpirationAfter
10768}
10769export const CreateFileRequest = Schema.Struct({
10770 "file": Schema.String.annotate({
10771 "description": "The File object (not file name) to be uploaded.\n",
10772 "format": "binary"
10773 }),
10774 "purpose": Schema.Literals(["assistants", "batch", "fine-tune", "vision", "user_data", "evals"]).annotate({
10775 "description":
10776 "The intended purpose of the uploaded file. One of:\n- `assistants`: Used in the Assistants API\n- `batch`: Used in the Batch API\n- `fine-tune`: Used for fine-tuning\n- `vision`: Images used for vision fine-tuning\n- `user_data`: Flexible file type for any purpose\n- `evals`: Used for eval data sets\n"
10777 }),
10778 "expires_after": Schema.optionalKey(FileExpirationAfter)
10779})
10780export type CreateUploadRequest = {
10781 readonly "filename": string
10782 readonly "purpose": "assistants" | "batch" | "fine-tune" | "vision"
10783 readonly "bytes": number
10784 readonly "mime_type": string
10785 readonly "expires_after"?: FileExpirationAfter
10786}
10787export const CreateUploadRequest = Schema.Struct({
10788 "filename": Schema.String.annotate({ "description": "The name of the file to upload.\n" }),
10789 "purpose": Schema.Literals(["assistants", "batch", "fine-tune", "vision"]).annotate({
10790 "description":
10791 "The intended purpose of the uploaded file.\n\nSee the [documentation on File\npurposes](/docs/api-reference/files/create#files-create-purpose).\n"
10792 }),
10793 "bytes": Schema.Number.annotate({ "description": "The number of bytes in the file you are uploading.\n" }).check(
10794 Schema.isInt()
10795 ),
10796 "mime_type": Schema.String.annotate({
10797 "description":
10798 "The MIME type of the file.\n\n\nThis must fall within the supported MIME types for your file purpose. See\nthe supported MIME types for assistants and vision.\n"
10799 }),
10800 "expires_after": Schema.optionalKey(FileExpirationAfter)
10801})
10802export type FileSearchRankingOptions = { readonly "ranker"?: FileSearchRanker; readonly "score_threshold": number }
10803export const FileSearchRankingOptions = Schema.Struct({
10804 "ranker": Schema.optionalKey(FileSearchRanker),
10805 "score_threshold": Schema.Number.annotate({
10806 "description":
10807 "The score threshold for the file search. All values must be a floating point number between 0 and 1."
10808 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
10809}).annotate({
10810 "title": "File search tool call ranking options",
10811 "description":
10812 "The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0.\n\nSee the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"
10813})
10814export type RunStepDetailsToolCallsFileSearchRankingOptionsObject = {
10815 readonly "ranker": FileSearchRanker
10816 readonly "score_threshold": number
10817}
10818export const RunStepDetailsToolCallsFileSearchRankingOptionsObject = Schema.Struct({
10819 "ranker": FileSearchRanker,
10820 "score_threshold": Schema.Number.annotate({
10821 "description":
10822 "The score threshold for the file search. All values must be a floating point number between 0 and 1."
10823 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1))
10824}).annotate({
10825 "title": "File search tool call ranking options",
10826 "description": "The ranking options for the file search."
10827})
10828export type FineTuneDPOMethod = { readonly "hyperparameters"?: FineTuneDPOHyperparameters }
10829export const FineTuneDPOMethod = Schema.Struct({ "hyperparameters": Schema.optionalKey(FineTuneDPOHyperparameters) })
10830 .annotate({ "description": "Configuration for the DPO fine-tuning method." })
10831export type FineTuneSupervisedMethod = { readonly "hyperparameters"?: FineTuneSupervisedHyperparameters }
10832export const FineTuneSupervisedMethod = Schema.Struct({
10833 "hyperparameters": Schema.optionalKey(FineTuneSupervisedHyperparameters)
10834}).annotate({ "description": "Configuration for the supervised fine-tuning method." })
10835export type ListFineTuningCheckpointPermissionResponse = {
10836 readonly "data": ReadonlyArray<FineTuningCheckpointPermission>
10837 readonly "object": "list"
10838 readonly "first_id"?: string | null
10839 readonly "last_id"?: string | null
10840 readonly "has_more": boolean
10841}
10842export const ListFineTuningCheckpointPermissionResponse = Schema.Struct({
10843 "data": Schema.Array(FineTuningCheckpointPermission),
10844 "object": Schema.Literal("list"),
10845 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
10846 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
10847 "has_more": Schema.Boolean
10848})
10849export type ListFineTuningJobCheckpointsResponse = {
10850 readonly "data": ReadonlyArray<FineTuningJobCheckpoint>
10851 readonly "object": "list"
10852 readonly "first_id"?: string | null
10853 readonly "last_id"?: string | null
10854 readonly "has_more": boolean
10855}
10856export const ListFineTuningJobCheckpointsResponse = Schema.Struct({
10857 "data": Schema.Array(FineTuningJobCheckpoint),
10858 "object": Schema.Literal("list"),
10859 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
10860 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
10861 "has_more": Schema.Boolean
10862})
10863export type ListFineTuningJobEventsResponse = {
10864 readonly "data": ReadonlyArray<FineTuningJobEvent>
10865 readonly "object": "list"
10866 readonly "has_more": boolean
10867}
10868export const ListFineTuningJobEventsResponse = Schema.Struct({
10869 "data": Schema.Array(FineTuningJobEvent),
10870 "object": Schema.Literal("list"),
10871 "has_more": Schema.Boolean
10872})
10873export type ChatCompletionFunctions = {
10874 readonly "description"?: string
10875 readonly "name": string
10876 readonly "parameters"?: FunctionParameters
10877}
10878export const ChatCompletionFunctions = Schema.Struct({
10879 "description": Schema.optionalKey(
10880 Schema.String.annotate({
10881 "description":
10882 "A description of what the function does, used by the model to choose when and how to call the function."
10883 })
10884 ),
10885 "name": Schema.String.annotate({
10886 "description":
10887 "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."
10888 }),
10889 "parameters": Schema.optionalKey(FunctionParameters)
10890})
10891export type FunctionObject = {
10892 readonly "description"?: string
10893 readonly "name": string
10894 readonly "parameters"?: FunctionParameters
10895 readonly "strict"?: boolean | null
10896}
10897export const FunctionObject = Schema.Struct({
10898 "description": Schema.optionalKey(
10899 Schema.String.annotate({
10900 "description":
10901 "A description of what the function does, used by the model to choose when and how to call the function."
10902 })
10903 ),
10904 "name": Schema.String.annotate({
10905 "description":
10906 "The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."
10907 }),
10908 "parameters": Schema.optionalKey(FunctionParameters),
10909 "strict": Schema.optionalKey(Schema.Union([
10910 Schema.Boolean.annotate({
10911 "description":
10912 "Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](/docs/guides/function-calling)."
10913 }),
10914 Schema.Null
10915 ]))
10916})
10917export type GroupListResource = {
10918 readonly "object": "list"
10919 readonly "data": ReadonlyArray<GroupResponse>
10920 readonly "has_more": boolean
10921 readonly "next": string | null
10922}
10923export const GroupListResource = Schema.Struct({
10924 "object": Schema.Literal("list").annotate({ "description": "Always `list`." }),
10925 "data": Schema.Array(GroupResponse).annotate({ "description": "Groups returned in the current page." }),
10926 "has_more": Schema.Boolean.annotate({ "description": "Whether additional groups are available when paginating." }),
10927 "next": Schema.Union([Schema.String, Schema.Null]).annotate({
10928 "description": "Cursor to fetch the next page of results, or `null` if there are no more results."
10929 })
10930}).annotate({ "description": "Paginated list of organization groups." })
10931export type UserListResource = {
10932 readonly "object": "list"
10933 readonly "data": ReadonlyArray<GroupUser>
10934 readonly "has_more": boolean
10935 readonly "next": string | null
10936}
10937export const UserListResource = Schema.Struct({
10938 "object": Schema.Literal("list").annotate({ "description": "Always `list`." }),
10939 "data": Schema.Array(GroupUser).annotate({ "description": "Users in the current page." }),
10940 "has_more": Schema.Boolean.annotate({ "description": "Whether more users are available when paginating." }),
10941 "next": Schema.Union([Schema.String, Schema.Null]).annotate({
10942 "description": "Cursor to fetch the next page of results, or `null` when no further users are available."
10943 })
10944}).annotate({ "description": "Paginated list of user objects returned when inspecting group membership." })
10945export type ProjectHostedToolPermissions = {
10946 readonly "file_search": HostedToolPermission
10947 readonly "web_search": HostedToolPermission
10948 readonly "image_generation": HostedToolPermission
10949 readonly "mcp": HostedToolPermission
10950 readonly "code_interpreter": HostedToolPermission
10951}
10952export const ProjectHostedToolPermissions = Schema.Struct({
10953 "file_search": HostedToolPermission,
10954 "web_search": HostedToolPermission,
10955 "image_generation": HostedToolPermission,
10956 "mcp": HostedToolPermission,
10957 "code_interpreter": HostedToolPermission
10958}).annotate({ "description": "Represents hosted tool permissions for a project." })
10959export type ProjectHostedToolPermissionsUpdateRequest = {
10960 readonly "file_search"?: HostedToolPermissionUpdate | null
10961 readonly "web_search"?: HostedToolPermissionUpdate | null
10962 readonly "image_generation"?: HostedToolPermissionUpdate | null
10963 readonly "mcp"?: HostedToolPermissionUpdate | null
10964 readonly "code_interpreter"?: HostedToolPermissionUpdate | null
10965}
10966export const ProjectHostedToolPermissionsUpdateRequest = Schema.Struct({
10967 "file_search": Schema.optionalKey(
10968 Schema.Union([HostedToolPermissionUpdate, Schema.Null]).annotate({
10969 "description": "The file search permission update."
10970 })
10971 ),
10972 "web_search": Schema.optionalKey(
10973 Schema.Union([HostedToolPermissionUpdate, Schema.Null]).annotate({
10974 "description": "The web search permission update."
10975 })
10976 ),
10977 "image_generation": Schema.optionalKey(
10978 Schema.Union([HostedToolPermissionUpdate, Schema.Null]).annotate({
10979 "description": "The image generation permission update."
10980 })
10981 ),
10982 "mcp": Schema.optionalKey(
10983 Schema.Union([HostedToolPermissionUpdate, Schema.Null]).annotate({ "description": "The MCP permission update." })
10984 ),
10985 "code_interpreter": Schema.optionalKey(
10986 Schema.Union([HostedToolPermissionUpdate, Schema.Null]).annotate({
10987 "description": "The code interpreter permission update."
10988 })
10989 )
10990})
10991export type ImageEditCompletedEvent = {
10992 readonly "type": "image_edit.completed"
10993 readonly "b64_json": string
10994 readonly "created_at": number
10995 readonly "size": "1024x1024" | "1024x1536" | "1536x1024" | "auto"
10996 readonly "quality": "low" | "medium" | "high" | "auto"
10997 readonly "background": "transparent" | "opaque" | "auto"
10998 readonly "output_format": "png" | "webp" | "jpeg"
10999 readonly "usage": ImagesUsage
11000}
11001export const ImageEditCompletedEvent = Schema.Struct({
11002 "type": Schema.Literal("image_edit.completed").annotate({
11003 "description": "The type of the event. Always `image_edit.completed`.\n"
11004 }),
11005 "b64_json": Schema.String.annotate({
11006 "description": "Base64-encoded final edited image data, suitable for rendering as an image.\n"
11007 }),
11008 "created_at": Schema.Number.annotate({
11009 "description": "The Unix timestamp when the event was created.\n",
11010 "format": "unixtime"
11011 }).check(Schema.isInt()),
11012 "size": Schema.Literals(["1024x1024", "1024x1536", "1536x1024", "auto"]).annotate({
11013 "description": "The size of the edited image.\n"
11014 }),
11015 "quality": Schema.Literals(["low", "medium", "high", "auto"]).annotate({
11016 "description": "The quality setting for the edited image.\n"
11017 }),
11018 "background": Schema.Literals(["transparent", "opaque", "auto"]).annotate({
11019 "description": "The background setting for the edited image.\n"
11020 }),
11021 "output_format": Schema.Literals(["png", "webp", "jpeg"]).annotate({
11022 "description": "The output format for the edited image.\n"
11023 }),
11024 "usage": ImagesUsage
11025}).annotate({ "description": "Emitted when image editing has completed and the final image is available.\n" })
11026export type ImageGenCompletedEvent = {
11027 readonly "type": "image_generation.completed"
11028 readonly "b64_json": string
11029 readonly "created_at": number
11030 readonly "size": "1024x1024" | "1024x1536" | "1536x1024" | "auto"
11031 readonly "quality": "low" | "medium" | "high" | "auto"
11032 readonly "background": "transparent" | "opaque" | "auto"
11033 readonly "output_format": "png" | "webp" | "jpeg"
11034 readonly "usage": ImagesUsage
11035}
11036export const ImageGenCompletedEvent = Schema.Struct({
11037 "type": Schema.Literal("image_generation.completed").annotate({
11038 "description": "The type of the event. Always `image_generation.completed`.\n"
11039 }),
11040 "b64_json": Schema.String.annotate({
11041 "description": "Base64-encoded image data, suitable for rendering as an image.\n"
11042 }),
11043 "created_at": Schema.Number.annotate({
11044 "description": "The Unix timestamp when the event was created.\n",
11045 "format": "unixtime"
11046 }).check(Schema.isInt()),
11047 "size": Schema.Literals(["1024x1024", "1024x1536", "1536x1024", "auto"]).annotate({
11048 "description": "The size of the generated image.\n"
11049 }),
11050 "quality": Schema.Literals(["low", "medium", "high", "auto"]).annotate({
11051 "description": "The quality setting for the generated image.\n"
11052 }),
11053 "background": Schema.Literals(["transparent", "opaque", "auto"]).annotate({
11054 "description": "The background setting for the generated image.\n"
11055 }),
11056 "output_format": Schema.Literals(["png", "webp", "jpeg"]).annotate({
11057 "description": "The output format for the generated image.\n"
11058 }),
11059 "usage": ImagesUsage
11060}).annotate({ "description": "Emitted when image generation has completed and the final image is available.\n" })
11061export type InviteListResponse = {
11062 readonly "object": "list"
11063 readonly "data": ReadonlyArray<Invite>
11064 readonly "first_id"?: string | null
11065 readonly "last_id"?: string | null
11066 readonly "has_more": boolean
11067}
11068export const InviteListResponse = Schema.Struct({
11069 "object": Schema.Literal("list").annotate({ "description": "The object type, which is always `list`" }),
11070 "data": Schema.Array(Invite),
11071 "first_id": Schema.optionalKey(
11072 Schema.Union([Schema.String, Schema.Null]).annotate({
11073 "description": "The first `invite_id` in the retrieved `list`"
11074 })
11075 ),
11076 "last_id": Schema.optionalKey(
11077 Schema.Union([Schema.String, Schema.Null]).annotate({
11078 "description": "The last `invite_id` in the retrieved `list`"
11079 })
11080 ),
11081 "has_more": Schema.Boolean.annotate({
11082 "description": "The `has_more` property is used for pagination to indicate there are additional results."
11083 })
11084})
11085export type RealtimeServerEventConversationItemInputAudioTranscriptionCompleted = {
11086 readonly "event_id": string
11087 readonly "type": "conversation.item.input_audio_transcription.completed"
11088 readonly "item_id": string
11089 readonly "content_index": number
11090 readonly "transcript": string
11091 readonly "logprobs"?: ReadonlyArray<LogProbProperties> | null
11092 readonly "usage": {
11093 readonly "type": "tokens"
11094 readonly "input_tokens": number
11095 readonly "input_token_details"?: { readonly "text_tokens"?: number; readonly "audio_tokens"?: number }
11096 readonly "output_tokens": number
11097 readonly "total_tokens": number
11098 } | { readonly "type": "duration"; readonly "seconds": number }
11099}
11100export const RealtimeServerEventConversationItemInputAudioTranscriptionCompleted = Schema.Struct({
11101 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
11102 "type": Schema.Literal("conversation.item.input_audio_transcription.completed").annotate({
11103 "description": "The event type, must be\n`conversation.item.input_audio_transcription.completed`.\n"
11104 }),
11105 "item_id": Schema.String.annotate({
11106 "description": "The ID of the item containing the audio that is being transcribed."
11107 }),
11108 "content_index": Schema.Number.annotate({ "description": "The index of the content part containing the audio." })
11109 .check(Schema.isInt()),
11110 "transcript": Schema.String.annotate({ "description": "The transcribed text." }),
11111 "logprobs": Schema.optionalKey(
11112 Schema.Union([
11113 Schema.Array(LogProbProperties).annotate({ "description": "The log probabilities of the transcription." }),
11114 Schema.Null
11115 ])
11116 ),
11117 "usage": Schema.Union([
11118 Schema.Struct({
11119 "type": Schema.Literal("tokens").annotate({
11120 "description": "The type of the usage object. Always `tokens` for this variant."
11121 }),
11122 "input_tokens": Schema.Number.annotate({ "description": "Number of input tokens billed for this request." })
11123 .check(Schema.isInt()),
11124 "input_token_details": Schema.optionalKey(
11125 Schema.Struct({
11126 "text_tokens": Schema.optionalKey(
11127 Schema.Number.annotate({ "description": "Number of text tokens billed for this request." }).check(
11128 Schema.isInt()
11129 )
11130 ),
11131 "audio_tokens": Schema.optionalKey(
11132 Schema.Number.annotate({ "description": "Number of audio tokens billed for this request." }).check(
11133 Schema.isInt()
11134 )
11135 )
11136 }).annotate({ "description": "Details about the input tokens billed for this request." })
11137 ),
11138 "output_tokens": Schema.Number.annotate({ "description": "Number of output tokens generated." }).check(
11139 Schema.isInt()
11140 ),
11141 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (input + output)." }).check(
11142 Schema.isInt()
11143 )
11144 }).annotate({
11145 "title": "Token Usage",
11146 "description":
11147 "Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing."
11148 }),
11149 Schema.Struct({
11150 "type": Schema.Literal("duration").annotate({
11151 "description": "The type of the usage object. Always `duration` for this variant."
11152 }),
11153 "seconds": Schema.Number.annotate({
11154 "description": "Duration of the input audio in seconds.",
11155 "format": "double"
11156 }).check(Schema.isFinite())
11157 }).annotate({
11158 "title": "Duration Usage",
11159 "description":
11160 "Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing."
11161 })
11162 ], { mode: "oneOf" })
11163}).annotate({
11164 "description":
11165 "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (when VAD is enabled). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n"
11166})
11167export type RealtimeServerEventConversationItemInputAudioTranscriptionDelta = {
11168 readonly "event_id": string
11169 readonly "type": "conversation.item.input_audio_transcription.delta"
11170 readonly "item_id": string
11171 readonly "content_index"?: number
11172 readonly "delta"?: string
11173 readonly "logprobs"?: ReadonlyArray<LogProbProperties> | null
11174}
11175export const RealtimeServerEventConversationItemInputAudioTranscriptionDelta = Schema.Struct({
11176 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
11177 "type": Schema.Literal("conversation.item.input_audio_transcription.delta").annotate({
11178 "description": "The event type, must be `conversation.item.input_audio_transcription.delta`."
11179 }),
11180 "item_id": Schema.String.annotate({
11181 "description": "The ID of the item containing the audio that is being transcribed."
11182 }),
11183 "content_index": Schema.optionalKey(
11184 Schema.Number.annotate({ "description": "The index of the content part in the item's content array." }).check(
11185 Schema.isInt()
11186 )
11187 ),
11188 "delta": Schema.optionalKey(Schema.String.annotate({ "description": "The text delta." })),
11189 "logprobs": Schema.optionalKey(Schema.Union([
11190 Schema.Array(LogProbProperties).annotate({
11191 "description":
11192 "The log probabilities of the transcription. These can be enabled by configurating the session with `\"include\": [\"item.input_audio_transcription.logprobs\"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription."
11193 }),
11194 Schema.Null
11195 ]))
11196}).annotate({
11197 "description":
11198 "Returned when the text value of an input audio transcription content part is updated with incremental transcription results.\n"
11199})
11200export type MCPListTools = {
11201 readonly "type": "mcp_list_tools"
11202 readonly "id": string
11203 readonly "server_label": string
11204 readonly "tools": ReadonlyArray<MCPListToolsTool>
11205 readonly "error"?: string | null
11206}
11207export const MCPListTools = Schema.Struct({
11208 "type": Schema.Literal("mcp_list_tools").annotate({
11209 "description": "The type of the item. Always `mcp_list_tools`.\n"
11210 }),
11211 "id": Schema.String.annotate({ "description": "The unique ID of the list.\n" }),
11212 "server_label": Schema.String.annotate({ "description": "The label of the MCP server.\n" }),
11213 "tools": Schema.Array(MCPListToolsTool).annotate({ "description": "The tools available on the server.\n" }),
11214 "error": Schema.optionalKey(
11215 Schema.Union([
11216 Schema.String.annotate({ "description": "Error message if the server could not list tools.\n" }),
11217 Schema.Null
11218 ])
11219 )
11220}).annotate({ "title": "MCP list tools", "description": "A list of tools available on an MCP server.\n" })
11221export type RealtimeMCPListTools = {
11222 readonly "type": "mcp_list_tools"
11223 readonly "id"?: string
11224 readonly "server_label": string
11225 readonly "tools": ReadonlyArray<MCPListToolsTool>
11226}
11227export const RealtimeMCPListTools = Schema.Struct({
11228 "type": Schema.Literal("mcp_list_tools").annotate({
11229 "description": "The type of the item. Always `mcp_list_tools`."
11230 }),
11231 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the list." })),
11232 "server_label": Schema.String.annotate({ "description": "The label of the MCP server." }),
11233 "tools": Schema.Array(MCPListToolsTool).annotate({ "description": "The tools available on the server." })
11234}).annotate({
11235 "title": "Realtime MCP list tools",
11236 "description": "A Realtime item listing tools available on an MCP server.\n"
11237})
11238export type MCPTool = {
11239 readonly "type": "mcp"
11240 readonly "server_label": string
11241 readonly "server_url"?: string
11242 readonly "connector_id"?:
11243 | "connector_dropbox"
11244 | "connector_gmail"
11245 | "connector_googlecalendar"
11246 | "connector_googledrive"
11247 | "connector_microsoftteams"
11248 | "connector_outlookcalendar"
11249 | "connector_outlookemail"
11250 | "connector_sharepoint"
11251 readonly "authorization"?: string
11252 readonly "server_description"?: string
11253 readonly "headers"?: {} | null
11254 readonly "allowed_tools"?: ReadonlyArray<string> | MCPToolFilter | null
11255 readonly "require_approval"?:
11256 | { readonly "always"?: MCPToolFilter; readonly "never"?: MCPToolFilter }
11257 | "always"
11258 | "never"
11259 | null
11260 readonly "defer_loading"?: boolean
11261}
11262export const MCPTool = Schema.Struct({
11263 "type": Schema.Literal("mcp").annotate({ "description": "The type of the MCP tool. Always `mcp`." }),
11264 "server_label": Schema.String.annotate({
11265 "description": "A label for this MCP server, used to identify it in tool calls.\n"
11266 }),
11267 "server_url": Schema.optionalKey(
11268 Schema.String.annotate({
11269 "description": "The URL for the MCP server. One of `server_url` or `connector_id` must be\nprovided.\n",
11270 "format": "uri"
11271 })
11272 ),
11273 "connector_id": Schema.optionalKey(
11274 Schema.Literals([
11275 "connector_dropbox",
11276 "connector_gmail",
11277 "connector_googlecalendar",
11278 "connector_googledrive",
11279 "connector_microsoftteams",
11280 "connector_outlookcalendar",
11281 "connector_outlookemail",
11282 "connector_sharepoint"
11283 ]).annotate({
11284 "description":
11285 "Identifier for service connectors, like those available in ChatGPT. One of\n`server_url` or `connector_id` must be provided. Learn more about service\nconnectors [here](/docs/guides/tools-remote-mcp#connectors).\n\nCurrently supported `connector_id` values are:\n\n- Dropbox: `connector_dropbox`\n- Gmail: `connector_gmail`\n- Google Calendar: `connector_googlecalendar`\n- Google Drive: `connector_googledrive`\n- Microsoft Teams: `connector_microsoftteams`\n- Outlook Calendar: `connector_outlookcalendar`\n- Outlook Email: `connector_outlookemail`\n- SharePoint: `connector_sharepoint`\n"
11286 })
11287 ),
11288 "authorization": Schema.optionalKey(
11289 Schema.String.annotate({
11290 "description":
11291 "An OAuth access token that can be used with a remote MCP server, either\nwith a custom MCP server URL or a service connector. Your application\nmust handle the OAuth authorization flow and provide the token here.\n"
11292 })
11293 ),
11294 "server_description": Schema.optionalKey(
11295 Schema.String.annotate({ "description": "Optional description of the MCP server, used to provide more context.\n" })
11296 ),
11297 "headers": Schema.optionalKey(
11298 Schema.Union([
11299 Schema.Struct({}).annotate({
11300 "description": "Optional HTTP headers to send to the MCP server. Use for authentication\nor other purposes.\n"
11301 }),
11302 Schema.Null
11303 ])
11304 ),
11305 "allowed_tools": Schema.optionalKey(
11306 Schema.Union([
11307 Schema.Union([
11308 Schema.Array(Schema.String).annotate({
11309 "title": "MCP allowed tools",
11310 "description": "A string array of allowed tool names"
11311 }),
11312 MCPToolFilter
11313 ], { mode: "oneOf" }).annotate({ "description": "List of allowed tool names or a filter object.\n" }),
11314 Schema.Null
11315 ])
11316 ),
11317 "require_approval": Schema.optionalKey(
11318 Schema.Union([
11319 Schema.Union([
11320 Schema.Struct({ "always": Schema.optionalKey(MCPToolFilter), "never": Schema.optionalKey(MCPToolFilter) })
11321 .annotate({
11322 "title": "MCP tool approval filter",
11323 "description":
11324 "Specify which of the MCP server's tools require approval. Can be\n`always`, `never`, or a filter object associated with tools\nthat require approval.\n"
11325 }),
11326 Schema.Literals(["always", "never"]).annotate({
11327 "title": "MCP tool approval setting",
11328 "description":
11329 "Specify a single approval policy for all tools. One of `always` or\n`never`. When set to `always`, all tools will require approval. When\nset to `never`, all tools will not require approval.\n"
11330 })
11331 ], { mode: "oneOf" }).annotate({ "description": "Specify which of the MCP server's tools require approval." }),
11332 Schema.Null
11333 ])
11334 ),
11335 "defer_loading": Schema.optionalKey(
11336 Schema.Boolean.annotate({ "description": "Whether this MCP tool is deferred and discovered via tool search.\n" })
11337 )
11338}).annotate({
11339 "title": "MCP tool",
11340 "description":
11341 "Give the model access to additional tools via remote Model Context Protocol\n(MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp).\n"
11342})
11343export type MessageContentTextObject = {
11344 readonly "type": "text"
11345 readonly "text": {
11346 readonly "value": string
11347 readonly "annotations": ReadonlyArray<
11348 MessageContentTextAnnotationsFileCitationObject | MessageContentTextAnnotationsFilePathObject
11349 >
11350 }
11351}
11352export const MessageContentTextObject = Schema.Struct({
11353 "type": Schema.Literal("text").annotate({ "description": "Always `text`." }),
11354 "text": Schema.Struct({
11355 "value": Schema.String.annotate({ "description": "The data that makes up the text." }),
11356 "annotations": Schema.Array(
11357 Schema.Union([MessageContentTextAnnotationsFileCitationObject, MessageContentTextAnnotationsFilePathObject], {
11358 mode: "oneOf"
11359 })
11360 )
11361 })
11362}).annotate({ "title": "Text", "description": "The text content that is part of a message." })
11363export type MessageDeltaContentTextObject = {
11364 readonly "index": number
11365 readonly "type": "text"
11366 readonly "text"?: {
11367 readonly "value"?: string
11368 readonly "annotations"?: ReadonlyArray<
11369 MessageDeltaContentTextAnnotationsFileCitationObject | MessageDeltaContentTextAnnotationsFilePathObject
11370 >
11371 }
11372}
11373export const MessageDeltaContentTextObject = Schema.Struct({
11374 "index": Schema.Number.annotate({ "description": "The index of the content part in the message." }).check(
11375 Schema.isInt()
11376 ),
11377 "type": Schema.Literal("text").annotate({ "description": "Always `text`." }),
11378 "text": Schema.optionalKey(Schema.Struct({
11379 "value": Schema.optionalKey(Schema.String.annotate({ "description": "The data that makes up the text." })),
11380 "annotations": Schema.optionalKey(
11381 Schema.Array(
11382 Schema.Union([
11383 MessageDeltaContentTextAnnotationsFileCitationObject,
11384 MessageDeltaContentTextAnnotationsFilePathObject
11385 ], { mode: "oneOf" })
11386 )
11387 )
11388 }))
11389}).annotate({ "title": "Text", "description": "The text content that is part of a message." })
11390export type Batch = {
11391 readonly "id": string
11392 readonly "object": "batch"
11393 readonly "endpoint": string
11394 readonly "model"?: string
11395 readonly "errors"?: {
11396 readonly "object"?: string
11397 readonly "data"?: ReadonlyArray<
11398 {
11399 readonly "code"?: string
11400 readonly "message"?: string
11401 readonly "param"?: string | null
11402 readonly "line"?: number | null
11403 }
11404 >
11405 }
11406 readonly "input_file_id": string
11407 readonly "completion_window": string
11408 readonly "status":
11409 | "validating"
11410 | "failed"
11411 | "in_progress"
11412 | "finalizing"
11413 | "completed"
11414 | "expired"
11415 | "cancelling"
11416 | "cancelled"
11417 readonly "output_file_id"?: string
11418 readonly "error_file_id"?: string
11419 readonly "created_at": number
11420 readonly "in_progress_at"?: number
11421 readonly "expires_at"?: number
11422 readonly "finalizing_at"?: number
11423 readonly "completed_at"?: number
11424 readonly "failed_at"?: number
11425 readonly "expired_at"?: number
11426 readonly "cancelling_at"?: number
11427 readonly "cancelled_at"?: number
11428 readonly "request_counts"?: { readonly "total": number; readonly "completed": number; readonly "failed": number }
11429 readonly "usage"?: {
11430 readonly "input_tokens": number
11431 readonly "input_tokens_details": { readonly "cached_tokens": number }
11432 readonly "output_tokens": number
11433 readonly "output_tokens_details": { readonly "reasoning_tokens": number }
11434 readonly "total_tokens": number
11435 }
11436 readonly "metadata"?: Metadata
11437}
11438export const Batch = Schema.Struct({
11439 "id": Schema.String,
11440 "object": Schema.Literal("batch").annotate({ "description": "The object type, which is always `batch`." }),
11441 "endpoint": Schema.String.annotate({ "description": "The OpenAI API endpoint used by the batch." }),
11442 "model": Schema.optionalKey(Schema.String.annotate({
11443 "description":
11444 "Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model\nguide](/docs/models) to browse and compare available models.\n"
11445 })),
11446 "errors": Schema.optionalKey(Schema.Struct({
11447 "object": Schema.optionalKey(Schema.String.annotate({ "description": "The object type, which is always `list`." })),
11448 "data": Schema.optionalKey(Schema.Array(Schema.Struct({
11449 "code": Schema.optionalKey(
11450 Schema.String.annotate({ "description": "An error code identifying the error type." })
11451 ),
11452 "message": Schema.optionalKey(
11453 Schema.String.annotate({ "description": "A human-readable message providing more details about the error." })
11454 ),
11455 "param": Schema.optionalKey(
11456 Schema.Union([
11457 Schema.String.annotate({ "description": "The name of the parameter that caused the error, if applicable." }),
11458 Schema.Null
11459 ])
11460 ),
11461 "line": Schema.optionalKey(
11462 Schema.Union([
11463 Schema.Number.annotate({
11464 "description": "The line number of the input file where the error occurred, if applicable."
11465 }).check(Schema.isInt()),
11466 Schema.Null
11467 ])
11468 )
11469 })))
11470 })),
11471 "input_file_id": Schema.String.annotate({ "description": "The ID of the input file for the batch." }),
11472 "completion_window": Schema.String.annotate({
11473 "description": "The time frame within which the batch should be processed."
11474 }),
11475 "status": Schema.Literals([
11476 "validating",
11477 "failed",
11478 "in_progress",
11479 "finalizing",
11480 "completed",
11481 "expired",
11482 "cancelling",
11483 "cancelled"
11484 ]).annotate({ "description": "The current status of the batch." }),
11485 "output_file_id": Schema.optionalKey(
11486 Schema.String.annotate({
11487 "description": "The ID of the file containing the outputs of successfully executed requests."
11488 })
11489 ),
11490 "error_file_id": Schema.optionalKey(
11491 Schema.String.annotate({ "description": "The ID of the file containing the outputs of requests with errors." })
11492 ),
11493 "created_at": Schema.Number.annotate({
11494 "description": "The Unix timestamp (in seconds) for when the batch was created.",
11495 "format": "unixtime"
11496 }).check(Schema.isInt()),
11497 "in_progress_at": Schema.optionalKey(
11498 Schema.Number.annotate({
11499 "description": "The Unix timestamp (in seconds) for when the batch started processing.",
11500 "format": "unixtime"
11501 }).check(Schema.isInt())
11502 ),
11503 "expires_at": Schema.optionalKey(
11504 Schema.Number.annotate({
11505 "description": "The Unix timestamp (in seconds) for when the batch will expire.",
11506 "format": "unixtime"
11507 }).check(Schema.isInt())
11508 ),
11509 "finalizing_at": Schema.optionalKey(
11510 Schema.Number.annotate({
11511 "description": "The Unix timestamp (in seconds) for when the batch started finalizing.",
11512 "format": "unixtime"
11513 }).check(Schema.isInt())
11514 ),
11515 "completed_at": Schema.optionalKey(
11516 Schema.Number.annotate({
11517 "description": "The Unix timestamp (in seconds) for when the batch was completed.",
11518 "format": "unixtime"
11519 }).check(Schema.isInt())
11520 ),
11521 "failed_at": Schema.optionalKey(
11522 Schema.Number.annotate({
11523 "description": "The Unix timestamp (in seconds) for when the batch failed.",
11524 "format": "unixtime"
11525 }).check(Schema.isInt())
11526 ),
11527 "expired_at": Schema.optionalKey(
11528 Schema.Number.annotate({
11529 "description": "The Unix timestamp (in seconds) for when the batch expired.",
11530 "format": "unixtime"
11531 }).check(Schema.isInt())
11532 ),
11533 "cancelling_at": Schema.optionalKey(
11534 Schema.Number.annotate({
11535 "description": "The Unix timestamp (in seconds) for when the batch started cancelling.",
11536 "format": "unixtime"
11537 }).check(Schema.isInt())
11538 ),
11539 "cancelled_at": Schema.optionalKey(
11540 Schema.Number.annotate({
11541 "description": "The Unix timestamp (in seconds) for when the batch was cancelled.",
11542 "format": "unixtime"
11543 }).check(Schema.isInt())
11544 ),
11545 "request_counts": Schema.optionalKey(
11546 Schema.Struct({
11547 "total": Schema.Number.annotate({ "description": "Total number of requests in the batch." }).check(
11548 Schema.isInt()
11549 ),
11550 "completed": Schema.Number.annotate({
11551 "description": "Number of requests that have been completed successfully."
11552 }).check(Schema.isInt()),
11553 "failed": Schema.Number.annotate({ "description": "Number of requests that have failed." }).check(Schema.isInt())
11554 }).annotate({ "description": "The request counts for different statuses within the batch." })
11555 ),
11556 "usage": Schema.optionalKey(
11557 Schema.Struct({
11558 "input_tokens": Schema.Number.annotate({ "description": "The number of input tokens." }).check(Schema.isInt()),
11559 "input_tokens_details": Schema.Struct({
11560 "cached_tokens": Schema.Number.annotate({
11561 "description":
11562 "The number of tokens that were retrieved from the cache. [More on\nprompt caching](/docs/guides/prompt-caching).\n"
11563 }).check(Schema.isInt())
11564 }).annotate({ "description": "A detailed breakdown of the input tokens." }),
11565 "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens." }).check(Schema.isInt()),
11566 "output_tokens_details": Schema.Struct({
11567 "reasoning_tokens": Schema.Number.annotate({ "description": "The number of reasoning tokens." }).check(
11568 Schema.isInt()
11569 )
11570 }).annotate({ "description": "A detailed breakdown of the output tokens." }),
11571 "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(
11572 Schema.isInt()
11573 )
11574 }).annotate({
11575 "description":
11576 "Represents token usage details including input tokens, output tokens, a\nbreakdown of output tokens, and the total tokens used. Only populated on\nbatches created after September 7, 2025.\n"
11577 })
11578 ),
11579 "metadata": Schema.optionalKey(Metadata)
11580})
11581export type CreateMessageRequest = {
11582 readonly "role": "user" | "assistant"
11583 readonly "content":
11584 | string
11585 | ReadonlyArray<MessageContentImageFileObject | MessageContentImageUrlObject | MessageRequestContentTextObject>
11586 readonly "attachments"?:
11587 | ReadonlyArray<
11588 {
11589 readonly "file_id"?: string
11590 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearchTypeOnly>
11591 }
11592 >
11593 | null
11594 readonly "metadata"?: Metadata
11595}
11596export const CreateMessageRequest = Schema.Struct({
11597 "role": Schema.Literals(["user", "assistant"]).annotate({
11598 "description":
11599 "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n"
11600 }),
11601 "content": Schema.Union([
11602 Schema.String.annotate({ "title": "Text content", "description": "The text contents of the message." }),
11603 Schema.Array(
11604 Schema.Union([MessageContentImageFileObject, MessageContentImageUrlObject, MessageRequestContentTextObject], {
11605 mode: "oneOf"
11606 })
11607 ).annotate({
11608 "title": "Array of content parts",
11609 "description":
11610 "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models)."
11611 }).check(Schema.isMinLength(1))
11612 ], { mode: "oneOf" }),
11613 "attachments": Schema.optionalKey(Schema.Union([
11614 Schema.Array(Schema.Struct({
11615 "file_id": Schema.optionalKey(
11616 Schema.String.annotate({ "description": "The ID of the file to attach to the message." })
11617 ),
11618 "tools": Schema.optionalKey(
11619 Schema.Array(Schema.Union([AssistantToolsCode, AssistantToolsFileSearchTypeOnly], { mode: "oneOf" })).annotate({
11620 "description": "The tools to add this file to."
11621 })
11622 )
11623 })).annotate({ "description": "A list of files attached to the message, and the tools they should be added to." }),
11624 Schema.Null
11625 ])),
11626 "metadata": Schema.optionalKey(Metadata)
11627})
11628export type EvalStoredCompletionsSource = {
11629 readonly "type": "stored_completions"
11630 readonly "metadata"?: Metadata
11631 readonly "model"?: string | null
11632 readonly "created_after"?: number | null
11633 readonly "created_before"?: number | null
11634 readonly "limit"?: number | null
11635}
11636export const EvalStoredCompletionsSource = Schema.Struct({
11637 "type": Schema.Literal("stored_completions").annotate({
11638 "description": "The type of source. Always `stored_completions`."
11639 }),
11640 "metadata": Schema.optionalKey(Metadata),
11641 "model": Schema.optionalKey(
11642 Schema.Union([
11643 Schema.String.annotate({ "description": "An optional model to filter by (e.g., 'gpt-4o')." }),
11644 Schema.Null
11645 ])
11646 ),
11647 "created_after": Schema.optionalKey(
11648 Schema.Union([
11649 Schema.Number.annotate({ "description": "An optional Unix timestamp to filter items created after this time." })
11650 .check(Schema.isInt()),
11651 Schema.Null
11652 ])
11653 ),
11654 "created_before": Schema.optionalKey(
11655 Schema.Union([
11656 Schema.Number.annotate({ "description": "An optional Unix timestamp to filter items created before this time." })
11657 .check(Schema.isInt()),
11658 Schema.Null
11659 ])
11660 ),
11661 "limit": Schema.optionalKey(
11662 Schema.Union([
11663 Schema.Number.annotate({ "description": "An optional maximum number of items to return." }).check(Schema.isInt()),
11664 Schema.Null
11665 ])
11666 )
11667}).annotate({
11668 "title": "StoredCompletionsRunDataSource",
11669 "description": "A StoredCompletionsRunDataSource configuration describing a set of filters\n"
11670})
11671export type ModifyMessageRequest = { readonly "metadata"?: Metadata }
11672export const ModifyMessageRequest = Schema.Struct({ "metadata": Schema.optionalKey(Metadata) })
11673export type ModifyRunRequest = { readonly "metadata"?: Metadata }
11674export const ModifyRunRequest = Schema.Struct({ "metadata": Schema.optionalKey(Metadata) })
11675export type ModifyThreadRequest = {
11676 readonly "tool_resources"?: {
11677 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
11678 readonly "file_search"?: { readonly "vector_store_ids"?: ReadonlyArray<string> }
11679 } | null
11680 readonly "metadata"?: Metadata
11681}
11682export const ModifyThreadRequest = Schema.Struct({
11683 "tool_resources": Schema.optionalKey(Schema.Union([
11684 Schema.Struct({
11685 "code_interpreter": Schema.optionalKey(Schema.Struct({
11686 "file_ids": Schema.optionalKey(
11687 Schema.Array(Schema.String).annotate({
11688 "description":
11689 "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"
11690 }).check(Schema.isMaxLength(20))
11691 )
11692 })),
11693 "file_search": Schema.optionalKey(Schema.Struct({
11694 "vector_store_ids": Schema.optionalKey(
11695 Schema.Array(Schema.String).annotate({
11696 "description":
11697 "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"
11698 }).check(Schema.isMaxLength(1))
11699 )
11700 }))
11701 }).annotate({
11702 "description":
11703 "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
11704 }),
11705 Schema.Null
11706 ])),
11707 "metadata": Schema.optionalKey(Metadata)
11708})
11709export type ThreadObject = {
11710 readonly "id": string
11711 readonly "object": "thread"
11712 readonly "created_at": number
11713 readonly "tool_resources": {
11714 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
11715 readonly "file_search"?: { readonly "vector_store_ids"?: ReadonlyArray<string> }
11716 } | null
11717 readonly "metadata": Metadata
11718}
11719export const ThreadObject = Schema.Struct({
11720 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
11721 "object": Schema.Literal("thread").annotate({ "description": "The object type, which is always `thread`." }),
11722 "created_at": Schema.Number.annotate({
11723 "description": "The Unix timestamp (in seconds) for when the thread was created.",
11724 "format": "unixtime"
11725 }).check(Schema.isInt()),
11726 "tool_resources": Schema.Union([
11727 Schema.Struct({
11728 "code_interpreter": Schema.optionalKey(Schema.Struct({
11729 "file_ids": Schema.optionalKey(
11730 Schema.Array(Schema.String).annotate({
11731 "description":
11732 "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"
11733 }).check(Schema.isMaxLength(20))
11734 )
11735 })),
11736 "file_search": Schema.optionalKey(Schema.Struct({
11737 "vector_store_ids": Schema.optionalKey(
11738 Schema.Array(Schema.String).annotate({
11739 "description":
11740 "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"
11741 }).check(Schema.isMaxLength(1))
11742 )
11743 }))
11744 }).annotate({
11745 "description":
11746 "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
11747 }),
11748 Schema.Null
11749 ]),
11750 "metadata": Metadata
11751}).annotate({
11752 "title": "Thread",
11753 "description": "Represents a thread that contains [messages](/docs/api-reference/messages)."
11754})
11755export type UpdateVectorStoreRequest = {
11756 readonly "name"?: string | null
11757 readonly "expires_after"?: { readonly "anchor": "last_active_at"; readonly "days": number }
11758 readonly "metadata"?: Metadata
11759}
11760export const UpdateVectorStoreRequest = Schema.Struct({
11761 "name": Schema.optionalKey(
11762 Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "The name of the vector store." })
11763 ),
11764 "expires_after": Schema.optionalKey(Schema.Union([
11765 Schema.Struct({
11766 "anchor": Schema.Literal("last_active_at").annotate({
11767 "description":
11768 "Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`."
11769 }),
11770 "days": Schema.Number.annotate({
11771 "description": "The number of days after the anchor time that the vector store will expire."
11772 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(365))
11773 }).annotate({
11774 "title": "Vector store expiration policy",
11775 "description": "The expiration policy for a vector store."
11776 })
11777 ])),
11778 "metadata": Schema.optionalKey(Metadata)
11779})
11780export type ListModelsResponse = { readonly "object": "list"; readonly "data": ReadonlyArray<Model> }
11781export const ListModelsResponse = Schema.Struct({ "object": Schema.Literal("list"), "data": Schema.Array(Model) })
11782export type ModelIdsResponses =
11783 | ModelIdsShared
11784 | "o1-pro"
11785 | "o1-pro-2025-03-19"
11786 | "o3-pro"
11787 | "o3-pro-2025-06-10"
11788 | "o3-deep-research"
11789 | "o3-deep-research-2025-06-26"
11790 | "o4-mini-deep-research"
11791 | "o4-mini-deep-research-2025-06-26"
11792 | "computer-use-preview"
11793 | "computer-use-preview-2025-03-11"
11794 | "gpt-5-codex"
11795 | "gpt-5-pro"
11796 | "gpt-5-pro-2025-10-06"
11797 | "gpt-5.1-codex-max"
11798export const ModelIdsResponses = Schema.Union([
11799 ModelIdsShared,
11800 Schema.Literals([
11801 "o1-pro",
11802 "o1-pro-2025-03-19",
11803 "o3-pro",
11804 "o3-pro-2025-06-10",
11805 "o3-deep-research",
11806 "o3-deep-research-2025-06-26",
11807 "o4-mini-deep-research",
11808 "o4-mini-deep-research-2025-06-26",
11809 "computer-use-preview",
11810 "computer-use-preview-2025-03-11",
11811 "gpt-5-codex",
11812 "gpt-5-pro",
11813 "gpt-5-pro-2025-10-06",
11814 "gpt-5.1-codex-max"
11815 ]).annotate({ "title": "ResponsesOnlyModel" })
11816])
11817export type RealtimeTranscriptionSessionCreateRequest = {
11818 readonly "turn_detection"?: {
11819 readonly "type"?: "server_vad"
11820 readonly "threshold"?: number
11821 readonly "prefix_padding_ms"?: number
11822 readonly "silence_duration_ms"?: number
11823 }
11824 readonly "input_audio_noise_reduction"?: { readonly "type"?: NoiseReductionType }
11825 readonly "input_audio_format"?: "pcm16" | "g711_ulaw" | "g711_alaw"
11826 readonly "input_audio_transcription"?: {
11827 readonly "model"?:
11828 | string
11829 | "whisper-1"
11830 | "gpt-4o-mini-transcribe"
11831 | "gpt-4o-mini-transcribe-2025-12-15"
11832 | "gpt-4o-transcribe"
11833 | "gpt-4o-transcribe-diarize"
11834 | "gpt-realtime-whisper"
11835 readonly "language"?: string
11836 readonly "prompt"?: string
11837 readonly "delay"?: "minimal" | "low" | "medium" | "high" | "xhigh"
11838 }
11839 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
11840}
11841export const RealtimeTranscriptionSessionCreateRequest = Schema.Struct({
11842 "turn_detection": Schema.optionalKey(
11843 Schema.Struct({
11844 "type": Schema.optionalKey(
11845 Schema.Literal("server_vad").annotate({
11846 "description":
11847 "Type of turn detection. Only `server_vad` is currently supported for transcription sessions.\n"
11848 })
11849 ),
11850 "threshold": Schema.optionalKey(
11851 Schema.Number.annotate({
11852 "description":
11853 "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"
11854 }).check(Schema.isFinite())
11855 ),
11856 "prefix_padding_ms": Schema.optionalKey(
11857 Schema.Number.annotate({
11858 "description":
11859 "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"
11860 }).check(Schema.isInt())
11861 ),
11862 "silence_duration_ms": Schema.optionalKey(
11863 Schema.Number.annotate({
11864 "description":
11865 "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"
11866 }).check(Schema.isInt())
11867 )
11868 }).annotate({
11869 "description":
11870 "Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.\n"
11871 })
11872 ),
11873 "input_audio_noise_reduction": Schema.optionalKey(
11874 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
11875 "description":
11876 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
11877 })
11878 ),
11879 "input_audio_format": Schema.optionalKey(
11880 Schema.Literals(["pcm16", "g711_ulaw", "g711_alaw"]).annotate({
11881 "description":
11882 "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"
11883 })
11884 ),
11885 "input_audio_transcription": Schema.optionalKey(
11886 Schema.Struct({
11887 "model": Schema.optionalKey(
11888 Schema.Union([
11889 Schema.String,
11890 Schema.Literals([
11891 "whisper-1",
11892 "gpt-4o-mini-transcribe",
11893 "gpt-4o-mini-transcribe-2025-12-15",
11894 "gpt-4o-transcribe",
11895 "gpt-4o-transcribe-diarize",
11896 "gpt-realtime-whisper"
11897 ])
11898 ]).annotate({
11899 "description":
11900 "The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n"
11901 })
11902 ),
11903 "language": Schema.optionalKey(
11904 Schema.String.annotate({
11905 "description":
11906 "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"
11907 })
11908 ),
11909 "prompt": Schema.optionalKey(Schema.String.annotate({
11910 "description":
11911 "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
11912 })),
11913 "delay": Schema.optionalKey(
11914 Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
11915 "description":
11916 "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
11917 })
11918 )
11919 }).annotate({
11920 "description":
11921 "Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
11922 })
11923 ),
11924 "include": Schema.optionalKey(
11925 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
11926 "description":
11927 "The set of items to include in the transcription. Current available items are:\n`item.input_audio_transcription.logprobs`\n"
11928 })
11929 )
11930}).annotate({
11931 "title": "Realtime transcription session configuration",
11932 "description": "Realtime transcription session object configuration."
11933})
11934export type RealtimeTranslationClientEventSessionUpdate = {
11935 readonly "event_id"?: string
11936 readonly "type": "session.update"
11937 readonly "session": {
11938 readonly "audio"?: {
11939 readonly "input"?: {
11940 readonly "transcription"?: { readonly "model": string } | null
11941 readonly "noise_reduction"?: { readonly "type": NoiseReductionType } | null
11942 }
11943 readonly "output"?: { readonly "language"?: string }
11944 }
11945 }
11946}
11947export const RealtimeTranslationClientEventSessionUpdate = Schema.Struct({
11948 "event_id": Schema.optionalKey(
11949 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
11950 Schema.isMaxLength(512)
11951 )
11952 ),
11953 "type": Schema.Literal("session.update").annotate({ "description": "The event type, must be `session.update`." }),
11954 "session": Schema.Struct({
11955 "audio": Schema.optionalKey(
11956 Schema.Struct({
11957 "input": Schema.optionalKey(Schema.Struct({
11958 "transcription": Schema.optionalKey(
11959 Schema.Union([
11960 Schema.Struct({
11961 "model": Schema.String.annotate({
11962 "description": "The transcription model to use for source transcript deltas."
11963 })
11964 }).annotate({
11965 "description":
11966 "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n"
11967 }),
11968 Schema.Null
11969 ])
11970 ),
11971 "noise_reduction": Schema.optionalKey(
11972 Schema.Union([
11973 Schema.Struct({ "type": NoiseReductionType }).annotate({
11974 "description": "Optional input noise reduction. Set to `null` to disable it.\n"
11975 }),
11976 Schema.Null
11977 ])
11978 )
11979 })),
11980 "output": Schema.optionalKey(
11981 Schema.Struct({
11982 "language": Schema.optionalKey(
11983 Schema.String.annotate({
11984 "description": "Target language for translated output audio and transcript deltas.\n"
11985 })
11986 )
11987 })
11988 )
11989 }).annotate({ "description": "Configuration for translation input and output audio.\n" })
11990 )
11991 }).annotate({
11992 "title": "Realtime translation session update",
11993 "description":
11994 "Translation session fields to update. The session `type` and `model` are set\nat creation and cannot be changed with `session.update`.\n"
11995 })
11996}).annotate({
11997 "description":
11998 "Send this event to update the translation session configuration. Translation\nsessions support updates to `audio.output.language`, `audio.input.transcription`,\nand `audio.input.noise_reduction`.\n"
11999})
12000export type RealtimeTranslationServerEventSessionCreated = {
12001 readonly "event_id": string
12002 readonly "type": "session.created"
12003 readonly "session": {
12004 readonly "id": string
12005 readonly "type": "translation"
12006 readonly "expires_at": number
12007 readonly "model": string
12008 readonly "audio": {
12009 readonly "input"?: {
12010 readonly "transcription"?: { readonly "model": string } | null
12011 readonly "noise_reduction"?: { readonly "type": NoiseReductionType } | null
12012 }
12013 readonly "output"?: { readonly "language"?: string }
12014 }
12015 }
12016}
12017export const RealtimeTranslationServerEventSessionCreated = Schema.Struct({
12018 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
12019 "type": Schema.Literal("session.created").annotate({ "description": "The event type, must be `session.created`." }),
12020 "session": Schema.Struct({
12021 "id": Schema.String.annotate({
12022 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
12023 }),
12024 "type": Schema.Literal("translation").annotate({
12025 "description": "The session type. Always `translation` for Realtime translation sessions.\n"
12026 }),
12027 "expires_at": Schema.Number.annotate({
12028 "description": "Expiration timestamp for the session, in seconds since epoch.",
12029 "format": "unixtime"
12030 }).check(Schema.isInt()),
12031 "model": Schema.String.annotate({
12032 "description":
12033 "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n"
12034 }),
12035 "audio": Schema.Struct({
12036 "input": Schema.optionalKey(Schema.Struct({
12037 "transcription": Schema.optionalKey(
12038 Schema.Union([
12039 Schema.Struct({
12040 "model": Schema.String.annotate({
12041 "description": "The transcription model used for source transcript deltas."
12042 })
12043 }).annotate({
12044 "description":
12045 "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n"
12046 }),
12047 Schema.Null
12048 ])
12049 ),
12050 "noise_reduction": Schema.optionalKey(
12051 Schema.Union([
12052 Schema.Struct({ "type": NoiseReductionType }).annotate({
12053 "description": "Optional input noise reduction.\n"
12054 }),
12055 Schema.Null
12056 ])
12057 )
12058 })),
12059 "output": Schema.optionalKey(
12060 Schema.Struct({
12061 "language": Schema.optionalKey(
12062 Schema.String.annotate({
12063 "description": "Target language for translated output audio and transcript deltas.\n"
12064 })
12065 )
12066 })
12067 )
12068 }).annotate({ "description": "Configuration for translation input and output audio.\n" })
12069 }).annotate({ "title": "Realtime translation session", "description": "The translation session configuration." })
12070}).annotate({
12071 "description":
12072 "Returned when a translation session is created. Emitted automatically when a\nnew connection is established as the first server event. This event contains\nthe default translation session configuration.\n"
12073})
12074export type RealtimeTranslationServerEventSessionUpdated = {
12075 readonly "event_id": string
12076 readonly "type": "session.updated"
12077 readonly "session": {
12078 readonly "id": string
12079 readonly "type": "translation"
12080 readonly "expires_at": number
12081 readonly "model": string
12082 readonly "audio": {
12083 readonly "input"?: {
12084 readonly "transcription"?: { readonly "model": string } | null
12085 readonly "noise_reduction"?: { readonly "type": NoiseReductionType } | null
12086 }
12087 readonly "output"?: { readonly "language"?: string }
12088 }
12089 }
12090}
12091export const RealtimeTranslationServerEventSessionUpdated = Schema.Struct({
12092 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
12093 "type": Schema.Literal("session.updated").annotate({ "description": "The event type, must be `session.updated`." }),
12094 "session": Schema.Struct({
12095 "id": Schema.String.annotate({
12096 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
12097 }),
12098 "type": Schema.Literal("translation").annotate({
12099 "description": "The session type. Always `translation` for Realtime translation sessions.\n"
12100 }),
12101 "expires_at": Schema.Number.annotate({
12102 "description": "Expiration timestamp for the session, in seconds since epoch.",
12103 "format": "unixtime"
12104 }).check(Schema.isInt()),
12105 "model": Schema.String.annotate({
12106 "description":
12107 "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n"
12108 }),
12109 "audio": Schema.Struct({
12110 "input": Schema.optionalKey(Schema.Struct({
12111 "transcription": Schema.optionalKey(
12112 Schema.Union([
12113 Schema.Struct({
12114 "model": Schema.String.annotate({
12115 "description": "The transcription model used for source transcript deltas."
12116 })
12117 }).annotate({
12118 "description":
12119 "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n"
12120 }),
12121 Schema.Null
12122 ])
12123 ),
12124 "noise_reduction": Schema.optionalKey(
12125 Schema.Union([
12126 Schema.Struct({ "type": NoiseReductionType }).annotate({
12127 "description": "Optional input noise reduction.\n"
12128 }),
12129 Schema.Null
12130 ])
12131 )
12132 })),
12133 "output": Schema.optionalKey(
12134 Schema.Struct({
12135 "language": Schema.optionalKey(
12136 Schema.String.annotate({
12137 "description": "Target language for translated output audio and transcript deltas.\n"
12138 })
12139 )
12140 })
12141 )
12142 }).annotate({ "description": "Configuration for translation input and output audio.\n" })
12143 }).annotate({ "title": "Realtime translation session", "description": "The translation session configuration." })
12144}).annotate({
12145 "description":
12146 "Returned when a translation session is updated with a `session.update` event,\nunless there is an error.\n"
12147})
12148export type RealtimeTranslationSession = {
12149 readonly "id": string
12150 readonly "type": "translation"
12151 readonly "expires_at": number
12152 readonly "model": string
12153 readonly "audio": {
12154 readonly "input"?: {
12155 readonly "transcription"?: { readonly "model": string } | null
12156 readonly "noise_reduction"?: { readonly "type": NoiseReductionType } | null
12157 }
12158 readonly "output"?: { readonly "language"?: string }
12159 }
12160}
12161export const RealtimeTranslationSession = Schema.Struct({
12162 "id": Schema.String.annotate({
12163 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
12164 }),
12165 "type": Schema.Literal("translation").annotate({
12166 "description": "The session type. Always `translation` for Realtime translation sessions.\n"
12167 }),
12168 "expires_at": Schema.Number.annotate({
12169 "description": "Expiration timestamp for the session, in seconds since epoch.",
12170 "format": "unixtime"
12171 }).check(Schema.isInt()),
12172 "model": Schema.String.annotate({
12173 "description":
12174 "The Realtime translation model used for this session. This field is set at\nsession creation and cannot be changed with `session.update`.\n"
12175 }),
12176 "audio": Schema.Struct({
12177 "input": Schema.optionalKey(Schema.Struct({
12178 "transcription": Schema.optionalKey(
12179 Schema.Union([
12180 Schema.Struct({
12181 "model": Schema.String.annotate({
12182 "description": "The transcription model used for source transcript deltas."
12183 })
12184 }).annotate({
12185 "description":
12186 "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n"
12187 }),
12188 Schema.Null
12189 ])
12190 ),
12191 "noise_reduction": Schema.optionalKey(
12192 Schema.Union([
12193 Schema.Struct({ "type": NoiseReductionType }).annotate({
12194 "description": "Optional input noise reduction.\n"
12195 }),
12196 Schema.Null
12197 ])
12198 )
12199 })),
12200 "output": Schema.optionalKey(
12201 Schema.Struct({
12202 "language": Schema.optionalKey(
12203 Schema.String.annotate({
12204 "description": "Target language for translated output audio and transcript deltas.\n"
12205 })
12206 )
12207 })
12208 )
12209 }).annotate({ "description": "Configuration for translation input and output audio.\n" })
12210}).annotate({
12211 "title": "Realtime translation session",
12212 "description":
12213 "A Realtime translation session. Translation sessions continuously translate input\naudio into the configured output language.\n"
12214})
12215export type RealtimeTranslationSessionCreateRequest = {
12216 readonly "model": string
12217 readonly "audio"?: {
12218 readonly "input"?: {
12219 readonly "transcription"?: { readonly "model": string } | null
12220 readonly "noise_reduction"?: { readonly "type": NoiseReductionType } | null
12221 }
12222 readonly "output"?: { readonly "language"?: string }
12223 }
12224}
12225export const RealtimeTranslationSessionCreateRequest = Schema.Struct({
12226 "model": Schema.String.annotate({ "description": "The Realtime translation model used for this session.\n" }),
12227 "audio": Schema.optionalKey(
12228 Schema.Struct({
12229 "input": Schema.optionalKey(Schema.Struct({
12230 "transcription": Schema.optionalKey(
12231 Schema.Union([
12232 Schema.Struct({
12233 "model": Schema.String.annotate({
12234 "description": "The transcription model to use for source transcript deltas."
12235 })
12236 }).annotate({
12237 "description":
12238 "Optional source-language transcription. When configured, the server emits\n`session.input_transcript.delta` events. Translation itself still runs from\nthe input audio stream.\n"
12239 }),
12240 Schema.Null
12241 ])
12242 ),
12243 "noise_reduction": Schema.optionalKey(
12244 Schema.Union([
12245 Schema.Struct({ "type": NoiseReductionType }).annotate({
12246 "description": "Optional input noise reduction. Set to `null` to disable it.\n"
12247 }),
12248 Schema.Null
12249 ])
12250 )
12251 })),
12252 "output": Schema.optionalKey(
12253 Schema.Struct({
12254 "language": Schema.optionalKey(
12255 Schema.String.annotate({
12256 "description": "Target language for translated output audio and transcript deltas.\n"
12257 })
12258 )
12259 })
12260 )
12261 }).annotate({ "description": "Configuration for translation input and output audio.\n" })
12262 )
12263}).annotate({
12264 "title": "Realtime translation session configuration",
12265 "description":
12266 "Realtime translation session configuration. Translation sessions stream source\naudio in and translated audio plus transcript deltas out continuously.\n"
12267})
12268export type ListFilesResponse = {
12269 readonly "object": string
12270 readonly "data": ReadonlyArray<OpenAIFile>
12271 readonly "first_id": string
12272 readonly "last_id": string
12273 readonly "has_more": boolean
12274}
12275export const ListFilesResponse = Schema.Struct({
12276 "object": Schema.String,
12277 "data": Schema.Array(OpenAIFile),
12278 "first_id": Schema.String,
12279 "last_id": Schema.String,
12280 "has_more": Schema.Boolean
12281})
12282export type ListCertificatesResponse = {
12283 readonly "data": ReadonlyArray<OrganizationCertificate>
12284 readonly "first_id": string | null
12285 readonly "last_id": string | null
12286 readonly "has_more": boolean
12287 readonly "object": "list"
12288}
12289export const ListCertificatesResponse = Schema.Struct({
12290 "data": Schema.Array(OrganizationCertificate),
12291 "first_id": Schema.Union([Schema.String, Schema.Null]),
12292 "last_id": Schema.Union([Schema.String, Schema.Null]),
12293 "has_more": Schema.Boolean,
12294 "object": Schema.Literal("list")
12295})
12296export type OrganizationCertificateActivationResponse = {
12297 readonly "object": "organization.certificate.activation"
12298 readonly "data": ReadonlyArray<OrganizationCertificate>
12299}
12300export const OrganizationCertificateActivationResponse = Schema.Struct({
12301 "object": Schema.Literal("organization.certificate.activation").annotate({
12302 "description": "The organization certificate activation result type."
12303 }),
12304 "data": Schema.Array(OrganizationCertificate)
12305})
12306export type OrganizationCertificateDeactivationResponse = {
12307 readonly "object": "organization.certificate.deactivation"
12308 readonly "data": ReadonlyArray<OrganizationCertificate>
12309}
12310export const OrganizationCertificateDeactivationResponse = Schema.Struct({
12311 "object": Schema.Literal("organization.certificate.deactivation").annotate({
12312 "description": "The organization certificate deactivation result type."
12313 }),
12314 "data": Schema.Array(OrganizationCertificate)
12315})
12316export type ListProjectCertificatesResponse = {
12317 readonly "data": ReadonlyArray<OrganizationProjectCertificate>
12318 readonly "first_id": string | null
12319 readonly "last_id": string | null
12320 readonly "has_more": boolean
12321 readonly "object": "list"
12322}
12323export const ListProjectCertificatesResponse = Schema.Struct({
12324 "data": Schema.Array(OrganizationProjectCertificate),
12325 "first_id": Schema.Union([Schema.String, Schema.Null]),
12326 "last_id": Schema.Union([Schema.String, Schema.Null]),
12327 "has_more": Schema.Boolean,
12328 "object": Schema.Literal("list")
12329})
12330export type OrganizationProjectCertificateActivationResponse = {
12331 readonly "object": "organization.project.certificate.activation"
12332 readonly "data": ReadonlyArray<OrganizationProjectCertificate>
12333}
12334export const OrganizationProjectCertificateActivationResponse = Schema.Struct({
12335 "object": Schema.Literal("organization.project.certificate.activation").annotate({
12336 "description": "The project certificate activation result type."
12337 }),
12338 "data": Schema.Array(OrganizationProjectCertificate)
12339})
12340export type OrganizationProjectCertificateDeactivationResponse = {
12341 readonly "object": "organization.project.certificate.deactivation"
12342 readonly "data": ReadonlyArray<OrganizationProjectCertificate>
12343}
12344export const OrganizationProjectCertificateDeactivationResponse = Schema.Struct({
12345 "object": Schema.Literal("organization.project.certificate.deactivation").annotate({
12346 "description": "The project certificate deactivation result type."
12347 }),
12348 "data": Schema.Array(OrganizationProjectCertificate)
12349})
12350export type CreateImageRequest = {
12351 readonly "prompt": string
12352 readonly "model"?: string | "gpt-image-1.5" | "dall-e-2" | "dall-e-3" | "gpt-image-1" | "gpt-image-1-mini" | null
12353 readonly "n"?: number
12354 readonly "quality"?: "standard" | "hd" | "low" | "medium" | "high" | "auto" | null
12355 readonly "response_format"?: "url" | "b64_json" | null
12356 readonly "output_format"?: "png" | "jpeg" | "webp" | null
12357 readonly "output_compression"?: number | null
12358 readonly "stream"?: boolean | null
12359 readonly "partial_images"?: PartialImages
12360 readonly "size"?:
12361 | string
12362 | "auto"
12363 | "1024x1024"
12364 | "1536x1024"
12365 | "1024x1536"
12366 | "256x256"
12367 | "512x512"
12368 | "1792x1024"
12369 | "1024x1792"
12370 | null
12371 readonly "moderation"?: "low" | "auto" | null
12372 readonly "background"?: "transparent" | "opaque" | "auto" | null
12373 readonly "style"?: "vivid" | "natural" | null
12374 readonly "user"?: string
12375}
12376export const CreateImageRequest = Schema.Struct({
12377 "prompt": Schema.String.annotate({
12378 "description":
12379 "A text description of the desired image(s). The maximum length is 32000 characters for the GPT image models, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`."
12380 }),
12381 "model": Schema.optionalKey(
12382 Schema.Union([
12383 Schema.Union([
12384 Schema.String,
12385 Schema.Literals(["gpt-image-1.5", "dall-e-2", "dall-e-3", "gpt-image-1", "gpt-image-1-mini"])
12386 ]).annotate({
12387 "description":
12388 "The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used."
12389 }),
12390 Schema.Null
12391 ])
12392 ),
12393 "n": Schema.optionalKey(
12394 Schema.Union([
12395 Schema.Number.check(Schema.isInt()).check(
12396 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(10)], {
12397 "description":
12398 "The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported."
12399 })
12400 )
12401 ])
12402 ),
12403 "quality": Schema.optionalKey(
12404 Schema.Union([
12405 Schema.Literals(["standard", "hd", "low", "medium", "high", "auto"]).annotate({
12406 "description":
12407 "The quality of the image that will be generated.\n\n- `auto` (default value) will automatically select the best quality for the given model.\n- `high`, `medium` and `low` are supported for the GPT image models.\n- `hd` and `standard` are supported for `dall-e-3`.\n- `standard` is the only option for `dall-e-2`.\n"
12408 }),
12409 Schema.Union([Schema.Null]).annotate({
12410 "description":
12411 "The quality of the image that will be generated.\n\n- `auto` (default value) will automatically select the best quality for the given model.\n- `high`, `medium` and `low` are supported for the GPT image models.\n- `hd` and `standard` are supported for `dall-e-3`.\n- `standard` is the only option for `dall-e-2`.\n"
12412 })
12413 ])
12414 ),
12415 "response_format": Schema.optionalKey(Schema.Union([
12416 Schema.Literals(["url", "b64_json"]).annotate({
12417 "description":
12418 "The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for the GPT image models, which always return base64-encoded images."
12419 }),
12420 Schema.Union([Schema.Null]).annotate({
12421 "description":
12422 "The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for the GPT image models, which always return base64-encoded images."
12423 })
12424 ])),
12425 "output_format": Schema.optionalKey(
12426 Schema.Union([
12427 Schema.Literals(["png", "jpeg", "webp"]).annotate({
12428 "description":
12429 "The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`."
12430 }),
12431 Schema.Union([Schema.Null]).annotate({
12432 "description":
12433 "The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`."
12434 })
12435 ])
12436 ),
12437 "output_compression": Schema.optionalKey(
12438 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
12439 "description":
12440 "The compression level (0-100%) for the generated images. This parameter is only supported for the GPT image models with the `webp` or `jpeg` output formats, and defaults to 100."
12441 })
12442 ),
12443 "stream": Schema.optionalKey(
12444 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
12445 "description":
12446 "Generate the image in streaming mode. Defaults to `false`. See the\n[Image generation guide](/docs/guides/image-generation) for more information.\nThis parameter is only supported for the GPT image models.\n"
12447 })
12448 ),
12449 "partial_images": Schema.optionalKey(PartialImages),
12450 "size": Schema.optionalKey(
12451 Schema.Union([
12452 Schema.Union([
12453 Schema.String,
12454 Schema.Literals(["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"])
12455 ]).annotate({
12456 "description":
12457 "The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`."
12458 }),
12459 Schema.Null
12460 ])
12461 ),
12462 "moderation": Schema.optionalKey(
12463 Schema.Union([
12464 Schema.Literals(["low", "auto"]).annotate({
12465 "description":
12466 "Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value)."
12467 }),
12468 Schema.Union([Schema.Null]).annotate({
12469 "description":
12470 "Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value)."
12471 })
12472 ])
12473 ),
12474 "background": Schema.optionalKey(Schema.Union([
12475 Schema.Literals(["transparent", "opaque", "auto"]).annotate({
12476 "description":
12477 "Allows to set transparency for the background of the generated image(s).\nThis parameter is only supported for the GPT image models. Must be one of\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it\nshould be set to either `png` (default value) or `webp`.\n"
12478 }),
12479 Schema.Union([Schema.Null]).annotate({
12480 "description":
12481 "Allows to set transparency for the background of the generated image(s).\nThis parameter is only supported for the GPT image models. Must be one of\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it\nshould be set to either `png` (default value) or `webp`.\n"
12482 })
12483 ])),
12484 "style": Schema.optionalKey(Schema.Union([
12485 Schema.Literals(["vivid", "natural"]).annotate({
12486 "description":
12487 "The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images."
12488 }),
12489 Schema.Union([Schema.Null]).annotate({
12490 "description":
12491 "The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images."
12492 })
12493 ])),
12494 "user": Schema.optionalKey(
12495 Schema.String.annotate({
12496 "description":
12497 "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).\n"
12498 })
12499 )
12500})
12501export type EditImageBodyJsonParam = {
12502 readonly "model"?: string | "gpt-image-1.5" | "gpt-image-1" | "gpt-image-1-mini" | "chatgpt-image-latest" | null
12503 readonly "images": ReadonlyArray<ImageRefParam>
12504 readonly "mask"?: ImageRefParam
12505 readonly "prompt": string
12506 readonly "n"?: number | null
12507 readonly "quality"?: "low" | "medium" | "high" | "auto" | null
12508 readonly "input_fidelity"?: "high" | "low" | null
12509 readonly "size"?: "auto" | "1024x1024" | "1536x1024" | "1024x1536" | null
12510 readonly "user"?: string
12511 readonly "output_format"?: "png" | "jpeg" | "webp" | null
12512 readonly "output_compression"?: number | null
12513 readonly "moderation"?: "low" | "auto" | null
12514 readonly "background"?: "transparent" | "opaque" | "auto" | null
12515 readonly "stream"?: boolean | null
12516 readonly "partial_images"?: PartialImages
12517}
12518export const EditImageBodyJsonParam = Schema.Struct({
12519 "model": Schema.optionalKey(
12520 Schema.Union([
12521 Schema.String,
12522 Schema.Literals(["gpt-image-1.5", "gpt-image-1", "gpt-image-1-mini", "chatgpt-image-latest"]),
12523 Schema.Null
12524 ]).annotate({ "description": "The model to use for image editing." })
12525 ),
12526 "images": Schema.Array(ImageRefParam).annotate({
12527 "description": "Input image references to edit.\nFor GPT image models, you can provide up to 16 images.\n"
12528 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(16)),
12529 "mask": Schema.optionalKey(ImageRefParam),
12530 "prompt": Schema.String.annotate({ "description": "A text description of the desired image edit." }).check(
12531 Schema.isMinLength(1)
12532 ).check(Schema.isMaxLength(32000)),
12533 "n": Schema.optionalKey(
12534 Schema.Union([
12535 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(10)),
12536 Schema.Null
12537 ]).annotate({ "description": "The number of edited images to generate." })
12538 ),
12539 "quality": Schema.optionalKey(
12540 Schema.Union([Schema.Literals(["low", "medium", "high", "auto"]), Schema.Null]).annotate({
12541 "description": "Output quality for GPT image models.\n"
12542 })
12543 ),
12544 "input_fidelity": Schema.optionalKey(
12545 Schema.Union([Schema.Literals(["high", "low"]), Schema.Null]).annotate({
12546 "description": "Controls fidelity to the original input image(s)."
12547 })
12548 ),
12549 "size": Schema.optionalKey(
12550 Schema.Union([Schema.Literals(["auto", "1024x1024", "1536x1024", "1024x1536"]), Schema.Null]).annotate({
12551 "description": "Requested output image size."
12552 })
12553 ),
12554 "user": Schema.optionalKey(
12555 Schema.String.annotate({
12556 "description":
12557 "A unique identifier representing your end-user, which can help OpenAI\nmonitor and detect abuse.\n"
12558 })
12559 ),
12560 "output_format": Schema.optionalKey(
12561 Schema.Union([Schema.Literals(["png", "jpeg", "webp"]), Schema.Null]).annotate({
12562 "description": "Output image format. Supported for GPT image models."
12563 })
12564 ),
12565 "output_compression": Schema.optionalKey(
12566 Schema.Union([
12567 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(
12568 Schema.isLessThanOrEqualTo(100)
12569 ),
12570 Schema.Null
12571 ]).annotate({ "description": "Compression level for `jpeg` or `webp` output." })
12572 ),
12573 "moderation": Schema.optionalKey(
12574 Schema.Union([Schema.Literals(["low", "auto"]), Schema.Null]).annotate({
12575 "description": "Moderation level for GPT image models."
12576 })
12577 ),
12578 "background": Schema.optionalKey(
12579 Schema.Union([Schema.Literals(["transparent", "opaque", "auto"]), Schema.Null]).annotate({
12580 "description": "Background behavior for generated image output."
12581 })
12582 ),
12583 "stream": Schema.optionalKey(
12584 Schema.Union([Schema.Boolean, Schema.Null]).annotate({ "description": "Stream partial image results as events." })
12585 ),
12586 "partial_images": Schema.optionalKey(PartialImages)
12587}).annotate({
12588 "description":
12589 "JSON request body for image edits.\n\nUse `images` (array of `ImageRefParam`) instead of multipart `image` uploads.\nYou can reference images via external URLs, data URLs, or uploaded file IDs.\nJSON edits support GPT image models only; DALL-E edits require multipart (`dall-e-2` only).\n"
12590})
12591export type ProjectListResponse = {
12592 readonly "object": "list"
12593 readonly "data": ReadonlyArray<Project>
12594 readonly "first_id"?: string | null
12595 readonly "last_id"?: string | null
12596 readonly "has_more": boolean
12597}
12598export const ProjectListResponse = Schema.Struct({
12599 "object": Schema.Literal("list"),
12600 "data": Schema.Array(Project),
12601 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12602 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12603 "has_more": Schema.Boolean
12604})
12605export type ProjectApiKey = {
12606 readonly "object": "organization.project.api_key"
12607 readonly "redacted_value": string
12608 readonly "name": string
12609 readonly "created_at": number
12610 readonly "last_used_at": number | null
12611 readonly "id": string
12612 readonly "owner": {
12613 readonly "type"?: "user" | "service_account"
12614 readonly "user"?: ProjectApiKeyOwnerUser
12615 readonly "service_account"?: ProjectApiKeyOwnerServiceAccount
12616 }
12617}
12618export const ProjectApiKey = Schema.Struct({
12619 "object": Schema.Literal("organization.project.api_key").annotate({
12620 "description": "The object type, which is always `organization.project.api_key`"
12621 }),
12622 "redacted_value": Schema.String.annotate({ "description": "The redacted value of the API key" }),
12623 "name": Schema.String.annotate({ "description": "The name of the API key" }),
12624 "created_at": Schema.Number.annotate({
12625 "description": "The Unix timestamp (in seconds) of when the API key was created",
12626 "format": "unixtime"
12627 }).check(Schema.isInt()),
12628 "last_used_at": Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null])
12629 .annotate({ "description": "The Unix timestamp (in seconds) of when the API key was last used." }),
12630 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints" }),
12631 "owner": Schema.Struct({
12632 "type": Schema.optionalKey(
12633 Schema.Literals(["user", "service_account"]).annotate({ "description": "`user` or `service_account`" })
12634 ),
12635 "user": Schema.optionalKey(ProjectApiKeyOwnerUser),
12636 "service_account": Schema.optionalKey(ProjectApiKeyOwnerServiceAccount)
12637 })
12638}).annotate({ "description": "Represents an individual API key in a project." })
12639export type ProjectGroupListResource = {
12640 readonly "object": "list"
12641 readonly "data": ReadonlyArray<ProjectGroup>
12642 readonly "has_more": boolean
12643 readonly "next": string | null
12644}
12645export const ProjectGroupListResource = Schema.Struct({
12646 "object": Schema.Literal("list").annotate({ "description": "Always `list`." }),
12647 "data": Schema.Array(ProjectGroup).annotate({
12648 "description": "Project group memberships returned in the current page."
12649 }),
12650 "has_more": Schema.Boolean.annotate({ "description": "Whether additional project group memberships are available." }),
12651 "next": Schema.Union([Schema.String, Schema.Null]).annotate({
12652 "description": "Cursor to fetch the next page of results, or `null` when there are no more results."
12653 })
12654}).annotate({ "description": "Paginated list of groups that have access to a project." })
12655export type ProjectRateLimitListResponse = {
12656 readonly "object": "list"
12657 readonly "data": ReadonlyArray<ProjectRateLimit>
12658 readonly "first_id"?: string | null
12659 readonly "last_id"?: string | null
12660 readonly "has_more": boolean
12661}
12662export const ProjectRateLimitListResponse = Schema.Struct({
12663 "object": Schema.Literal("list"),
12664 "data": Schema.Array(ProjectRateLimit),
12665 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12666 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12667 "has_more": Schema.Boolean
12668})
12669export type ProjectServiceAccountListResponse = {
12670 readonly "object": "list"
12671 readonly "data": ReadonlyArray<ProjectServiceAccount>
12672 readonly "first_id"?: string | null
12673 readonly "last_id"?: string | null
12674 readonly "has_more": boolean
12675}
12676export const ProjectServiceAccountListResponse = Schema.Struct({
12677 "object": Schema.Literal("list"),
12678 "data": Schema.Array(ProjectServiceAccount),
12679 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12680 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12681 "has_more": Schema.Boolean
12682})
12683export type ProjectServiceAccountCreateResponse = {
12684 readonly "object": "organization.project.service_account"
12685 readonly "id": string
12686 readonly "name": string
12687 readonly "role": "member"
12688 readonly "created_at": number
12689 readonly "api_key": ProjectServiceAccountApiKey | null
12690}
12691export const ProjectServiceAccountCreateResponse = Schema.Struct({
12692 "object": Schema.Literal("organization.project.service_account"),
12693 "id": Schema.String,
12694 "name": Schema.String,
12695 "role": Schema.Literal("member").annotate({
12696 "description": "Service accounts can only have one role of type `member`"
12697 }),
12698 "created_at": Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()),
12699 "api_key": Schema.Union([ProjectServiceAccountApiKey, Schema.Null])
12700})
12701export type ProjectUserListResponse = {
12702 readonly "object": string
12703 readonly "data": ReadonlyArray<ProjectUser>
12704 readonly "first_id"?: string | null
12705 readonly "last_id"?: string | null
12706 readonly "has_more": boolean
12707}
12708export const ProjectUserListResponse = Schema.Struct({
12709 "object": Schema.String,
12710 "data": Schema.Array(ProjectUser),
12711 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12712 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
12713 "has_more": Schema.Boolean
12714})
12715export type RealtimeTranscriptionSessionCreateResponseGA = {
12716 readonly "type": "transcription"
12717 readonly "id": string
12718 readonly "object": string
12719 readonly "expires_at"?: number
12720 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
12721 readonly "audio"?: {
12722 readonly "input"?: {
12723 readonly "format"?: RealtimeAudioFormats
12724 readonly "transcription"?: {
12725 readonly "model"?:
12726 | string
12727 | "whisper-1"
12728 | "gpt-4o-mini-transcribe"
12729 | "gpt-4o-mini-transcribe-2025-12-15"
12730 | "gpt-4o-transcribe"
12731 | "gpt-4o-transcribe-diarize"
12732 | "gpt-realtime-whisper"
12733 readonly "language"?: string
12734 readonly "prompt"?: string
12735 }
12736 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
12737 readonly "turn_detection"?: {
12738 readonly "type"?: string
12739 readonly "threshold"?: number
12740 readonly "prefix_padding_ms"?: number
12741 readonly "silence_duration_ms"?: number
12742 } | null
12743 }
12744 }
12745}
12746export const RealtimeTranscriptionSessionCreateResponseGA = Schema.Struct({
12747 "type": Schema.Literal("transcription").annotate({
12748 "description": "The type of session. Always `transcription` for transcription sessions.\n"
12749 }),
12750 "id": Schema.String.annotate({
12751 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
12752 }),
12753 "object": Schema.String.annotate({ "description": "The object type. Always `realtime.transcription_session`." }),
12754 "expires_at": Schema.optionalKey(
12755 Schema.Number.annotate({
12756 "description": "Expiration timestamp for the session, in seconds since epoch.",
12757 "format": "unixtime"
12758 }).check(Schema.isInt())
12759 ),
12760 "include": Schema.optionalKey(
12761 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
12762 "description":
12763 "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
12764 })
12765 ),
12766 "audio": Schema.optionalKey(
12767 Schema.Struct({
12768 "input": Schema.optionalKey(Schema.Struct({
12769 "format": Schema.optionalKey(RealtimeAudioFormats),
12770 "transcription": Schema.optionalKey(
12771 Schema.Struct({
12772 "model": Schema.optionalKey(
12773 Schema.Union([
12774 Schema.String,
12775 Schema.Literals([
12776 "whisper-1",
12777 "gpt-4o-mini-transcribe",
12778 "gpt-4o-mini-transcribe-2025-12-15",
12779 "gpt-4o-transcribe",
12780 "gpt-4o-transcribe-diarize",
12781 "gpt-realtime-whisper"
12782 ])
12783 ]).annotate({
12784 "description":
12785 "The model used for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n"
12786 })
12787 ),
12788 "language": Schema.optionalKey(
12789 Schema.String.annotate({ "description": "The language of the input audio.\n" })
12790 ),
12791 "prompt": Schema.optionalKey(
12792 Schema.String.annotate({
12793 "description": "The prompt configured for input audio transcription, when present.\n"
12794 })
12795 )
12796 }).annotate({ "description": "Configuration of the transcription model.\n" })
12797 ),
12798 "noise_reduction": Schema.optionalKey(
12799 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
12800 "description": "Configuration for input audio noise reduction.\n"
12801 })
12802 ),
12803 "turn_detection": Schema.optionalKey(
12804 Schema.Union([
12805 Schema.Struct({
12806 "type": Schema.optionalKey(
12807 Schema.String.annotate({
12808 "description": "Type of turn detection, only `server_vad` is currently supported.\n"
12809 })
12810 ),
12811 "threshold": Schema.optionalKey(
12812 Schema.Number.annotate({
12813 "description":
12814 "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"
12815 }).check(Schema.isFinite())
12816 ),
12817 "prefix_padding_ms": Schema.optionalKey(
12818 Schema.Number.annotate({
12819 "description":
12820 "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"
12821 }).check(Schema.isInt())
12822 ),
12823 "silence_duration_ms": Schema.optionalKey(
12824 Schema.Number.annotate({
12825 "description":
12826 "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"
12827 }).check(Schema.isInt())
12828 )
12829 }).annotate({
12830 "description":
12831 "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.\n"
12832 }),
12833 Schema.Null
12834 ]).annotate({
12835 "description":
12836 "Configuration for turn detection. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported.\n"
12837 })
12838 )
12839 }))
12840 }).annotate({ "description": "Configuration for input audio for the session.\n" })
12841 )
12842}).annotate({
12843 "title": "Realtime transcription session configuration object",
12844 "description": "A Realtime transcription session configuration object.\n"
12845})
12846export type RealtimeMCPToolCall = {
12847 readonly "type": "mcp_call"
12848 readonly "id": string
12849 readonly "server_label": string
12850 readonly "name": string
12851 readonly "arguments": string
12852 readonly "approval_request_id"?: string | null
12853 readonly "output"?: string | null
12854 readonly "error"?: RealtimeMCPProtocolError | RealtimeMCPToolExecutionError | RealtimeMCPHTTPError | null
12855}
12856export const RealtimeMCPToolCall = Schema.Struct({
12857 "type": Schema.Literal("mcp_call").annotate({ "description": "The type of the item. Always `mcp_call`." }),
12858 "id": Schema.String.annotate({ "description": "The unique ID of the tool call." }),
12859 "server_label": Schema.String.annotate({ "description": "The label of the MCP server running the tool." }),
12860 "name": Schema.String.annotate({ "description": "The name of the tool that was run." }),
12861 "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments passed to the tool." }),
12862 "approval_request_id": Schema.optionalKey(
12863 Schema.Union([
12864 Schema.String.annotate({ "description": "The ID of an associated approval request, if any." }),
12865 Schema.Null
12866 ])
12867 ),
12868 "output": Schema.optionalKey(
12869 Schema.Union([Schema.String.annotate({ "description": "The output from the tool call." }), Schema.Null])
12870 ),
12871 "error": Schema.optionalKey(
12872 Schema.Union([
12873 Schema.Union([RealtimeMCPProtocolError, RealtimeMCPToolExecutionError, RealtimeMCPHTTPError], { mode: "oneOf" })
12874 .annotate({ "description": "The error from the tool call, if any." }),
12875 Schema.Null
12876 ])
12877 )
12878}).annotate({
12879 "title": "Realtime MCP tool call",
12880 "description": "A Realtime item representing an invocation of a tool on an MCP server.\n"
12881})
12882export type RealtimeReasoning = { readonly "effort"?: RealtimeReasoningEffort }
12883export const RealtimeReasoning = Schema.Struct({ "effort": Schema.optionalKey(RealtimeReasoningEffort) }).annotate({
12884 "title": "Realtime reasoning configuration",
12885 "description": "Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.\n"
12886})
12887export type RealtimeTranscriptionSessionCreateRequestGA = {
12888 readonly "type": "transcription"
12889 readonly "audio"?: {
12890 readonly "input"?: {
12891 readonly "format"?: RealtimeAudioFormats
12892 readonly "transcription"?: {
12893 readonly "model"?:
12894 | string
12895 | "whisper-1"
12896 | "gpt-4o-mini-transcribe"
12897 | "gpt-4o-mini-transcribe-2025-12-15"
12898 | "gpt-4o-transcribe"
12899 | "gpt-4o-transcribe-diarize"
12900 | "gpt-realtime-whisper"
12901 readonly "language"?: string
12902 readonly "prompt"?: string
12903 readonly "delay"?: "minimal" | "low" | "medium" | "high" | "xhigh"
12904 }
12905 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
12906 readonly "turn_detection"?: RealtimeTurnDetection
12907 }
12908 }
12909 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
12910}
12911export const RealtimeTranscriptionSessionCreateRequestGA = Schema.Struct({
12912 "type": Schema.Literal("transcription").annotate({
12913 "description": "The type of session to create. Always `transcription` for transcription sessions.\n"
12914 }),
12915 "audio": Schema.optionalKey(
12916 Schema.Struct({
12917 "input": Schema.optionalKey(Schema.Struct({
12918 "format": Schema.optionalKey(RealtimeAudioFormats),
12919 "transcription": Schema.optionalKey(
12920 Schema.Struct({
12921 "model": Schema.optionalKey(
12922 Schema.Union([
12923 Schema.String,
12924 Schema.Literals([
12925 "whisper-1",
12926 "gpt-4o-mini-transcribe",
12927 "gpt-4o-mini-transcribe-2025-12-15",
12928 "gpt-4o-transcribe",
12929 "gpt-4o-transcribe-diarize",
12930 "gpt-realtime-whisper"
12931 ])
12932 ]).annotate({
12933 "description":
12934 "The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n"
12935 })
12936 ),
12937 "language": Schema.optionalKey(
12938 Schema.String.annotate({
12939 "description":
12940 "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"
12941 })
12942 ),
12943 "prompt": Schema.optionalKey(Schema.String.annotate({
12944 "description":
12945 "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
12946 })),
12947 "delay": Schema.optionalKey(
12948 Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
12949 "description":
12950 "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
12951 })
12952 )
12953 }).annotate({
12954 "description":
12955 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
12956 })
12957 ),
12958 "noise_reduction": Schema.optionalKey(
12959 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
12960 "description":
12961 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
12962 })
12963 ),
12964 "turn_detection": Schema.optionalKey(RealtimeTurnDetection)
12965 }))
12966 }).annotate({ "description": "Configuration for input and output audio.\n" })
12967 ),
12968 "include": Schema.optionalKey(
12969 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
12970 "description":
12971 "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
12972 })
12973 )
12974}).annotate({
12975 "title": "Realtime transcription session configuration",
12976 "description": "Realtime transcription session object configuration."
12977})
12978export type Reasoning = {
12979 readonly "effort"?: ReasoningEffort
12980 readonly "summary"?: "auto" | "concise" | "detailed" | null
12981 readonly "generate_summary"?: "auto" | "concise" | "detailed" | null
12982}
12983export const Reasoning = Schema.Struct({
12984 "effort": Schema.optionalKey(ReasoningEffort),
12985 "summary": Schema.optionalKey(Schema.Union([
12986 Schema.Literals(["auto", "concise", "detailed"]).annotate({
12987 "description":
12988 "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n\n`concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.\n"
12989 }),
12990 Schema.Null
12991 ])),
12992 "generate_summary": Schema.optionalKey(
12993 Schema.Union([
12994 Schema.Literals(["auto", "concise", "detailed"]).annotate({
12995 "description":
12996 "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n"
12997 }),
12998 Schema.Null
12999 ])
13000 )
13001}).annotate({
13002 "title": "Reasoning",
13003 "description":
13004 "**gpt-5 and o-series models only**\n\nConfiguration options for\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\n"
13005})
13006export type ResponseError = { readonly "code": ResponseErrorCode; readonly "message": string } | null
13007export const ResponseError = Schema.Union([
13008 Schema.Struct({
13009 "code": ResponseErrorCode,
13010 "message": Schema.String.annotate({ "description": "A human-readable description of the error.\n" })
13011 }).annotate({ "description": "An error object returned when the model fails to generate a Response.\n" }),
13012 Schema.Null
13013])
13014export type ResponseFormatJsonSchema = {
13015 readonly "type": "json_schema"
13016 readonly "json_schema": {
13017 readonly "description"?: string
13018 readonly "name": string
13019 readonly "schema"?: ResponseFormatJsonSchemaSchema
13020 readonly "strict"?: boolean | null
13021 }
13022}
13023export const ResponseFormatJsonSchema = Schema.Struct({
13024 "type": Schema.Literal("json_schema").annotate({
13025 "description": "The type of response format being defined. Always `json_schema`."
13026 }),
13027 "json_schema": Schema.Struct({
13028 "description": Schema.optionalKey(
13029 Schema.String.annotate({
13030 "description":
13031 "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n"
13032 })
13033 ),
13034 "name": Schema.String.annotate({
13035 "description":
13036 "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n"
13037 }),
13038 "schema": Schema.optionalKey(ResponseFormatJsonSchemaSchema),
13039 "strict": Schema.optionalKey(Schema.Union([
13040 Schema.Boolean.annotate({
13041 "description":
13042 "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n"
13043 }),
13044 Schema.Null
13045 ]))
13046 }).annotate({
13047 "title": "JSON schema",
13048 "description": "Structured Outputs configuration options, including a JSON Schema.\n"
13049 })
13050}).annotate({
13051 "title": "JSON schema",
13052 "description":
13053 "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](/docs/guides/structured-outputs).\n"
13054})
13055export type TextResponseFormatJsonSchema = {
13056 readonly "type": "json_schema"
13057 readonly "description"?: string
13058 readonly "name": string
13059 readonly "schema": ResponseFormatJsonSchemaSchema
13060 readonly "strict"?: boolean | null
13061}
13062export const TextResponseFormatJsonSchema = Schema.Struct({
13063 "type": Schema.Literal("json_schema").annotate({
13064 "description": "The type of response format being defined. Always `json_schema`."
13065 }),
13066 "description": Schema.optionalKey(
13067 Schema.String.annotate({
13068 "description":
13069 "A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n"
13070 })
13071 ),
13072 "name": Schema.String.annotate({
13073 "description":
13074 "The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n"
13075 }),
13076 "schema": ResponseFormatJsonSchemaSchema,
13077 "strict": Schema.optionalKey(Schema.Union([
13078 Schema.Boolean.annotate({
13079 "description":
13080 "Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n"
13081 }),
13082 Schema.Null
13083 ]))
13084}).annotate({
13085 "title": "JSON schema",
13086 "description":
13087 "JSON Schema response format. Used to generate structured JSON responses.\nLearn more about [Structured Outputs](/docs/guides/structured-outputs).\n"
13088})
13089export type ResponseTextDeltaEvent = {
13090 readonly "type": "response.output_text.delta"
13091 readonly "item_id": string
13092 readonly "output_index": number
13093 readonly "content_index": number
13094 readonly "delta": string
13095 readonly "sequence_number": number
13096 readonly "logprobs": ReadonlyArray<ResponseLogProb>
13097}
13098export const ResponseTextDeltaEvent = Schema.Struct({
13099 "type": Schema.Literal("response.output_text.delta").annotate({
13100 "description": "The type of the event. Always `response.output_text.delta`.\n"
13101 }),
13102 "item_id": Schema.String.annotate({ "description": "The ID of the output item that the text delta was added to.\n" }),
13103 "output_index": Schema.Number.annotate({
13104 "description": "The index of the output item that the text delta was added to.\n"
13105 }).check(Schema.isInt()),
13106 "content_index": Schema.Number.annotate({
13107 "description": "The index of the content part that the text delta was added to.\n"
13108 }).check(Schema.isInt()),
13109 "delta": Schema.String.annotate({ "description": "The text delta that was added.\n" }),
13110 "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check(
13111 Schema.isInt()
13112 ),
13113 "logprobs": Schema.Array(ResponseLogProb).annotate({
13114 "description": "The log probabilities of the tokens in the delta.\n"
13115 })
13116}).annotate({ "description": "Emitted when there is an additional text delta." })
13117export type ResponseTextDoneEvent = {
13118 readonly "type": "response.output_text.done"
13119 readonly "item_id": string
13120 readonly "output_index": number
13121 readonly "content_index": number
13122 readonly "text": string
13123 readonly "sequence_number": number
13124 readonly "logprobs": ReadonlyArray<ResponseLogProb>
13125}
13126export const ResponseTextDoneEvent = Schema.Struct({
13127 "type": Schema.Literal("response.output_text.done").annotate({
13128 "description": "The type of the event. Always `response.output_text.done`.\n"
13129 }),
13130 "item_id": Schema.String.annotate({
13131 "description": "The ID of the output item that the text content is finalized.\n"
13132 }),
13133 "output_index": Schema.Number.annotate({
13134 "description": "The index of the output item that the text content is finalized.\n"
13135 }).check(Schema.isInt()),
13136 "content_index": Schema.Number.annotate({
13137 "description": "The index of the content part that the text content is finalized.\n"
13138 }).check(Schema.isInt()),
13139 "text": Schema.String.annotate({ "description": "The text content that is finalized.\n" }),
13140 "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check(
13141 Schema.isInt()
13142 ),
13143 "logprobs": Schema.Array(ResponseLogProb).annotate({
13144 "description": "The log probabilities of the tokens in the delta.\n"
13145 })
13146}).annotate({ "description": "Emitted when text content is finalized." })
13147export type Prompt = {
13148 readonly "id": string
13149 readonly "version"?: string | null
13150 readonly "variables"?: ResponsePromptVariables
13151} | null
13152export const Prompt = Schema.Union([
13153 Schema.Struct({
13154 "id": Schema.String.annotate({ "description": "The unique identifier of the prompt template to use." }),
13155 "version": Schema.optionalKey(
13156 Schema.Union([Schema.String.annotate({ "description": "Optional version of the prompt template." }), Schema.Null])
13157 ),
13158 "variables": Schema.optionalKey(ResponsePromptVariables)
13159 }).annotate({
13160 "description":
13161 "Reference to a prompt template and its variables.\n[Learn more](/docs/guides/text?api-mode=responses#reusable-prompts).\n"
13162 }),
13163 Schema.Null
13164])
13165export type GroupRoleAssignment = { readonly "object": "group.role"; readonly "group": Group; readonly "role": Role }
13166export const GroupRoleAssignment = Schema.Struct({
13167 "object": Schema.Literal("group.role").annotate({ "description": "Always `group.role`." }),
13168 "group": Group,
13169 "role": Role
13170}).annotate({ "description": "Role assignment linking a group to a role." })
13171export type PublicRoleListResource = {
13172 readonly "object": "list"
13173 readonly "data": ReadonlyArray<Role>
13174 readonly "has_more": boolean
13175 readonly "next": string | null
13176}
13177export const PublicRoleListResource = Schema.Struct({
13178 "object": Schema.Literal("list").annotate({ "description": "Always `list`." }),
13179 "data": Schema.Array(Role).annotate({ "description": "Roles returned in the current page." }),
13180 "has_more": Schema.Boolean.annotate({ "description": "Whether more roles are available when paginating." }),
13181 "next": Schema.Union([Schema.String, Schema.Null]).annotate({
13182 "description": "Cursor to fetch the next page of results, or `null` when there are no additional roles."
13183 })
13184}).annotate({ "description": "Paginated list of roles available on an organization or project." })
13185export type RunStepDeltaObject = {
13186 readonly "id": string
13187 readonly "object": "thread.run.step.delta"
13188 readonly "delta": {
13189 readonly "step_details"?: {
13190 readonly "type": "message_creation"
13191 readonly "message_creation"?: { readonly "message_id"?: string }
13192 } | {
13193 readonly "type": "tool_calls"
13194 readonly "tool_calls"?: ReadonlyArray<
13195 | RunStepDeltaStepDetailsToolCallsCodeObject
13196 | RunStepDeltaStepDetailsToolCallsFileSearchObject
13197 | RunStepDeltaStepDetailsToolCallsFunctionObject
13198 >
13199 }
13200 }
13201}
13202export const RunStepDeltaObject = Schema.Struct({
13203 "id": Schema.String.annotate({
13204 "description": "The identifier of the run step, which can be referenced in API endpoints."
13205 }),
13206 "object": Schema.Literal("thread.run.step.delta").annotate({
13207 "description": "The object type, which is always `thread.run.step.delta`."
13208 }),
13209 "delta": Schema.Struct({
13210 "step_details": Schema.optionalKey(Schema.Union([
13211 Schema.Struct({
13212 "type": Schema.Literal("message_creation").annotate({ "description": "Always `message_creation`." }),
13213 "message_creation": Schema.optionalKey(
13214 Schema.Struct({
13215 "message_id": Schema.optionalKey(
13216 Schema.String.annotate({ "description": "The ID of the message that was created by this run step." })
13217 )
13218 })
13219 )
13220 }).annotate({ "title": "Message creation", "description": "The details of the run step." }),
13221 Schema.Struct({
13222 "type": Schema.Literal("tool_calls").annotate({ "description": "Always `tool_calls`." }),
13223 "tool_calls": Schema.optionalKey(
13224 Schema.Array(
13225 Schema.Union([
13226 RunStepDeltaStepDetailsToolCallsCodeObject,
13227 RunStepDeltaStepDetailsToolCallsFileSearchObject,
13228 RunStepDeltaStepDetailsToolCallsFunctionObject
13229 ], { mode: "oneOf" })
13230 ).annotate({
13231 "description":
13232 "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n"
13233 })
13234 )
13235 }).annotate({ "title": "Tool calls", "description": "The details of the run step." })
13236 ], { mode: "oneOf" }))
13237 }).annotate({ "description": "The delta containing the fields that have changed on the run step." })
13238}).annotate({
13239 "title": "Run step delta object",
13240 "description": "Represents a run step delta i.e. any changed fields on a run step during streaming.\n"
13241})
13242export type CreateSpeechResponseStreamEvent = SpeechAudioDeltaEvent | SpeechAudioDoneEvent
13243export const CreateSpeechResponseStreamEvent = Schema.Union([SpeechAudioDeltaEvent, SpeechAudioDoneEvent])
13244export type ChunkingStrategyRequestParam = { readonly "type": "auto" } | {
13245 readonly "type": "static"
13246 readonly "static": StaticChunkingStrategy
13247}
13248export const ChunkingStrategyRequestParam = Schema.Union([
13249 Schema.Struct({ "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }) }).annotate({
13250 "title": "Auto Chunking Strategy",
13251 "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
13252 }),
13253 Schema.Struct({
13254 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
13255 "static": StaticChunkingStrategy
13256 }).annotate({
13257 "title": "Static Chunking Strategy",
13258 "description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
13259 })
13260], { mode: "oneOf" })
13261export type CreateCompletionRequest = {
13262 readonly "model": string | "gpt-3.5-turbo-instruct" | "davinci-002" | "babbage-002"
13263 readonly "prompt":
13264 | string
13265 | ReadonlyArray<string>
13266 | ReadonlyArray<number>
13267 | ReadonlyArray<ReadonlyArray<number>>
13268 | null
13269 readonly "best_of"?: number
13270 readonly "echo"?: boolean | null
13271 readonly "frequency_penalty"?: number
13272 readonly "logit_bias"?: {}
13273 readonly "logprobs"?: number
13274 readonly "max_tokens"?: number
13275 readonly "n"?: number
13276 readonly "presence_penalty"?: number
13277 readonly "seed"?: never
13278 readonly "stop"?: StopConfiguration
13279 readonly "stream"?: boolean | null
13280 readonly "stream_options"?: ChatCompletionStreamOptions
13281 readonly "suffix"?: string | null
13282 readonly "temperature"?: number
13283 readonly "top_p"?: number
13284 readonly "user"?: string
13285}
13286export const CreateCompletionRequest = Schema.Struct({
13287 "model": Schema.Union([Schema.String, Schema.Literals(["gpt-3.5-turbo-instruct", "davinci-002", "babbage-002"])])
13288 .annotate({
13289 "description":
13290 "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.\n"
13291 }),
13292 "prompt": Schema.Union([
13293 Schema.Union([
13294 Schema.String,
13295 Schema.Array(Schema.String),
13296 Schema.Array(Schema.Number.check(Schema.isInt())).check(Schema.isMinLength(1)),
13297 Schema.Array(Schema.Array(Schema.Number.check(Schema.isInt())).check(Schema.isMinLength(1))).check(
13298 Schema.isMinLength(1)
13299 )
13300 ], { mode: "oneOf" }).annotate({
13301 "description":
13302 "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n"
13303 }),
13304 Schema.Null
13305 ]),
13306 "best_of": Schema.optionalKey(
13307 Schema.Union([
13308 Schema.Number.check(Schema.isInt()).check(
13309 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)], {
13310 "description":
13311 "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n"
13312 })
13313 )
13314 ])
13315 ),
13316 "echo": Schema.optionalKey(
13317 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
13318 "description": "Echo back the prompt in addition to the completion\n"
13319 })
13320 ),
13321 "frequency_penalty": Schema.optionalKey(
13322 Schema.Union([
13323 Schema.Number.check(Schema.isFinite()).check(
13324 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(-2), Schema.isLessThanOrEqualTo(2)], {
13325 "description":
13326 "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation)\n"
13327 })
13328 )
13329 ])
13330 ),
13331 "logit_bias": Schema.optionalKey(Schema.Union([
13332 Schema.Struct({}).annotate({
13333 "description":
13334 "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n"
13335 })
13336 ])),
13337 "logprobs": Schema.optionalKey(
13338 Schema.Union([
13339 Schema.Number.check(Schema.isInt()).check(
13340 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(5)], {
13341 "description":
13342 "Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5.\n"
13343 })
13344 )
13345 ])
13346 ),
13347 "max_tokens": Schema.optionalKey(
13348 Schema.Union([
13349 Schema.Number.check(Schema.isInt()).check(
13350 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(0)], {
13351 "description":
13352 "The maximum number of [tokens](/tokenizer) that can be generated in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens.\n"
13353 })
13354 )
13355 ])
13356 ),
13357 "n": Schema.optionalKey(
13358 Schema.Union([
13359 Schema.Number.check(Schema.isInt()).check(
13360 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(128)], {
13361 "description":
13362 "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n"
13363 })
13364 )
13365 ])
13366 ),
13367 "presence_penalty": Schema.optionalKey(
13368 Schema.Union([
13369 Schema.Number.check(Schema.isFinite()).check(
13370 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(-2), Schema.isLessThanOrEqualTo(2)], {
13371 "description":
13372 "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/guides/text-generation)\n"
13373 })
13374 )
13375 ])
13376 ),
13377 "seed": Schema.optionalKey(Schema.Never),
13378 "stop": Schema.optionalKey(StopConfiguration),
13379 "stream": Schema.optionalKey(
13380 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
13381 "description":
13382 "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).\n"
13383 })
13384 ),
13385 "stream_options": Schema.optionalKey(ChatCompletionStreamOptions),
13386 "suffix": Schema.optionalKey(
13387 Schema.Union([Schema.String, Schema.Null]).annotate({
13388 "description":
13389 "The suffix that comes after a completion of inserted text.\n\nThis parameter is only supported for `gpt-3.5-turbo-instruct`.\n"
13390 })
13391 ),
13392 "temperature": Schema.optionalKey(
13393 Schema.Union([
13394 Schema.Number.check(Schema.isFinite()).check(
13395 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(2)], {
13396 "description":
13397 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n"
13398 })
13399 )
13400 ])
13401 ),
13402 "top_p": Schema.optionalKey(
13403 Schema.Union([
13404 Schema.Number.check(Schema.isFinite()).check(
13405 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(1)], {
13406 "description":
13407 "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
13408 })
13409 )
13410 ])
13411 ),
13412 "user": Schema.optionalKey(
13413 Schema.String.annotate({
13414 "description":
13415 "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).\n"
13416 })
13417 )
13418})
13419export type TranscriptTextDoneEvent = {
13420 readonly "type": "transcript.text.done"
13421 readonly "text": string
13422 readonly "logprobs"?: ReadonlyArray<
13423 { readonly "token"?: string; readonly "logprob"?: number; readonly "bytes"?: ReadonlyArray<number> }
13424 >
13425 readonly "usage"?: TranscriptTextUsageTokens
13426}
13427export const TranscriptTextDoneEvent = Schema.Struct({
13428 "type": Schema.Literal("transcript.text.done").annotate({
13429 "description": "The type of the event. Always `transcript.text.done`.\n"
13430 }),
13431 "text": Schema.String.annotate({ "description": "The text that was transcribed.\n" }),
13432 "logprobs": Schema.optionalKey(
13433 Schema.Array(Schema.Struct({
13434 "token": Schema.optionalKey(
13435 Schema.String.annotate({ "description": "The token that was used to generate the log probability.\n" })
13436 ),
13437 "logprob": Schema.optionalKey(
13438 Schema.Number.annotate({ "description": "The log probability of the token.\n" }).check(Schema.isFinite())
13439 ),
13440 "bytes": Schema.optionalKey(
13441 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
13442 "description": "The bytes that were used to generate the log probability.\n"
13443 })
13444 )
13445 })).annotate({
13446 "description":
13447 "The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](/docs/api-reference/audio/create-transcription) with the `include[]` parameter set to `logprobs`.\n"
13448 })
13449 ),
13450 "usage": Schema.optionalKey(TranscriptTextUsageTokens)
13451}).annotate({
13452 "description":
13453 "Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](/docs/api-reference/audio/create-transcription) with the `Stream` parameter set to `true`."
13454})
13455export type CreateTranscriptionResponseDiarizedJson = {
13456 readonly "task": "transcribe"
13457 readonly "duration": number
13458 readonly "text": string
13459 readonly "segments": ReadonlyArray<TranscriptionDiarizedSegment>
13460 readonly "usage"?: {
13461 readonly "type": "tokens"
13462 readonly "input_tokens": number
13463 readonly "input_token_details"?: { readonly "text_tokens"?: number; readonly "audio_tokens"?: number }
13464 readonly "output_tokens": number
13465 readonly "total_tokens": number
13466 } | { readonly "type": "duration"; readonly "seconds": number }
13467}
13468export const CreateTranscriptionResponseDiarizedJson = Schema.Struct({
13469 "task": Schema.Literal("transcribe").annotate({
13470 "description": "The type of task that was run. Always `transcribe`."
13471 }),
13472 "duration": Schema.Number.annotate({ "description": "Duration of the input audio in seconds.", "format": "double" })
13473 .check(Schema.isFinite()),
13474 "text": Schema.String.annotate({ "description": "The concatenated transcript text for the entire audio input." }),
13475 "segments": Schema.Array(TranscriptionDiarizedSegment).annotate({
13476 "description": "Segments of the transcript annotated with timestamps and speaker labels."
13477 }),
13478 "usage": Schema.optionalKey(Schema.Union([
13479 Schema.Struct({
13480 "type": Schema.Literal("tokens").annotate({
13481 "description": "The type of the usage object. Always `tokens` for this variant."
13482 }),
13483 "input_tokens": Schema.Number.annotate({ "description": "Number of input tokens billed for this request." })
13484 .check(Schema.isInt()),
13485 "input_token_details": Schema.optionalKey(
13486 Schema.Struct({
13487 "text_tokens": Schema.optionalKey(
13488 Schema.Number.annotate({ "description": "Number of text tokens billed for this request." }).check(
13489 Schema.isInt()
13490 )
13491 ),
13492 "audio_tokens": Schema.optionalKey(
13493 Schema.Number.annotate({ "description": "Number of audio tokens billed for this request." }).check(
13494 Schema.isInt()
13495 )
13496 )
13497 }).annotate({ "description": "Details about the input tokens billed for this request." })
13498 ),
13499 "output_tokens": Schema.Number.annotate({ "description": "Number of output tokens generated." }).check(
13500 Schema.isInt()
13501 ),
13502 "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used (input + output)." }).check(
13503 Schema.isInt()
13504 )
13505 }).annotate({ "title": "Token Usage", "description": "Token or duration usage statistics for the request." }),
13506 Schema.Struct({
13507 "type": Schema.Literal("duration").annotate({
13508 "description": "The type of the usage object. Always `duration` for this variant."
13509 }),
13510 "seconds": Schema.Number.annotate({
13511 "description": "Duration of the input audio in seconds.",
13512 "format": "double"
13513 }).check(Schema.isFinite())
13514 }).annotate({ "title": "Duration Usage", "description": "Token or duration usage statistics for the request." })
13515 ], { mode: "oneOf" }))
13516}).annotate({
13517 "description":
13518 "Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations.\n"
13519})
13520export type CreateTranslationResponseVerboseJson = {
13521 readonly "language": string
13522 readonly "duration": number
13523 readonly "text": string
13524 readonly "segments"?: ReadonlyArray<TranscriptionSegment>
13525}
13526export const CreateTranslationResponseVerboseJson = Schema.Struct({
13527 "language": Schema.String.annotate({ "description": "The language of the output translation (always `english`)." }),
13528 "duration": Schema.Number.annotate({ "description": "The duration of the input audio.", "format": "double" }).check(
13529 Schema.isFinite()
13530 ),
13531 "text": Schema.String.annotate({ "description": "The translated text." }),
13532 "segments": Schema.optionalKey(
13533 Schema.Array(TranscriptionSegment).annotate({
13534 "description": "Segments of the translated text and their corresponding details."
13535 })
13536 )
13537})
13538export type CreateTranscriptionResponseVerboseJson = {
13539 readonly "language": string
13540 readonly "duration": number
13541 readonly "text": string
13542 readonly "words"?: ReadonlyArray<TranscriptionWord>
13543 readonly "segments"?: ReadonlyArray<TranscriptionSegment>
13544 readonly "usage"?: TranscriptTextUsageDuration
13545}
13546export const CreateTranscriptionResponseVerboseJson = Schema.Struct({
13547 "language": Schema.String.annotate({ "description": "The language of the input audio." }),
13548 "duration": Schema.Number.annotate({ "description": "The duration of the input audio.", "format": "double" }).check(
13549 Schema.isFinite()
13550 ),
13551 "text": Schema.String.annotate({ "description": "The transcribed text." }),
13552 "words": Schema.optionalKey(
13553 Schema.Array(TranscriptionWord).annotate({ "description": "Extracted words and their corresponding timestamps." })
13554 ),
13555 "segments": Schema.optionalKey(
13556 Schema.Array(TranscriptionSegment).annotate({
13557 "description": "Segments of the transcribed text and their corresponding details."
13558 })
13559 ),
13560 "usage": Schema.optionalKey(TranscriptTextUsageDuration)
13561}).annotate({
13562 "description": "Represents a verbose json transcription response returned by model, based on the provided input."
13563})
13564export type UsageTimeBucket = {
13565 readonly "object": "bucket"
13566 readonly "start_time": number
13567 readonly "end_time": number
13568 readonly "results": ReadonlyArray<
13569 | UsageCompletionsResult
13570 | UsageEmbeddingsResult
13571 | UsageModerationsResult
13572 | UsageImagesResult
13573 | UsageAudioSpeechesResult
13574 | UsageAudioTranscriptionsResult
13575 | UsageVectorStoresResult
13576 | UsageCodeInterpreterSessionsResult
13577 | UsageFileSearchCallsResult
13578 | UsageWebSearchCallsResult
13579 | CostsResult
13580 >
13581}
13582export const UsageTimeBucket = Schema.Struct({
13583 "object": Schema.Literal("bucket"),
13584 "start_time": Schema.Number.check(Schema.isInt()),
13585 "end_time": Schema.Number.check(Schema.isInt()),
13586 "results": Schema.Array(
13587 Schema.Union([
13588 UsageCompletionsResult,
13589 UsageEmbeddingsResult,
13590 UsageModerationsResult,
13591 UsageImagesResult,
13592 UsageAudioSpeechesResult,
13593 UsageAudioTranscriptionsResult,
13594 UsageVectorStoresResult,
13595 UsageCodeInterpreterSessionsResult,
13596 UsageFileSearchCallsResult,
13597 UsageWebSearchCallsResult,
13598 CostsResult
13599 ], { mode: "oneOf" })
13600 )
13601})
13602export type UserListResponse = {
13603 readonly "object": "list"
13604 readonly "data": ReadonlyArray<User>
13605 readonly "first_id"?: string | null
13606 readonly "last_id"?: string | null
13607 readonly "has_more": boolean
13608}
13609export const UserListResponse = Schema.Struct({
13610 "object": Schema.Literal("list"),
13611 "data": Schema.Array(User),
13612 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
13613 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
13614 "has_more": Schema.Boolean
13615})
13616export type UserRoleAssignment = { readonly "object": "user.role"; readonly "user": User; readonly "role": Role }
13617export const UserRoleAssignment = Schema.Struct({
13618 "object": Schema.Literal("user.role").annotate({ "description": "Always `user.role`." }),
13619 "user": User,
13620 "role": Role
13621}).annotate({ "description": "Role assignment linking a user to a role." })
13622export type CreateTranscriptionRequest = {
13623 readonly "file": string
13624 readonly "model":
13625 | string
13626 | "whisper-1"
13627 | "gpt-4o-transcribe"
13628 | "gpt-4o-mini-transcribe"
13629 | "gpt-4o-mini-transcribe-2025-12-15"
13630 | "gpt-4o-transcribe-diarize"
13631 readonly "language"?: string
13632 readonly "prompt"?: string
13633 readonly "response_format"?: AudioResponseFormat
13634 readonly "temperature"?: number
13635 readonly "include"?: ReadonlyArray<TranscriptionInclude>
13636 readonly "timestamp_granularities"?: ReadonlyArray<"word" | "segment">
13637 readonly "stream"?: boolean | null
13638 readonly "chunking_strategy"?: "auto" | VadConfig | null
13639 readonly "known_speaker_names"?: ReadonlyArray<string>
13640 readonly "known_speaker_references"?: ReadonlyArray<string>
13641}
13642export const CreateTranscriptionRequest = Schema.Struct({
13643 "file": Schema.String.annotate({
13644 "description":
13645 "The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\n",
13646 "format": "binary"
13647 }),
13648 "model": Schema.Union([
13649 Schema.String,
13650 Schema.Literals([
13651 "whisper-1",
13652 "gpt-4o-transcribe",
13653 "gpt-4o-mini-transcribe",
13654 "gpt-4o-mini-transcribe-2025-12-15",
13655 "gpt-4o-transcribe-diarize"
13656 ])
13657 ]).annotate({
13658 "description":
13659 "ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.\n"
13660 }),
13661 "language": Schema.optionalKey(
13662 Schema.String.annotate({
13663 "description":
13664 "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.\n"
13665 })
13666 ),
13667 "prompt": Schema.optionalKey(
13668 Schema.String.annotate({
13669 "description":
13670 "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.\n"
13671 })
13672 ),
13673 "response_format": Schema.optionalKey(AudioResponseFormat),
13674 "temperature": Schema.optionalKey(
13675 Schema.Number.annotate({
13676 "description":
13677 "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n"
13678 }).check(Schema.isFinite())
13679 ),
13680 "include": Schema.optionalKey(
13681 Schema.Array(TranscriptionInclude).annotate({
13682 "description":
13683 "Additional information to include in the transcription response.\n`logprobs` will return the log probabilities of the tokens in the\nresponse to understand the model's confidence in the transcription.\n`logprobs` only works with response_format set to `json` and only with\nthe models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.\n"
13684 })
13685 ),
13686 "timestamp_granularities": Schema.optionalKey(
13687 Schema.Array(Schema.Literals(["word", "segment"])).annotate({
13688 "description":
13689 "The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\nThis option is not available for `gpt-4o-transcribe-diarize`.\n"
13690 })
13691 ),
13692 "stream": Schema.optionalKey(Schema.Union([
13693 Schema.Boolean.annotate({
13694 "description":
13695 "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section of the Speech-to-Text guide](/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)\nfor more information.\n\nNote: Streaming is not supported for the `whisper-1` model and will be ignored.\n"
13696 }),
13697 Schema.Null
13698 ])),
13699 "chunking_strategy": Schema.optionalKey(
13700 Schema.Union([
13701 Schema.Union([
13702 Schema.Literal("auto").annotate({
13703 "description": "Automatically set chunking parameters based on the audio. Must be set to `\"auto\"`.\n"
13704 }),
13705 VadConfig
13706 ]).annotate({
13707 "description":
13708 "Controls how the audio is cut into chunks. When set to `\"auto\"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds. "
13709 }),
13710 Schema.Null
13711 ])
13712 ),
13713 "known_speaker_names": Schema.optionalKey(
13714 Schema.Array(Schema.String).annotate({
13715 "description":
13716 "Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.\n"
13717 }).check(Schema.isMaxLength(4))
13718 ),
13719 "known_speaker_references": Schema.optionalKey(
13720 Schema.Array(Schema.String).annotate({
13721 "description":
13722 "Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.\n"
13723 }).check(Schema.isMaxLength(4))
13724 )
13725})
13726export type CreateVectorStoreRequest = {
13727 readonly "file_ids"?: ReadonlyArray<string>
13728 readonly "name"?: string
13729 readonly "description"?: string
13730 readonly "expires_after"?: VectorStoreExpirationAfter
13731 readonly "chunking_strategy"?: { readonly "type": "auto" } | {
13732 readonly "type": "static"
13733 readonly "static": StaticChunkingStrategy
13734 }
13735 readonly "metadata"?: Metadata
13736}
13737export const CreateVectorStoreRequest = Schema.Struct({
13738 "file_ids": Schema.optionalKey(
13739 Schema.Array(Schema.String).annotate({
13740 "description":
13741 "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files."
13742 }).check(Schema.isMaxLength(500))
13743 ),
13744 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the vector store." })),
13745 "description": Schema.optionalKey(
13746 Schema.String.annotate({
13747 "description": "A description for the vector store. Can be used to describe the vector store's purpose."
13748 })
13749 ),
13750 "expires_after": Schema.optionalKey(VectorStoreExpirationAfter),
13751 "chunking_strategy": Schema.optionalKey(
13752 Schema.Union([
13753 Schema.Struct({ "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }) }).annotate({
13754 "title": "Auto Chunking Strategy",
13755 "description":
13756 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty."
13757 }),
13758 Schema.Struct({
13759 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
13760 "static": StaticChunkingStrategy
13761 }).annotate({
13762 "title": "Static Chunking Strategy",
13763 "description":
13764 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty."
13765 })
13766 ], { mode: "oneOf" })
13767 ),
13768 "metadata": Schema.optionalKey(Metadata)
13769})
13770export type VectorStoreObject = {
13771 readonly "id": string
13772 readonly "object": "vector_store"
13773 readonly "created_at": number
13774 readonly "name": string
13775 readonly "usage_bytes": number
13776 readonly "file_counts": {
13777 readonly "in_progress": number
13778 readonly "completed": number
13779 readonly "failed": number
13780 readonly "cancelled": number
13781 readonly "total": number
13782 }
13783 readonly "status": "expired" | "in_progress" | "completed"
13784 readonly "expires_after"?: VectorStoreExpirationAfter
13785 readonly "expires_at"?: number | null
13786 readonly "last_active_at": number | null
13787 readonly "metadata": Metadata
13788}
13789export const VectorStoreObject = Schema.Struct({
13790 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
13791 "object": Schema.Literal("vector_store").annotate({
13792 "description": "The object type, which is always `vector_store`."
13793 }),
13794 "created_at": Schema.Number.annotate({
13795 "description": "The Unix timestamp (in seconds) for when the vector store was created.",
13796 "format": "unixtime"
13797 }).check(Schema.isInt()),
13798 "name": Schema.String.annotate({ "description": "The name of the vector store." }),
13799 "usage_bytes": Schema.Number.annotate({
13800 "description": "The total number of bytes used by the files in the vector store."
13801 }).check(Schema.isInt()),
13802 "file_counts": Schema.Struct({
13803 "in_progress": Schema.Number.annotate({ "description": "The number of files that are currently being processed." })
13804 .check(Schema.isInt()),
13805 "completed": Schema.Number.annotate({ "description": "The number of files that have been successfully processed." })
13806 .check(Schema.isInt()),
13807 "failed": Schema.Number.annotate({ "description": "The number of files that have failed to process." }).check(
13808 Schema.isInt()
13809 ),
13810 "cancelled": Schema.Number.annotate({ "description": "The number of files that were cancelled." }).check(
13811 Schema.isInt()
13812 ),
13813 "total": Schema.Number.annotate({ "description": "The total number of files." }).check(Schema.isInt())
13814 }),
13815 "status": Schema.Literals(["expired", "in_progress", "completed"]).annotate({
13816 "description":
13817 "The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use."
13818 }),
13819 "expires_after": Schema.optionalKey(VectorStoreExpirationAfter),
13820 "expires_at": Schema.optionalKey(
13821 Schema.Union([
13822 Schema.Number.annotate({
13823 "description": "The Unix timestamp (in seconds) for when the vector store will expire.",
13824 "format": "unixtime"
13825 }).check(Schema.isInt()),
13826 Schema.Null
13827 ])
13828 ),
13829 "last_active_at": Schema.Union([
13830 Schema.Number.annotate({
13831 "description": "The Unix timestamp (in seconds) for when the vector store was last active.",
13832 "format": "unixtime"
13833 }).check(Schema.isInt()),
13834 Schema.Null
13835 ]),
13836 "metadata": Metadata
13837}).annotate({
13838 "title": "Vector store",
13839 "description": "A vector store is a collection of processed files can be used by the `file_search` tool."
13840})
13841export type FileSearchToolCall = {
13842 readonly "id": string
13843 readonly "type": "file_search_call"
13844 readonly "status": "in_progress" | "searching" | "completed" | "incomplete" | "failed"
13845 readonly "queries": ReadonlyArray<string>
13846 readonly "results"?:
13847 | ReadonlyArray<
13848 {
13849 readonly "file_id"?: string
13850 readonly "text"?: string
13851 readonly "filename"?: string
13852 readonly "attributes"?: VectorStoreFileAttributes
13853 readonly "score"?: number
13854 }
13855 >
13856 | null
13857}
13858export const FileSearchToolCall = Schema.Struct({
13859 "id": Schema.String.annotate({ "description": "The unique ID of the file search tool call.\n" }),
13860 "type": Schema.Literal("file_search_call").annotate({
13861 "description": "The type of the file search tool call. Always `file_search_call`.\n"
13862 }),
13863 "status": Schema.Literals(["in_progress", "searching", "completed", "incomplete", "failed"]).annotate({
13864 "description":
13865 "The status of the file search tool call. One of `in_progress`,\n`searching`, `incomplete` or `failed`,\n"
13866 }),
13867 "queries": Schema.Array(Schema.String).annotate({ "description": "The queries used to search for files.\n" }),
13868 "results": Schema.optionalKey(Schema.Union([
13869 Schema.Array(Schema.Struct({
13870 "file_id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the file.\n" })),
13871 "text": Schema.optionalKey(
13872 Schema.String.annotate({ "description": "The text that was retrieved from the file.\n" })
13873 ),
13874 "filename": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the file.\n" })),
13875 "attributes": Schema.optionalKey(VectorStoreFileAttributes),
13876 "score": Schema.optionalKey(
13877 Schema.Number.annotate({
13878 "description": "The relevance score of the file - a value between 0 and 1.\n",
13879 "format": "float"
13880 }).check(Schema.isFinite())
13881 )
13882 })).annotate({ "description": "The results of the file search tool call.\n" }),
13883 Schema.Null
13884 ]))
13885}).annotate({
13886 "title": "File search tool call",
13887 "description":
13888 "The results of a file search tool call. See the\n[file search guide](/docs/guides/tools-file-search) for more information.\n"
13889})
13890export type UpdateVectorStoreFileAttributesRequest = { readonly "attributes": VectorStoreFileAttributes }
13891export const UpdateVectorStoreFileAttributesRequest = Schema.Struct({ "attributes": VectorStoreFileAttributes })
13892export type VectorStoreFileObject = {
13893 readonly "id": string
13894 readonly "object": "vector_store.file"
13895 readonly "usage_bytes": number
13896 readonly "created_at": number
13897 readonly "vector_store_id": string
13898 readonly "status": "in_progress" | "completed" | "cancelled" | "failed"
13899 readonly "last_error": {
13900 readonly "code": "server_error" | "unsupported_file" | "invalid_file"
13901 readonly "message": string
13902 } | null
13903 readonly "chunking_strategy"?: { readonly "type": "static"; readonly "static": StaticChunkingStrategy } | {
13904 readonly "type": "other"
13905 }
13906 readonly "attributes"?: VectorStoreFileAttributes
13907}
13908export const VectorStoreFileObject = Schema.Struct({
13909 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
13910 "object": Schema.Literal("vector_store.file").annotate({
13911 "description": "The object type, which is always `vector_store.file`."
13912 }),
13913 "usage_bytes": Schema.Number.annotate({
13914 "description": "The total vector store usage in bytes. Note that this may be different from the original file size."
13915 }).check(Schema.isInt()),
13916 "created_at": Schema.Number.annotate({
13917 "description": "The Unix timestamp (in seconds) for when the vector store file was created.",
13918 "format": "unixtime"
13919 }).check(Schema.isInt()),
13920 "vector_store_id": Schema.String.annotate({
13921 "description":
13922 "The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to."
13923 }),
13924 "status": Schema.Literals(["in_progress", "completed", "cancelled", "failed"]).annotate({
13925 "description":
13926 "The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use."
13927 }),
13928 "last_error": Schema.Union([
13929 Schema.Struct({
13930 "code": Schema.Literals(["server_error", "unsupported_file", "invalid_file"]).annotate({
13931 "description": "One of `server_error`, `unsupported_file`, or `invalid_file`."
13932 }),
13933 "message": Schema.String.annotate({ "description": "A human-readable description of the error." })
13934 }).annotate({
13935 "description": "The last error associated with this vector store file. Will be `null` if there are no errors."
13936 }),
13937 Schema.Null
13938 ]),
13939 "chunking_strategy": Schema.optionalKey(
13940 Schema.Union([
13941 Schema.Struct({
13942 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
13943 "static": StaticChunkingStrategy
13944 }).annotate({ "title": "Static Chunking Strategy", "description": "The strategy used to chunk the file." }),
13945 Schema.Struct({ "type": Schema.Literal("other").annotate({ "description": "Always `other`." }) }).annotate({
13946 "title": "Other Chunking Strategy",
13947 "description": "The strategy used to chunk the file."
13948 })
13949 ], { mode: "oneOf" })
13950 ),
13951 "attributes": Schema.optionalKey(VectorStoreFileAttributes)
13952}).annotate({ "title": "Vector store files", "description": "A list of files attached to a vector store." })
13953export type VectorStoreSearchResultItem = {
13954 readonly "file_id": string
13955 readonly "filename": string
13956 readonly "score": number
13957 readonly "attributes": VectorStoreFileAttributes
13958 readonly "content": ReadonlyArray<VectorStoreSearchResultContentObject>
13959}
13960export const VectorStoreSearchResultItem = Schema.Struct({
13961 "file_id": Schema.String.annotate({ "description": "The ID of the vector store file." }),
13962 "filename": Schema.String.annotate({ "description": "The name of the vector store file." }),
13963 "score": Schema.Number.annotate({ "description": "The similarity score for the result." }).check(Schema.isFinite())
13964 .check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
13965 "attributes": VectorStoreFileAttributes,
13966 "content": Schema.Array(VectorStoreSearchResultContentObject).annotate({
13967 "description": "Content chunks from the file."
13968 })
13969})
13970export type VoiceConsentListResource = {
13971 readonly "object": "list"
13972 readonly "data": ReadonlyArray<VoiceConsentResource>
13973 readonly "first_id"?: string | null
13974 readonly "last_id"?: string | null
13975 readonly "has_more": boolean
13976}
13977export const VoiceConsentListResource = Schema.Struct({
13978 "object": Schema.Literal("list"),
13979 "data": Schema.Array(VoiceConsentResource),
13980 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
13981 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
13982 "has_more": Schema.Boolean
13983})
13984export type CreateSpeechRequest = {
13985 readonly "model": string | "tts-1" | "tts-1-hd" | "gpt-4o-mini-tts" | "gpt-4o-mini-tts-2025-12-15"
13986 readonly "input": string
13987 readonly "instructions"?: string
13988 readonly "voice": VoiceIdsShared | { readonly "id": string }
13989 readonly "response_format"?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"
13990 readonly "speed"?: number
13991 readonly "stream_format"?: "sse" | "audio"
13992}
13993export const CreateSpeechRequest = Schema.Struct({
13994 "model": Schema.Union([
13995 Schema.String,
13996 Schema.Literals(["tts-1", "tts-1-hd", "gpt-4o-mini-tts", "gpt-4o-mini-tts-2025-12-15"])
13997 ]).annotate({
13998 "description":
13999 "One of the available [TTS models](/docs/models#tts): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.\n"
14000 }),
14001 "input": Schema.String.annotate({
14002 "description": "The text to generate audio for. The maximum length is 4096 characters."
14003 }).check(Schema.isMaxLength(4096)),
14004 "instructions": Schema.optionalKey(
14005 Schema.String.annotate({
14006 "description":
14007 "Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`."
14008 }).check(Schema.isMaxLength(4096))
14009 ),
14010 "voice": Schema.Union([
14011 VoiceIdsShared,
14012 Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) })
14013 .annotate({ "description": "Custom voice reference." })
14014 ]).annotate({
14015 "title": "Voice",
14016 "description":
14017 "The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech#voice-options)."
14018 }),
14019 "response_format": Schema.optionalKey(
14020 Schema.Literals(["mp3", "opus", "aac", "flac", "wav", "pcm"]).annotate({
14021 "description": "The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`."
14022 })
14023 ),
14024 "speed": Schema.optionalKey(
14025 Schema.Number.annotate({
14026 "description": "The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default."
14027 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(4))
14028 ),
14029 "stream_format": Schema.optionalKey(
14030 Schema.Literals(["sse", "audio"]).annotate({
14031 "description":
14032 "The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`."
14033 })
14034 )
14035})
14036export type RealtimeSessionCreateResponse = {
14037 readonly "id"?: string
14038 readonly "object"?: string
14039 readonly "expires_at"?: number
14040 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
14041 readonly "model"?: string
14042 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
14043 readonly "instructions"?: string
14044 readonly "audio"?: {
14045 readonly "input"?: {
14046 readonly "format"?: RealtimeAudioFormats
14047 readonly "transcription"?: {
14048 readonly "model"?:
14049 | string
14050 | "whisper-1"
14051 | "gpt-4o-mini-transcribe"
14052 | "gpt-4o-mini-transcribe-2025-12-15"
14053 | "gpt-4o-transcribe"
14054 | "gpt-4o-transcribe-diarize"
14055 | "gpt-realtime-whisper"
14056 readonly "language"?: string
14057 readonly "prompt"?: string
14058 }
14059 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
14060 readonly "turn_detection"?: {
14061 readonly "type"?: string
14062 readonly "threshold"?: number
14063 readonly "prefix_padding_ms"?: number
14064 readonly "silence_duration_ms"?: number
14065 }
14066 }
14067 readonly "output"?: {
14068 readonly "format"?: RealtimeAudioFormats
14069 readonly "voice"?: VoiceIdsShared
14070 readonly "speed"?: number
14071 }
14072 }
14073 readonly "tracing"?: "auto" | {
14074 readonly "workflow_name"?: string
14075 readonly "group_id"?: string
14076 readonly "metadata"?: {}
14077 }
14078 readonly "turn_detection"?: {
14079 readonly "type"?: string
14080 readonly "threshold"?: number
14081 readonly "prefix_padding_ms"?: number
14082 readonly "silence_duration_ms"?: number
14083 }
14084 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool>
14085 readonly "tool_choice"?: string
14086 readonly "max_output_tokens"?: number | "inf"
14087}
14088export const RealtimeSessionCreateResponse = Schema.Struct({
14089 "id": Schema.optionalKey(
14090 Schema.String.annotate({
14091 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
14092 })
14093 ),
14094 "object": Schema.optionalKey(
14095 Schema.String.annotate({ "description": "The object type. Always `realtime.session`." })
14096 ),
14097 "expires_at": Schema.optionalKey(
14098 Schema.Number.annotate({
14099 "description": "Expiration timestamp for the session, in seconds since epoch.",
14100 "format": "unixtime"
14101 }).check(Schema.isInt())
14102 ),
14103 "include": Schema.optionalKey(
14104 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
14105 "description":
14106 "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
14107 })
14108 ),
14109 "model": Schema.optionalKey(Schema.String.annotate({ "description": "The Realtime model used for this session." })),
14110 "output_modalities": Schema.optionalKey(
14111 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
14112 "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"
14113 })
14114 ),
14115 "instructions": Schema.optionalKey(Schema.String.annotate({
14116 "description":
14117 "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed\nto be followed by the model, but they provide guidance to the model on the\ndesired behavior.\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n"
14118 })),
14119 "audio": Schema.optionalKey(
14120 Schema.Struct({
14121 "input": Schema.optionalKey(Schema.Struct({
14122 "format": Schema.optionalKey(RealtimeAudioFormats),
14123 "transcription": Schema.optionalKey(
14124 Schema.Struct({
14125 "model": Schema.optionalKey(
14126 Schema.Union([
14127 Schema.String,
14128 Schema.Literals([
14129 "whisper-1",
14130 "gpt-4o-mini-transcribe",
14131 "gpt-4o-mini-transcribe-2025-12-15",
14132 "gpt-4o-transcribe",
14133 "gpt-4o-transcribe-diarize",
14134 "gpt-realtime-whisper"
14135 ])
14136 ]).annotate({
14137 "description":
14138 "The model used for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n"
14139 })
14140 ),
14141 "language": Schema.optionalKey(
14142 Schema.String.annotate({ "description": "The language of the input audio.\n" })
14143 ),
14144 "prompt": Schema.optionalKey(
14145 Schema.String.annotate({
14146 "description": "The prompt configured for input audio transcription, when present.\n"
14147 })
14148 )
14149 }).annotate({ "description": "Configuration for input audio transcription.\n" })
14150 ),
14151 "noise_reduction": Schema.optionalKey(
14152 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
14153 "description": "Configuration for input audio noise reduction.\n"
14154 })
14155 ),
14156 "turn_detection": Schema.optionalKey(
14157 Schema.Struct({
14158 "type": Schema.optionalKey(
14159 Schema.String.annotate({
14160 "description": "Type of turn detection, only `server_vad` is currently supported.\n"
14161 })
14162 ),
14163 "threshold": Schema.optionalKey(Schema.Number.check(Schema.isFinite())),
14164 "prefix_padding_ms": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
14165 "silence_duration_ms": Schema.optionalKey(Schema.Number.check(Schema.isInt()))
14166 }).annotate({ "description": "Configuration for turn detection.\n" })
14167 )
14168 })),
14169 "output": Schema.optionalKey(
14170 Schema.Struct({
14171 "format": Schema.optionalKey(RealtimeAudioFormats),
14172 "voice": Schema.optionalKey(VoiceIdsShared),
14173 "speed": Schema.optionalKey(Schema.Number.check(Schema.isFinite()))
14174 })
14175 )
14176 }).annotate({ "description": "Configuration for input and output audio for the session.\n" })
14177 ),
14178 "tracing": Schema.optionalKey(
14179 Schema.Union([
14180 Schema.Literal("auto").annotate({ "description": "Default tracing mode for the session.\n" }),
14181 Schema.Struct({
14182 "workflow_name": Schema.optionalKey(
14183 Schema.String.annotate({
14184 "description":
14185 "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n"
14186 })
14187 ),
14188 "group_id": Schema.optionalKey(
14189 Schema.String.annotate({
14190 "description":
14191 "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n"
14192 })
14193 ),
14194 "metadata": Schema.optionalKey(
14195 Schema.Struct({}).annotate({
14196 "description":
14197 "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n"
14198 })
14199 )
14200 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
14201 ], { mode: "oneOf" }).annotate({
14202 "title": "Tracing Configuration",
14203 "description":
14204 "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
14205 })
14206 ),
14207 "turn_detection": Schema.optionalKey(
14208 Schema.Struct({
14209 "type": Schema.optionalKey(
14210 Schema.String.annotate({ "description": "Type of turn detection, only `server_vad` is currently supported.\n" })
14211 ),
14212 "threshold": Schema.optionalKey(
14213 Schema.Number.annotate({
14214 "description":
14215 "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"
14216 }).check(Schema.isFinite())
14217 ),
14218 "prefix_padding_ms": Schema.optionalKey(
14219 Schema.Number.annotate({
14220 "description":
14221 "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"
14222 }).check(Schema.isInt())
14223 ),
14224 "silence_duration_ms": Schema.optionalKey(
14225 Schema.Number.annotate({
14226 "description":
14227 "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"
14228 }).check(Schema.isInt())
14229 )
14230 }).annotate({
14231 "description":
14232 "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n"
14233 })
14234 ),
14235 "tools": Schema.optionalKey(
14236 Schema.Array(RealtimeFunctionTool).annotate({ "description": "Tools (functions) available to the model." })
14237 ),
14238 "tool_choice": Schema.optionalKey(
14239 Schema.String.annotate({
14240 "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n"
14241 })
14242 ),
14243 "max_output_tokens": Schema.optionalKey(
14244 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
14245 "description":
14246 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
14247 })
14248 )
14249}).annotate({
14250 "title": "Realtime session configuration object",
14251 "description": "A Realtime session configuration object.\n"
14252})
14253export type WebSearchTool = {
14254 readonly "type": "web_search" | "web_search_2025_08_26"
14255 readonly "filters"?: { readonly "allowed_domains"?: ReadonlyArray<string> | null } | null
14256 readonly "user_location"?: WebSearchApproximateLocation
14257 readonly "search_context_size"?: "low" | "medium" | "high"
14258}
14259export const WebSearchTool = Schema.Struct({
14260 "type": Schema.Literals(["web_search", "web_search_2025_08_26"]).annotate({
14261 "description": "The type of the web search tool. One of `web_search` or `web_search_2025_08_26`."
14262 }),
14263 "filters": Schema.optionalKey(Schema.Union([
14264 Schema.Struct({
14265 "allowed_domains": Schema.optionalKey(
14266 Schema.Union([
14267 Schema.Array(Schema.String.annotate({ "description": "Allowed domain for the search." })).annotate({
14268 "title": "Allowed domains for the search.",
14269 "description":
14270 "Allowed domains for the search. If not provided, all domains are allowed.\nSubdomains of the provided domains are allowed as well.\n\nExample: `[\"pubmed.ncbi.nlm.nih.gov\"]`\n"
14271 }),
14272 Schema.Null
14273 ])
14274 )
14275 }).annotate({ "description": "Filters for the search.\n" }),
14276 Schema.Null
14277 ])),
14278 "user_location": Schema.optionalKey(WebSearchApproximateLocation),
14279 "search_context_size": Schema.optionalKey(
14280 Schema.Literals(["low", "medium", "high"]).annotate({
14281 "description":
14282 "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default."
14283 })
14284 )
14285}).annotate({
14286 "title": "Web search",
14287 "description":
14288 "Search the Internet for sources related to the prompt. Learn more about the\n[web search tool](/docs/guides/tools-web-search).\n"
14289})
14290export type ContainerNetworkPolicyAllowlistParam = {
14291 readonly "type": "allowlist"
14292 readonly "allowed_domains": ReadonlyArray<string>
14293 readonly "domain_secrets"?: ReadonlyArray<ContainerNetworkPolicyDomainSecretParam>
14294}
14295export const ContainerNetworkPolicyAllowlistParam = Schema.Struct({
14296 "type": Schema.Literal("allowlist").annotate({
14297 "description": "Allow outbound network access only to specified domains. Always `allowlist`."
14298 }),
14299 "allowed_domains": Schema.Array(Schema.String).annotate({
14300 "description": "A list of allowed domains when type is `allowlist`."
14301 }).check(Schema.isMinLength(1)),
14302 "domain_secrets": Schema.optionalKey(
14303 Schema.Array(ContainerNetworkPolicyDomainSecretParam).annotate({
14304 "description": "Optional domain-scoped secrets for allowlisted domains."
14305 }).check(Schema.isMinLength(1))
14306 )
14307})
14308export type EvalItemContentItem =
14309 | EvalItemContentText
14310 | InputTextContent
14311 | EvalItemContentOutputText
14312 | EvalItemInputImage
14313 | InputAudio
14314export const EvalItemContentItem = Schema.Union([
14315 EvalItemContentText,
14316 InputTextContent,
14317 EvalItemContentOutputText,
14318 EvalItemInputImage,
14319 InputAudio
14320], { mode: "oneOf" }).annotate({
14321 "title": "Eval content item",
14322 "description": "A single content item: input text, output text, input image, or input audio.\n"
14323})
14324export type Annotation = FileCitationBody | UrlCitationBody | ContainerFileCitationBody | FilePath
14325export const Annotation = Schema.Union([FileCitationBody, UrlCitationBody, ContainerFileCitationBody, FilePath], {
14326 mode: "oneOf"
14327}).annotate({ "description": "An annotation that applies to a span of output text." })
14328export type LogProb = {
14329 readonly "token": string
14330 readonly "logprob": number
14331 readonly "bytes": ReadonlyArray<number>
14332 readonly "top_logprobs": ReadonlyArray<TopLogProb>
14333}
14334export const LogProb = Schema.Struct({
14335 "token": Schema.String,
14336 "logprob": Schema.Number.check(Schema.isFinite()),
14337 "bytes": Schema.Array(Schema.Number.check(Schema.isInt())),
14338 "top_logprobs": Schema.Array(TopLogProb)
14339}).annotate({ "title": "Log probability", "description": "The log probability of a token." })
14340export type ReasoningItem = {
14341 readonly "type": "reasoning"
14342 readonly "id": string
14343 readonly "encrypted_content"?: string | null
14344 readonly "summary": ReadonlyArray<SummaryTextContent>
14345 readonly "content"?: ReadonlyArray<ReasoningTextContent>
14346 readonly "status"?: "in_progress" | "completed" | "incomplete"
14347}
14348export const ReasoningItem = Schema.Struct({
14349 "type": Schema.Literal("reasoning").annotate({ "description": "The type of the object. Always `reasoning`.\n" }),
14350 "id": Schema.String.annotate({ "description": "The unique identifier of the reasoning content.\n" }),
14351 "encrypted_content": Schema.optionalKey(
14352 Schema.Union([
14353 Schema.String.annotate({
14354 "description":
14355 "The encrypted content of the reasoning item - populated when a response is\ngenerated with `reasoning.encrypted_content` in the `include` parameter.\n"
14356 }),
14357 Schema.Null
14358 ])
14359 ),
14360 "summary": Schema.Array(SummaryTextContent).annotate({ "description": "Reasoning summary content.\n" }),
14361 "content": Schema.optionalKey(
14362 Schema.Array(ReasoningTextContent).annotate({ "description": "Reasoning text content.\n" })
14363 ),
14364 "status": Schema.optionalKey(
14365 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
14366 "description":
14367 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
14368 })
14369 )
14370}).annotate({
14371 "title": "Reasoning",
14372 "description":
14373 "A description of the chain of thought used by a reasoning model while generating\na response. Be sure to include these items in your `input` to the Responses API\nfor subsequent turns of a conversation if you are manually\n[managing context](/docs/guides/conversation-state).\n"
14374})
14375export type FunctionAndCustomToolCallOutput = InputTextContent | InputImageContent | InputFileContent
14376export const FunctionAndCustomToolCallOutput = Schema.Union([InputTextContent, InputImageContent, InputFileContent], {
14377 mode: "oneOf"
14378})
14379export type InputContent = InputTextContent | InputImageContent | InputFileContent
14380export const InputContent = Schema.Union([InputTextContent, InputImageContent, InputFileContent], { mode: "oneOf" })
14381export type DragParam = {
14382 readonly "type": "drag"
14383 readonly "path": ReadonlyArray<CoordParam>
14384 readonly "keys"?: ReadonlyArray<string> | null
14385}
14386export const DragParam = Schema.Struct({
14387 "type": Schema.Literal("drag").annotate({
14388 "description": "Specifies the event type. For a drag action, this property is always set to `drag`."
14389 }),
14390 "path": Schema.Array(CoordParam).annotate({
14391 "description":
14392 "An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg\n```\n[\n { x: 100, y: 200 },\n { x: 200, y: 300 }\n]\n```"
14393 }),
14394 "keys": Schema.optionalKey(
14395 Schema.Union([
14396 Schema.Array(Schema.String).annotate({ "description": "The keys being held while dragging the mouse." }),
14397 Schema.Null
14398 ])
14399 )
14400}).annotate({ "title": "Drag", "description": "A drag action." })
14401export type ComputerToolCallOutputResource = {
14402 readonly "type": "computer_call_output"
14403 readonly "id": string
14404 readonly "call_id": string
14405 readonly "acknowledged_safety_checks"?: ReadonlyArray<ComputerCallSafetyCheckParam>
14406 readonly "output": ComputerScreenshotImage
14407 readonly "status": "completed" | "incomplete"
14408 readonly "created_by"?: string
14409}
14410export const ComputerToolCallOutputResource = Schema.Struct({
14411 "type": Schema.Literal("computer_call_output").annotate({
14412 "description": "The type of the computer tool call output. Always `computer_call_output`.\n"
14413 }),
14414 "id": Schema.String.annotate({ "description": "The unique ID of the computer call tool output.\n" }),
14415 "call_id": Schema.String.annotate({ "description": "The ID of the computer tool call that produced the output.\n" }),
14416 "acknowledged_safety_checks": Schema.optionalKey(
14417 Schema.Array(ComputerCallSafetyCheckParam).annotate({
14418 "description": "The safety checks reported by the API that have been acknowledged by the\ndeveloper.\n"
14419 })
14420 ),
14421 "output": ComputerScreenshotImage,
14422 "status": Schema.Union([
14423 Schema.Literal("completed").annotate({
14424 "description":
14425 "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"
14426 }),
14427 Schema.Literal("incomplete").annotate({
14428 "description":
14429 "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"
14430 })
14431 ]).annotate({
14432 "description":
14433 "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"
14434 }),
14435 "created_by": Schema.optionalKey(
14436 Schema.String.annotate({ "description": "The identifier of the actor that created the item.\n" })
14437 )
14438}).annotate({ "title": "Computer tool call output", "description": "The output of a computer tool call.\n" })
14439export type CreateImageEditRequest = {
14440 readonly "image": string | ReadonlyArray<string>
14441 readonly "prompt": string
14442 readonly "mask"?: string
14443 readonly "background"?: "transparent" | "opaque" | "auto" | null
14444 readonly "model"?:
14445 | string
14446 | "gpt-image-1.5"
14447 | "dall-e-2"
14448 | "gpt-image-1"
14449 | "gpt-image-1-mini"
14450 | "chatgpt-image-latest"
14451 | null
14452 readonly "n"?: number
14453 readonly "size"?: string | "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "auto" | null
14454 readonly "response_format"?: "url" | "b64_json" | null
14455 readonly "output_format"?: "png" | "jpeg" | "webp" | null
14456 readonly "output_compression"?: number | null
14457 readonly "user"?: string
14458 readonly "input_fidelity"?: InputFidelity | null
14459 readonly "stream"?: boolean | null
14460 readonly "partial_images"?: PartialImages
14461 readonly "quality"?: "standard" | "low" | "medium" | "high" | "auto" | null
14462}
14463export const CreateImageEditRequest = Schema.Struct({
14464 "image": Schema.Union([
14465 Schema.String.annotate({ "format": "binary" }),
14466 Schema.Array(Schema.String.annotate({ "format": "binary" })).check(Schema.isMaxLength(16))
14467 ]).annotate({
14468 "description":
14469 "The image(s) to edit. Must be a supported image file or an array of images.\n\nFor the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`\nfile less than 50MB. You can provide up to 16 images.\n`chatgpt-image-latest` follows the same input constraints as GPT image models.\n\nFor `dall-e-2`, you can only provide one image, and it should be a square\n`png` file less than 4MB.\n"
14470 }),
14471 "prompt": Schema.String.annotate({
14472 "description":
14473 "A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models."
14474 }),
14475 "mask": Schema.optionalKey(Schema.String.annotate({
14476 "description":
14477 "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.",
14478 "format": "binary"
14479 })),
14480 "background": Schema.optionalKey(Schema.Union([
14481 Schema.Literals(["transparent", "opaque", "auto"]).annotate({
14482 "description":
14483 "Allows to set transparency for the background of the generated image(s).\nThis parameter is only supported for the GPT image models. Must be one of\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it\nshould be set to either `png` (default value) or `webp`.\n"
14484 }),
14485 Schema.Union([Schema.Null]).annotate({
14486 "description":
14487 "Allows to set transparency for the background of the generated image(s).\nThis parameter is only supported for the GPT image models. Must be one of\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\nmodel will automatically determine the best background for the image.\n\nIf `transparent`, the output format needs to support transparency, so it\nshould be set to either `png` (default value) or `webp`.\n"
14488 })
14489 ])),
14490 "model": Schema.optionalKey(
14491 Schema.Union([
14492 Schema.Union([
14493 Schema.String,
14494 Schema.Literals(["gpt-image-1.5", "dall-e-2", "gpt-image-1", "gpt-image-1-mini", "chatgpt-image-latest"])
14495 ]).annotate({ "description": "The model to use for image generation. Defaults to `gpt-image-1.5`." }),
14496 Schema.Null
14497 ])
14498 ),
14499 "n": Schema.optionalKey(
14500 Schema.Union([
14501 Schema.Number.check(Schema.isInt()).check(
14502 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(10)], {
14503 "description": "The number of images to generate. Must be between 1 and 10."
14504 })
14505 )
14506 ])
14507 ),
14508 "size": Schema.optionalKey(
14509 Schema.Union([
14510 Schema.Union([
14511 Schema.String,
14512 Schema.Literals(["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"])
14513 ]).annotate({
14514 "description":
14515 "The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`."
14516 }),
14517 Schema.Null
14518 ])
14519 ),
14520 "response_format": Schema.optionalKey(Schema.Union([
14521 Schema.Literals(["url", "b64_json"]).annotate({
14522 "description":
14523 "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images."
14524 }),
14525 Schema.Union([Schema.Null]).annotate({
14526 "description":
14527 "The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images."
14528 })
14529 ])),
14530 "output_format": Schema.optionalKey(
14531 Schema.Union([
14532 Schema.Literals(["png", "jpeg", "webp"]).annotate({
14533 "description":
14534 "The format in which the generated images are returned. This parameter is\nonly supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.\nThe default value is `png`.\n"
14535 }),
14536 Schema.Union([Schema.Null]).annotate({
14537 "description":
14538 "The format in which the generated images are returned. This parameter is\nonly supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.\nThe default value is `png`.\n"
14539 })
14540 ])
14541 ),
14542 "output_compression": Schema.optionalKey(
14543 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
14544 "description":
14545 "The compression level (0-100%) for the generated images. This parameter\nis only supported for the GPT image models with the `webp` or `jpeg` output\nformats, and defaults to 100.\n"
14546 })
14547 ),
14548 "user": Schema.optionalKey(
14549 Schema.String.annotate({
14550 "description":
14551 "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).\n"
14552 })
14553 ),
14554 "input_fidelity": Schema.optionalKey(Schema.Union([InputFidelity, Schema.Null])),
14555 "stream": Schema.optionalKey(
14556 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
14557 "description":
14558 "Edit the image in streaming mode. Defaults to `false`. See the\n[Image generation guide](/docs/guides/image-generation) for more information.\n"
14559 })
14560 ),
14561 "partial_images": Schema.optionalKey(PartialImages),
14562 "quality": Schema.optionalKey(
14563 Schema.Union([
14564 Schema.Literals(["standard", "low", "medium", "high", "auto"]).annotate({
14565 "description": "The quality of the image that will be generated for GPT image models. Defaults to `auto`.\n"
14566 }),
14567 Schema.Union([Schema.Null]).annotate({
14568 "description": "The quality of the image that will be generated for GPT image models. Defaults to `auto`.\n"
14569 })
14570 ])
14571 )
14572})
14573export type ImageGenTool = {
14574 readonly "type": "image_generation"
14575 readonly "model"?: string | "gpt-image-1" | "gpt-image-1-mini" | "gpt-image-1.5"
14576 readonly "quality"?: "low" | "medium" | "high" | "auto"
14577 readonly "size"?: string | "1024x1024" | "1024x1536" | "1536x1024" | "auto"
14578 readonly "output_format"?: "png" | "webp" | "jpeg"
14579 readonly "output_compression"?: number
14580 readonly "moderation"?: "auto" | "low"
14581 readonly "background"?: "transparent" | "opaque" | "auto"
14582 readonly "input_fidelity"?: InputFidelity | null
14583 readonly "input_image_mask"?: { readonly "image_url"?: string; readonly "file_id"?: string }
14584 readonly "partial_images"?: number
14585 readonly "action"?: "generate" | "edit" | "auto"
14586}
14587export const ImageGenTool = Schema.Struct({
14588 "type": Schema.Literal("image_generation").annotate({
14589 "description": "The type of the image generation tool. Always `image_generation`.\n"
14590 }),
14591 "model": Schema.optionalKey(
14592 Schema.Union([
14593 Schema.String,
14594 Schema.Literals(["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5"]).annotate({
14595 "description": "The image generation model to use. Default: `gpt-image-1`.\n"
14596 })
14597 ])
14598 ),
14599 "quality": Schema.optionalKey(
14600 Schema.Literals(["low", "medium", "high", "auto"]).annotate({
14601 "description":
14602 "The quality of the generated image. One of `low`, `medium`, `high`,\nor `auto`. Default: `auto`.\n"
14603 })
14604 ),
14605 "size": Schema.optionalKey(
14606 Schema.Union([Schema.String, Schema.Literals(["1024x1024", "1024x1536", "1536x1024", "auto"])]).annotate({
14607 "description":
14608 "The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`."
14609 })
14610 ),
14611 "output_format": Schema.optionalKey(
14612 Schema.Literals(["png", "webp", "jpeg"]).annotate({
14613 "description": "The output format of the generated image. One of `png`, `webp`, or\n`jpeg`. Default: `png`.\n"
14614 })
14615 ),
14616 "output_compression": Schema.optionalKey(
14617 Schema.Number.annotate({ "description": "Compression level for the output image. Default: 100.\n" }).check(
14618 Schema.isInt()
14619 ).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
14620 ),
14621 "moderation": Schema.optionalKey(
14622 Schema.Literals(["auto", "low"]).annotate({
14623 "description": "Moderation level for the generated image. Default: `auto`.\n"
14624 })
14625 ),
14626 "background": Schema.optionalKey(
14627 Schema.Literals(["transparent", "opaque", "auto"]).annotate({
14628 "description":
14629 "Background type for the generated image. One of `transparent`,\n`opaque`, or `auto`. Default: `auto`.\n"
14630 })
14631 ),
14632 "input_fidelity": Schema.optionalKey(Schema.Union([InputFidelity, Schema.Null])),
14633 "input_image_mask": Schema.optionalKey(
14634 Schema.Struct({
14635 "image_url": Schema.optionalKey(Schema.String.annotate({ "description": "Base64-encoded mask image.\n" })),
14636 "file_id": Schema.optionalKey(Schema.String.annotate({ "description": "File ID for the mask image.\n" }))
14637 }).annotate({
14638 "description":
14639 "Optional mask for inpainting. Contains `image_url`\n(string, optional) and `file_id` (string, optional).\n"
14640 })
14641 ),
14642 "partial_images": Schema.optionalKey(
14643 Schema.Number.annotate({
14644 "description": "Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n"
14645 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(3))
14646 ),
14647 "action": Schema.optionalKey(
14648 Schema.Literals(["generate", "edit", "auto"]).annotate({
14649 "description": "Whether to generate a new image or edit an existing image. Default: `auto`.\n"
14650 })
14651 )
14652}).annotate({
14653 "title": "Image generation tool",
14654 "description": "A tool that generates images using the GPT image models.\n"
14655})
14656export type LocalEnvironmentParam = { readonly "type": "local"; readonly "skills"?: ReadonlyArray<LocalSkillParam> }
14657export const LocalEnvironmentParam = Schema.Struct({
14658 "type": Schema.Literal("local").annotate({ "description": "Use a local computer environment." }),
14659 "skills": Schema.optionalKey(
14660 Schema.Array(LocalSkillParam).annotate({ "description": "An optional list of skills." }).check(
14661 Schema.isMaxLength(200)
14662 )
14663 )
14664})
14665export type CustomToolParam = {
14666 readonly "type": "custom"
14667 readonly "name": string
14668 readonly "description"?: string
14669 readonly "format"?: CustomTextFormatParam | CustomGrammarFormatParam
14670 readonly "defer_loading"?: boolean
14671}
14672export const CustomToolParam = Schema.Struct({
14673 "type": Schema.Literal("custom").annotate({ "description": "The type of the custom tool. Always `custom`." }),
14674 "name": Schema.String.annotate({ "description": "The name of the custom tool, used to identify it in tool calls." }),
14675 "description": Schema.optionalKey(
14676 Schema.String.annotate({ "description": "Optional description of the custom tool, used to provide more context." })
14677 ),
14678 "format": Schema.optionalKey(
14679 Schema.Union([CustomTextFormatParam, CustomGrammarFormatParam], { mode: "oneOf" }).annotate({
14680 "description": "The input format for the custom tool. Default is unconstrained text."
14681 })
14682 ),
14683 "defer_loading": Schema.optionalKey(
14684 Schema.Boolean.annotate({ "description": "Whether this tool should be deferred and discovered via tool search." })
14685 )
14686}).annotate({
14687 "title": "Custom tool",
14688 "description":
14689 "A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools)"
14690})
14691export type FunctionToolParam = {
14692 readonly "name": string
14693 readonly "description"?: string | null
14694 readonly "parameters"?: EmptyModelParam | null
14695 readonly "strict"?: boolean | null
14696 readonly "type": "function"
14697 readonly "defer_loading"?: boolean
14698}
14699export const FunctionToolParam = Schema.Struct({
14700 "name": Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check(
14701 Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))
14702 ),
14703 "description": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
14704 "parameters": Schema.optionalKey(Schema.Union([EmptyModelParam, Schema.Null])),
14705 "strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])),
14706 "type": Schema.Literal("function"),
14707 "defer_loading": Schema.optionalKey(
14708 Schema.Boolean.annotate({
14709 "description": "Whether this function should be deferred and discovered via tool search."
14710 })
14711 )
14712})
14713export type WebSearchPreviewTool = {
14714 readonly "type": "web_search_preview" | "web_search_preview_2025_03_11"
14715 readonly "user_location"?: {
14716 readonly "type": "approximate"
14717 readonly "country"?: string | null
14718 readonly "region"?: string | null
14719 readonly "city"?: string | null
14720 readonly "timezone"?: string | null
14721 } | null
14722 readonly "search_context_size"?: "low" | "medium" | "high"
14723 readonly "search_content_types"?: ReadonlyArray<SearchContentType>
14724}
14725export const WebSearchPreviewTool = Schema.Struct({
14726 "type": Schema.Literals(["web_search_preview", "web_search_preview_2025_03_11"]).annotate({
14727 "description": "The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`."
14728 }),
14729 "user_location": Schema.optionalKey(Schema.Union([
14730 Schema.Struct({
14731 "type": Schema.Literal("approximate").annotate({
14732 "description": "The type of location approximation. Always `approximate`."
14733 }),
14734 "country": Schema.optionalKey(
14735 Schema.Union([
14736 Schema.String.annotate({
14737 "description":
14738 "The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`."
14739 }),
14740 Schema.Null
14741 ])
14742 ),
14743 "region": Schema.optionalKey(
14744 Schema.Union([
14745 Schema.String.annotate({ "description": "Free text input for the region of the user, e.g. `California`." }),
14746 Schema.Null
14747 ])
14748 ),
14749 "city": Schema.optionalKey(
14750 Schema.Union([
14751 Schema.String.annotate({ "description": "Free text input for the city of the user, e.g. `San Francisco`." }),
14752 Schema.Null
14753 ])
14754 ),
14755 "timezone": Schema.optionalKey(
14756 Schema.Union([
14757 Schema.String.annotate({
14758 "description":
14759 "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`."
14760 }),
14761 Schema.Null
14762 ])
14763 )
14764 }).annotate({ "description": "The user's location." }),
14765 Schema.Null
14766 ])),
14767 "search_context_size": Schema.optionalKey(
14768 Schema.Literals(["low", "medium", "high"]).annotate({
14769 "description":
14770 "High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default."
14771 })
14772 ),
14773 "search_content_types": Schema.optionalKey(Schema.Array(SearchContentType))
14774}).annotate({
14775 "title": "Web search preview",
14776 "description":
14777 "This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search)."
14778})
14779export type CodeInterpreterToolCall = {
14780 readonly "type": "code_interpreter_call"
14781 readonly "id": string
14782 readonly "status": "in_progress" | "completed" | "incomplete" | "interpreting" | "failed"
14783 readonly "container_id": string
14784 readonly "code": string | null
14785 readonly "outputs": ReadonlyArray<CodeInterpreterOutputLogs | CodeInterpreterOutputImage> | null
14786}
14787export const CodeInterpreterToolCall = Schema.Struct({
14788 "type": Schema.Literal("code_interpreter_call").annotate({
14789 "description": "The type of the code interpreter tool call. Always `code_interpreter_call`.\n"
14790 }),
14791 "id": Schema.String.annotate({ "description": "The unique ID of the code interpreter tool call.\n" }),
14792 "status": Schema.Literals(["in_progress", "completed", "incomplete", "interpreting", "failed"]).annotate({
14793 "description":
14794 "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n"
14795 }),
14796 "container_id": Schema.String.annotate({ "description": "The ID of the container used to run the code.\n" }),
14797 "code": Schema.Union([
14798 Schema.String.annotate({ "description": "The code to run, or null if not available.\n" }),
14799 Schema.Null
14800 ]),
14801 "outputs": Schema.Union([
14802 Schema.Array(Schema.Union([CodeInterpreterOutputLogs, CodeInterpreterOutputImage], { mode: "oneOf" })).annotate({
14803 "description":
14804 "The outputs generated by the code interpreter, such as logs or images.\nCan be null if no outputs are available.\n"
14805 }),
14806 Schema.Null
14807 ])
14808}).annotate({ "title": "Code interpreter tool call", "description": "A tool call to run code.\n" })
14809export type LocalShellToolCall = {
14810 readonly "type": "local_shell_call"
14811 readonly "id": string
14812 readonly "call_id": string
14813 readonly "action": LocalShellExecAction
14814 readonly "status": "in_progress" | "completed" | "incomplete"
14815}
14816export const LocalShellToolCall = Schema.Struct({
14817 "type": Schema.Literal("local_shell_call").annotate({
14818 "description": "The type of the local shell call. Always `local_shell_call`.\n"
14819 }),
14820 "id": Schema.String.annotate({ "description": "The unique ID of the local shell call.\n" }),
14821 "call_id": Schema.String.annotate({
14822 "description": "The unique ID of the local shell tool call generated by the model.\n"
14823 }),
14824 "action": LocalShellExecAction,
14825 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
14826 "description": "The status of the local shell call.\n"
14827 })
14828}).annotate({ "title": "Local shell call", "description": "A tool call to run a command on the local shell.\n" })
14829export type FunctionShellCall = {
14830 readonly "type": "shell_call"
14831 readonly "id": string
14832 readonly "call_id": string
14833 readonly "action": {
14834 readonly "commands": ReadonlyArray<string>
14835 readonly "timeout_ms": number | null
14836 readonly "max_output_length": number | null
14837 }
14838 readonly "status": "in_progress" | "completed" | "incomplete"
14839 readonly "environment": LocalEnvironmentResource | ContainerReferenceResource | null
14840 readonly "created_by"?: string
14841}
14842export const FunctionShellCall = Schema.Struct({
14843 "type": Schema.Literal("shell_call").annotate({ "description": "The type of the item. Always `shell_call`." }),
14844 "id": Schema.String.annotate({
14845 "description": "The unique ID of the shell tool call. Populated when this item is returned via API."
14846 }),
14847 "call_id": Schema.String.annotate({ "description": "The unique ID of the shell tool call generated by the model." }),
14848 "action": Schema.Struct({
14849 "commands": Schema.Array(Schema.String.annotate({ "description": "A list of commands to run." })),
14850 "timeout_ms": Schema.Union([
14851 Schema.Number.annotate({ "description": "Optional timeout in milliseconds for the commands." }).check(
14852 Schema.isInt()
14853 ),
14854 Schema.Null
14855 ]),
14856 "max_output_length": Schema.Union([
14857 Schema.Number.annotate({ "description": "Optional maximum number of characters to return from each command." })
14858 .check(Schema.isInt()),
14859 Schema.Null
14860 ])
14861 }).annotate({
14862 "title": "Shell exec action",
14863 "description": "The shell commands and limits that describe how to run the tool call."
14864 }),
14865 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
14866 "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`."
14867 }),
14868 "environment": Schema.Union([
14869 Schema.Union([LocalEnvironmentResource, ContainerReferenceResource], { mode: "oneOf" }),
14870 Schema.Null
14871 ]),
14872 "created_by": Schema.optionalKey(
14873 Schema.String.annotate({ "description": "The ID of the entity that created this tool call." })
14874 )
14875}).annotate({
14876 "title": "Shell tool call",
14877 "description": "A tool call that executes one or more shell commands in a managed environment."
14878})
14879export type FunctionShellCallOutputContent = {
14880 readonly "stdout": string
14881 readonly "stderr": string
14882 readonly "outcome": FunctionShellCallOutputTimeoutOutcome | FunctionShellCallOutputExitOutcome
14883 readonly "created_by"?: string
14884}
14885export const FunctionShellCallOutputContent = Schema.Struct({
14886 "stdout": Schema.String.annotate({ "description": "The standard output that was captured." }),
14887 "stderr": Schema.String.annotate({ "description": "The standard error output that was captured." }),
14888 "outcome": Schema.Union([FunctionShellCallOutputTimeoutOutcome, FunctionShellCallOutputExitOutcome], {
14889 mode: "oneOf"
14890 }).annotate({
14891 "title": "Shell call outcome",
14892 "description":
14893 "Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk."
14894 }),
14895 "created_by": Schema.optionalKey(
14896 Schema.String.annotate({ "description": "The identifier of the actor that created the item." })
14897 )
14898}).annotate({
14899 "title": "Shell call output content",
14900 "description": "The content of a shell tool call output that was emitted."
14901})
14902export type ApplyPatchToolCall = {
14903 readonly "type": "apply_patch_call"
14904 readonly "id": string
14905 readonly "call_id": string
14906 readonly "status": "in_progress" | "completed"
14907 readonly "operation": ApplyPatchCreateFileOperation | ApplyPatchDeleteFileOperation | ApplyPatchUpdateFileOperation
14908 readonly "created_by"?: string
14909}
14910export const ApplyPatchToolCall = Schema.Struct({
14911 "type": Schema.Literal("apply_patch_call").annotate({
14912 "description": "The type of the item. Always `apply_patch_call`."
14913 }),
14914 "id": Schema.String.annotate({
14915 "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API."
14916 }),
14917 "call_id": Schema.String.annotate({
14918 "description": "The unique ID of the apply patch tool call generated by the model."
14919 }),
14920 "status": Schema.Literals(["in_progress", "completed"]).annotate({
14921 "description": "The status of the apply patch tool call. One of `in_progress` or `completed`."
14922 }),
14923 "operation": Schema.Union([
14924 ApplyPatchCreateFileOperation,
14925 ApplyPatchDeleteFileOperation,
14926 ApplyPatchUpdateFileOperation
14927 ], { mode: "oneOf" }).annotate({
14928 "title": "Apply patch operation",
14929 "description": "One of the create_file, delete_file, or update_file operations applied via apply_patch."
14930 }),
14931 "created_by": Schema.optionalKey(
14932 Schema.String.annotate({ "description": "The ID of the entity that created this tool call." })
14933 )
14934}).annotate({
14935 "title": "Apply patch tool call",
14936 "description": "A tool call that applies file diffs by creating, deleting, or updating files."
14937})
14938export type FunctionShellCallOutputContentParam = {
14939 readonly "stdout": string
14940 readonly "stderr": string
14941 readonly "outcome": FunctionShellCallOutputTimeoutOutcomeParam | FunctionShellCallOutputExitOutcomeParam
14942}
14943export const FunctionShellCallOutputContentParam = Schema.Struct({
14944 "stdout": Schema.String.annotate({ "description": "Captured stdout output for the shell call." }).check(
14945 Schema.isMaxLength(10485760)
14946 ),
14947 "stderr": Schema.String.annotate({ "description": "Captured stderr output for the shell call." }).check(
14948 Schema.isMaxLength(10485760)
14949 ),
14950 "outcome": Schema.Union([FunctionShellCallOutputTimeoutOutcomeParam, FunctionShellCallOutputExitOutcomeParam], {
14951 mode: "oneOf"
14952 }).annotate({
14953 "title": "Shell call outcome",
14954 "description": "The exit or timeout outcome associated with this shell call."
14955 })
14956}).annotate({
14957 "title": "Shell output content",
14958 "description": "Captured stdout and stderr for a portion of a shell tool call output."
14959})
14960export type ImageGenUsage = {
14961 readonly "input_tokens": number
14962 readonly "total_tokens": number
14963 readonly "output_tokens": number
14964 readonly "output_tokens_details"?: ImageGenOutputTokensDetails
14965 readonly "input_tokens_details": ImageGenInputUsageDetails
14966}
14967export const ImageGenUsage = Schema.Struct({
14968 "input_tokens": Schema.Number.annotate({
14969 "description": "The number of tokens (images and text) in the input prompt."
14970 }).check(Schema.isInt()),
14971 "total_tokens": Schema.Number.annotate({
14972 "description": "The total number of tokens (images and text) used for the image generation."
14973 }).check(Schema.isInt()),
14974 "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens generated by the model." })
14975 .check(Schema.isInt()),
14976 "output_tokens_details": Schema.optionalKey(ImageGenOutputTokensDetails),
14977 "input_tokens_details": ImageGenInputUsageDetails
14978}).annotate({
14979 "title": "Image generation usage",
14980 "description": "For `gpt-image-1` only, the token usage information for the image generation."
14981})
14982export type ToolChoiceParam =
14983 | ToolChoiceOptions
14984 | ToolChoiceAllowed
14985 | ToolChoiceTypes
14986 | ToolChoiceFunction
14987 | ToolChoiceMCP
14988 | ToolChoiceCustom
14989 | SpecificApplyPatchParam
14990 | SpecificFunctionShellParam
14991export const ToolChoiceParam = Schema.Union([
14992 ToolChoiceOptions,
14993 ToolChoiceAllowed,
14994 ToolChoiceTypes,
14995 ToolChoiceFunction,
14996 ToolChoiceMCP,
14997 ToolChoiceCustom,
14998 SpecificApplyPatchParam,
14999 SpecificFunctionShellParam
15000], { mode: "oneOf" }).annotate({
15001 "description":
15002 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
15003})
15004export type ConversationParam = string | ConversationParam_2
15005export const ConversationParam = Schema.Union([
15006 Schema.String.annotate({ "title": "Conversation ID", "description": "The unique ID of the conversation.\n" }),
15007 ConversationParam_2
15008], { mode: "oneOf" }).annotate({
15009 "description":
15010 "The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\nInput items and output items from this response are automatically added to this conversation after this response completes.\n"
15011})
15012export type VideoListResource = {
15013 readonly "object": "list"
15014 readonly "data": ReadonlyArray<VideoResource>
15015 readonly "first_id": string | null
15016 readonly "last_id": string | null
15017 readonly "has_more": boolean
15018}
15019export const VideoListResource = Schema.Struct({
15020 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
15021 "data": Schema.Array(VideoResource).annotate({ "description": "A list of items" }),
15022 "first_id": Schema.Union([
15023 Schema.String.annotate({ "description": "The ID of the first item in the list." }),
15024 Schema.Null
15025 ]),
15026 "last_id": Schema.Union([
15027 Schema.String.annotate({ "description": "The ID of the last item in the list." }),
15028 Schema.Null
15029 ]),
15030 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." })
15031})
15032export type CreateVideoMultipartBody = {
15033 readonly "model"?:
15034 | string
15035 | "sora-2"
15036 | "sora-2-pro"
15037 | "sora-2-2025-10-06"
15038 | "sora-2-pro-2025-10-06"
15039 | "sora-2-2025-12-08"
15040 readonly "prompt": string
15041 readonly "input_reference"?: string | ImageRefParam_2
15042 readonly "seconds"?: "4" | "8" | "12"
15043 readonly "size"?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024"
15044}
15045export const CreateVideoMultipartBody = Schema.Struct({
15046 "model": Schema.optionalKey(
15047 Schema.Union([
15048 Schema.String,
15049 Schema.Literals(["sora-2", "sora-2-pro", "sora-2-2025-10-06", "sora-2-pro-2025-10-06", "sora-2-2025-12-08"])
15050 ]).annotate({
15051 "description": "The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`."
15052 })
15053 ),
15054 "prompt": Schema.String.annotate({ "description": "Text prompt that describes the video to generate." }).check(
15055 Schema.isMinLength(1)
15056 ).check(Schema.isMaxLength(32000)),
15057 "input_reference": Schema.optionalKey(
15058 Schema.Union([
15059 Schema.String.annotate({
15060 "description": "Optional reference asset upload or reference object that guides generation.",
15061 "format": "binary"
15062 }),
15063 ImageRefParam_2
15064 ], { mode: "oneOf" })
15065 ),
15066 "seconds": Schema.optionalKey(
15067 Schema.Literals(["4", "8", "12"]).annotate({
15068 "description": "Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds."
15069 })
15070 ),
15071 "size": Schema.optionalKey(
15072 Schema.Literals(["720x1280", "1280x720", "1024x1792", "1792x1024"]).annotate({
15073 "description":
15074 "Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280."
15075 })
15076 )
15077}).annotate({
15078 "title": "Create video multipart request",
15079 "description": "Multipart parameters for creating a new video generation job."
15080})
15081export type CreateVideoEditMultipartBody = {
15082 readonly "video": string | VideoReferenceInputParam
15083 readonly "prompt": string
15084}
15085export const CreateVideoEditMultipartBody = Schema.Struct({
15086 "video": Schema.Union([
15087 Schema.String.annotate({ "description": "Reference to the completed video to edit.", "format": "binary" }),
15088 VideoReferenceInputParam
15089 ], { mode: "oneOf" }),
15090 "prompt": Schema.String.annotate({ "description": "Text prompt that describes how to edit the source video." }).check(
15091 Schema.isMinLength(1)
15092 ).check(Schema.isMaxLength(32000))
15093}).annotate({
15094 "title": "Create video edit multipart request",
15095 "description": "Parameters for editing an existing generated video."
15096})
15097export type CreateVideoExtendMultipartBody = {
15098 readonly "video": VideoReferenceInputParam | string
15099 readonly "prompt": string
15100 readonly "seconds": "4" | "8" | "12"
15101}
15102export const CreateVideoExtendMultipartBody = Schema.Struct({
15103 "video": Schema.Union([
15104 VideoReferenceInputParam,
15105 Schema.String.annotate({ "description": "Reference to the completed video to extend.", "format": "binary" })
15106 ], { mode: "oneOf" }),
15107 "prompt": Schema.String.annotate({ "description": "Updated text prompt that directs the extension generation." })
15108 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(32000)),
15109 "seconds": Schema.Literals(["4", "8", "12"]).annotate({
15110 "description": "Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20)."
15111 })
15112}).annotate({
15113 "title": "Create video extension multipart request",
15114 "description": "Multipart parameters for extending an existing generated video."
15115})
15116export type SkillListResource = {
15117 readonly "object": "list"
15118 readonly "data": ReadonlyArray<SkillResource>
15119 readonly "first_id": string | null
15120 readonly "last_id": string | null
15121 readonly "has_more": boolean
15122}
15123export const SkillListResource = Schema.Struct({
15124 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
15125 "data": Schema.Array(SkillResource).annotate({ "description": "A list of items" }),
15126 "first_id": Schema.Union([
15127 Schema.String.annotate({ "description": "The ID of the first item in the list." }),
15128 Schema.Null
15129 ]),
15130 "last_id": Schema.Union([
15131 Schema.String.annotate({ "description": "The ID of the last item in the list." }),
15132 Schema.Null
15133 ]),
15134 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." })
15135})
15136export type SkillVersionListResource = {
15137 readonly "object": "list"
15138 readonly "data": ReadonlyArray<SkillVersionResource>
15139 readonly "first_id": string | null
15140 readonly "last_id": string | null
15141 readonly "has_more": boolean
15142}
15143export const SkillVersionListResource = Schema.Struct({
15144 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
15145 "data": Schema.Array(SkillVersionResource).annotate({ "description": "A list of items" }),
15146 "first_id": Schema.Union([
15147 Schema.String.annotate({ "description": "The ID of the first item in the list." }),
15148 Schema.Null
15149 ]),
15150 "last_id": Schema.Union([
15151 Schema.String.annotate({ "description": "The ID of the last item in the list." }),
15152 Schema.Null
15153 ]),
15154 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." })
15155})
15156export type UserMessageItem = {
15157 readonly "id": string
15158 readonly "object": "chatkit.thread_item"
15159 readonly "created_at": number
15160 readonly "thread_id": string
15161 readonly "type": "chatkit.user_message"
15162 readonly "content": ReadonlyArray<UserMessageInputText | UserMessageQuotedText>
15163 readonly "attachments": ReadonlyArray<Attachment>
15164 readonly "inference_options": {
15165 readonly "tool_choice": { readonly "id": string } | null
15166 readonly "model": string | null
15167 } | null
15168}
15169export const UserMessageItem = Schema.Struct({
15170 "id": Schema.String.annotate({ "description": "Identifier of the thread item." }),
15171 "object": Schema.Literal("chatkit.thread_item").annotate({
15172 "description": "Type discriminator that is always `chatkit.thread_item`."
15173 }),
15174 "created_at": Schema.Number.annotate({
15175 "description": "Unix timestamp (in seconds) for when the item was created.",
15176 "format": "unixtime"
15177 }).check(Schema.isInt()),
15178 "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }),
15179 "type": Schema.Literal("chatkit.user_message"),
15180 "content": Schema.Array(
15181 Schema.Union([UserMessageInputText, UserMessageQuotedText], { mode: "oneOf" }).annotate({
15182 "description": "Content blocks that comprise a user message."
15183 })
15184 ).annotate({ "description": "Ordered content elements supplied by the user." }),
15185 "attachments": Schema.Array(Attachment).annotate({
15186 "description": "Attachments associated with the user message. Defaults to an empty list."
15187 }),
15188 "inference_options": Schema.Union([
15189 Schema.Struct({
15190 "tool_choice": Schema.Union([
15191 Schema.Struct({ "id": Schema.String.annotate({ "description": "Identifier of the requested tool." }) })
15192 .annotate({
15193 "title": "Tool choice",
15194 "description": "Preferred tool to invoke. Defaults to null when ChatKit should auto-select."
15195 }),
15196 Schema.Null
15197 ]),
15198 "model": Schema.Union([
15199 Schema.String.annotate({
15200 "description": "Model name that generated the response. Defaults to null when using the session default."
15201 }),
15202 Schema.Null
15203 ])
15204 }).annotate({
15205 "title": "Inference options",
15206 "description": "Inference overrides applied to the message. Defaults to null when unset."
15207 }),
15208 Schema.Null
15209 ])
15210}).annotate({ "title": "User Message Item", "description": "User-authored messages within a thread." })
15211export type ResponseOutputText = {
15212 readonly "type": "output_text"
15213 readonly "text": string
15214 readonly "annotations": ReadonlyArray<FileAnnotation | UrlAnnotation>
15215}
15216export const ResponseOutputText = Schema.Struct({
15217 "type": Schema.Literal("output_text").annotate({ "description": "Type discriminator that is always `output_text`." }),
15218 "text": Schema.String.annotate({ "description": "Assistant generated text." }),
15219 "annotations": Schema.Array(
15220 Schema.Union([FileAnnotation, UrlAnnotation], { mode: "oneOf" }).annotate({
15221 "description": "Annotation object describing a cited source."
15222 })
15223 ).annotate({ "description": "Ordered list of annotations attached to the response text." })
15224}).annotate({
15225 "title": "Assistant message content",
15226 "description": "Assistant response text accompanied by optional annotations."
15227})
15228export type TaskGroupItem = {
15229 readonly "id": string
15230 readonly "object": "chatkit.thread_item"
15231 readonly "created_at": number
15232 readonly "thread_id": string
15233 readonly "type": "chatkit.task_group"
15234 readonly "tasks": ReadonlyArray<TaskGroupTask>
15235}
15236export const TaskGroupItem = Schema.Struct({
15237 "id": Schema.String.annotate({ "description": "Identifier of the thread item." }),
15238 "object": Schema.Literal("chatkit.thread_item").annotate({
15239 "description": "Type discriminator that is always `chatkit.thread_item`."
15240 }),
15241 "created_at": Schema.Number.annotate({
15242 "description": "Unix timestamp (in seconds) for when the item was created.",
15243 "format": "unixtime"
15244 }).check(Schema.isInt()),
15245 "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }),
15246 "type": Schema.Literal("chatkit.task_group").annotate({
15247 "description": "Type discriminator that is always `chatkit.task_group`."
15248 }),
15249 "tasks": Schema.Array(TaskGroupTask).annotate({ "description": "Tasks included in the group." })
15250}).annotate({ "title": "Task group", "description": "Collection of workflow tasks grouped together in the thread." })
15251export type ThreadResource = {
15252 readonly "id": string
15253 readonly "object": "chatkit.thread"
15254 readonly "created_at": number
15255 readonly "title": string | null
15256 readonly "status": ActiveStatus | LockedStatus | ClosedStatus
15257 readonly "user": string
15258}
15259export const ThreadResource = Schema.Struct({
15260 "id": Schema.String.annotate({ "description": "Identifier of the thread." }),
15261 "object": Schema.Literal("chatkit.thread").annotate({
15262 "description": "Type discriminator that is always `chatkit.thread`."
15263 }),
15264 "created_at": Schema.Number.annotate({
15265 "description": "Unix timestamp (in seconds) for when the thread was created.",
15266 "format": "unixtime"
15267 }).check(Schema.isInt()),
15268 "title": Schema.Union([
15269 Schema.String.annotate({
15270 "description": "Optional human-readable title for the thread. Defaults to null when no title has been generated."
15271 }),
15272 Schema.Null
15273 ]),
15274 "status": Schema.Union([ActiveStatus, LockedStatus, ClosedStatus], { mode: "oneOf" }).annotate({
15275 "description": "Current status for the thread. Defaults to `active` for newly created threads."
15276 }),
15277 "user": Schema.String.annotate({
15278 "description": "Free-form string that identifies your end user who owns the thread."
15279 })
15280}).annotate({ "title": "The thread object", "description": "Represents a ChatKit thread and its current status." })
15281export type AuditLogActor = {
15282 readonly "type"?: "session" | "api_key"
15283 readonly "session"?: AuditLogActorSession
15284 readonly "api_key"?: AuditLogActorApiKey
15285}
15286export const AuditLogActor = Schema.Struct({
15287 "type": Schema.optionalKey(
15288 Schema.Literals(["session", "api_key"]).annotate({
15289 "description": "The type of actor. Is either `session` or `api_key`."
15290 })
15291 ),
15292 "session": Schema.optionalKey(AuditLogActorSession),
15293 "api_key": Schema.optionalKey(AuditLogActorApiKey)
15294}).annotate({ "description": "The actor who performed the audit logged action." })
15295export type ChatCompletionToolChoiceOption =
15296 | "none"
15297 | "auto"
15298 | "required"
15299 | ChatCompletionAllowedToolsChoice
15300 | ChatCompletionNamedToolChoice
15301 | ChatCompletionNamedToolChoiceCustom
15302export const ChatCompletionToolChoiceOption = Schema.Union([
15303 Schema.Literals(["none", "auto", "required"]).annotate({
15304 "title": "Tool choice mode",
15305 "description":
15306 "`none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools.\n"
15307 }),
15308 ChatCompletionAllowedToolsChoice,
15309 ChatCompletionNamedToolChoice,
15310 ChatCompletionNamedToolChoiceCustom
15311], { mode: "oneOf" }).annotate({
15312 "description":
15313 "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tool and instead generates a message.\n`auto` means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools.\nSpecifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n\n`none` is the default when no tools are present. `auto` is the default if tools are present.\n"
15314})
15315export type ChatCompletionMessageList = {
15316 readonly "object": "list"
15317 readonly "data": ReadonlyArray<
15318 {
15319 readonly "content": string | null
15320 readonly "refusal": string | null
15321 readonly "tool_calls"?: ChatCompletionMessageToolCalls
15322 readonly "annotations"?: ReadonlyArray<
15323 {
15324 readonly "type": "url_citation"
15325 readonly "url_citation": {
15326 readonly "end_index": number
15327 readonly "start_index": number
15328 readonly "url": string
15329 readonly "title": string
15330 }
15331 }
15332 >
15333 readonly "role": "assistant"
15334 readonly "function_call"?: { readonly "arguments": string; readonly "name": string }
15335 readonly "audio"?: {
15336 readonly "id": string
15337 readonly "expires_at": number
15338 readonly "data": string
15339 readonly "transcript": string
15340 } | null
15341 readonly "id": string
15342 readonly "content_parts"?:
15343 | ReadonlyArray<ChatCompletionRequestMessageContentPartText | ChatCompletionRequestMessageContentPartImage>
15344 | null
15345 }
15346 >
15347 readonly "first_id": string
15348 readonly "last_id": string
15349 readonly "has_more": boolean
15350}
15351export const ChatCompletionMessageList = Schema.Struct({
15352 "object": Schema.Literal("list").annotate({
15353 "description": "The type of this object. It is always set to \"list\".\n"
15354 }),
15355 "data": Schema.Array(
15356 Schema.Struct({
15357 "content": Schema.Union([Schema.String.annotate({ "description": "The contents of the message." }), Schema.Null]),
15358 "refusal": Schema.Union([
15359 Schema.String.annotate({ "description": "The refusal message generated by the model." }),
15360 Schema.Null
15361 ]),
15362 "tool_calls": Schema.optionalKey(ChatCompletionMessageToolCalls),
15363 "annotations": Schema.optionalKey(
15364 Schema.Array(
15365 Schema.Struct({
15366 "type": Schema.Literal("url_citation").annotate({
15367 "description": "The type of the URL citation. Always `url_citation`."
15368 }),
15369 "url_citation": Schema.Struct({
15370 "end_index": Schema.Number.annotate({
15371 "description": "The index of the last character of the URL citation in the message."
15372 }).check(Schema.isInt()),
15373 "start_index": Schema.Number.annotate({
15374 "description": "The index of the first character of the URL citation in the message."
15375 }).check(Schema.isInt()),
15376 "url": Schema.String.annotate({ "description": "The URL of the web resource.", "format": "uri" }),
15377 "title": Schema.String.annotate({ "description": "The title of the web resource." })
15378 }).annotate({ "description": "A URL citation when using web search." })
15379 }).annotate({ "description": "A URL citation when using web search.\n" })
15380 ).annotate({
15381 "description":
15382 "Annotations for the message, when applicable, as when using the\n[web search tool](/docs/guides/tools-web-search?api-mode=chat).\n"
15383 })
15384 ),
15385 "role": Schema.Literal("assistant").annotate({ "description": "The role of the author of this message." }),
15386 "function_call": Schema.optionalKey(
15387 Schema.Struct({
15388 "arguments": Schema.String.annotate({
15389 "description":
15390 "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
15391 }),
15392 "name": Schema.String.annotate({ "description": "The name of the function to call." })
15393 }).annotate({
15394 "description":
15395 "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."
15396 })
15397 ),
15398 "audio": Schema.optionalKey(Schema.Union([
15399 Schema.Struct({
15400 "id": Schema.String.annotate({ "description": "Unique identifier for this audio response." }),
15401 "expires_at": Schema.Number.annotate({
15402 "description":
15403 "The Unix timestamp (in seconds) for when this audio response will\nno longer be accessible on the server for use in multi-turn\nconversations.\n",
15404 "format": "unixtime"
15405 }).check(Schema.isInt()),
15406 "data": Schema.String.annotate({
15407 "description":
15408 "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n"
15409 }),
15410 "transcript": Schema.String.annotate({ "description": "Transcript of the audio generated by the model." })
15411 }).annotate({
15412 "description":
15413 "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](/docs/guides/audio).\n"
15414 }),
15415 Schema.Null
15416 ])),
15417 "id": Schema.String.annotate({ "description": "The identifier of the chat message." }),
15418 "content_parts": Schema.optionalKey(
15419 Schema.Union([
15420 Schema.Array(
15421 Schema.Union([ChatCompletionRequestMessageContentPartText, ChatCompletionRequestMessageContentPartImage], {
15422 mode: "oneOf"
15423 })
15424 ).annotate({
15425 "description":
15426 "If a content parts array was provided, this is an array of `text` and `image_url` parts.\nOtherwise, null.\n"
15427 }),
15428 Schema.Null
15429 ])
15430 )
15431 }).annotate({ "description": "A chat completion message generated by the model." })
15432 ).annotate({ "description": "An array of chat completion message objects.\n" }),
15433 "first_id": Schema.String.annotate({ "description": "The identifier of the first chat message in the data array." }),
15434 "last_id": Schema.String.annotate({ "description": "The identifier of the last chat message in the data array." }),
15435 "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more chat messages available." })
15436}).annotate({
15437 "title": "ChatCompletionMessageList",
15438 "description": "An object representing a list of chat completion messages.\n"
15439})
15440export type ChatCompletionResponseMessage = {
15441 readonly "content": string | null
15442 readonly "refusal": string | null
15443 readonly "tool_calls"?: ChatCompletionMessageToolCalls
15444 readonly "annotations"?: ReadonlyArray<
15445 {
15446 readonly "type": "url_citation"
15447 readonly "url_citation": {
15448 readonly "end_index": number
15449 readonly "start_index": number
15450 readonly "url": string
15451 readonly "title": string
15452 }
15453 }
15454 >
15455 readonly "role": "assistant"
15456 readonly "function_call"?: { readonly "arguments": string; readonly "name": string }
15457 readonly "audio"?: {
15458 readonly "id": string
15459 readonly "expires_at": number
15460 readonly "data": string
15461 readonly "transcript": string
15462 } | null
15463}
15464export const ChatCompletionResponseMessage = Schema.Struct({
15465 "content": Schema.Union([Schema.String.annotate({ "description": "The contents of the message." }), Schema.Null]),
15466 "refusal": Schema.Union([
15467 Schema.String.annotate({ "description": "The refusal message generated by the model." }),
15468 Schema.Null
15469 ]),
15470 "tool_calls": Schema.optionalKey(ChatCompletionMessageToolCalls),
15471 "annotations": Schema.optionalKey(
15472 Schema.Array(
15473 Schema.Struct({
15474 "type": Schema.Literal("url_citation").annotate({
15475 "description": "The type of the URL citation. Always `url_citation`."
15476 }),
15477 "url_citation": Schema.Struct({
15478 "end_index": Schema.Number.annotate({
15479 "description": "The index of the last character of the URL citation in the message."
15480 }).check(Schema.isInt()),
15481 "start_index": Schema.Number.annotate({
15482 "description": "The index of the first character of the URL citation in the message."
15483 }).check(Schema.isInt()),
15484 "url": Schema.String.annotate({ "description": "The URL of the web resource.", "format": "uri" }),
15485 "title": Schema.String.annotate({ "description": "The title of the web resource." })
15486 }).annotate({ "description": "A URL citation when using web search." })
15487 }).annotate({ "description": "A URL citation when using web search.\n" })
15488 ).annotate({
15489 "description":
15490 "Annotations for the message, when applicable, as when using the\n[web search tool](/docs/guides/tools-web-search?api-mode=chat).\n"
15491 })
15492 ),
15493 "role": Schema.Literal("assistant").annotate({ "description": "The role of the author of this message." }),
15494 "function_call": Schema.optionalKey(
15495 Schema.Struct({
15496 "arguments": Schema.String.annotate({
15497 "description":
15498 "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
15499 }),
15500 "name": Schema.String.annotate({ "description": "The name of the function to call." })
15501 }).annotate({
15502 "description":
15503 "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."
15504 })
15505 ),
15506 "audio": Schema.optionalKey(Schema.Union([
15507 Schema.Struct({
15508 "id": Schema.String.annotate({ "description": "Unique identifier for this audio response." }),
15509 "expires_at": Schema.Number.annotate({
15510 "description":
15511 "The Unix timestamp (in seconds) for when this audio response will\nno longer be accessible on the server for use in multi-turn\nconversations.\n",
15512 "format": "unixtime"
15513 }).check(Schema.isInt()),
15514 "data": Schema.String.annotate({
15515 "description": "Base64 encoded audio bytes generated by the model, in the format\nspecified in the request.\n"
15516 }),
15517 "transcript": Schema.String.annotate({ "description": "Transcript of the audio generated by the model." })
15518 }).annotate({
15519 "description":
15520 "If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](/docs/guides/audio).\n"
15521 }),
15522 Schema.Null
15523 ]))
15524}).annotate({ "description": "A chat completion message generated by the model." })
15525export type CreateChatCompletionStreamResponse = {
15526 readonly "id": string
15527 readonly "choices": ReadonlyArray<
15528 {
15529 readonly "delta": ChatCompletionStreamResponseDelta
15530 readonly "logprobs"?: {
15531 readonly "content": ReadonlyArray<
15532 {
15533 readonly "token": string
15534 readonly "logprob": number
15535 readonly "bytes": ReadonlyArray<number> | null
15536 readonly "top_logprobs": ReadonlyArray<
15537 { readonly "token": string; readonly "logprob": number; readonly "bytes": ReadonlyArray<number> | null }
15538 >
15539 }
15540 >
15541 readonly "refusal": ReadonlyArray<
15542 {
15543 readonly "token": string
15544 readonly "logprob": number
15545 readonly "bytes": ReadonlyArray<number> | null
15546 readonly "top_logprobs": ReadonlyArray<
15547 { readonly "token": string; readonly "logprob": number; readonly "bytes": ReadonlyArray<number> | null }
15548 >
15549 }
15550 >
15551 }
15552 readonly "finish_reason": "stop" | "length" | "tool_calls" | "content_filter" | "function_call" | null
15553 readonly "index": number
15554 }
15555 >
15556 readonly "created": number
15557 readonly "model": string
15558 readonly "service_tier"?: ServiceTier
15559 readonly "system_fingerprint"?: string
15560 readonly "object": "chat.completion.chunk"
15561 readonly "usage"?: {
15562 readonly "completion_tokens": number
15563 readonly "prompt_tokens": number
15564 readonly "total_tokens": number
15565 readonly "completion_tokens_details"?: {
15566 readonly "accepted_prediction_tokens"?: number
15567 readonly "audio_tokens"?: number
15568 readonly "reasoning_tokens"?: number
15569 readonly "rejected_prediction_tokens"?: number
15570 }
15571 readonly "prompt_tokens_details"?: { readonly "audio_tokens"?: number; readonly "cached_tokens"?: number }
15572 } | null
15573}
15574export const CreateChatCompletionStreamResponse = Schema.Struct({
15575 "id": Schema.String.annotate({
15576 "description": "A unique identifier for the chat completion. Each chunk has the same ID."
15577 }),
15578 "choices": Schema.Array(Schema.Struct({
15579 "delta": ChatCompletionStreamResponseDelta,
15580 "logprobs": Schema.optionalKey(Schema.Union([
15581 Schema.Struct({
15582 "content": Schema.Union([
15583 Schema.Array(Schema.Struct({
15584 "token": Schema.String.annotate({ "description": "The token." }),
15585 "logprob": Schema.Number.annotate({
15586 "description":
15587 "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely."
15588 }).check(Schema.isFinite()),
15589 "bytes": Schema.Union([
15590 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
15591 "description":
15592 "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."
15593 }),
15594 Schema.Null
15595 ]),
15596 "top_logprobs": Schema.Array(Schema.Struct({
15597 "token": Schema.String.annotate({ "description": "The token." }),
15598 "logprob": Schema.Number.annotate({
15599 "description":
15600 "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely."
15601 }).check(Schema.isFinite()),
15602 "bytes": Schema.Union([
15603 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
15604 "description":
15605 "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."
15606 }),
15607 Schema.Null
15608 ])
15609 })).annotate({
15610 "description":
15611 "List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`."
15612 })
15613 })).annotate({ "description": "A list of message content tokens with log probability information." })
15614 ]),
15615 "refusal": Schema.Union([
15616 Schema.Array(Schema.Struct({
15617 "token": Schema.String.annotate({ "description": "The token." }),
15618 "logprob": Schema.Number.annotate({
15619 "description":
15620 "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely."
15621 }).check(Schema.isFinite()),
15622 "bytes": Schema.Union([
15623 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
15624 "description":
15625 "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."
15626 }),
15627 Schema.Null
15628 ]),
15629 "top_logprobs": Schema.Array(Schema.Struct({
15630 "token": Schema.String.annotate({ "description": "The token." }),
15631 "logprob": Schema.Number.annotate({
15632 "description":
15633 "The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely."
15634 }).check(Schema.isFinite()),
15635 "bytes": Schema.Union([
15636 Schema.Array(Schema.Number.check(Schema.isInt())).annotate({
15637 "description":
15638 "A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token."
15639 }),
15640 Schema.Null
15641 ])
15642 })).annotate({
15643 "description":
15644 "List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`."
15645 })
15646 })).annotate({ "description": "A list of message refusal tokens with log probability information." })
15647 ])
15648 }).annotate({ "description": "Log probability information for the choice." })
15649 ])),
15650 "finish_reason": Schema.Union([
15651 Schema.Literals(["stop", "length", "tool_calls", "content_filter", "function_call"]).annotate({
15652 "description":
15653 "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"
15654 }),
15655 Schema.Union([Schema.Null]).annotate({
15656 "description":
15657 "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"
15658 })
15659 ]),
15660 "index": Schema.Number.annotate({ "description": "The index of the choice in the list of choices." }).check(
15661 Schema.isInt()
15662 )
15663 })).annotate({
15664 "description":
15665 "A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the\nlast chunk if you set `stream_options: {\"include_usage\": true}`.\n"
15666 }),
15667 "created": Schema.Number.annotate({
15668 "description":
15669 "The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.",
15670 "format": "unixtime"
15671 }).check(Schema.isInt()),
15672 "model": Schema.String.annotate({ "description": "The model to generate the completion." }),
15673 "service_tier": Schema.optionalKey(ServiceTier),
15674 "system_fingerprint": Schema.optionalKey(
15675 Schema.String.annotate({
15676 "description":
15677 "This fingerprint represents the backend configuration that the model runs with.\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"
15678 })
15679 ),
15680 "object": Schema.Literal("chat.completion.chunk").annotate({
15681 "description": "The object type, which is always `chat.completion.chunk`."
15682 }),
15683 "usage": Schema.optionalKey(Schema.Union([
15684 Schema.Struct({
15685 "completion_tokens": Schema.Number.annotate({ "description": "Number of tokens in the generated completion." })
15686 .check(Schema.isInt()),
15687 "prompt_tokens": Schema.Number.annotate({ "description": "Number of tokens in the prompt." }).check(
15688 Schema.isInt()
15689 ),
15690 "total_tokens": Schema.Number.annotate({
15691 "description": "Total number of tokens used in the request (prompt + completion)."
15692 }).check(Schema.isInt()),
15693 "completion_tokens_details": Schema.optionalKey(
15694 Schema.Struct({
15695 "accepted_prediction_tokens": Schema.optionalKey(
15696 Schema.Number.annotate({
15697 "description":
15698 "When using Predicted Outputs, the number of tokens in the\nprediction that appeared in the completion.\n"
15699 }).check(Schema.isInt())
15700 ),
15701 "audio_tokens": Schema.optionalKey(
15702 Schema.Number.annotate({ "description": "Audio input tokens generated by the model." }).check(
15703 Schema.isInt()
15704 )
15705 ),
15706 "reasoning_tokens": Schema.optionalKey(
15707 Schema.Number.annotate({ "description": "Tokens generated by the model for reasoning." }).check(
15708 Schema.isInt()
15709 )
15710 ),
15711 "rejected_prediction_tokens": Schema.optionalKey(
15712 Schema.Number.annotate({
15713 "description":
15714 "When using Predicted Outputs, the number of tokens in the\nprediction that did not appear in the completion. However, like\nreasoning tokens, these tokens are still counted in the total\ncompletion tokens for purposes of billing, output, and context window\nlimits.\n"
15715 }).check(Schema.isInt())
15716 )
15717 }).annotate({ "description": "Breakdown of tokens used in a completion." })
15718 ),
15719 "prompt_tokens_details": Schema.optionalKey(
15720 Schema.Struct({
15721 "audio_tokens": Schema.optionalKey(
15722 Schema.Number.annotate({ "description": "Audio input tokens present in the prompt." }).check(Schema.isInt())
15723 ),
15724 "cached_tokens": Schema.optionalKey(
15725 Schema.Number.annotate({ "description": "Cached tokens present in the prompt." }).check(Schema.isInt())
15726 )
15727 }).annotate({ "description": "Breakdown of tokens used in the prompt." })
15728 )
15729 }).annotate({
15730 "description":
15731 "An optional field that will only be present when you set\n`stream_options: {\"include_usage\": true}` in your request. When present, it\ncontains a null value **except for the last chunk** which contains the\ntoken usage statistics for the entire request.\n\n**NOTE:** If the stream is interrupted or cancelled, you may not\nreceive the final usage chunk which contains the total token usage for\nthe request.\n"
15732 }),
15733 Schema.Null
15734 ]))
15735}).annotate({
15736 "description":
15737 "Represents a streamed chunk of a chat completion response returned\nby the model, based on the provided input. \n[Learn more](/docs/guides/streaming-responses).\n"
15738})
15739export type ChatCompletionRequestAssistantMessage = {
15740 readonly "content"?: string | ReadonlyArray<ChatCompletionRequestAssistantMessageContentPart> | null
15741 readonly "refusal"?: string | null
15742 readonly "role": "assistant"
15743 readonly "name"?: string
15744 readonly "audio"?: { readonly "id": string } | null
15745 readonly "tool_calls"?: ChatCompletionMessageToolCalls
15746 readonly "function_call"?: { readonly "arguments": string; readonly "name": string } | null
15747}
15748export const ChatCompletionRequestAssistantMessage = Schema.Struct({
15749 "content": Schema.optionalKey(
15750 Schema.Union([
15751 Schema.Union([
15752 Schema.String.annotate({ "title": "Text content", "description": "The contents of the assistant message." }),
15753 Schema.Array(ChatCompletionRequestAssistantMessageContentPart).annotate({
15754 "title": "Array of content parts",
15755 "description":
15756 "An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`."
15757 }).check(Schema.isMinLength(1))
15758 ], { mode: "oneOf" }).annotate({
15759 "description":
15760 "The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.\n"
15761 }),
15762 Schema.Null
15763 ])
15764 ),
15765 "refusal": Schema.optionalKey(
15766 Schema.Union([Schema.String.annotate({ "description": "The refusal message by the assistant." }), Schema.Null])
15767 ),
15768 "role": Schema.Literal("assistant").annotate({
15769 "description": "The role of the messages author, in this case `assistant`."
15770 }),
15771 "name": Schema.optionalKey(
15772 Schema.String.annotate({
15773 "description":
15774 "An optional name for the participant. Provides the model information to differentiate between participants of the same role."
15775 })
15776 ),
15777 "audio": Schema.optionalKey(
15778 Schema.Union([
15779 Schema.Struct({
15780 "id": Schema.String.annotate({
15781 "description": "Unique identifier for a previous audio response from the model.\n"
15782 })
15783 }).annotate({
15784 "description": "Data about a previous audio response from the model.\n[Learn more](/docs/guides/audio).\n"
15785 }),
15786 Schema.Null
15787 ])
15788 ),
15789 "tool_calls": Schema.optionalKey(ChatCompletionMessageToolCalls),
15790 "function_call": Schema.optionalKey(Schema.Union([
15791 Schema.Struct({
15792 "arguments": Schema.String.annotate({
15793 "description":
15794 "The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."
15795 }),
15796 "name": Schema.String.annotate({ "description": "The name of the function to call." })
15797 }).annotate({
15798 "description":
15799 "Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model."
15800 }),
15801 Schema.Null
15802 ]))
15803}).annotate({
15804 "title": "Assistant message",
15805 "description": "Messages sent by the model in response to user messages.\n"
15806})
15807export type ChatCompletionRequestSystemMessage = {
15808 readonly "content": string | ReadonlyArray<ChatCompletionRequestSystemMessageContentPart>
15809 readonly "role": "system"
15810 readonly "name"?: string
15811}
15812export const ChatCompletionRequestSystemMessage = Schema.Struct({
15813 "content": Schema.Union([
15814 Schema.String.annotate({ "title": "Text content", "description": "The contents of the system message." }),
15815 Schema.Array(ChatCompletionRequestSystemMessageContentPart).annotate({
15816 "title": "Array of content parts",
15817 "description":
15818 "An array of content parts with a defined type. For system messages, only type `text` is supported."
15819 }).check(Schema.isMinLength(1))
15820 ], { mode: "oneOf" }).annotate({ "description": "The contents of the system message." }),
15821 "role": Schema.Literal("system").annotate({
15822 "description": "The role of the messages author, in this case `system`."
15823 }),
15824 "name": Schema.optionalKey(
15825 Schema.String.annotate({
15826 "description":
15827 "An optional name for the participant. Provides the model information to differentiate between participants of the same role."
15828 })
15829 )
15830}).annotate({
15831 "title": "System message",
15832 "description":
15833 "Developer-provided instructions that the model should follow, regardless of\nmessages sent by the user. With o1 models and newer, use `developer` messages\nfor this purpose instead.\n"
15834})
15835export type ChatCompletionRequestToolMessage = {
15836 readonly "role": "tool"
15837 readonly "content": string | ReadonlyArray<ChatCompletionRequestToolMessageContentPart>
15838 readonly "tool_call_id": string
15839}
15840export const ChatCompletionRequestToolMessage = Schema.Struct({
15841 "role": Schema.Literal("tool").annotate({ "description": "The role of the messages author, in this case `tool`." }),
15842 "content": Schema.Union([
15843 Schema.String.annotate({ "title": "Text content", "description": "The contents of the tool message." }),
15844 Schema.Array(ChatCompletionRequestToolMessageContentPart).annotate({
15845 "title": "Array of content parts",
15846 "description": "An array of content parts with a defined type. For tool messages, only type `text` is supported."
15847 }).check(Schema.isMinLength(1))
15848 ], { mode: "oneOf" }).annotate({ "description": "The contents of the tool message." }),
15849 "tool_call_id": Schema.String.annotate({ "description": "Tool call that this message is responding to." })
15850}).annotate({ "title": "Tool message" })
15851export type ChatCompletionRequestUserMessage = {
15852 readonly "content": string | ReadonlyArray<ChatCompletionRequestUserMessageContentPart>
15853 readonly "role": "user"
15854 readonly "name"?: string
15855}
15856export const ChatCompletionRequestUserMessage = Schema.Struct({
15857 "content": Schema.Union([
15858 Schema.String.annotate({ "title": "Text content", "description": "The text contents of the message." }),
15859 Schema.Array(ChatCompletionRequestUserMessageContentPart).annotate({
15860 "title": "Array of content parts",
15861 "description":
15862 "An array of content parts with a defined type. Supported options differ based on the [model](/docs/models) being used to generate the response. Can contain text, image, or audio inputs."
15863 }).check(Schema.isMinLength(1))
15864 ], { mode: "oneOf" }).annotate({ "description": "The contents of the user message.\n" }),
15865 "role": Schema.Literal("user").annotate({ "description": "The role of the messages author, in this case `user`." }),
15866 "name": Schema.optionalKey(
15867 Schema.String.annotate({
15868 "description":
15869 "An optional name for the participant. Provides the model information to differentiate between participants of the same role."
15870 })
15871 )
15872}).annotate({
15873 "title": "User message",
15874 "description": "Messages sent by an end user, containing prompts or additional context\ninformation.\n"
15875})
15876export type VectorStoreSearchRequest = {
15877 readonly "query": string | ReadonlyArray<string>
15878 readonly "rewrite_query"?: boolean
15879 readonly "max_num_results"?: number
15880 readonly "filters"?: ComparisonFilter | CompoundFilter
15881 readonly "ranking_options"?: {
15882 readonly "ranker"?: "none" | "auto" | "default-2024-11-15"
15883 readonly "score_threshold"?: number
15884 }
15885}
15886export const VectorStoreSearchRequest = Schema.Struct({
15887 "query": Schema.Union([
15888 Schema.String,
15889 Schema.Array(Schema.String.annotate({ "description": "A list of queries to search for." }))
15890 ], { mode: "oneOf" }).annotate({ "description": "A query string for a search" }),
15891 "rewrite_query": Schema.optionalKey(
15892 Schema.Boolean.annotate({ "description": "Whether to rewrite the natural language query for vector search." })
15893 ),
15894 "max_num_results": Schema.optionalKey(
15895 Schema.Number.annotate({
15896 "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive."
15897 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50))
15898 ),
15899 "filters": Schema.optionalKey(
15900 Schema.Union([ComparisonFilter, CompoundFilter], { mode: "oneOf" }).annotate({
15901 "description": "A filter to apply based on file attributes."
15902 })
15903 ),
15904 "ranking_options": Schema.optionalKey(
15905 Schema.Struct({
15906 "ranker": Schema.optionalKey(
15907 Schema.Literals(["none", "auto", "default-2024-11-15"]).annotate({
15908 "description": "Enable re-ranking; set to `none` to disable, which can help reduce latency."
15909 })
15910 ),
15911 "score_threshold": Schema.optionalKey(
15912 Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(
15913 Schema.isLessThanOrEqualTo(1)
15914 )
15915 )
15916 }).annotate({ "description": "Ranking options for search." })
15917 )
15918})
15919export type FileSearchTool = {
15920 readonly "type": "file_search"
15921 readonly "vector_store_ids": ReadonlyArray<string>
15922 readonly "max_num_results"?: number
15923 readonly "ranking_options"?: {
15924 readonly "ranker"?: "auto" | "default-2024-11-15"
15925 readonly "score_threshold"?: number
15926 readonly "hybrid_search"?: { readonly "embedding_weight": number; readonly "text_weight": number }
15927 }
15928 readonly "filters"?: ComparisonFilter | CompoundFilter | null
15929}
15930export const FileSearchTool = Schema.Struct({
15931 "type": Schema.Literal("file_search").annotate({
15932 "description": "The type of the file search tool. Always `file_search`."
15933 }),
15934 "vector_store_ids": Schema.Array(Schema.String).annotate({
15935 "description": "The IDs of the vector stores to search."
15936 }),
15937 "max_num_results": Schema.optionalKey(
15938 Schema.Number.annotate({
15939 "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive."
15940 }).check(Schema.isInt())
15941 ),
15942 "ranking_options": Schema.optionalKey(
15943 Schema.Struct({
15944 "ranker": Schema.optionalKey(
15945 Schema.Literals(["auto", "default-2024-11-15"]).annotate({
15946 "description": "The ranker to use for the file search."
15947 })
15948 ),
15949 "score_threshold": Schema.optionalKey(
15950 Schema.Number.annotate({
15951 "description":
15952 "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results."
15953 }).check(Schema.isFinite())
15954 ),
15955 "hybrid_search": Schema.optionalKey(
15956 Schema.Struct({
15957 "embedding_weight": Schema.Number.annotate({
15958 "description": "The weight of the embedding in the reciprocal ranking fusion."
15959 }).check(Schema.isFinite()),
15960 "text_weight": Schema.Number.annotate({
15961 "description": "The weight of the text in the reciprocal ranking fusion."
15962 }).check(Schema.isFinite())
15963 }).annotate({
15964 "description":
15965 "Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled."
15966 })
15967 )
15968 }).annotate({ "description": "Ranking options for search." })
15969 ),
15970 "filters": Schema.optionalKey(
15971 Schema.Union([
15972 Schema.Union([ComparisonFilter, CompoundFilter]).annotate({ "description": "A filter to apply." }),
15973 Schema.Null
15974 ])
15975 )
15976}).annotate({
15977 "title": "File search",
15978 "description":
15979 "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search)."
15980})
15981export type EvalRunOutputItemList = {
15982 readonly "object": "list"
15983 readonly "data": ReadonlyArray<EvalRunOutputItem>
15984 readonly "first_id": string
15985 readonly "last_id": string
15986 readonly "has_more": boolean
15987}
15988export const EvalRunOutputItemList = Schema.Struct({
15989 "object": Schema.Literal("list").annotate({
15990 "description": "The type of this object. It is always set to \"list\".\n"
15991 }),
15992 "data": Schema.Array(EvalRunOutputItem).annotate({ "description": "An array of eval run output item objects.\n" }),
15993 "first_id": Schema.String.annotate({
15994 "description": "The identifier of the first eval run output item in the data array."
15995 }),
15996 "last_id": Schema.String.annotate({
15997 "description": "The identifier of the last eval run output item in the data array."
15998 }),
15999 "has_more": Schema.Boolean.annotate({
16000 "description": "Indicates whether there are more eval run output items available."
16001 })
16002}).annotate({
16003 "title": "EvalRunOutputItemList",
16004 "description": "An object representing a list of output items for an evaluation run.\n"
16005})
16006export type AssistantToolsFileSearch = {
16007 readonly "type": "file_search"
16008 readonly "file_search"?: {
16009 readonly "max_num_results"?: number
16010 readonly "ranking_options"?: FileSearchRankingOptions
16011 }
16012}
16013export const AssistantToolsFileSearch = Schema.Struct({
16014 "type": Schema.Literal("file_search").annotate({ "description": "The type of tool being defined: `file_search`" }),
16015 "file_search": Schema.optionalKey(
16016 Schema.Struct({
16017 "max_num_results": Schema.optionalKey(
16018 Schema.Number.annotate({
16019 "description":
16020 "The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive.\n\nNote that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) for more information.\n"
16021 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50))
16022 ),
16023 "ranking_options": Schema.optionalKey(FileSearchRankingOptions)
16024 }).annotate({ "description": "Overrides for the file search tool." })
16025 )
16026}).annotate({ "title": "FileSearch tool" })
16027export type RunStepDetailsToolCallsFileSearchObject = {
16028 readonly "id": string
16029 readonly "type": "file_search"
16030 readonly "file_search": {
16031 readonly "ranking_options"?: RunStepDetailsToolCallsFileSearchRankingOptionsObject
16032 readonly "results"?: ReadonlyArray<RunStepDetailsToolCallsFileSearchResultObject>
16033 }
16034}
16035export const RunStepDetailsToolCallsFileSearchObject = Schema.Struct({
16036 "id": Schema.String.annotate({ "description": "The ID of the tool call object." }),
16037 "type": Schema.Literal("file_search").annotate({
16038 "description": "The type of tool call. This is always going to be `file_search` for this type of tool call."
16039 }),
16040 "file_search": Schema.Struct({
16041 "ranking_options": Schema.optionalKey(RunStepDetailsToolCallsFileSearchRankingOptionsObject),
16042 "results": Schema.optionalKey(
16043 Schema.Array(RunStepDetailsToolCallsFileSearchResultObject).annotate({
16044 "description": "The results of the file search."
16045 })
16046 )
16047 }).annotate({ "description": "For now, this is always going to be an empty object." })
16048}).annotate({ "title": "File search tool call" })
16049export type AssistantToolsFunction = { readonly "type": "function"; readonly "function": FunctionObject }
16050export const AssistantToolsFunction = Schema.Struct({
16051 "type": Schema.Literal("function").annotate({ "description": "The type of tool being defined: `function`" }),
16052 "function": FunctionObject
16053}).annotate({ "title": "Function tool" })
16054export type ChatCompletionTool = { readonly "type": "function"; readonly "function": FunctionObject }
16055export const ChatCompletionTool = Schema.Struct({
16056 "type": Schema.Literal("function").annotate({
16057 "description": "The type of the tool. Currently, only `function` is supported."
16058 }),
16059 "function": FunctionObject
16060}).annotate({ "title": "Function tool", "description": "A function tool that can be used to generate a response.\n" })
16061export type ImageEditStreamEvent = ImageEditPartialImageEvent | ImageEditCompletedEvent
16062export const ImageEditStreamEvent = Schema.Union([ImageEditPartialImageEvent, ImageEditCompletedEvent])
16063export type ImageGenStreamEvent = ImageGenPartialImageEvent | ImageGenCompletedEvent
16064export const ImageGenStreamEvent = Schema.Union([ImageGenPartialImageEvent, ImageGenCompletedEvent])
16065export type MessageObject = {
16066 readonly "id": string
16067 readonly "object": "thread.message"
16068 readonly "created_at": number
16069 readonly "thread_id": string
16070 readonly "status": "in_progress" | "incomplete" | "completed"
16071 readonly "incomplete_details": {
16072 readonly "reason": "content_filter" | "max_tokens" | "run_cancelled" | "run_expired" | "run_failed"
16073 } | null
16074 readonly "completed_at": number | null
16075 readonly "incomplete_at": number | null
16076 readonly "role": "user" | "assistant"
16077 readonly "content": ReadonlyArray<
16078 | MessageContentImageFileObject
16079 | MessageContentImageUrlObject
16080 | MessageContentTextObject
16081 | MessageContentRefusalObject
16082 >
16083 readonly "assistant_id": string | null
16084 readonly "run_id": string | null
16085 readonly "attachments":
16086 | ReadonlyArray<
16087 {
16088 readonly "file_id"?: string
16089 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearchTypeOnly>
16090 }
16091 >
16092 | null
16093 readonly "metadata": Metadata
16094}
16095export const MessageObject = Schema.Struct({
16096 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
16097 "object": Schema.Literal("thread.message").annotate({
16098 "description": "The object type, which is always `thread.message`."
16099 }),
16100 "created_at": Schema.Number.annotate({
16101 "description": "The Unix timestamp (in seconds) for when the message was created.",
16102 "format": "unixtime"
16103 }).check(Schema.isInt()),
16104 "thread_id": Schema.String.annotate({
16105 "description": "The [thread](/docs/api-reference/threads) ID that this message belongs to."
16106 }),
16107 "status": Schema.Literals(["in_progress", "incomplete", "completed"]).annotate({
16108 "description": "The status of the message, which can be either `in_progress`, `incomplete`, or `completed`."
16109 }),
16110 "incomplete_details": Schema.Union([
16111 Schema.Struct({
16112 "reason": Schema.Literals(["content_filter", "max_tokens", "run_cancelled", "run_expired", "run_failed"])
16113 .annotate({ "description": "The reason the message is incomplete." })
16114 }).annotate({ "description": "On an incomplete message, details about why the message is incomplete." }),
16115 Schema.Null
16116 ]),
16117 "completed_at": Schema.Union([
16118 Schema.Number.annotate({
16119 "description": "The Unix timestamp (in seconds) for when the message was completed.",
16120 "format": "unixtime"
16121 }).check(Schema.isInt()),
16122 Schema.Null
16123 ]),
16124 "incomplete_at": Schema.Union([
16125 Schema.Number.annotate({
16126 "description": "The Unix timestamp (in seconds) for when the message was marked as incomplete.",
16127 "format": "unixtime"
16128 }).check(Schema.isInt()),
16129 Schema.Null
16130 ]),
16131 "role": Schema.Literals(["user", "assistant"]).annotate({
16132 "description": "The entity that produced the message. One of `user` or `assistant`."
16133 }),
16134 "content": Schema.Array(
16135 Schema.Union([
16136 MessageContentImageFileObject,
16137 MessageContentImageUrlObject,
16138 MessageContentTextObject,
16139 MessageContentRefusalObject
16140 ], { mode: "oneOf" })
16141 ).annotate({ "description": "The content of the message in array of text and/or images." }),
16142 "assistant_id": Schema.Union([
16143 Schema.String.annotate({
16144 "description":
16145 "If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message."
16146 }),
16147 Schema.Null
16148 ]),
16149 "run_id": Schema.Union([
16150 Schema.String.annotate({
16151 "description":
16152 "The ID of the [run](/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints."
16153 }),
16154 Schema.Null
16155 ]),
16156 "attachments": Schema.Union([
16157 Schema.Array(Schema.Struct({
16158 "file_id": Schema.optionalKey(
16159 Schema.String.annotate({ "description": "The ID of the file to attach to the message." })
16160 ),
16161 "tools": Schema.optionalKey(
16162 Schema.Array(Schema.Union([AssistantToolsCode, AssistantToolsFileSearchTypeOnly], { mode: "oneOf" })).annotate({
16163 "description": "The tools to add this file to."
16164 })
16165 )
16166 })).annotate({ "description": "A list of files attached to the message, and the tools they were added to." }),
16167 Schema.Null
16168 ]),
16169 "metadata": Metadata
16170}).annotate({
16171 "title": "The message object",
16172 "description": "Represents a message within a [thread](/docs/api-reference/threads)."
16173})
16174export type MessageDeltaObject = {
16175 readonly "id": string
16176 readonly "object": "thread.message.delta"
16177 readonly "delta": {
16178 readonly "role"?: "user" | "assistant"
16179 readonly "content"?: ReadonlyArray<
16180 | MessageDeltaContentImageFileObject
16181 | MessageDeltaContentTextObject
16182 | MessageDeltaContentRefusalObject
16183 | MessageDeltaContentImageUrlObject
16184 >
16185 }
16186}
16187export const MessageDeltaObject = Schema.Struct({
16188 "id": Schema.String.annotate({
16189 "description": "The identifier of the message, which can be referenced in API endpoints."
16190 }),
16191 "object": Schema.Literal("thread.message.delta").annotate({
16192 "description": "The object type, which is always `thread.message.delta`."
16193 }),
16194 "delta": Schema.Struct({
16195 "role": Schema.optionalKey(
16196 Schema.Literals(["user", "assistant"]).annotate({
16197 "description": "The entity that produced the message. One of `user` or `assistant`."
16198 })
16199 ),
16200 "content": Schema.optionalKey(
16201 Schema.Array(
16202 Schema.Union([
16203 MessageDeltaContentImageFileObject,
16204 MessageDeltaContentTextObject,
16205 MessageDeltaContentRefusalObject,
16206 MessageDeltaContentImageUrlObject
16207 ], { mode: "oneOf" })
16208 ).annotate({ "description": "The content of the message in array of text and/or images." })
16209 )
16210 }).annotate({ "description": "The delta containing the fields that have changed on the Message." })
16211}).annotate({
16212 "title": "Message delta object",
16213 "description": "Represents a message delta i.e. any changed fields on a message during streaming.\n"
16214})
16215export type ListBatchesResponse = {
16216 readonly "data": ReadonlyArray<Batch>
16217 readonly "first_id"?: string
16218 readonly "last_id"?: string
16219 readonly "has_more": boolean
16220 readonly "object": "list"
16221}
16222export const ListBatchesResponse = Schema.Struct({
16223 "data": Schema.Array(Batch),
16224 "first_id": Schema.optionalKey(Schema.String),
16225 "last_id": Schema.optionalKey(Schema.String),
16226 "has_more": Schema.Boolean,
16227 "object": Schema.Literal("list")
16228})
16229export type CreateThreadRequest = {
16230 readonly "messages"?: ReadonlyArray<CreateMessageRequest>
16231 readonly "tool_resources"?: {
16232 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
16233 readonly "file_search"?: {
16234 readonly "vector_store_ids": ReadonlyArray<string>
16235 readonly "vector_stores"?: ReadonlyArray<
16236 {
16237 readonly "file_ids"?: ReadonlyArray<string>
16238 readonly "chunking_strategy"?: { readonly "type": "auto" } | {
16239 readonly "type": "static"
16240 readonly "static": { readonly "max_chunk_size_tokens": number; readonly "chunk_overlap_tokens": number }
16241 }
16242 readonly "metadata"?: Metadata
16243 }
16244 >
16245 } | {
16246 readonly "vector_stores": ReadonlyArray<
16247 {
16248 readonly "file_ids"?: ReadonlyArray<string>
16249 readonly "chunking_strategy"?: { readonly "type": "auto" } | {
16250 readonly "type": "static"
16251 readonly "static": { readonly "max_chunk_size_tokens": number; readonly "chunk_overlap_tokens": number }
16252 }
16253 readonly "metadata"?: Metadata
16254 }
16255 >
16256 readonly "vector_store_ids"?: ReadonlyArray<string>
16257 }
16258 } | null
16259 readonly "metadata"?: Metadata
16260}
16261export const CreateThreadRequest = Schema.Struct({
16262 "messages": Schema.optionalKey(
16263 Schema.Array(CreateMessageRequest).annotate({
16264 "description": "A list of [messages](/docs/api-reference/messages) to start the thread with."
16265 })
16266 ),
16267 "tool_resources": Schema.optionalKey(Schema.Union([
16268 Schema.Struct({
16269 "code_interpreter": Schema.optionalKey(Schema.Struct({
16270 "file_ids": Schema.optionalKey(
16271 Schema.Array(Schema.String).annotate({
16272 "description":
16273 "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"
16274 }).check(Schema.isMaxLength(20))
16275 )
16276 })),
16277 "file_search": Schema.optionalKey(Schema.Union([
16278 Schema.Struct({
16279 "vector_store_ids": Schema.Array(Schema.String).annotate({
16280 "description":
16281 "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"
16282 }).check(Schema.isMaxLength(1)),
16283 "vector_stores": Schema.optionalKey(
16284 Schema.Array(Schema.Struct({
16285 "file_ids": Schema.optionalKey(
16286 Schema.Array(Schema.String).annotate({
16287 "description":
16288 "A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n"
16289 }).check(Schema.isMaxLength(100000000))
16290 ),
16291 "chunking_strategy": Schema.optionalKey(
16292 Schema.Union([
16293 Schema.Struct({ "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }) })
16294 .annotate({
16295 "title": "Auto Chunking Strategy",
16296 "description":
16297 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
16298 }),
16299 Schema.Struct({
16300 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
16301 "static": Schema.Struct({
16302 "max_chunk_size_tokens": Schema.Number.annotate({
16303 "description":
16304 "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."
16305 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(100)).check(
16306 Schema.isLessThanOrEqualTo(4096)
16307 ),
16308 "chunk_overlap_tokens": Schema.Number.annotate({
16309 "description":
16310 "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"
16311 }).check(Schema.isInt())
16312 })
16313 }).annotate({
16314 "title": "Static Chunking Strategy",
16315 "description":
16316 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
16317 })
16318 ], { mode: "oneOf" })
16319 ),
16320 "metadata": Schema.optionalKey(Metadata)
16321 })).annotate({
16322 "description":
16323 "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n"
16324 }).check(Schema.isMaxLength(1))
16325 )
16326 }),
16327 Schema.Struct({
16328 "vector_stores": Schema.Array(Schema.Struct({
16329 "file_ids": Schema.optionalKey(
16330 Schema.Array(Schema.String).annotate({
16331 "description":
16332 "A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n"
16333 }).check(Schema.isMaxLength(100000000))
16334 ),
16335 "chunking_strategy": Schema.optionalKey(
16336 Schema.Union([
16337 Schema.Struct({ "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }) })
16338 .annotate({
16339 "title": "Auto Chunking Strategy",
16340 "description":
16341 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
16342 }),
16343 Schema.Struct({
16344 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
16345 "static": Schema.Struct({
16346 "max_chunk_size_tokens": Schema.Number.annotate({
16347 "description":
16348 "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."
16349 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(100)).check(
16350 Schema.isLessThanOrEqualTo(4096)
16351 ),
16352 "chunk_overlap_tokens": Schema.Number.annotate({
16353 "description":
16354 "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"
16355 }).check(Schema.isInt())
16356 })
16357 }).annotate({
16358 "title": "Static Chunking Strategy",
16359 "description":
16360 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
16361 })
16362 ], { mode: "oneOf" })
16363 ),
16364 "metadata": Schema.optionalKey(Metadata)
16365 })).annotate({
16366 "description":
16367 "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.\n"
16368 }).check(Schema.isMaxLength(1)),
16369 "vector_store_ids": Schema.optionalKey(
16370 Schema.Array(Schema.String).annotate({
16371 "description":
16372 "The [vector store](/docs/api-reference/vector-stores/object) attached to this thread. There can be a maximum of 1 vector store attached to the thread.\n"
16373 }).check(Schema.isMaxLength(1))
16374 )
16375 })
16376 ], { mode: "oneOf" }))
16377 }).annotate({
16378 "description":
16379 "A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
16380 }),
16381 Schema.Null
16382 ])),
16383 "metadata": Schema.optionalKey(Metadata)
16384}).annotate({
16385 "description":
16386 "Options to create a new thread. If no thread is provided when running a\nrequest, an empty thread will be created.\n"
16387})
16388export type ThreadStreamEvent = {
16389 readonly "enabled"?: boolean
16390 readonly "event": "thread.created"
16391 readonly "data": ThreadObject
16392}
16393export const ThreadStreamEvent = Schema.Union([
16394 Schema.Struct({
16395 "enabled": Schema.optionalKey(
16396 Schema.Boolean.annotate({ "description": "Whether to enable input audio transcription." })
16397 ),
16398 "event": Schema.Literal("thread.created"),
16399 "data": ThreadObject
16400 }).annotate({ "description": "Occurs when a new [thread](/docs/api-reference/threads/object) is created." })
16401], { mode: "oneOf" })
16402export type ModelIdsCompaction = ModelIdsResponses | string | null
16403export const ModelIdsCompaction = Schema.Union([ModelIdsResponses, Schema.String, Schema.Null]).annotate({
16404 "description":
16405 "Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/docs/models) to browse and compare available models."
16406})
16407export type RealtimeTranslationClientSecretCreateResponse = {
16408 readonly "value": string
16409 readonly "expires_at": number
16410 readonly "session": RealtimeTranslationSession
16411}
16412export const RealtimeTranslationClientSecretCreateResponse = Schema.Struct({
16413 "value": Schema.String.annotate({ "description": "The generated client secret value." }),
16414 "expires_at": Schema.Number.annotate({
16415 "description": "Expiration timestamp for the client secret, in seconds since epoch.",
16416 "format": "unixtime"
16417 }).check(Schema.isInt()),
16418 "session": RealtimeTranslationSession
16419}).annotate({
16420 "title": "Realtime translation session and client secret",
16421 "description": "Response from creating a translation session and client secret for the Realtime API.\n"
16422})
16423export type RealtimeTranslationClientSecretCreateRequest = {
16424 readonly "expires_after"?: { readonly "anchor"?: "created_at"; readonly "seconds"?: number }
16425 readonly "session": RealtimeTranslationSessionCreateRequest
16426}
16427export const RealtimeTranslationClientSecretCreateRequest = Schema.Struct({
16428 "expires_after": Schema.optionalKey(
16429 Schema.Struct({
16430 "anchor": Schema.optionalKey(
16431 Schema.Literal("created_at").annotate({
16432 "description":
16433 "The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.\n"
16434 })
16435 ),
16436 "seconds": Schema.optionalKey(
16437 Schema.Number.annotate({
16438 "description":
16439 "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.\n",
16440 "format": "int64"
16441 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(10)).check(Schema.isLessThanOrEqualTo(7200))
16442 )
16443 }).annotate({
16444 "title": "Client secret expiration",
16445 "description":
16446 "Configuration for the client secret expiration. Expiration refers to the time after which\na client secret will no longer be valid for creating sessions. The session itself may\ncontinue after that time once started. A secret can be used to create multiple sessions\nuntil it expires.\n"
16447 })
16448 ),
16449 "session": RealtimeTranslationSessionCreateRequest
16450}).annotate({
16451 "title": "Realtime translation client secret creation request",
16452 "description": "Create a translation session and client secret for the Realtime API.\n"
16453})
16454export type ProjectApiKeyListResponse = {
16455 readonly "object": "list"
16456 readonly "data": ReadonlyArray<ProjectApiKey>
16457 readonly "first_id"?: string | null
16458 readonly "last_id"?: string | null
16459 readonly "has_more": boolean
16460}
16461export const ProjectApiKeyListResponse = Schema.Struct({
16462 "object": Schema.Literal("list"),
16463 "data": Schema.Array(ProjectApiKey),
16464 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
16465 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
16466 "has_more": Schema.Boolean
16467})
16468export type RealtimeConversationItem =
16469 | RealtimeConversationItemMessageSystem
16470 | RealtimeConversationItemMessageUser
16471 | RealtimeConversationItemMessageAssistant
16472 | RealtimeConversationItemFunctionCall
16473 | RealtimeConversationItemFunctionCallOutput
16474 | RealtimeMCPApprovalResponse
16475 | RealtimeMCPListTools
16476 | RealtimeMCPToolCall
16477 | RealtimeMCPApprovalRequest
16478export const RealtimeConversationItem = Schema.Union([
16479 RealtimeConversationItemMessageSystem,
16480 RealtimeConversationItemMessageUser,
16481 RealtimeConversationItemMessageAssistant,
16482 RealtimeConversationItemFunctionCall,
16483 RealtimeConversationItemFunctionCallOutput,
16484 RealtimeMCPApprovalResponse,
16485 RealtimeMCPListTools,
16486 RealtimeMCPToolCall,
16487 RealtimeMCPApprovalRequest
16488]).annotate({ "description": "A single item within a Realtime conversation." })
16489export type AssistantsApiResponseFormatOption =
16490 | "auto"
16491 | ResponseFormatText
16492 | ResponseFormatJsonObject
16493 | ResponseFormatJsonSchema
16494export const AssistantsApiResponseFormatOption = Schema.Union([
16495 Schema.Literal("auto").annotate({ "description": "`auto` is the default value\n" }),
16496 ResponseFormatText,
16497 ResponseFormatJsonObject,
16498 ResponseFormatJsonSchema
16499], { mode: "oneOf" }).annotate({
16500 "description":
16501 "Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.\n\n**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.\n"
16502})
16503export type TextResponseFormatConfiguration =
16504 | ResponseFormatText
16505 | TextResponseFormatJsonSchema
16506 | ResponseFormatJsonObject
16507export const TextResponseFormatConfiguration = Schema.Union([
16508 ResponseFormatText,
16509 TextResponseFormatJsonSchema,
16510 ResponseFormatJsonObject
16511], { mode: "oneOf" }).annotate({
16512 "description":
16513 "An object specifying the format that the model must output.\n\nConfiguring `{ \"type\": \"json_schema\" }` enables Structured Outputs, \nwhich ensures the model will match your supplied JSON schema. Learn more in the \n[Structured Outputs guide](/docs/guides/structured-outputs).\n\nThe default format is `{ \"type\": \"text\" }` with no additional options.\n\n**Not recommended for gpt-4o and newer models:**\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"
16514})
16515export type RealtimeCallCreateRequest = {
16516 readonly "sdp": string
16517 readonly "session"?: {
16518 readonly "type": "realtime"
16519 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
16520 readonly "model"?:
16521 | string
16522 | "gpt-realtime"
16523 | "gpt-realtime-1.5"
16524 | "gpt-realtime-2"
16525 | "gpt-realtime-2025-08-28"
16526 | "gpt-4o-realtime-preview"
16527 | "gpt-4o-realtime-preview-2024-10-01"
16528 | "gpt-4o-realtime-preview-2024-12-17"
16529 | "gpt-4o-realtime-preview-2025-06-03"
16530 | "gpt-4o-mini-realtime-preview"
16531 | "gpt-4o-mini-realtime-preview-2024-12-17"
16532 | "gpt-realtime-mini"
16533 | "gpt-realtime-mini-2025-10-06"
16534 | "gpt-realtime-mini-2025-12-15"
16535 | "gpt-audio-1.5"
16536 | "gpt-audio-mini"
16537 | "gpt-audio-mini-2025-10-06"
16538 | "gpt-audio-mini-2025-12-15"
16539 readonly "instructions"?: string
16540 readonly "audio"?: {
16541 readonly "input"?: {
16542 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
16543 readonly "type"?: "audio/pcmu"
16544 } | { readonly "type"?: "audio/pcma" }
16545 readonly "transcription"?: {
16546 readonly "model"?:
16547 | string
16548 | "whisper-1"
16549 | "gpt-4o-mini-transcribe"
16550 | "gpt-4o-mini-transcribe-2025-12-15"
16551 | "gpt-4o-transcribe"
16552 | "gpt-4o-transcribe-diarize"
16553 | "gpt-realtime-whisper"
16554 readonly "language"?: string
16555 readonly "prompt"?: string
16556 readonly "delay"?: "minimal" | "low" | "medium" | "high" | "xhigh"
16557 }
16558 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
16559 readonly "turn_detection"?: RealtimeTurnDetection
16560 }
16561 readonly "output"?: {
16562 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
16563 readonly "type"?: "audio/pcmu"
16564 } | { readonly "type"?: "audio/pcma" }
16565 readonly "voice"?: VoiceIdsShared | { readonly "id": string }
16566 readonly "speed"?: number
16567 }
16568 }
16569 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
16570 readonly "tracing"?: "auto" | {
16571 readonly "workflow_name"?: string
16572 readonly "group_id"?: string
16573 readonly "metadata"?: {}
16574 } | null
16575 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool | MCPTool>
16576 readonly "tool_choice"?: ToolChoiceOptions | ToolChoiceFunction | ToolChoiceMCP
16577 readonly "parallel_tool_calls"?: boolean
16578 readonly "reasoning"?: RealtimeReasoning
16579 readonly "max_output_tokens"?: number | "inf"
16580 readonly "truncation"?: RealtimeTruncation
16581 readonly "prompt"?: Prompt
16582 }
16583}
16584export const RealtimeCallCreateRequest = Schema.Struct({
16585 "sdp": Schema.String.annotate({
16586 "description": "WebRTC Session Description Protocol (SDP) offer generated by the caller."
16587 }),
16588 "session": Schema.optionalKey(
16589 Schema.Struct({
16590 "type": Schema.Literal("realtime").annotate({
16591 "description": "The type of session to create. Always `realtime` for the Realtime API.\n"
16592 }),
16593 "output_modalities": Schema.optionalKey(
16594 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
16595 "description":
16596 "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n"
16597 })
16598 ),
16599 "model": Schema.optionalKey(
16600 Schema.Union([
16601 Schema.String,
16602 Schema.Literals([
16603 "gpt-realtime",
16604 "gpt-realtime-1.5",
16605 "gpt-realtime-2",
16606 "gpt-realtime-2025-08-28",
16607 "gpt-4o-realtime-preview",
16608 "gpt-4o-realtime-preview-2024-10-01",
16609 "gpt-4o-realtime-preview-2024-12-17",
16610 "gpt-4o-realtime-preview-2025-06-03",
16611 "gpt-4o-mini-realtime-preview",
16612 "gpt-4o-mini-realtime-preview-2024-12-17",
16613 "gpt-realtime-mini",
16614 "gpt-realtime-mini-2025-10-06",
16615 "gpt-realtime-mini-2025-12-15",
16616 "gpt-audio-1.5",
16617 "gpt-audio-mini",
16618 "gpt-audio-mini-2025-10-06",
16619 "gpt-audio-mini-2025-12-15"
16620 ])
16621 ]).annotate({ "description": "The Realtime model used for this session.\n" })
16622 ),
16623 "instructions": Schema.optionalKey(Schema.String.annotate({
16624 "description":
16625 "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"
16626 })),
16627 "audio": Schema.optionalKey(
16628 Schema.Struct({
16629 "input": Schema.optionalKey(Schema.Struct({
16630 "format": Schema.optionalKey(
16631 Schema.Union([
16632 Schema.Struct({
16633 "type": Schema.optionalKey(
16634 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
16635 ),
16636 "rate": Schema.optionalKey(
16637 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
16638 )
16639 }).annotate({
16640 "title": "PCM audio format",
16641 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
16642 }),
16643 Schema.Struct({
16644 "type": Schema.optionalKey(
16645 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
16646 )
16647 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
16648 Schema.Struct({
16649 "type": Schema.optionalKey(
16650 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
16651 )
16652 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
16653 ]).annotate({ "description": "The format of the input audio." })
16654 ),
16655 "transcription": Schema.optionalKey(
16656 Schema.Struct({
16657 "model": Schema.optionalKey(
16658 Schema.Union([
16659 Schema.String,
16660 Schema.Literals([
16661 "whisper-1",
16662 "gpt-4o-mini-transcribe",
16663 "gpt-4o-mini-transcribe-2025-12-15",
16664 "gpt-4o-transcribe",
16665 "gpt-4o-transcribe-diarize",
16666 "gpt-realtime-whisper"
16667 ])
16668 ]).annotate({
16669 "description":
16670 "The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n"
16671 })
16672 ),
16673 "language": Schema.optionalKey(
16674 Schema.String.annotate({
16675 "description":
16676 "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"
16677 })
16678 ),
16679 "prompt": Schema.optionalKey(Schema.String.annotate({
16680 "description":
16681 "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
16682 })),
16683 "delay": Schema.optionalKey(
16684 Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
16685 "description":
16686 "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
16687 })
16688 )
16689 }).annotate({
16690 "description":
16691 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
16692 })
16693 ),
16694 "noise_reduction": Schema.optionalKey(
16695 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
16696 "description":
16697 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
16698 })
16699 ),
16700 "turn_detection": Schema.optionalKey(RealtimeTurnDetection)
16701 })),
16702 "output": Schema.optionalKey(Schema.Struct({
16703 "format": Schema.optionalKey(
16704 Schema.Union([
16705 Schema.Struct({
16706 "type": Schema.optionalKey(
16707 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
16708 ),
16709 "rate": Schema.optionalKey(
16710 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
16711 )
16712 }).annotate({
16713 "title": "PCM audio format",
16714 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
16715 }),
16716 Schema.Struct({
16717 "type": Schema.optionalKey(
16718 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
16719 )
16720 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
16721 Schema.Struct({
16722 "type": Schema.optionalKey(
16723 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
16724 )
16725 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
16726 ]).annotate({ "description": "The format of the output audio." })
16727 ),
16728 "voice": Schema.optionalKey(
16729 Schema.Union([
16730 VoiceIdsShared,
16731 Schema.Struct({
16732 "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." })
16733 }).annotate({ "description": "Custom voice reference." })
16734 ]).annotate({
16735 "title": "Voice",
16736 "description":
16737 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nWe recommend `marin` and `cedar` for best quality.\n"
16738 })
16739 ),
16740 "speed": Schema.optionalKey(
16741 Schema.Number.annotate({
16742 "description":
16743 "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n"
16744 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(
16745 Schema.isLessThanOrEqualTo(1.5)
16746 )
16747 )
16748 }))
16749 }).annotate({ "description": "Configuration for input and output audio.\n" })
16750 ),
16751 "include": Schema.optionalKey(
16752 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
16753 "description":
16754 "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
16755 })
16756 ),
16757 "tracing": Schema.optionalKey(
16758 Schema.Union([
16759 Schema.Union([
16760 Schema.Literal("auto").annotate({
16761 "title": "auto",
16762 "description":
16763 "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n"
16764 }),
16765 Schema.Struct({
16766 "workflow_name": Schema.optionalKey(
16767 Schema.String.annotate({
16768 "description":
16769 "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n"
16770 })
16771 ),
16772 "group_id": Schema.optionalKey(
16773 Schema.String.annotate({
16774 "description":
16775 "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n"
16776 })
16777 ),
16778 "metadata": Schema.optionalKey(
16779 Schema.Struct({}).annotate({
16780 "description":
16781 "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n"
16782 })
16783 )
16784 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
16785 ], { mode: "oneOf" }).annotate({
16786 "title": "Tracing Configuration",
16787 "description":
16788 "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
16789 }),
16790 Schema.Null
16791 ])
16792 ),
16793 "tools": Schema.optionalKey(
16794 Schema.Array(Schema.Union([RealtimeFunctionTool, MCPTool], { mode: "oneOf" })).annotate({
16795 "description": "Tools available to the model."
16796 })
16797 ),
16798 "tool_choice": Schema.optionalKey(
16799 Schema.Union([ToolChoiceOptions, ToolChoiceFunction, ToolChoiceMCP], { mode: "oneOf" }).annotate({
16800 "description":
16801 "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n"
16802 })
16803 ),
16804 "parallel_tool_calls": Schema.optionalKey(
16805 Schema.Boolean.annotate({
16806 "description":
16807 "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n"
16808 })
16809 ),
16810 "reasoning": Schema.optionalKey(RealtimeReasoning),
16811 "max_output_tokens": Schema.optionalKey(
16812 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
16813 "description":
16814 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
16815 })
16816 ),
16817 "truncation": Schema.optionalKey(RealtimeTruncation),
16818 "prompt": Schema.optionalKey(Prompt)
16819 }).annotate({ "title": "Realtime session configuration", "description": "Realtime session object configuration." })
16820 )
16821}).annotate({
16822 "title": "Realtime call creation request",
16823 "description":
16824 "Parameters required to initiate a realtime call and receive the SDP answer\nneeded to complete a WebRTC peer connection. Provide an SDP offer generated\nby your client and optionally configure the session that will answer the call."
16825})
16826export type RealtimeClientEventSessionUpdate = {
16827 readonly "event_id"?: string
16828 readonly "type": "session.update"
16829 readonly "session": {
16830 readonly "type": "realtime"
16831 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
16832 readonly "model"?:
16833 | string
16834 | "gpt-realtime"
16835 | "gpt-realtime-1.5"
16836 | "gpt-realtime-2"
16837 | "gpt-realtime-2025-08-28"
16838 | "gpt-4o-realtime-preview"
16839 | "gpt-4o-realtime-preview-2024-10-01"
16840 | "gpt-4o-realtime-preview-2024-12-17"
16841 | "gpt-4o-realtime-preview-2025-06-03"
16842 | "gpt-4o-mini-realtime-preview"
16843 | "gpt-4o-mini-realtime-preview-2024-12-17"
16844 | "gpt-realtime-mini"
16845 | "gpt-realtime-mini-2025-10-06"
16846 | "gpt-realtime-mini-2025-12-15"
16847 | "gpt-audio-1.5"
16848 | "gpt-audio-mini"
16849 | "gpt-audio-mini-2025-10-06"
16850 | "gpt-audio-mini-2025-12-15"
16851 readonly "instructions"?: string
16852 readonly "audio"?: {
16853 readonly "input"?: {
16854 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
16855 readonly "type"?: "audio/pcmu"
16856 } | { readonly "type"?: "audio/pcma" }
16857 readonly "transcription"?: {
16858 readonly "model"?:
16859 | string
16860 | "whisper-1"
16861 | "gpt-4o-mini-transcribe"
16862 | "gpt-4o-mini-transcribe-2025-12-15"
16863 | "gpt-4o-transcribe"
16864 | "gpt-4o-transcribe-diarize"
16865 | "gpt-realtime-whisper"
16866 readonly "language"?: string
16867 readonly "prompt"?: string
16868 readonly "delay"?: "minimal" | "low" | "medium" | "high" | "xhigh"
16869 }
16870 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
16871 readonly "turn_detection"?: RealtimeTurnDetection
16872 }
16873 readonly "output"?: {
16874 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
16875 readonly "type"?: "audio/pcmu"
16876 } | { readonly "type"?: "audio/pcma" }
16877 readonly "voice"?: VoiceIdsShared | { readonly "id": string }
16878 readonly "speed"?: number
16879 }
16880 }
16881 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
16882 readonly "tracing"?: "auto" | {
16883 readonly "workflow_name"?: string
16884 readonly "group_id"?: string
16885 readonly "metadata"?: {}
16886 } | null
16887 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool | MCPTool>
16888 readonly "tool_choice"?: ToolChoiceOptions | ToolChoiceFunction | ToolChoiceMCP
16889 readonly "parallel_tool_calls"?: boolean
16890 readonly "reasoning"?: RealtimeReasoning
16891 readonly "max_output_tokens"?: number | "inf"
16892 readonly "truncation"?: RealtimeTruncation
16893 readonly "prompt"?: Prompt
16894 } | {
16895 readonly "type": "transcription"
16896 readonly "audio"?: {
16897 readonly "input"?: {
16898 readonly "format"?: RealtimeAudioFormats
16899 readonly "transcription"?: {
16900 readonly "model"?:
16901 | string
16902 | "whisper-1"
16903 | "gpt-4o-mini-transcribe"
16904 | "gpt-4o-mini-transcribe-2025-12-15"
16905 | "gpt-4o-transcribe"
16906 | "gpt-4o-transcribe-diarize"
16907 | "gpt-realtime-whisper"
16908 readonly "language"?: string
16909 readonly "prompt"?: string
16910 readonly "delay"?: "minimal" | "low" | "medium" | "high" | "xhigh"
16911 }
16912 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
16913 readonly "turn_detection"?: RealtimeTurnDetection
16914 }
16915 }
16916 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
16917 }
16918}
16919export const RealtimeClientEventSessionUpdate = Schema.Struct({
16920 "event_id": Schema.optionalKey(
16921 Schema.String.annotate({
16922 "description":
16923 "Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it."
16924 }).check(Schema.isMaxLength(512))
16925 ),
16926 "type": Schema.Literal("session.update").annotate({ "description": "The event type, must be `session.update`." }),
16927 "session": Schema.Union([
16928 Schema.Struct({
16929 "type": Schema.Literal("realtime").annotate({
16930 "description": "The type of session to create. Always `realtime` for the Realtime API.\n"
16931 }),
16932 "output_modalities": Schema.optionalKey(
16933 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
16934 "description":
16935 "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n"
16936 })
16937 ),
16938 "model": Schema.optionalKey(
16939 Schema.Union([
16940 Schema.String,
16941 Schema.Literals([
16942 "gpt-realtime",
16943 "gpt-realtime-1.5",
16944 "gpt-realtime-2",
16945 "gpt-realtime-2025-08-28",
16946 "gpt-4o-realtime-preview",
16947 "gpt-4o-realtime-preview-2024-10-01",
16948 "gpt-4o-realtime-preview-2024-12-17",
16949 "gpt-4o-realtime-preview-2025-06-03",
16950 "gpt-4o-mini-realtime-preview",
16951 "gpt-4o-mini-realtime-preview-2024-12-17",
16952 "gpt-realtime-mini",
16953 "gpt-realtime-mini-2025-10-06",
16954 "gpt-realtime-mini-2025-12-15",
16955 "gpt-audio-1.5",
16956 "gpt-audio-mini",
16957 "gpt-audio-mini-2025-10-06",
16958 "gpt-audio-mini-2025-12-15"
16959 ])
16960 ]).annotate({ "description": "The Realtime model used for this session.\n" })
16961 ),
16962 "instructions": Schema.optionalKey(Schema.String.annotate({
16963 "description":
16964 "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"
16965 })),
16966 "audio": Schema.optionalKey(
16967 Schema.Struct({
16968 "input": Schema.optionalKey(Schema.Struct({
16969 "format": Schema.optionalKey(
16970 Schema.Union([
16971 Schema.Struct({
16972 "type": Schema.optionalKey(
16973 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
16974 ),
16975 "rate": Schema.optionalKey(
16976 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
16977 )
16978 }).annotate({
16979 "title": "PCM audio format",
16980 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
16981 }),
16982 Schema.Struct({
16983 "type": Schema.optionalKey(
16984 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
16985 )
16986 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
16987 Schema.Struct({
16988 "type": Schema.optionalKey(
16989 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
16990 )
16991 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
16992 ]).annotate({ "description": "The format of the input audio." })
16993 ),
16994 "transcription": Schema.optionalKey(
16995 Schema.Struct({
16996 "model": Schema.optionalKey(
16997 Schema.Union([
16998 Schema.String,
16999 Schema.Literals([
17000 "whisper-1",
17001 "gpt-4o-mini-transcribe",
17002 "gpt-4o-mini-transcribe-2025-12-15",
17003 "gpt-4o-transcribe",
17004 "gpt-4o-transcribe-diarize",
17005 "gpt-realtime-whisper"
17006 ])
17007 ]).annotate({
17008 "description":
17009 "The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n"
17010 })
17011 ),
17012 "language": Schema.optionalKey(
17013 Schema.String.annotate({
17014 "description":
17015 "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"
17016 })
17017 ),
17018 "prompt": Schema.optionalKey(Schema.String.annotate({
17019 "description":
17020 "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
17021 })),
17022 "delay": Schema.optionalKey(
17023 Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
17024 "description":
17025 "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
17026 })
17027 )
17028 }).annotate({
17029 "description":
17030 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
17031 })
17032 ),
17033 "noise_reduction": Schema.optionalKey(
17034 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
17035 "description":
17036 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
17037 })
17038 ),
17039 "turn_detection": Schema.optionalKey(RealtimeTurnDetection)
17040 })),
17041 "output": Schema.optionalKey(Schema.Struct({
17042 "format": Schema.optionalKey(
17043 Schema.Union([
17044 Schema.Struct({
17045 "type": Schema.optionalKey(
17046 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
17047 ),
17048 "rate": Schema.optionalKey(
17049 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
17050 )
17051 }).annotate({
17052 "title": "PCM audio format",
17053 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
17054 }),
17055 Schema.Struct({
17056 "type": Schema.optionalKey(
17057 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
17058 )
17059 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
17060 Schema.Struct({
17061 "type": Schema.optionalKey(
17062 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
17063 )
17064 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
17065 ]).annotate({ "description": "The format of the output audio." })
17066 ),
17067 "voice": Schema.optionalKey(
17068 Schema.Union([
17069 VoiceIdsShared,
17070 Schema.Struct({
17071 "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." })
17072 }).annotate({ "description": "Custom voice reference." })
17073 ]).annotate({
17074 "title": "Voice",
17075 "description":
17076 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nWe recommend `marin` and `cedar` for best quality.\n"
17077 })
17078 ),
17079 "speed": Schema.optionalKey(
17080 Schema.Number.annotate({
17081 "description":
17082 "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n"
17083 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(
17084 Schema.isLessThanOrEqualTo(1.5)
17085 )
17086 )
17087 }))
17088 }).annotate({ "description": "Configuration for input and output audio.\n" })
17089 ),
17090 "include": Schema.optionalKey(
17091 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
17092 "description":
17093 "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
17094 })
17095 ),
17096 "tracing": Schema.optionalKey(
17097 Schema.Union([
17098 Schema.Union([
17099 Schema.Literal("auto").annotate({
17100 "title": "auto",
17101 "description":
17102 "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n"
17103 }),
17104 Schema.Struct({
17105 "workflow_name": Schema.optionalKey(
17106 Schema.String.annotate({
17107 "description":
17108 "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n"
17109 })
17110 ),
17111 "group_id": Schema.optionalKey(
17112 Schema.String.annotate({
17113 "description":
17114 "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n"
17115 })
17116 ),
17117 "metadata": Schema.optionalKey(
17118 Schema.Struct({}).annotate({
17119 "description":
17120 "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n"
17121 })
17122 )
17123 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
17124 ], { mode: "oneOf" }).annotate({
17125 "title": "Tracing Configuration",
17126 "description":
17127 "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
17128 }),
17129 Schema.Null
17130 ])
17131 ),
17132 "tools": Schema.optionalKey(
17133 Schema.Array(Schema.Union([RealtimeFunctionTool, MCPTool], { mode: "oneOf" })).annotate({
17134 "description": "Tools available to the model."
17135 })
17136 ),
17137 "tool_choice": Schema.optionalKey(
17138 Schema.Union([ToolChoiceOptions, ToolChoiceFunction, ToolChoiceMCP], { mode: "oneOf" }).annotate({
17139 "description":
17140 "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n"
17141 })
17142 ),
17143 "parallel_tool_calls": Schema.optionalKey(
17144 Schema.Boolean.annotate({
17145 "description":
17146 "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n"
17147 })
17148 ),
17149 "reasoning": Schema.optionalKey(RealtimeReasoning),
17150 "max_output_tokens": Schema.optionalKey(
17151 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
17152 "description":
17153 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
17154 })
17155 ),
17156 "truncation": Schema.optionalKey(RealtimeTruncation),
17157 "prompt": Schema.optionalKey(Prompt)
17158 }).annotate({
17159 "title": "Realtime session configuration",
17160 "description": "Update the Realtime session. Choose either a realtime\nsession or a transcription session.\n"
17161 }),
17162 Schema.Struct({
17163 "type": Schema.Literal("transcription").annotate({
17164 "description": "The type of session to create. Always `transcription` for transcription sessions.\n"
17165 }),
17166 "audio": Schema.optionalKey(
17167 Schema.Struct({
17168 "input": Schema.optionalKey(Schema.Struct({
17169 "format": Schema.optionalKey(RealtimeAudioFormats),
17170 "transcription": Schema.optionalKey(
17171 Schema.Struct({
17172 "model": Schema.optionalKey(
17173 Schema.Union([
17174 Schema.String,
17175 Schema.Literals([
17176 "whisper-1",
17177 "gpt-4o-mini-transcribe",
17178 "gpt-4o-mini-transcribe-2025-12-15",
17179 "gpt-4o-transcribe",
17180 "gpt-4o-transcribe-diarize",
17181 "gpt-realtime-whisper"
17182 ])
17183 ]).annotate({
17184 "description":
17185 "The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n"
17186 })
17187 ),
17188 "language": Schema.optionalKey(
17189 Schema.String.annotate({
17190 "description":
17191 "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"
17192 })
17193 ),
17194 "prompt": Schema.optionalKey(Schema.String.annotate({
17195 "description":
17196 "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
17197 })),
17198 "delay": Schema.optionalKey(
17199 Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
17200 "description":
17201 "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
17202 })
17203 )
17204 }).annotate({
17205 "description":
17206 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
17207 })
17208 ),
17209 "noise_reduction": Schema.optionalKey(
17210 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
17211 "description":
17212 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
17213 })
17214 ),
17215 "turn_detection": Schema.optionalKey(RealtimeTurnDetection)
17216 }))
17217 }).annotate({ "description": "Configuration for input and output audio.\n" })
17218 ),
17219 "include": Schema.optionalKey(
17220 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
17221 "description":
17222 "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
17223 })
17224 )
17225 }).annotate({
17226 "title": "Realtime transcription session configuration",
17227 "description": "Update the Realtime session. Choose either a realtime\nsession or a transcription session.\n"
17228 })
17229 ], { mode: "oneOf" })
17230}).annotate({
17231 "description":
17232 "Send this event to update the session’s configuration.\nThe client may send this event at any time to update any field\nexcept for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet.\n\nWhen the server receives a `session.update`, it will respond\nwith a `session.updated` event showing the full, effective configuration.\nOnly the fields that are present in the `session.update` are updated. To clear a field like\n`instructions`, pass an empty string. To clear a field like `tools`, pass an empty array.\nTo clear a field like `turn_detection`, pass `null`.\n"
17233})
17234export type RealtimeSession = {
17235 readonly "id"?: string
17236 readonly "object"?: "realtime.session"
17237 readonly "modalities"?: ReadonlyArray<"text" | "audio">
17238 readonly "model"?:
17239 | string
17240 | "gpt-realtime"
17241 | "gpt-realtime-1.5"
17242 | "gpt-realtime-2025-08-28"
17243 | "gpt-4o-realtime-preview"
17244 | "gpt-4o-realtime-preview-2024-10-01"
17245 | "gpt-4o-realtime-preview-2024-12-17"
17246 | "gpt-4o-realtime-preview-2025-06-03"
17247 | "gpt-4o-mini-realtime-preview"
17248 | "gpt-4o-mini-realtime-preview-2024-12-17"
17249 | "gpt-realtime-mini"
17250 | "gpt-realtime-mini-2025-10-06"
17251 | "gpt-realtime-mini-2025-12-15"
17252 | "gpt-audio-1.5"
17253 | "gpt-audio-mini"
17254 | "gpt-audio-mini-2025-10-06"
17255 | "gpt-audio-mini-2025-12-15"
17256 readonly "instructions"?: string
17257 readonly "voice"?:
17258 | string
17259 | "alloy"
17260 | "ash"
17261 | "ballad"
17262 | "coral"
17263 | "echo"
17264 | "sage"
17265 | "shimmer"
17266 | "verse"
17267 | "marin"
17268 | "cedar"
17269 readonly "input_audio_format"?: "pcm16" | "g711_ulaw" | "g711_alaw"
17270 readonly "output_audio_format"?: "pcm16" | "g711_ulaw" | "g711_alaw"
17271 readonly "input_audio_transcription"?: {
17272 readonly "model"?:
17273 | string
17274 | "whisper-1"
17275 | "gpt-4o-mini-transcribe"
17276 | "gpt-4o-mini-transcribe-2025-12-15"
17277 | "gpt-4o-transcribe"
17278 | "gpt-4o-transcribe-diarize"
17279 | "gpt-realtime-whisper"
17280 readonly "language"?: string
17281 readonly "prompt"?: string
17282 } | null
17283 readonly "turn_detection"?: RealtimeTurnDetection
17284 readonly "input_audio_noise_reduction"?: { readonly "type"?: NoiseReductionType }
17285 readonly "speed"?: number
17286 readonly "tracing"?: "auto" | {
17287 readonly "workflow_name"?: string
17288 readonly "group_id"?: string
17289 readonly "metadata"?: {}
17290 } | null
17291 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool>
17292 readonly "tool_choice"?: string
17293 readonly "temperature"?: number
17294 readonly "max_response_output_tokens"?: number | "inf"
17295 readonly "expires_at"?: number
17296 readonly "prompt"?: Prompt | null
17297 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs"> | null
17298}
17299export const RealtimeSession = Schema.Struct({
17300 "id": Schema.optionalKey(
17301 Schema.String.annotate({
17302 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
17303 })
17304 ),
17305 "object": Schema.optionalKey(
17306 Schema.Literal("realtime.session").annotate({ "description": "The object type. Always `realtime.session`." })
17307 ),
17308 "modalities": Schema.optionalKey(
17309 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
17310 "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"
17311 })
17312 ),
17313 "model": Schema.optionalKey(
17314 Schema.Union([
17315 Schema.String,
17316 Schema.Literals([
17317 "gpt-realtime",
17318 "gpt-realtime-1.5",
17319 "gpt-realtime-2025-08-28",
17320 "gpt-4o-realtime-preview",
17321 "gpt-4o-realtime-preview-2024-10-01",
17322 "gpt-4o-realtime-preview-2024-12-17",
17323 "gpt-4o-realtime-preview-2025-06-03",
17324 "gpt-4o-mini-realtime-preview",
17325 "gpt-4o-mini-realtime-preview-2024-12-17",
17326 "gpt-realtime-mini",
17327 "gpt-realtime-mini-2025-10-06",
17328 "gpt-realtime-mini-2025-12-15",
17329 "gpt-audio-1.5",
17330 "gpt-audio-mini",
17331 "gpt-audio-mini-2025-10-06",
17332 "gpt-audio-mini-2025-12-15"
17333 ])
17334 ]).annotate({ "description": "The Realtime model used for this session.\n" })
17335 ),
17336 "instructions": Schema.optionalKey(Schema.String.annotate({
17337 "description":
17338 "The default system instructions (i.e. system message) prepended to model\ncalls. This field allows the client to guide the model on desired\nresponses. The model can be instructed on response content and format,\n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good\nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion\ninto your voice\", \"laugh frequently\"). The instructions are not\nguaranteed to be followed by the model, but they provide guidance to the\nmodel on the desired behavior.\n\n\nNote that the server sets default instructions which will be used if this\nfield is not set and are visible in the `session.created` event at the\nstart of the session.\n"
17339 })),
17340 "voice": Schema.optionalKey(
17341 Schema.Union([
17342 Schema.String,
17343 Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"])
17344 ]).annotate({
17345 "description":
17346 "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"
17347 })
17348 ),
17349 "input_audio_format": Schema.optionalKey(
17350 Schema.Literals(["pcm16", "g711_ulaw", "g711_alaw"]).annotate({
17351 "description":
17352 "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate,\nsingle channel (mono), and little-endian byte order.\n"
17353 })
17354 ),
17355 "output_audio_format": Schema.optionalKey(
17356 Schema.Literals(["pcm16", "g711_ulaw", "g711_alaw"]).annotate({
17357 "description":
17358 "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\nFor `pcm16`, output audio is sampled at a rate of 24kHz.\n"
17359 })
17360 ),
17361 "input_audio_transcription": Schema.optionalKey(Schema.Union([
17362 Schema.Struct({
17363 "model": Schema.optionalKey(
17364 Schema.Union([
17365 Schema.String,
17366 Schema.Literals([
17367 "whisper-1",
17368 "gpt-4o-mini-transcribe",
17369 "gpt-4o-mini-transcribe-2025-12-15",
17370 "gpt-4o-transcribe",
17371 "gpt-4o-transcribe-diarize",
17372 "gpt-realtime-whisper"
17373 ])
17374 ]).annotate({
17375 "description":
17376 "The model used for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n"
17377 })
17378 ),
17379 "language": Schema.optionalKey(Schema.String.annotate({ "description": "The language of the input audio.\n" })),
17380 "prompt": Schema.optionalKey(
17381 Schema.String.annotate({
17382 "description": "The prompt configured for input audio transcription, when present.\n"
17383 })
17384 )
17385 }).annotate({
17386 "description":
17387 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
17388 }),
17389 Schema.Null
17390 ])),
17391 "turn_detection": Schema.optionalKey(RealtimeTurnDetection),
17392 "input_audio_noise_reduction": Schema.optionalKey(
17393 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
17394 "description":
17395 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
17396 })
17397 ),
17398 "speed": Schema.optionalKey(
17399 Schema.Number.annotate({
17400 "description":
17401 "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n"
17402 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(1.5))
17403 ),
17404 "tracing": Schema.optionalKey(
17405 Schema.Union([
17406 Schema.Union([
17407 Schema.Literal("auto").annotate({ "description": "Default tracing mode for the session.\n" }),
17408 Schema.Struct({
17409 "workflow_name": Schema.optionalKey(
17410 Schema.String.annotate({
17411 "description":
17412 "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n"
17413 })
17414 ),
17415 "group_id": Schema.optionalKey(
17416 Schema.String.annotate({
17417 "description":
17418 "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n"
17419 })
17420 ),
17421 "metadata": Schema.optionalKey(
17422 Schema.Struct({}).annotate({
17423 "description":
17424 "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n"
17425 })
17426 )
17427 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
17428 ], { mode: "oneOf" }).annotate({
17429 "title": "Tracing Configuration",
17430 "description":
17431 "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
17432 }),
17433 Schema.Null
17434 ])
17435 ),
17436 "tools": Schema.optionalKey(
17437 Schema.Array(RealtimeFunctionTool).annotate({ "description": "Tools (functions) available to the model." })
17438 ),
17439 "tool_choice": Schema.optionalKey(
17440 Schema.String.annotate({
17441 "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n"
17442 })
17443 ),
17444 "temperature": Schema.optionalKey(
17445 Schema.Number.annotate({
17446 "description":
17447 "Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance.\n"
17448 }).check(Schema.isFinite())
17449 ),
17450 "max_response_output_tokens": Schema.optionalKey(
17451 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
17452 "description":
17453 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
17454 })
17455 ),
17456 "expires_at": Schema.optionalKey(
17457 Schema.Number.annotate({
17458 "description": "Expiration timestamp for the session, in seconds since epoch.",
17459 "format": "unixtime"
17460 }).check(Schema.isInt())
17461 ),
17462 "prompt": Schema.optionalKey(Schema.Union([Prompt, Schema.Null])),
17463 "include": Schema.optionalKey(
17464 Schema.Union([
17465 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
17466 "description":
17467 "Additional fields to include in server outputs.\n- `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
17468 }),
17469 Schema.Null
17470 ])
17471 )
17472}).annotate({ "description": "Realtime session object for the beta interface." })
17473export type RealtimeSessionCreateRequest = {
17474 readonly "client_secret": { readonly "value": string; readonly "expires_at": number }
17475 readonly "modalities"?: ReadonlyArray<"text" | "audio">
17476 readonly "instructions"?: string
17477 readonly "voice"?: VoiceIdsShared | { readonly "id": string }
17478 readonly "input_audio_format"?: string
17479 readonly "output_audio_format"?: string
17480 readonly "input_audio_transcription"?: { readonly "model"?: string }
17481 readonly "speed"?: number
17482 readonly "tracing"?: "auto" | {
17483 readonly "workflow_name"?: string
17484 readonly "group_id"?: string
17485 readonly "metadata"?: {}
17486 }
17487 readonly "turn_detection"?: {
17488 readonly "type"?: string
17489 readonly "threshold"?: number
17490 readonly "prefix_padding_ms"?: number
17491 readonly "silence_duration_ms"?: number
17492 }
17493 readonly "tools"?: ReadonlyArray<
17494 {
17495 readonly "type"?: "function"
17496 readonly "name"?: string
17497 readonly "description"?: string
17498 readonly "parameters"?: {}
17499 }
17500 >
17501 readonly "tool_choice"?: string
17502 readonly "temperature"?: number
17503 readonly "max_response_output_tokens"?: number | "inf"
17504 readonly "truncation"?: RealtimeTruncation
17505 readonly "prompt"?: Prompt
17506}
17507export const RealtimeSessionCreateRequest = Schema.Struct({
17508 "client_secret": Schema.Struct({
17509 "value": Schema.String.annotate({
17510 "description":
17511 "Ephemeral key usable in client environments to authenticate connections\nto the Realtime API. Use this in client-side environments rather than\na standard API token, which should only be used server-side.\n"
17512 }),
17513 "expires_at": Schema.Number.annotate({
17514 "description": "Timestamp for when the token expires. Currently, all tokens expire\nafter one minute.\n",
17515 "format": "unixtime"
17516 }).check(Schema.isInt())
17517 }).annotate({ "description": "Ephemeral key returned by the API." }),
17518 "modalities": Schema.optionalKey(
17519 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
17520 "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"
17521 })
17522 ),
17523 "instructions": Schema.optionalKey(Schema.String.annotate({
17524 "description":
17525 "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"
17526 })),
17527 "voice": Schema.optionalKey(
17528 Schema.Union([
17529 VoiceIdsShared,
17530 Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) })
17531 .annotate({ "description": "Custom voice reference." })
17532 ]).annotate({
17533 "title": "Voice",
17534 "description":
17535 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with an\n`id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\nthe session once the model has responded with audio at least once.\n"
17536 })
17537 ),
17538 "input_audio_format": Schema.optionalKey(
17539 Schema.String.annotate({
17540 "description": "The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"
17541 })
17542 ),
17543 "output_audio_format": Schema.optionalKey(
17544 Schema.String.annotate({
17545 "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"
17546 })
17547 ),
17548 "input_audio_transcription": Schema.optionalKey(
17549 Schema.Struct({
17550 "model": Schema.optionalKey(Schema.String.annotate({ "description": "The model to use for transcription.\n" }))
17551 }).annotate({
17552 "description":
17553 "Configuration for input audio transcription, defaults to off and can be\nset to `null` to turn off once on. Input audio transcription is not native\nto the model, since the model consumes audio directly. Transcription runs\nasynchronously and should be treated as rough guidance\nrather than the representation understood by the model.\n"
17554 })
17555 ),
17556 "speed": Schema.optionalKey(
17557 Schema.Number.annotate({
17558 "description":
17559 "The speed of the model's spoken response. 1.0 is the default speed. 0.25 is\nthe minimum speed. 1.5 is the maximum speed. This value can only be changed\nin between model turns, not while a response is in progress.\n"
17560 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(1.5))
17561 ),
17562 "tracing": Schema.optionalKey(
17563 Schema.Union([
17564 Schema.Literal("auto").annotate({ "description": "Default tracing mode for the session.\n" }),
17565 Schema.Struct({
17566 "workflow_name": Schema.optionalKey(
17567 Schema.String.annotate({
17568 "description":
17569 "The name of the workflow to attach to this trace. This is used to\nname the trace in the traces dashboard.\n"
17570 })
17571 ),
17572 "group_id": Schema.optionalKey(
17573 Schema.String.annotate({
17574 "description":
17575 "The group id to attach to this trace to enable filtering and\ngrouping in the traces dashboard.\n"
17576 })
17577 ),
17578 "metadata": Schema.optionalKey(
17579 Schema.Struct({}).annotate({
17580 "description":
17581 "The arbitrary metadata to attach to this trace to enable\nfiltering in the traces dashboard.\n"
17582 })
17583 )
17584 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
17585 ], { mode: "oneOf" }).annotate({
17586 "title": "Tracing Configuration",
17587 "description":
17588 "Configuration options for tracing. Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
17589 })
17590 ),
17591 "turn_detection": Schema.optionalKey(
17592 Schema.Struct({
17593 "type": Schema.optionalKey(
17594 Schema.String.annotate({ "description": "Type of turn detection, only `server_vad` is currently supported.\n" })
17595 ),
17596 "threshold": Schema.optionalKey(
17597 Schema.Number.annotate({
17598 "description":
17599 "Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A\nhigher threshold will require louder audio to activate the model, and\nthus might perform better in noisy environments.\n"
17600 }).check(Schema.isFinite())
17601 ),
17602 "prefix_padding_ms": Schema.optionalKey(
17603 Schema.Number.annotate({
17604 "description":
17605 "Amount of audio to include before the VAD detected speech (in\nmilliseconds). Defaults to 300ms.\n"
17606 }).check(Schema.isInt())
17607 ),
17608 "silence_duration_ms": Schema.optionalKey(
17609 Schema.Number.annotate({
17610 "description":
17611 "Duration of silence to detect speech stop (in milliseconds). Defaults\nto 500ms. With shorter values the model will respond more quickly,\nbut may jump in on short pauses from the user.\n"
17612 }).check(Schema.isInt())
17613 )
17614 }).annotate({
17615 "description":
17616 "Configuration for turn detection. Can be set to `null` to turn off. Server\nVAD means that the model will detect the start and end of speech based on\naudio volume and respond at the end of user speech.\n"
17617 })
17618 ),
17619 "tools": Schema.optionalKey(
17620 Schema.Array(Schema.Struct({
17621 "type": Schema.optionalKey(
17622 Schema.Literal("function").annotate({ "description": "The type of the tool, i.e. `function`." })
17623 ),
17624 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function." })),
17625 "description": Schema.optionalKey(
17626 Schema.String.annotate({
17627 "description":
17628 "The description of the function, including guidance on when and how\nto call it, and guidance about what to tell the user when calling\n(if anything).\n"
17629 })
17630 ),
17631 "parameters": Schema.optionalKey(
17632 Schema.Struct({}).annotate({ "description": "Parameters of the function in JSON Schema." })
17633 )
17634 })).annotate({ "description": "Tools (functions) available to the model." })
17635 ),
17636 "tool_choice": Schema.optionalKey(
17637 Schema.String.annotate({
17638 "description": "How the model chooses tools. Options are `auto`, `none`, `required`, or\nspecify a function.\n"
17639 })
17640 ),
17641 "temperature": Schema.optionalKey(
17642 Schema.Number.annotate({
17643 "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n"
17644 }).check(Schema.isFinite())
17645 ),
17646 "max_response_output_tokens": Schema.optionalKey(
17647 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
17648 "description":
17649 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
17650 })
17651 ),
17652 "truncation": Schema.optionalKey(RealtimeTruncation),
17653 "prompt": Schema.optionalKey(Prompt)
17654}).annotate({
17655 "description": "A new Realtime session configuration, with an ephemeral key. Default TTL\nfor keys is one minute.\n"
17656})
17657export type RealtimeSessionCreateRequestGA = {
17658 readonly "type": "realtime"
17659 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
17660 readonly "model"?:
17661 | string
17662 | "gpt-realtime"
17663 | "gpt-realtime-1.5"
17664 | "gpt-realtime-2"
17665 | "gpt-realtime-2025-08-28"
17666 | "gpt-4o-realtime-preview"
17667 | "gpt-4o-realtime-preview-2024-10-01"
17668 | "gpt-4o-realtime-preview-2024-12-17"
17669 | "gpt-4o-realtime-preview-2025-06-03"
17670 | "gpt-4o-mini-realtime-preview"
17671 | "gpt-4o-mini-realtime-preview-2024-12-17"
17672 | "gpt-realtime-mini"
17673 | "gpt-realtime-mini-2025-10-06"
17674 | "gpt-realtime-mini-2025-12-15"
17675 | "gpt-audio-1.5"
17676 | "gpt-audio-mini"
17677 | "gpt-audio-mini-2025-10-06"
17678 | "gpt-audio-mini-2025-12-15"
17679 readonly "instructions"?: string
17680 readonly "audio"?: {
17681 readonly "input"?: {
17682 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
17683 readonly "type"?: "audio/pcmu"
17684 } | { readonly "type"?: "audio/pcma" }
17685 readonly "transcription"?: {
17686 readonly "model"?:
17687 | string
17688 | "whisper-1"
17689 | "gpt-4o-mini-transcribe"
17690 | "gpt-4o-mini-transcribe-2025-12-15"
17691 | "gpt-4o-transcribe"
17692 | "gpt-4o-transcribe-diarize"
17693 | "gpt-realtime-whisper"
17694 readonly "language"?: string
17695 readonly "prompt"?: string
17696 readonly "delay"?: "minimal" | "low" | "medium" | "high" | "xhigh"
17697 }
17698 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
17699 readonly "turn_detection"?: RealtimeTurnDetection
17700 }
17701 readonly "output"?: {
17702 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
17703 readonly "type"?: "audio/pcmu"
17704 } | { readonly "type"?: "audio/pcma" }
17705 readonly "voice"?: VoiceIdsShared | { readonly "id": string }
17706 readonly "speed"?: number
17707 }
17708 }
17709 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
17710 readonly "tracing"?: "auto" | {
17711 readonly "workflow_name"?: string
17712 readonly "group_id"?: string
17713 readonly "metadata"?: {}
17714 } | null
17715 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool | MCPTool>
17716 readonly "tool_choice"?: ToolChoiceOptions | ToolChoiceFunction | ToolChoiceMCP
17717 readonly "parallel_tool_calls"?: boolean
17718 readonly "reasoning"?: RealtimeReasoning
17719 readonly "max_output_tokens"?: number | "inf"
17720 readonly "truncation"?: RealtimeTruncation
17721 readonly "prompt"?: Prompt
17722}
17723export const RealtimeSessionCreateRequestGA = Schema.Struct({
17724 "type": Schema.Literal("realtime").annotate({
17725 "description": "The type of session to create. Always `realtime` for the Realtime API.\n"
17726 }),
17727 "output_modalities": Schema.optionalKey(
17728 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
17729 "description":
17730 "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n"
17731 })
17732 ),
17733 "model": Schema.optionalKey(
17734 Schema.Union([
17735 Schema.String,
17736 Schema.Literals([
17737 "gpt-realtime",
17738 "gpt-realtime-1.5",
17739 "gpt-realtime-2",
17740 "gpt-realtime-2025-08-28",
17741 "gpt-4o-realtime-preview",
17742 "gpt-4o-realtime-preview-2024-10-01",
17743 "gpt-4o-realtime-preview-2024-12-17",
17744 "gpt-4o-realtime-preview-2025-06-03",
17745 "gpt-4o-mini-realtime-preview",
17746 "gpt-4o-mini-realtime-preview-2024-12-17",
17747 "gpt-realtime-mini",
17748 "gpt-realtime-mini-2025-10-06",
17749 "gpt-realtime-mini-2025-12-15",
17750 "gpt-audio-1.5",
17751 "gpt-audio-mini",
17752 "gpt-audio-mini-2025-10-06",
17753 "gpt-audio-mini-2025-12-15"
17754 ])
17755 ]).annotate({ "description": "The Realtime model used for this session.\n" })
17756 ),
17757 "instructions": Schema.optionalKey(Schema.String.annotate({
17758 "description":
17759 "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"
17760 })),
17761 "audio": Schema.optionalKey(
17762 Schema.Struct({
17763 "input": Schema.optionalKey(Schema.Struct({
17764 "format": Schema.optionalKey(
17765 Schema.Union([
17766 Schema.Struct({
17767 "type": Schema.optionalKey(
17768 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
17769 ),
17770 "rate": Schema.optionalKey(
17771 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
17772 )
17773 }).annotate({
17774 "title": "PCM audio format",
17775 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
17776 }),
17777 Schema.Struct({
17778 "type": Schema.optionalKey(
17779 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
17780 )
17781 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
17782 Schema.Struct({
17783 "type": Schema.optionalKey(
17784 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
17785 )
17786 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
17787 ]).annotate({ "description": "The format of the input audio." })
17788 ),
17789 "transcription": Schema.optionalKey(
17790 Schema.Struct({
17791 "model": Schema.optionalKey(
17792 Schema.Union([
17793 Schema.String,
17794 Schema.Literals([
17795 "whisper-1",
17796 "gpt-4o-mini-transcribe",
17797 "gpt-4o-mini-transcribe-2025-12-15",
17798 "gpt-4o-transcribe",
17799 "gpt-4o-transcribe-diarize",
17800 "gpt-realtime-whisper"
17801 ])
17802 ]).annotate({
17803 "description":
17804 "The model to use for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.\n"
17805 })
17806 ),
17807 "language": Schema.optionalKey(
17808 Schema.String.annotate({
17809 "description":
17810 "The language of the input audio. Supplying the input language in\n[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format\nwill improve accuracy and latency.\n"
17811 })
17812 ),
17813 "prompt": Schema.optionalKey(Schema.String.annotate({
17814 "description":
17815 "An optional text to guide the model's style or continue a previous audio\nsegment.\nFor `whisper-1`, the [prompt is a list of keywords](/docs/guides/speech-to-text#prompting).\nFor `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example \"expect words related to technology\".\nPrompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
17816 })),
17817 "delay": Schema.optionalKey(
17818 Schema.Literals(["minimal", "low", "medium", "high", "xhigh"]).annotate({
17819 "description":
17820 "Controls how long the model waits before emitting transcription text.\nHigher values can improve transcription accuracy at the cost of latency.\nOnly supported with `gpt-realtime-whisper` in GA Realtime sessions.\n"
17821 })
17822 )
17823 }).annotate({
17824 "description":
17825 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
17826 })
17827 ),
17828 "noise_reduction": Schema.optionalKey(
17829 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
17830 "description":
17831 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
17832 })
17833 ),
17834 "turn_detection": Schema.optionalKey(RealtimeTurnDetection)
17835 })),
17836 "output": Schema.optionalKey(Schema.Struct({
17837 "format": Schema.optionalKey(
17838 Schema.Union([
17839 Schema.Struct({
17840 "type": Schema.optionalKey(
17841 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
17842 ),
17843 "rate": Schema.optionalKey(
17844 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
17845 )
17846 }).annotate({
17847 "title": "PCM audio format",
17848 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
17849 }),
17850 Schema.Struct({
17851 "type": Schema.optionalKey(
17852 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
17853 )
17854 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
17855 Schema.Struct({
17856 "type": Schema.optionalKey(
17857 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
17858 )
17859 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
17860 ]).annotate({ "description": "The format of the output audio." })
17861 ),
17862 "voice": Schema.optionalKey(
17863 Schema.Union([
17864 VoiceIdsShared,
17865 Schema.Struct({
17866 "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." })
17867 }).annotate({ "description": "Custom voice reference." })
17868 ]).annotate({
17869 "title": "Voice",
17870 "description":
17871 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nWe recommend `marin` and `cedar` for best quality.\n"
17872 })
17873 ),
17874 "speed": Schema.optionalKey(
17875 Schema.Number.annotate({
17876 "description":
17877 "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n"
17878 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(1.5))
17879 )
17880 }))
17881 }).annotate({ "description": "Configuration for input and output audio.\n" })
17882 ),
17883 "include": Schema.optionalKey(
17884 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
17885 "description":
17886 "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
17887 })
17888 ),
17889 "tracing": Schema.optionalKey(
17890 Schema.Union([
17891 Schema.Union([
17892 Schema.Literal("auto").annotate({
17893 "title": "auto",
17894 "description": "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n"
17895 }),
17896 Schema.Struct({
17897 "workflow_name": Schema.optionalKey(
17898 Schema.String.annotate({
17899 "description":
17900 "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n"
17901 })
17902 ),
17903 "group_id": Schema.optionalKey(
17904 Schema.String.annotate({
17905 "description":
17906 "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n"
17907 })
17908 ),
17909 "metadata": Schema.optionalKey(
17910 Schema.Struct({}).annotate({
17911 "description":
17912 "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n"
17913 })
17914 )
17915 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
17916 ], { mode: "oneOf" }).annotate({
17917 "title": "Tracing Configuration",
17918 "description":
17919 "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
17920 }),
17921 Schema.Null
17922 ])
17923 ),
17924 "tools": Schema.optionalKey(
17925 Schema.Array(Schema.Union([RealtimeFunctionTool, MCPTool], { mode: "oneOf" })).annotate({
17926 "description": "Tools available to the model."
17927 })
17928 ),
17929 "tool_choice": Schema.optionalKey(
17930 Schema.Union([ToolChoiceOptions, ToolChoiceFunction, ToolChoiceMCP], { mode: "oneOf" }).annotate({
17931 "description":
17932 "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n"
17933 })
17934 ),
17935 "parallel_tool_calls": Schema.optionalKey(
17936 Schema.Boolean.annotate({
17937 "description":
17938 "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n"
17939 })
17940 ),
17941 "reasoning": Schema.optionalKey(RealtimeReasoning),
17942 "max_output_tokens": Schema.optionalKey(
17943 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
17944 "description":
17945 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
17946 })
17947 ),
17948 "truncation": Schema.optionalKey(RealtimeTruncation),
17949 "prompt": Schema.optionalKey(Prompt)
17950}).annotate({ "title": "Realtime session configuration", "description": "Realtime session object configuration." })
17951export type RealtimeSessionCreateResponseGA = {
17952 readonly "type": "realtime"
17953 readonly "id": string
17954 readonly "object": "realtime.session"
17955 readonly "expires_at"?: number
17956 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
17957 readonly "model"?:
17958 | string
17959 | "gpt-realtime"
17960 | "gpt-realtime-1.5"
17961 | "gpt-realtime-2"
17962 | "gpt-realtime-2025-08-28"
17963 | "gpt-4o-realtime-preview"
17964 | "gpt-4o-realtime-preview-2024-10-01"
17965 | "gpt-4o-realtime-preview-2024-12-17"
17966 | "gpt-4o-realtime-preview-2025-06-03"
17967 | "gpt-4o-mini-realtime-preview"
17968 | "gpt-4o-mini-realtime-preview-2024-12-17"
17969 | "gpt-realtime-mini"
17970 | "gpt-realtime-mini-2025-10-06"
17971 | "gpt-realtime-mini-2025-12-15"
17972 | "gpt-audio-1.5"
17973 | "gpt-audio-mini"
17974 | "gpt-audio-mini-2025-10-06"
17975 | "gpt-audio-mini-2025-12-15"
17976 readonly "instructions"?: string
17977 readonly "audio"?: {
17978 readonly "input"?: {
17979 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
17980 readonly "type"?: "audio/pcmu"
17981 } | { readonly "type"?: "audio/pcma" }
17982 readonly "transcription"?: {
17983 readonly "model"?:
17984 | string
17985 | "whisper-1"
17986 | "gpt-4o-mini-transcribe"
17987 | "gpt-4o-mini-transcribe-2025-12-15"
17988 | "gpt-4o-transcribe"
17989 | "gpt-4o-transcribe-diarize"
17990 | "gpt-realtime-whisper"
17991 readonly "language"?: string
17992 readonly "prompt"?: string
17993 }
17994 readonly "noise_reduction"?: { readonly "type"?: NoiseReductionType }
17995 readonly "turn_detection"?: RealtimeTurnDetection
17996 }
17997 readonly "output"?: {
17998 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
17999 readonly "type"?: "audio/pcmu"
18000 } | { readonly "type"?: "audio/pcma" }
18001 readonly "voice"?:
18002 | string
18003 | "alloy"
18004 | "ash"
18005 | "ballad"
18006 | "coral"
18007 | "echo"
18008 | "sage"
18009 | "shimmer"
18010 | "verse"
18011 | "marin"
18012 | "cedar"
18013 readonly "speed"?: number
18014 }
18015 }
18016 readonly "include"?: ReadonlyArray<"item.input_audio_transcription.logprobs">
18017 readonly "tracing"?: "auto" | {
18018 readonly "workflow_name"?: string
18019 readonly "group_id"?: string
18020 readonly "metadata"?: {}
18021 } | null
18022 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool | MCPTool>
18023 readonly "tool_choice"?: ToolChoiceOptions | ToolChoiceFunction | ToolChoiceMCP
18024 readonly "reasoning"?: RealtimeReasoning
18025 readonly "max_output_tokens"?: number | "inf"
18026 readonly "truncation"?: RealtimeTruncation
18027 readonly "prompt"?: Prompt
18028}
18029export const RealtimeSessionCreateResponseGA = Schema.Struct({
18030 "type": Schema.Literal("realtime").annotate({
18031 "description": "The type of session to create. Always `realtime` for the Realtime API.\n"
18032 }),
18033 "id": Schema.String.annotate({
18034 "description": "Unique identifier for the session that looks like `sess_1234567890abcdef`.\n"
18035 }),
18036 "object": Schema.Literal("realtime.session").annotate({
18037 "description": "The object type. Always `realtime.session`."
18038 }),
18039 "expires_at": Schema.optionalKey(
18040 Schema.Number.annotate({
18041 "description": "Expiration timestamp for the session, in seconds since epoch.",
18042 "format": "unixtime"
18043 }).check(Schema.isInt())
18044 ),
18045 "output_modalities": Schema.optionalKey(
18046 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
18047 "description":
18048 "The set of modalities the model can respond with. It defaults to `[\"audio\"]`, indicating\nthat the model will respond with audio plus a transcript. `[\"text\"]` can be used to make\nthe model respond with text only. It is not possible to request both `text` and `audio` at the same time.\n"
18049 })
18050 ),
18051 "model": Schema.optionalKey(
18052 Schema.Union([
18053 Schema.String,
18054 Schema.Literals([
18055 "gpt-realtime",
18056 "gpt-realtime-1.5",
18057 "gpt-realtime-2",
18058 "gpt-realtime-2025-08-28",
18059 "gpt-4o-realtime-preview",
18060 "gpt-4o-realtime-preview-2024-10-01",
18061 "gpt-4o-realtime-preview-2024-12-17",
18062 "gpt-4o-realtime-preview-2025-06-03",
18063 "gpt-4o-mini-realtime-preview",
18064 "gpt-4o-mini-realtime-preview-2024-12-17",
18065 "gpt-realtime-mini",
18066 "gpt-realtime-mini-2025-10-06",
18067 "gpt-realtime-mini-2025-12-15",
18068 "gpt-audio-1.5",
18069 "gpt-audio-mini",
18070 "gpt-audio-mini-2025-10-06",
18071 "gpt-audio-mini-2025-12-15"
18072 ])
18073 ]).annotate({ "description": "The Realtime model used for this session.\n" })
18074 ),
18075 "instructions": Schema.optionalKey(Schema.String.annotate({
18076 "description":
18077 "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\n\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"
18078 })),
18079 "audio": Schema.optionalKey(
18080 Schema.Struct({
18081 "input": Schema.optionalKey(Schema.Struct({
18082 "format": Schema.optionalKey(
18083 Schema.Union([
18084 Schema.Struct({
18085 "type": Schema.optionalKey(
18086 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
18087 ),
18088 "rate": Schema.optionalKey(
18089 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
18090 )
18091 }).annotate({
18092 "title": "PCM audio format",
18093 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
18094 }),
18095 Schema.Struct({
18096 "type": Schema.optionalKey(
18097 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
18098 )
18099 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
18100 Schema.Struct({
18101 "type": Schema.optionalKey(
18102 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
18103 )
18104 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
18105 ]).annotate({ "description": "The format of the input audio." })
18106 ),
18107 "transcription": Schema.optionalKey(
18108 Schema.Struct({
18109 "model": Schema.optionalKey(
18110 Schema.Union([
18111 Schema.String,
18112 Schema.Literals([
18113 "whisper-1",
18114 "gpt-4o-mini-transcribe",
18115 "gpt-4o-mini-transcribe-2025-12-15",
18116 "gpt-4o-transcribe",
18117 "gpt-4o-transcribe-diarize",
18118 "gpt-realtime-whisper"
18119 ])
18120 ]).annotate({
18121 "description":
18122 "The model used for transcription. Current options are `whisper-1`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.\n"
18123 })
18124 ),
18125 "language": Schema.optionalKey(
18126 Schema.String.annotate({ "description": "The language of the input audio.\n" })
18127 ),
18128 "prompt": Schema.optionalKey(
18129 Schema.String.annotate({
18130 "description": "The prompt configured for input audio transcription, when present.\n"
18131 })
18132 )
18133 }).annotate({
18134 "description":
18135 "Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](/docs/api-reference/audio/createTranscription) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.\n"
18136 })
18137 ),
18138 "noise_reduction": Schema.optionalKey(
18139 Schema.Struct({ "type": Schema.optionalKey(NoiseReductionType) }).annotate({
18140 "description":
18141 "Configuration for input audio noise reduction. This can be set to `null` to turn off.\nNoise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.\nFiltering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.\n"
18142 })
18143 ),
18144 "turn_detection": Schema.optionalKey(RealtimeTurnDetection)
18145 })),
18146 "output": Schema.optionalKey(Schema.Struct({
18147 "format": Schema.optionalKey(
18148 Schema.Union([
18149 Schema.Struct({
18150 "type": Schema.optionalKey(
18151 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
18152 ),
18153 "rate": Schema.optionalKey(
18154 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
18155 )
18156 }).annotate({
18157 "title": "PCM audio format",
18158 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
18159 }),
18160 Schema.Struct({
18161 "type": Schema.optionalKey(
18162 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
18163 )
18164 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
18165 Schema.Struct({
18166 "type": Schema.optionalKey(
18167 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
18168 )
18169 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
18170 ]).annotate({ "description": "The format of the output audio." })
18171 ),
18172 "voice": Schema.optionalKey(
18173 Schema.Union([
18174 Schema.String,
18175 Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"])
18176 ]).annotate({
18177 "description":
18178 "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for\nbest quality.\n"
18179 })
18180 ),
18181 "speed": Schema.optionalKey(
18182 Schema.Number.annotate({
18183 "description":
18184 "The speed of the model's spoken response as a multiple of the original speed.\n1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.\n\nThis parameter is a post-processing adjustment to the audio after it is generated, it's\nalso possible to prompt the model to speak faster or slower.\n"
18185 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0.25)).check(Schema.isLessThanOrEqualTo(1.5))
18186 )
18187 }))
18188 }).annotate({ "description": "Configuration for input and output audio.\n" })
18189 ),
18190 "include": Schema.optionalKey(
18191 Schema.Array(Schema.Literal("item.input_audio_transcription.logprobs")).annotate({
18192 "description":
18193 "Additional fields to include in server outputs.\n\n`item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.\n"
18194 })
18195 ),
18196 "tracing": Schema.optionalKey(
18197 Schema.Union([
18198 Schema.Union([
18199 Schema.Literal("auto").annotate({
18200 "title": "auto",
18201 "description": "Enables tracing and sets default values for tracing configuration options. Always `auto`.\n"
18202 }),
18203 Schema.Struct({
18204 "workflow_name": Schema.optionalKey(
18205 Schema.String.annotate({
18206 "description":
18207 "The name of the workflow to attach to this trace. This is used to\nname the trace in the Traces Dashboard.\n"
18208 })
18209 ),
18210 "group_id": Schema.optionalKey(
18211 Schema.String.annotate({
18212 "description":
18213 "The group id to attach to this trace to enable filtering and\ngrouping in the Traces Dashboard.\n"
18214 })
18215 ),
18216 "metadata": Schema.optionalKey(
18217 Schema.Struct({}).annotate({
18218 "description":
18219 "The arbitrary metadata to attach to this trace to enable\nfiltering in the Traces Dashboard.\n"
18220 })
18221 )
18222 }).annotate({ "title": "Tracing Configuration", "description": "Granular configuration for tracing.\n" })
18223 ], { mode: "oneOf" }).annotate({
18224 "title": "Tracing Configuration",
18225 "description":
18226 "Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once\ntracing is enabled for a session, the configuration cannot be modified.\n\n`auto` will create a trace for the session with default values for the\nworkflow name, group id, and metadata.\n"
18227 }),
18228 Schema.Null
18229 ])
18230 ),
18231 "tools": Schema.optionalKey(
18232 Schema.Array(Schema.Union([RealtimeFunctionTool, MCPTool], { mode: "oneOf" })).annotate({
18233 "description": "Tools available to the model."
18234 })
18235 ),
18236 "tool_choice": Schema.optionalKey(
18237 Schema.Union([ToolChoiceOptions, ToolChoiceFunction, ToolChoiceMCP], { mode: "oneOf" }).annotate({
18238 "description":
18239 "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n"
18240 })
18241 ),
18242 "reasoning": Schema.optionalKey(RealtimeReasoning),
18243 "max_output_tokens": Schema.optionalKey(
18244 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
18245 "description":
18246 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
18247 })
18248 ),
18249 "truncation": Schema.optionalKey(RealtimeTruncation),
18250 "prompt": Schema.optionalKey(Prompt)
18251}).annotate({
18252 "title": "Realtime session configuration object",
18253 "description": "A Realtime session configuration object.\n"
18254})
18255export type CreateVectorStoreFileRequest = {
18256 readonly "file_id": string
18257 readonly "chunking_strategy"?: ChunkingStrategyRequestParam
18258 readonly "attributes"?: VectorStoreFileAttributes
18259}
18260export const CreateVectorStoreFileRequest = Schema.Struct({
18261 "file_id": Schema.String.annotate({
18262 "description":
18263 "A [File](/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests."
18264 }),
18265 "chunking_strategy": Schema.optionalKey(ChunkingStrategyRequestParam),
18266 "attributes": Schema.optionalKey(VectorStoreFileAttributes)
18267})
18268export type CreateTranscriptionResponseStreamEvent =
18269 | TranscriptTextSegmentEvent
18270 | TranscriptTextDeltaEvent
18271 | TranscriptTextDoneEvent
18272export const CreateTranscriptionResponseStreamEvent = Schema.Union([
18273 TranscriptTextSegmentEvent,
18274 TranscriptTextDeltaEvent,
18275 TranscriptTextDoneEvent
18276])
18277export type UsageResponse = {
18278 readonly "object": "page"
18279 readonly "data": ReadonlyArray<UsageTimeBucket>
18280 readonly "has_more": boolean
18281 readonly "next_page": string | null
18282}
18283export const UsageResponse = Schema.Struct({
18284 "object": Schema.Literal("page"),
18285 "data": Schema.Array(UsageTimeBucket),
18286 "has_more": Schema.Boolean,
18287 "next_page": Schema.Union([Schema.String, Schema.Null])
18288})
18289export type ListVectorStoresResponse = {
18290 readonly "object": string
18291 readonly "data": ReadonlyArray<VectorStoreObject>
18292 readonly "first_id": string
18293 readonly "last_id": string
18294 readonly "has_more": boolean
18295 readonly [x: string]: unknown
18296}
18297export const ListVectorStoresResponse = Schema.StructWithRest(
18298 Schema.Struct({
18299 "object": Schema.String,
18300 "data": Schema.Array(VectorStoreObject),
18301 "first_id": Schema.String,
18302 "last_id": Schema.String,
18303 "has_more": Schema.Boolean
18304 }),
18305 [Schema.Record(Schema.String, Schema.Json)]
18306)
18307export type ListVectorStoreFilesResponse = {
18308 readonly "object": string
18309 readonly "data": ReadonlyArray<VectorStoreFileObject>
18310 readonly "first_id": string
18311 readonly "last_id": string
18312 readonly "has_more": boolean
18313 readonly [x: string]: unknown
18314}
18315export const ListVectorStoreFilesResponse = Schema.StructWithRest(
18316 Schema.Struct({
18317 "object": Schema.String,
18318 "data": Schema.Array(VectorStoreFileObject),
18319 "first_id": Schema.String,
18320 "last_id": Schema.String,
18321 "has_more": Schema.Boolean
18322 }),
18323 [Schema.Record(Schema.String, Schema.Json)]
18324)
18325export type VectorStoreSearchResultsPage = {
18326 readonly "object": "vector_store.search_results.page"
18327 readonly "search_query": ReadonlyArray<string>
18328 readonly "data": ReadonlyArray<VectorStoreSearchResultItem>
18329 readonly "has_more": boolean
18330 readonly "next_page": string | null
18331}
18332export const VectorStoreSearchResultsPage = Schema.Struct({
18333 "object": Schema.Literal("vector_store.search_results.page").annotate({
18334 "description": "The object type, which is always `vector_store.search_results.page`"
18335 }),
18336 "search_query": Schema.Array(Schema.String.annotate({ "description": "The query used for this search." })),
18337 "data": Schema.Array(VectorStoreSearchResultItem).annotate({ "description": "The list of search result items." }),
18338 "has_more": Schema.Boolean.annotate({ "description": "Indicates if there are more results to fetch." }),
18339 "next_page": Schema.Union([
18340 Schema.String.annotate({ "description": "The token for the next page, if any." }),
18341 Schema.Null
18342 ])
18343})
18344export type CreateContainerBody = {
18345 readonly "name": string
18346 readonly "file_ids"?: ReadonlyArray<string>
18347 readonly "expires_after"?: { readonly "anchor": "last_active_at"; readonly "minutes": number }
18348 readonly "skills"?: ReadonlyArray<SkillReferenceParam | InlineSkillParam>
18349 readonly "memory_limit"?: "1g" | "4g" | "16g" | "64g"
18350 readonly "network_policy"?: ContainerNetworkPolicyDisabledParam | ContainerNetworkPolicyAllowlistParam
18351}
18352export const CreateContainerBody = Schema.Struct({
18353 "name": Schema.String.annotate({ "description": "Name of the container to create." }),
18354 "file_ids": Schema.optionalKey(
18355 Schema.Array(Schema.String).annotate({ "description": "IDs of files to copy to the container." })
18356 ),
18357 "expires_after": Schema.optionalKey(
18358 Schema.Struct({
18359 "anchor": Schema.Literal("last_active_at").annotate({
18360 "description": "Time anchor for the expiration time. Currently only 'last_active_at' is supported."
18361 }),
18362 "minutes": Schema.Number.check(Schema.isInt())
18363 }).annotate({ "description": "Container expiration time in seconds relative to the 'anchor' time." })
18364 ),
18365 "skills": Schema.optionalKey(
18366 Schema.Array(Schema.Union([SkillReferenceParam, InlineSkillParam], { mode: "oneOf" })).annotate({
18367 "description": "An optional list of skills referenced by id or inline data."
18368 })
18369 ),
18370 "memory_limit": Schema.optionalKey(
18371 Schema.Literals(["1g", "4g", "16g", "64g"]).annotate({
18372 "description": "Optional memory limit for the container. Defaults to \"1g\"."
18373 })
18374 ),
18375 "network_policy": Schema.optionalKey(
18376 Schema.Union([ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam], { mode: "oneOf" })
18377 .annotate({ "description": "Network access policy for the container." })
18378 )
18379})
18380export type AutoCodeInterpreterToolParam = {
18381 readonly "type": "auto"
18382 readonly "file_ids"?: ReadonlyArray<string>
18383 readonly "memory_limit"?: "1g" | "4g" | "16g" | "64g" | null
18384 readonly "network_policy"?: ContainerNetworkPolicyDisabledParam | ContainerNetworkPolicyAllowlistParam
18385}
18386export const AutoCodeInterpreterToolParam = Schema.Struct({
18387 "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }),
18388 "file_ids": Schema.optionalKey(
18389 Schema.Array(Schema.String).annotate({
18390 "description": "An optional list of uploaded files to make available to your code."
18391 }).check(Schema.isMaxLength(50))
18392 ),
18393 "memory_limit": Schema.optionalKey(
18394 Schema.Union([
18395 Schema.Literals(["1g", "4g", "16g", "64g"]).annotate({
18396 "description": "The memory limit for the code interpreter container."
18397 }),
18398 Schema.Null
18399 ])
18400 ),
18401 "network_policy": Schema.optionalKey(
18402 Schema.Union([ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam], { mode: "oneOf" })
18403 .annotate({ "description": "Network access policy for the container." })
18404 )
18405}).annotate({
18406 "title": "CodeInterpreterToolAuto",
18407 "description":
18408 "Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on."
18409})
18410export type ContainerAutoParam = {
18411 readonly "type": "container_auto"
18412 readonly "file_ids"?: ReadonlyArray<string>
18413 readonly "memory_limit"?: "1g" | "4g" | "16g" | "64g" | null
18414 readonly "network_policy"?: ContainerNetworkPolicyDisabledParam | ContainerNetworkPolicyAllowlistParam
18415 readonly "skills"?: ReadonlyArray<SkillReferenceParam | InlineSkillParam>
18416}
18417export const ContainerAutoParam = Schema.Struct({
18418 "type": Schema.Literal("container_auto").annotate({
18419 "description": "Automatically creates a container for this request"
18420 }),
18421 "file_ids": Schema.optionalKey(
18422 Schema.Array(Schema.String).annotate({
18423 "description": "An optional list of uploaded files to make available to your code."
18424 }).check(Schema.isMaxLength(50))
18425 ),
18426 "memory_limit": Schema.optionalKey(
18427 Schema.Union([
18428 Schema.Literals(["1g", "4g", "16g", "64g"]).annotate({ "description": "The memory limit for the container." }),
18429 Schema.Null
18430 ])
18431 ),
18432 "network_policy": Schema.optionalKey(
18433 Schema.Union([ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam], { mode: "oneOf" })
18434 .annotate({ "description": "Network access policy for the container." })
18435 ),
18436 "skills": Schema.optionalKey(
18437 Schema.Array(Schema.Union([SkillReferenceParam, InlineSkillParam], { mode: "oneOf" })).annotate({
18438 "description": "An optional list of skills referenced by id or inline data."
18439 }).check(Schema.isMaxLength(200))
18440 )
18441})
18442export type EvalItemContentArray = ReadonlyArray<EvalItemContentItem>
18443export const EvalItemContentArray = Schema.Array(EvalItemContentItem).annotate({
18444 "title": "An array of Input text, Output text, Input image, and Input audio",
18445 "description":
18446 "A list of inputs, each of which may be either an input text, output text, input\nimage, or input audio object.\n"
18447})
18448export type OutputTextContent = {
18449 readonly "type": "output_text"
18450 readonly "text": string
18451 readonly "annotations": ReadonlyArray<Annotation>
18452 readonly "logprobs": ReadonlyArray<LogProb>
18453}
18454export const OutputTextContent = Schema.Struct({
18455 "type": Schema.Literal("output_text").annotate({
18456 "description": "The type of the output text. Always `output_text`."
18457 }),
18458 "text": Schema.String.annotate({ "description": "The text output from the model." }),
18459 "annotations": Schema.Array(Annotation).annotate({ "description": "The annotations of the text output." }),
18460 "logprobs": Schema.Array(LogProb)
18461}).annotate({ "title": "Output text", "description": "A text output from the model." })
18462export type CustomToolCallOutput = {
18463 readonly "type": "custom_tool_call_output"
18464 readonly "id"?: string
18465 readonly "call_id": string
18466 readonly "output": string | ReadonlyArray<FunctionAndCustomToolCallOutput>
18467}
18468export const CustomToolCallOutput = Schema.Struct({
18469 "type": Schema.Literal("custom_tool_call_output").annotate({
18470 "description": "The type of the custom tool call output. Always `custom_tool_call_output`.\n"
18471 }),
18472 "id": Schema.optionalKey(
18473 Schema.String.annotate({ "description": "The unique ID of the custom tool call output in the OpenAI platform.\n" })
18474 ),
18475 "call_id": Schema.String.annotate({
18476 "description": "The call ID, used to map this custom tool call output to a custom tool call.\n"
18477 }),
18478 "output": Schema.Union([
18479 Schema.String.annotate({
18480 "title": "string output",
18481 "description": "A string of the output of the custom tool call.\n"
18482 }),
18483 Schema.Array(FunctionAndCustomToolCallOutput).annotate({
18484 "title": "output content list",
18485 "description": "Text, image, or file output of the custom tool call.\n"
18486 })
18487 ], { mode: "oneOf" }).annotate({
18488 "description":
18489 "The output from the custom tool call generated by your code.\nCan be a string or an list of output content.\n"
18490 })
18491}).annotate({
18492 "title": "Custom tool call output",
18493 "description": "The output of a custom tool call from your code, being sent back to the model.\n"
18494})
18495export type CustomToolCallOutputResource = {
18496 readonly "type": "custom_tool_call_output"
18497 readonly "id": string
18498 readonly "call_id": string
18499 readonly "output": string | ReadonlyArray<FunctionAndCustomToolCallOutput>
18500 readonly "status": "in_progress" | "completed" | "incomplete"
18501 readonly "created_by"?: string
18502}
18503export const CustomToolCallOutputResource = Schema.Struct({
18504 "type": Schema.Literal("custom_tool_call_output").annotate({
18505 "description": "The type of the custom tool call output. Always `custom_tool_call_output`.\n"
18506 }),
18507 "id": Schema.String.annotate({ "description": "The unique ID of the custom tool call output item.\n" }),
18508 "call_id": Schema.String.annotate({
18509 "description": "The call ID, used to map this custom tool call output to a custom tool call.\n"
18510 }),
18511 "output": Schema.Union([
18512 Schema.String.annotate({
18513 "title": "string output",
18514 "description": "A string of the output of the custom tool call.\n"
18515 }),
18516 Schema.Array(FunctionAndCustomToolCallOutput).annotate({
18517 "title": "output content list",
18518 "description": "Text, image, or file output of the custom tool call.\n"
18519 })
18520 ], { mode: "oneOf" }).annotate({
18521 "description":
18522 "The output from the custom tool call generated by your code.\nCan be a string or an list of output content.\n"
18523 }),
18524 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
18525 "description":
18526 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
18527 }),
18528 "created_by": Schema.optionalKey(
18529 Schema.String.annotate({ "description": "The identifier of the actor that created the item.\n" })
18530 )
18531}).annotate({
18532 "title": "Custom tool call output",
18533 "description": "The output of a custom tool call from your code, being sent back to the model.\n"
18534})
18535export type FunctionToolCallOutput = {
18536 readonly "id"?: string
18537 readonly "type": "function_call_output"
18538 readonly "call_id": string
18539 readonly "output": string | ReadonlyArray<FunctionAndCustomToolCallOutput>
18540 readonly "status"?: "in_progress" | "completed" | "incomplete"
18541}
18542export const FunctionToolCallOutput = Schema.Struct({
18543 "id": Schema.optionalKey(
18544 Schema.String.annotate({
18545 "description": "The unique ID of the function tool call output. Populated when this item\nis returned via API.\n"
18546 })
18547 ),
18548 "type": Schema.Literal("function_call_output").annotate({
18549 "description": "The type of the function tool call output. Always `function_call_output`.\n"
18550 }),
18551 "call_id": Schema.String.annotate({
18552 "description": "The unique ID of the function tool call generated by the model.\n"
18553 }),
18554 "output": Schema.Union([
18555 Schema.String.annotate({
18556 "title": "string output",
18557 "description": "A string of the output of the function call.\n"
18558 }),
18559 Schema.Array(FunctionAndCustomToolCallOutput).annotate({
18560 "title": "output content list",
18561 "description": "Text, image, or file output of the function call.\n"
18562 })
18563 ], { mode: "oneOf" }).annotate({
18564 "description":
18565 "The output from the function call generated by your code.\nCan be a string or an list of output content.\n"
18566 }),
18567 "status": Schema.optionalKey(
18568 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
18569 "description":
18570 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
18571 })
18572 )
18573}).annotate({ "title": "Function tool call output", "description": "The output of a function tool call.\n" })
18574export type FunctionToolCallOutputResource = {
18575 readonly "id": string
18576 readonly "type": "function_call_output"
18577 readonly "call_id": string
18578 readonly "output": string | ReadonlyArray<FunctionAndCustomToolCallOutput>
18579 readonly "status": "in_progress" | "completed" | "incomplete"
18580 readonly "created_by"?: string
18581}
18582export const FunctionToolCallOutputResource = Schema.Struct({
18583 "id": Schema.String.annotate({ "description": "The unique ID of the function call tool output.\n" }),
18584 "type": Schema.Literal("function_call_output").annotate({
18585 "description": "The type of the function tool call output. Always `function_call_output`.\n"
18586 }),
18587 "call_id": Schema.String.annotate({
18588 "description": "The unique ID of the function tool call generated by the model.\n"
18589 }),
18590 "output": Schema.Union([
18591 Schema.String.annotate({
18592 "title": "string output",
18593 "description": "A string of the output of the function call.\n"
18594 }),
18595 Schema.Array(FunctionAndCustomToolCallOutput).annotate({
18596 "title": "output content list",
18597 "description": "Text, image, or file output of the function call.\n"
18598 })
18599 ], { mode: "oneOf" }).annotate({
18600 "description":
18601 "The output from the function call generated by your code.\nCan be a string or an list of output content.\n"
18602 }),
18603 "status": Schema.Union([
18604 Schema.Literal("in_progress").annotate({
18605 "description":
18606 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
18607 }),
18608 Schema.Literal("completed").annotate({
18609 "description":
18610 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
18611 }),
18612 Schema.Literal("incomplete").annotate({
18613 "description":
18614 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
18615 })
18616 ]).annotate({
18617 "description":
18618 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
18619 }),
18620 "created_by": Schema.optionalKey(
18621 Schema.String.annotate({ "description": "The identifier of the actor that created the item.\n" })
18622 )
18623}).annotate({ "title": "Function tool call output", "description": "The output of a function tool call.\n" })
18624export type InputMessageContentList = ReadonlyArray<InputContent>
18625export const InputMessageContentList = Schema.Array(InputContent).annotate({
18626 "title": "Input item content list",
18627 "description": "A list of one or many input items to the model, containing different content \ntypes.\n"
18628})
18629export type ComputerAction =
18630 | ClickParam
18631 | DoubleClickAction
18632 | DragParam
18633 | KeyPressAction
18634 | MoveParam
18635 | ScreenshotParam
18636 | ScrollParam
18637 | TypeParam
18638 | WaitParam
18639export const ComputerAction = Schema.Union([
18640 ClickParam,
18641 DoubleClickAction,
18642 DragParam,
18643 KeyPressAction,
18644 MoveParam,
18645 ScreenshotParam,
18646 ScrollParam,
18647 TypeParam,
18648 WaitParam
18649], { mode: "oneOf" })
18650export type NamespaceToolParam = {
18651 readonly "type": "namespace"
18652 readonly "name": string
18653 readonly "description": string
18654 readonly "tools": ReadonlyArray<FunctionToolParam | CustomToolParam>
18655}
18656export const NamespaceToolParam = Schema.Struct({
18657 "type": Schema.Literal("namespace").annotate({ "description": "The type of the tool. Always `namespace`." }),
18658 "name": Schema.String.annotate({ "description": "The namespace name used in tool calls (for example, `crm`)." })
18659 .check(Schema.isMinLength(1)),
18660 "description": Schema.String.annotate({ "description": "A description of the namespace shown to the model." }).check(
18661 Schema.isMinLength(1)
18662 ),
18663 "tools": Schema.Array(
18664 Schema.Union([FunctionToolParam, CustomToolParam], { mode: "oneOf" }).annotate({
18665 "description": "A function or custom tool that belongs to a namespace."
18666 })
18667 ).annotate({ "description": "The function/custom tools available inside this namespace." }).check(
18668 Schema.isMinLength(1)
18669 )
18670}).annotate({ "title": "Namespace", "description": "Groups function/custom tools under a shared namespace." })
18671export type FunctionShellCallOutput = {
18672 readonly "type": "shell_call_output"
18673 readonly "id": string
18674 readonly "call_id": string
18675 readonly "status": "in_progress" | "completed" | "incomplete"
18676 readonly "output": ReadonlyArray<FunctionShellCallOutputContent>
18677 readonly "max_output_length": number | null
18678 readonly "created_by"?: string
18679}
18680export const FunctionShellCallOutput = Schema.Struct({
18681 "type": Schema.Literal("shell_call_output").annotate({
18682 "description": "The type of the shell call output. Always `shell_call_output`."
18683 }),
18684 "id": Schema.String.annotate({
18685 "description": "The unique ID of the shell call output. Populated when this item is returned via API."
18686 }),
18687 "call_id": Schema.String.annotate({ "description": "The unique ID of the shell tool call generated by the model." }),
18688 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
18689 "description": "The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`."
18690 }),
18691 "output": Schema.Array(FunctionShellCallOutputContent).annotate({
18692 "description": "An array of shell call output contents"
18693 }),
18694 "max_output_length": Schema.Union([
18695 Schema.Number.annotate({
18696 "description":
18697 "The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output."
18698 }).check(Schema.isInt()),
18699 Schema.Null
18700 ]),
18701 "created_by": Schema.optionalKey(
18702 Schema.String.annotate({ "description": "The identifier of the actor that created the item." })
18703 )
18704}).annotate({ "title": "Shell call output", "description": "The output of a shell tool call that was emitted." })
18705export type ImagesResponse = {
18706 readonly "created": number
18707 readonly "data"?: ReadonlyArray<Image>
18708 readonly "background"?: "transparent" | "opaque"
18709 readonly "output_format"?: "png" | "webp" | "jpeg"
18710 readonly "size"?: "1024x1024" | "1024x1536" | "1536x1024"
18711 readonly "quality"?: "low" | "medium" | "high"
18712 readonly "usage"?: ImageGenUsage
18713}
18714export const ImagesResponse = Schema.Struct({
18715 "created": Schema.Number.annotate({
18716 "description": "The Unix timestamp (in seconds) of when the image was created.",
18717 "format": "unixtime"
18718 }).check(Schema.isInt()),
18719 "data": Schema.optionalKey(Schema.Array(Image).annotate({ "description": "The list of generated images." })),
18720 "background": Schema.optionalKey(
18721 Schema.Literals(["transparent", "opaque"]).annotate({
18722 "description": "The background parameter used for the image generation. Either `transparent` or `opaque`."
18723 })
18724 ),
18725 "output_format": Schema.optionalKey(
18726 Schema.Literals(["png", "webp", "jpeg"]).annotate({
18727 "description": "The output format of the image generation. Either `png`, `webp`, or `jpeg`."
18728 })
18729 ),
18730 "size": Schema.optionalKey(
18731 Schema.Literals(["1024x1024", "1024x1536", "1536x1024"]).annotate({
18732 "description": "The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`."
18733 })
18734 ),
18735 "quality": Schema.optionalKey(
18736 Schema.Literals(["low", "medium", "high"]).annotate({
18737 "description": "The quality of the image generated. Either `low`, `medium`, or `high`."
18738 })
18739 ),
18740 "usage": Schema.optionalKey(ImageGenUsage)
18741}).annotate({ "title": "Image generation response", "description": "The response from the image generation endpoint." })
18742export type AssistantMessageItem = {
18743 readonly "id": string
18744 readonly "object": "chatkit.thread_item"
18745 readonly "created_at": number
18746 readonly "thread_id": string
18747 readonly "type": "chatkit.assistant_message"
18748 readonly "content": ReadonlyArray<ResponseOutputText>
18749}
18750export const AssistantMessageItem = Schema.Struct({
18751 "id": Schema.String.annotate({ "description": "Identifier of the thread item." }),
18752 "object": Schema.Literal("chatkit.thread_item").annotate({
18753 "description": "Type discriminator that is always `chatkit.thread_item`."
18754 }),
18755 "created_at": Schema.Number.annotate({
18756 "description": "Unix timestamp (in seconds) for when the item was created.",
18757 "format": "unixtime"
18758 }).check(Schema.isInt()),
18759 "thread_id": Schema.String.annotate({ "description": "Identifier of the parent thread." }),
18760 "type": Schema.Literal("chatkit.assistant_message").annotate({
18761 "description": "Type discriminator that is always `chatkit.assistant_message`."
18762 }),
18763 "content": Schema.Array(ResponseOutputText).annotate({ "description": "Ordered assistant response segments." })
18764}).annotate({ "title": "Assistant message", "description": "Assistant-authored message within a thread." })
18765export type ThreadListResource = {
18766 readonly "object": "list"
18767 readonly "data": ReadonlyArray<ThreadResource>
18768 readonly "first_id": string | null
18769 readonly "last_id": string | null
18770 readonly "has_more": boolean
18771}
18772export const ThreadListResource = Schema.Struct({
18773 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
18774 "data": Schema.Array(ThreadResource).annotate({ "description": "A list of items" }),
18775 "first_id": Schema.Union([
18776 Schema.String.annotate({ "description": "The ID of the first item in the list." }),
18777 Schema.Null
18778 ]),
18779 "last_id": Schema.Union([
18780 Schema.String.annotate({ "description": "The ID of the last item in the list." }),
18781 Schema.Null
18782 ]),
18783 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." })
18784}).annotate({ "title": "Threads", "description": "A paginated list of ChatKit threads." })
18785export type AuditLog = {
18786 readonly "id": string
18787 readonly "type": AuditLogEventType
18788 readonly "effective_at": number
18789 readonly "project"?: { readonly "id"?: string; readonly "name"?: string }
18790 readonly "actor"?: AuditLogActor | null
18791 readonly "api_key.created"?: {
18792 readonly "id"?: string
18793 readonly "data"?: { readonly "scopes"?: ReadonlyArray<string> }
18794 }
18795 readonly "api_key.updated"?: {
18796 readonly "id"?: string
18797 readonly "changes_requested"?: { readonly "scopes"?: ReadonlyArray<string> }
18798 }
18799 readonly "api_key.deleted"?: { readonly "id"?: string }
18800 readonly "checkpoint.permission.created"?: {
18801 readonly "id"?: string
18802 readonly "data"?: { readonly "project_id"?: string; readonly "fine_tuned_model_checkpoint"?: string }
18803 }
18804 readonly "checkpoint.permission.deleted"?: { readonly "id"?: string }
18805 readonly "external_key.registered"?: { readonly "id"?: string; readonly "data"?: {} }
18806 readonly "external_key.removed"?: { readonly "id"?: string }
18807 readonly "group.created"?: { readonly "id"?: string; readonly "data"?: { readonly "group_name"?: string } }
18808 readonly "group.updated"?: {
18809 readonly "id"?: string
18810 readonly "changes_requested"?: { readonly "group_name"?: string }
18811 }
18812 readonly "group.deleted"?: { readonly "id"?: string }
18813 readonly "scim.enabled"?: { readonly "id"?: string }
18814 readonly "scim.disabled"?: { readonly "id"?: string }
18815 readonly "invite.sent"?: {
18816 readonly "id"?: string
18817 readonly "data"?: { readonly "email"?: string; readonly "role"?: string }
18818 }
18819 readonly "invite.accepted"?: { readonly "id"?: string }
18820 readonly "invite.deleted"?: { readonly "id"?: string }
18821 readonly "ip_allowlist.created"?: {
18822 readonly "id"?: string
18823 readonly "name"?: string
18824 readonly "allowed_ips"?: ReadonlyArray<string>
18825 }
18826 readonly "ip_allowlist.updated"?: { readonly "id"?: string; readonly "allowed_ips"?: ReadonlyArray<string> }
18827 readonly "ip_allowlist.deleted"?: {
18828 readonly "id"?: string
18829 readonly "name"?: string
18830 readonly "allowed_ips"?: ReadonlyArray<string>
18831 }
18832 readonly "ip_allowlist.config.activated"?: {
18833 readonly "configs"?: ReadonlyArray<{ readonly "id"?: string; readonly "name"?: string }>
18834 }
18835 readonly "ip_allowlist.config.deactivated"?: {
18836 readonly "configs"?: ReadonlyArray<{ readonly "id"?: string; readonly "name"?: string }>
18837 }
18838 readonly "login.succeeded"?: {}
18839 readonly "login.failed"?: { readonly "error_code"?: string; readonly "error_message"?: string }
18840 readonly "logout.succeeded"?: {}
18841 readonly "logout.failed"?: { readonly "error_code"?: string; readonly "error_message"?: string }
18842 readonly "organization.updated"?: {
18843 readonly "id"?: string
18844 readonly "changes_requested"?: {
18845 readonly "title"?: string
18846 readonly "description"?: string
18847 readonly "name"?: string
18848 readonly "threads_ui_visibility"?: string
18849 readonly "usage_dashboard_visibility"?: string
18850 readonly "api_call_logging"?: string
18851 readonly "api_call_logging_project_ids"?: string
18852 }
18853 }
18854 readonly "project.created"?: {
18855 readonly "id"?: string
18856 readonly "data"?: { readonly "name"?: string; readonly "title"?: string }
18857 }
18858 readonly "project.updated"?: { readonly "id"?: string; readonly "changes_requested"?: { readonly "title"?: string } }
18859 readonly "project.archived"?: { readonly "id"?: string }
18860 readonly "project.deleted"?: { readonly "id"?: string }
18861 readonly "rate_limit.updated"?: {
18862 readonly "id"?: string
18863 readonly "changes_requested"?: {
18864 readonly "max_requests_per_1_minute"?: number
18865 readonly "max_tokens_per_1_minute"?: number
18866 readonly "max_images_per_1_minute"?: number
18867 readonly "max_audio_megabytes_per_1_minute"?: number
18868 readonly "max_requests_per_1_day"?: number
18869 readonly "batch_1_day_max_input_tokens"?: number
18870 }
18871 }
18872 readonly "rate_limit.deleted"?: { readonly "id"?: string }
18873 readonly "role.created"?: {
18874 readonly "id"?: string
18875 readonly "role_name"?: string
18876 readonly "permissions"?: ReadonlyArray<string>
18877 readonly "resource_type"?: string
18878 readonly "resource_id"?: string
18879 }
18880 readonly "role.updated"?: {
18881 readonly "id"?: string
18882 readonly "changes_requested"?: {
18883 readonly "role_name"?: string
18884 readonly "resource_id"?: string
18885 readonly "resource_type"?: string
18886 readonly "permissions_added"?: ReadonlyArray<string>
18887 readonly "permissions_removed"?: ReadonlyArray<string>
18888 readonly "description"?: string
18889 readonly "metadata"?: {}
18890 }
18891 }
18892 readonly "role.deleted"?: { readonly "id"?: string }
18893 readonly "role.assignment.created"?: {
18894 readonly "id"?: string
18895 readonly "principal_id"?: string
18896 readonly "principal_type"?: string
18897 readonly "resource_id"?: string
18898 readonly "resource_type"?: string
18899 }
18900 readonly "role.assignment.deleted"?: {
18901 readonly "id"?: string
18902 readonly "principal_id"?: string
18903 readonly "principal_type"?: string
18904 readonly "resource_id"?: string
18905 readonly "resource_type"?: string
18906 }
18907 readonly "service_account.created"?: { readonly "id"?: string; readonly "data"?: { readonly "role"?: string } }
18908 readonly "service_account.updated"?: {
18909 readonly "id"?: string
18910 readonly "changes_requested"?: { readonly "role"?: string }
18911 }
18912 readonly "service_account.deleted"?: { readonly "id"?: string }
18913 readonly "user.added"?: { readonly "id"?: string; readonly "data"?: { readonly "role"?: string } }
18914 readonly "user.updated"?: { readonly "id"?: string; readonly "changes_requested"?: { readonly "role"?: string } }
18915 readonly "user.deleted"?: { readonly "id"?: string }
18916 readonly "certificate.created"?: { readonly "id"?: string; readonly "name"?: string }
18917 readonly "certificate.updated"?: { readonly "id"?: string; readonly "name"?: string }
18918 readonly "certificate.deleted"?: { readonly "id"?: string; readonly "name"?: string; readonly "certificate"?: string }
18919 readonly "certificates.activated"?: {
18920 readonly "certificates"?: ReadonlyArray<{ readonly "id"?: string; readonly "name"?: string }>
18921 }
18922 readonly "certificates.deactivated"?: {
18923 readonly "certificates"?: ReadonlyArray<{ readonly "id"?: string; readonly "name"?: string }>
18924 }
18925}
18926export const AuditLog = Schema.Struct({
18927 "id": Schema.String.annotate({ "description": "The ID of this log." }),
18928 "type": AuditLogEventType,
18929 "effective_at": Schema.Number.annotate({
18930 "description": "The Unix timestamp (in seconds) of the event.",
18931 "format": "unixtime"
18932 }).check(Schema.isInt()),
18933 "project": Schema.optionalKey(
18934 Schema.Struct({
18935 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The project ID." })),
18936 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The project title." }))
18937 }).annotate({
18938 "description":
18939 "The project that the action was scoped to. Absent for actions not scoped to projects. Note that any admin actions taken via Admin API keys are associated with the default project."
18940 })
18941 ),
18942 "actor": Schema.optionalKey(Schema.Union([AuditLogActor, Schema.Null])),
18943 "api_key.created": Schema.optionalKey(
18944 Schema.Struct({
18945 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The tracking ID of the API key." })),
18946 "data": Schema.optionalKey(
18947 Schema.Struct({
18948 "scopes": Schema.optionalKey(
18949 Schema.Array(Schema.String).annotate({
18950 "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`"
18951 })
18952 )
18953 }).annotate({ "description": "The payload used to create the API key." })
18954 )
18955 }).annotate({ "description": "The details for events with this `type`." })
18956 ),
18957 "api_key.updated": Schema.optionalKey(
18958 Schema.Struct({
18959 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The tracking ID of the API key." })),
18960 "changes_requested": Schema.optionalKey(
18961 Schema.Struct({
18962 "scopes": Schema.optionalKey(
18963 Schema.Array(Schema.String).annotate({
18964 "description": "A list of scopes allowed for the API key, e.g. `[\"api.model.request\"]`"
18965 })
18966 )
18967 }).annotate({ "description": "The payload used to update the API key." })
18968 )
18969 }).annotate({ "description": "The details for events with this `type`." })
18970 ),
18971 "api_key.deleted": Schema.optionalKey(
18972 Schema.Struct({
18973 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The tracking ID of the API key." }))
18974 }).annotate({ "description": "The details for events with this `type`." })
18975 ),
18976 "checkpoint.permission.created": Schema.optionalKey(
18977 Schema.Struct({
18978 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the checkpoint permission." })),
18979 "data": Schema.optionalKey(
18980 Schema.Struct({
18981 "project_id": Schema.optionalKey(
18982 Schema.String.annotate({
18983 "description": "The ID of the project that the checkpoint permission was created for."
18984 })
18985 ),
18986 "fine_tuned_model_checkpoint": Schema.optionalKey(
18987 Schema.String.annotate({ "description": "The ID of the fine-tuned model checkpoint." })
18988 )
18989 }).annotate({ "description": "The payload used to create the checkpoint permission." })
18990 )
18991 }).annotate({
18992 "description": "The project and fine-tuned model checkpoint that the checkpoint permission was created for."
18993 })
18994 ),
18995 "checkpoint.permission.deleted": Schema.optionalKey(
18996 Schema.Struct({
18997 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the checkpoint permission." }))
18998 }).annotate({ "description": "The details for events with this `type`." })
18999 ),
19000 "external_key.registered": Schema.optionalKey(
19001 Schema.Struct({
19002 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the external key configuration." })),
19003 "data": Schema.optionalKey(
19004 Schema.Struct({}).annotate({ "description": "The configuration for the external key." })
19005 )
19006 }).annotate({ "description": "The details for events with this `type`." })
19007 ),
19008 "external_key.removed": Schema.optionalKey(
19009 Schema.Struct({
19010 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the external key configuration." }))
19011 }).annotate({ "description": "The details for events with this `type`." })
19012 ),
19013 "group.created": Schema.optionalKey(
19014 Schema.Struct({
19015 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the group." })),
19016 "data": Schema.optionalKey(
19017 Schema.Struct({
19018 "group_name": Schema.optionalKey(Schema.String.annotate({ "description": "The group name." }))
19019 }).annotate({ "description": "Information about the created group." })
19020 )
19021 }).annotate({ "description": "The details for events with this `type`." })
19022 ),
19023 "group.updated": Schema.optionalKey(
19024 Schema.Struct({
19025 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the group." })),
19026 "changes_requested": Schema.optionalKey(
19027 Schema.Struct({
19028 "group_name": Schema.optionalKey(Schema.String.annotate({ "description": "The updated group name." }))
19029 }).annotate({ "description": "The payload used to update the group." })
19030 )
19031 }).annotate({ "description": "The details for events with this `type`." })
19032 ),
19033 "group.deleted": Schema.optionalKey(
19034 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the group." })) })
19035 .annotate({ "description": "The details for events with this `type`." })
19036 ),
19037 "scim.enabled": Schema.optionalKey(
19038 Schema.Struct({
19039 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the SCIM was enabled for." }))
19040 }).annotate({ "description": "The details for events with this `type`." })
19041 ),
19042 "scim.disabled": Schema.optionalKey(
19043 Schema.Struct({
19044 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the SCIM was disabled for." }))
19045 }).annotate({ "description": "The details for events with this `type`." })
19046 ),
19047 "invite.sent": Schema.optionalKey(
19048 Schema.Struct({
19049 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the invite." })),
19050 "data": Schema.optionalKey(
19051 Schema.Struct({
19052 "email": Schema.optionalKey(
19053 Schema.String.annotate({ "description": "The email invited to the organization." })
19054 ),
19055 "role": Schema.optionalKey(
19056 Schema.String.annotate({
19057 "description": "The role the email was invited to be. Is either `owner` or `member`."
19058 })
19059 )
19060 }).annotate({ "description": "The payload used to create the invite." })
19061 )
19062 }).annotate({ "description": "The details for events with this `type`." })
19063 ),
19064 "invite.accepted": Schema.optionalKey(
19065 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the invite." })) })
19066 .annotate({ "description": "The details for events with this `type`." })
19067 ),
19068 "invite.deleted": Schema.optionalKey(
19069 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the invite." })) })
19070 .annotate({ "description": "The details for events with this `type`." })
19071 ),
19072 "ip_allowlist.created": Schema.optionalKey(
19073 Schema.Struct({
19074 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the IP allowlist configuration." })),
19075 "name": Schema.optionalKey(
19076 Schema.String.annotate({ "description": "The name of the IP allowlist configuration." })
19077 ),
19078 "allowed_ips": Schema.optionalKey(
19079 Schema.Array(Schema.String).annotate({
19080 "description": "The IP addresses or CIDR ranges included in the configuration."
19081 })
19082 )
19083 }).annotate({ "description": "The details for events with this `type`." })
19084 ),
19085 "ip_allowlist.updated": Schema.optionalKey(
19086 Schema.Struct({
19087 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the IP allowlist configuration." })),
19088 "allowed_ips": Schema.optionalKey(
19089 Schema.Array(Schema.String).annotate({
19090 "description": "The updated set of IP addresses or CIDR ranges in the configuration."
19091 })
19092 )
19093 }).annotate({ "description": "The details for events with this `type`." })
19094 ),
19095 "ip_allowlist.deleted": Schema.optionalKey(
19096 Schema.Struct({
19097 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The ID of the IP allowlist configuration." })),
19098 "name": Schema.optionalKey(
19099 Schema.String.annotate({ "description": "The name of the IP allowlist configuration." })
19100 ),
19101 "allowed_ips": Schema.optionalKey(
19102 Schema.Array(Schema.String).annotate({
19103 "description": "The IP addresses or CIDR ranges that were in the configuration."
19104 })
19105 )
19106 }).annotate({ "description": "The details for events with this `type`." })
19107 ),
19108 "ip_allowlist.config.activated": Schema.optionalKey(
19109 Schema.Struct({
19110 "configs": Schema.optionalKey(
19111 Schema.Array(
19112 Schema.Struct({
19113 "id": Schema.optionalKey(
19114 Schema.String.annotate({ "description": "The ID of the IP allowlist configuration." })
19115 ),
19116 "name": Schema.optionalKey(
19117 Schema.String.annotate({ "description": "The name of the IP allowlist configuration." })
19118 )
19119 })
19120 ).annotate({ "description": "The configurations that were activated." })
19121 )
19122 }).annotate({ "description": "The details for events with this `type`." })
19123 ),
19124 "ip_allowlist.config.deactivated": Schema.optionalKey(
19125 Schema.Struct({
19126 "configs": Schema.optionalKey(
19127 Schema.Array(
19128 Schema.Struct({
19129 "id": Schema.optionalKey(
19130 Schema.String.annotate({ "description": "The ID of the IP allowlist configuration." })
19131 ),
19132 "name": Schema.optionalKey(
19133 Schema.String.annotate({ "description": "The name of the IP allowlist configuration." })
19134 )
19135 })
19136 ).annotate({ "description": "The configurations that were deactivated." })
19137 )
19138 }).annotate({ "description": "The details for events with this `type`." })
19139 ),
19140 "login.succeeded": Schema.optionalKey(
19141 Schema.Struct({}).annotate({
19142 "description": "This event has no additional fields beyond the standard audit log attributes."
19143 })
19144 ),
19145 "login.failed": Schema.optionalKey(
19146 Schema.Struct({
19147 "error_code": Schema.optionalKey(Schema.String.annotate({ "description": "The error code of the failure." })),
19148 "error_message": Schema.optionalKey(
19149 Schema.String.annotate({ "description": "The error message of the failure." })
19150 )
19151 }).annotate({ "description": "The details for events with this `type`." })
19152 ),
19153 "logout.succeeded": Schema.optionalKey(
19154 Schema.Struct({}).annotate({
19155 "description": "This event has no additional fields beyond the standard audit log attributes."
19156 })
19157 ),
19158 "logout.failed": Schema.optionalKey(
19159 Schema.Struct({
19160 "error_code": Schema.optionalKey(Schema.String.annotate({ "description": "The error code of the failure." })),
19161 "error_message": Schema.optionalKey(
19162 Schema.String.annotate({ "description": "The error message of the failure." })
19163 )
19164 }).annotate({ "description": "The details for events with this `type`." })
19165 ),
19166 "organization.updated": Schema.optionalKey(
19167 Schema.Struct({
19168 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The organization ID." })),
19169 "changes_requested": Schema.optionalKey(
19170 Schema.Struct({
19171 "title": Schema.optionalKey(Schema.String.annotate({ "description": "The organization title." })),
19172 "description": Schema.optionalKey(Schema.String.annotate({ "description": "The organization description." })),
19173 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The organization name." })),
19174 "threads_ui_visibility": Schema.optionalKey(
19175 Schema.String.annotate({
19176 "description":
19177 "Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`."
19178 })
19179 ),
19180 "usage_dashboard_visibility": Schema.optionalKey(
19181 Schema.String.annotate({
19182 "description":
19183 "Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`."
19184 })
19185 ),
19186 "api_call_logging": Schema.optionalKey(
19187 Schema.String.annotate({
19188 "description":
19189 "How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects`"
19190 })
19191 ),
19192 "api_call_logging_project_ids": Schema.optionalKey(
19193 Schema.String.annotate({
19194 "description": "The list of project ids if api_call_logging is set to `enabled_for_selected_projects`"
19195 })
19196 )
19197 }).annotate({ "description": "The payload used to update the organization settings." })
19198 )
19199 }).annotate({ "description": "The details for events with this `type`." })
19200 ),
19201 "project.created": Schema.optionalKey(
19202 Schema.Struct({
19203 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The project ID." })),
19204 "data": Schema.optionalKey(
19205 Schema.Struct({
19206 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The project name." })),
19207 "title": Schema.optionalKey(
19208 Schema.String.annotate({ "description": "The title of the project as seen on the dashboard." })
19209 )
19210 }).annotate({ "description": "The payload used to create the project." })
19211 )
19212 }).annotate({ "description": "The details for events with this `type`." })
19213 ),
19214 "project.updated": Schema.optionalKey(
19215 Schema.Struct({
19216 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The project ID." })),
19217 "changes_requested": Schema.optionalKey(
19218 Schema.Struct({
19219 "title": Schema.optionalKey(
19220 Schema.String.annotate({ "description": "The title of the project as seen on the dashboard." })
19221 )
19222 }).annotate({ "description": "The payload used to update the project." })
19223 )
19224 }).annotate({ "description": "The details for events with this `type`." })
19225 ),
19226 "project.archived": Schema.optionalKey(
19227 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The project ID." })) }).annotate({
19228 "description": "The details for events with this `type`."
19229 })
19230 ),
19231 "project.deleted": Schema.optionalKey(
19232 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The project ID." })) }).annotate({
19233 "description": "The details for events with this `type`."
19234 })
19235 ),
19236 "rate_limit.updated": Schema.optionalKey(
19237 Schema.Struct({
19238 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The rate limit ID" })),
19239 "changes_requested": Schema.optionalKey(
19240 Schema.Struct({
19241 "max_requests_per_1_minute": Schema.optionalKey(
19242 Schema.Number.annotate({ "description": "The maximum requests per minute." }).check(Schema.isInt())
19243 ),
19244 "max_tokens_per_1_minute": Schema.optionalKey(
19245 Schema.Number.annotate({ "description": "The maximum tokens per minute." }).check(Schema.isInt())
19246 ),
19247 "max_images_per_1_minute": Schema.optionalKey(
19248 Schema.Number.annotate({
19249 "description": "The maximum images per minute. Only relevant for certain models."
19250 }).check(Schema.isInt())
19251 ),
19252 "max_audio_megabytes_per_1_minute": Schema.optionalKey(
19253 Schema.Number.annotate({
19254 "description": "The maximum audio megabytes per minute. Only relevant for certain models."
19255 }).check(Schema.isInt())
19256 ),
19257 "max_requests_per_1_day": Schema.optionalKey(
19258 Schema.Number.annotate({ "description": "The maximum requests per day. Only relevant for certain models." })
19259 .check(Schema.isInt())
19260 ),
19261 "batch_1_day_max_input_tokens": Schema.optionalKey(
19262 Schema.Number.annotate({
19263 "description": "The maximum batch input tokens per day. Only relevant for certain models."
19264 }).check(Schema.isInt())
19265 )
19266 }).annotate({ "description": "The payload used to update the rate limits." })
19267 )
19268 }).annotate({ "description": "The details for events with this `type`." })
19269 ),
19270 "rate_limit.deleted": Schema.optionalKey(
19271 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The rate limit ID" })) })
19272 .annotate({ "description": "The details for events with this `type`." })
19273 ),
19274 "role.created": Schema.optionalKey(
19275 Schema.Struct({
19276 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The role ID." })),
19277 "role_name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the role." })),
19278 "permissions": Schema.optionalKey(
19279 Schema.Array(Schema.String).annotate({ "description": "The permissions granted by the role." })
19280 ),
19281 "resource_type": Schema.optionalKey(
19282 Schema.String.annotate({ "description": "The type of resource the role belongs to." })
19283 ),
19284 "resource_id": Schema.optionalKey(
19285 Schema.String.annotate({ "description": "The resource the role is scoped to." })
19286 )
19287 }).annotate({ "description": "The details for events with this `type`." })
19288 ),
19289 "role.updated": Schema.optionalKey(
19290 Schema.Struct({
19291 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The role ID." })),
19292 "changes_requested": Schema.optionalKey(
19293 Schema.Struct({
19294 "role_name": Schema.optionalKey(
19295 Schema.String.annotate({ "description": "The updated role name, when provided." })
19296 ),
19297 "resource_id": Schema.optionalKey(
19298 Schema.String.annotate({ "description": "The resource the role is scoped to." })
19299 ),
19300 "resource_type": Schema.optionalKey(
19301 Schema.String.annotate({ "description": "The type of resource the role belongs to." })
19302 ),
19303 "permissions_added": Schema.optionalKey(
19304 Schema.Array(Schema.String).annotate({ "description": "The permissions added to the role." })
19305 ),
19306 "permissions_removed": Schema.optionalKey(
19307 Schema.Array(Schema.String).annotate({ "description": "The permissions removed from the role." })
19308 ),
19309 "description": Schema.optionalKey(
19310 Schema.String.annotate({ "description": "The updated role description, when provided." })
19311 ),
19312 "metadata": Schema.optionalKey(
19313 Schema.Struct({}).annotate({ "description": "Additional metadata stored on the role." })
19314 )
19315 }).annotate({ "description": "The payload used to update the role." })
19316 )
19317 }).annotate({ "description": "The details for events with this `type`." })
19318 ),
19319 "role.deleted": Schema.optionalKey(
19320 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The role ID." })) }).annotate({
19321 "description": "The details for events with this `type`."
19322 })
19323 ),
19324 "role.assignment.created": Schema.optionalKey(
19325 Schema.Struct({
19326 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The identifier of the role assignment." })),
19327 "principal_id": Schema.optionalKey(
19328 Schema.String.annotate({ "description": "The principal (user or group) that received the role." })
19329 ),
19330 "principal_type": Schema.optionalKey(
19331 Schema.String.annotate({ "description": "The type of principal (user or group) that received the role." })
19332 ),
19333 "resource_id": Schema.optionalKey(
19334 Schema.String.annotate({ "description": "The resource the role assignment is scoped to." })
19335 ),
19336 "resource_type": Schema.optionalKey(
19337 Schema.String.annotate({ "description": "The type of resource the role assignment is scoped to." })
19338 )
19339 }).annotate({ "description": "The details for events with this `type`." })
19340 ),
19341 "role.assignment.deleted": Schema.optionalKey(
19342 Schema.Struct({
19343 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The identifier of the role assignment." })),
19344 "principal_id": Schema.optionalKey(
19345 Schema.String.annotate({ "description": "The principal (user or group) that had the role removed." })
19346 ),
19347 "principal_type": Schema.optionalKey(
19348 Schema.String.annotate({ "description": "The type of principal (user or group) that had the role removed." })
19349 ),
19350 "resource_id": Schema.optionalKey(
19351 Schema.String.annotate({ "description": "The resource the role assignment was scoped to." })
19352 ),
19353 "resource_type": Schema.optionalKey(
19354 Schema.String.annotate({ "description": "The type of resource the role assignment was scoped to." })
19355 )
19356 }).annotate({ "description": "The details for events with this `type`." })
19357 ),
19358 "service_account.created": Schema.optionalKey(
19359 Schema.Struct({
19360 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The service account ID." })),
19361 "data": Schema.optionalKey(
19362 Schema.Struct({
19363 "role": Schema.optionalKey(
19364 Schema.String.annotate({ "description": "The role of the service account. Is either `owner` or `member`." })
19365 )
19366 }).annotate({ "description": "The payload used to create the service account." })
19367 )
19368 }).annotate({ "description": "The details for events with this `type`." })
19369 ),
19370 "service_account.updated": Schema.optionalKey(
19371 Schema.Struct({
19372 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The service account ID." })),
19373 "changes_requested": Schema.optionalKey(
19374 Schema.Struct({
19375 "role": Schema.optionalKey(
19376 Schema.String.annotate({ "description": "The role of the service account. Is either `owner` or `member`." })
19377 )
19378 }).annotate({ "description": "The payload used to updated the service account." })
19379 )
19380 }).annotate({ "description": "The details for events with this `type`." })
19381 ),
19382 "service_account.deleted": Schema.optionalKey(
19383 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The service account ID." })) })
19384 .annotate({ "description": "The details for events with this `type`." })
19385 ),
19386 "user.added": Schema.optionalKey(
19387 Schema.Struct({
19388 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The user ID." })),
19389 "data": Schema.optionalKey(
19390 Schema.Struct({
19391 "role": Schema.optionalKey(
19392 Schema.String.annotate({ "description": "The role of the user. Is either `owner` or `member`." })
19393 )
19394 }).annotate({ "description": "The payload used to add the user to the project." })
19395 )
19396 }).annotate({ "description": "The details for events with this `type`." })
19397 ),
19398 "user.updated": Schema.optionalKey(
19399 Schema.Struct({
19400 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The project ID." })),
19401 "changes_requested": Schema.optionalKey(
19402 Schema.Struct({
19403 "role": Schema.optionalKey(
19404 Schema.String.annotate({ "description": "The role of the user. Is either `owner` or `member`." })
19405 )
19406 }).annotate({ "description": "The payload used to update the user." })
19407 )
19408 }).annotate({ "description": "The details for events with this `type`." })
19409 ),
19410 "user.deleted": Schema.optionalKey(
19411 Schema.Struct({ "id": Schema.optionalKey(Schema.String.annotate({ "description": "The user ID." })) }).annotate({
19412 "description": "The details for events with this `type`."
19413 })
19414 ),
19415 "certificate.created": Schema.optionalKey(
19416 Schema.Struct({
19417 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The certificate ID." })),
19418 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the certificate." }))
19419 }).annotate({ "description": "The details for events with this `type`." })
19420 ),
19421 "certificate.updated": Schema.optionalKey(
19422 Schema.Struct({
19423 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The certificate ID." })),
19424 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the certificate." }))
19425 }).annotate({ "description": "The details for events with this `type`." })
19426 ),
19427 "certificate.deleted": Schema.optionalKey(
19428 Schema.Struct({
19429 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The certificate ID." })),
19430 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the certificate." })),
19431 "certificate": Schema.optionalKey(
19432 Schema.String.annotate({ "description": "The certificate content in PEM format." })
19433 )
19434 }).annotate({ "description": "The details for events with this `type`." })
19435 ),
19436 "certificates.activated": Schema.optionalKey(
19437 Schema.Struct({
19438 "certificates": Schema.optionalKey(
19439 Schema.Array(
19440 Schema.Struct({
19441 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The certificate ID." })),
19442 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the certificate." }))
19443 })
19444 )
19445 )
19446 }).annotate({ "description": "The details for events with this `type`." })
19447 ),
19448 "certificates.deactivated": Schema.optionalKey(
19449 Schema.Struct({
19450 "certificates": Schema.optionalKey(
19451 Schema.Array(
19452 Schema.Struct({
19453 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The certificate ID." })),
19454 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the certificate." }))
19455 })
19456 )
19457 )
19458 }).annotate({ "description": "The details for events with this `type`." })
19459 )
19460}).annotate({ "description": "A log of a user action or configuration change within this organization." })
19461export type CreateChatCompletionResponse = {
19462 readonly "id": string
19463 readonly "choices": ReadonlyArray<
19464 {
19465 readonly "finish_reason": "stop" | "length" | "tool_calls" | "content_filter" | "function_call"
19466 readonly "index": number
19467 readonly "message": ChatCompletionResponseMessage
19468 readonly "logprobs": {
19469 readonly "content": ReadonlyArray<ChatCompletionTokenLogprob> | null
19470 readonly "refusal": ReadonlyArray<ChatCompletionTokenLogprob> | null
19471 } | null
19472 }
19473 >
19474 readonly "created": number
19475 readonly "model": string
19476 readonly "service_tier"?: ServiceTier
19477 readonly "system_fingerprint"?: string
19478 readonly "object": "chat.completion"
19479 readonly "usage"?: CompletionUsage
19480}
19481export const CreateChatCompletionResponse = Schema.Struct({
19482 "id": Schema.String.annotate({ "description": "A unique identifier for the chat completion." }),
19483 "choices": Schema.Array(Schema.Struct({
19484 "finish_reason": Schema.Literals(["stop", "length", "tool_calls", "content_filter", "function_call"]).annotate({
19485 "description":
19486 "The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,\n`length` if the maximum number of tokens specified in the request was reached,\n`content_filter` if content was omitted due to a flag from our content filters,\n`tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.\n"
19487 }),
19488 "index": Schema.Number.annotate({ "description": "The index of the choice in the list of choices." }).check(
19489 Schema.isInt()
19490 ),
19491 "message": ChatCompletionResponseMessage,
19492 "logprobs": Schema.Union([
19493 Schema.Struct({
19494 "content": Schema.Union([
19495 Schema.Array(ChatCompletionTokenLogprob).annotate({
19496 "description": "A list of message content tokens with log probability information."
19497 }),
19498 Schema.Null
19499 ]),
19500 "refusal": Schema.Union([
19501 Schema.Array(ChatCompletionTokenLogprob).annotate({
19502 "description": "A list of message refusal tokens with log probability information."
19503 }),
19504 Schema.Null
19505 ])
19506 }).annotate({ "description": "Log probability information for the choice." }),
19507 Schema.Null
19508 ])
19509 })).annotate({ "description": "A list of chat completion choices. Can be more than one if `n` is greater than 1." }),
19510 "created": Schema.Number.annotate({
19511 "description": "The Unix timestamp (in seconds) of when the chat completion was created.",
19512 "format": "unixtime"
19513 }).check(Schema.isInt()),
19514 "model": Schema.String.annotate({ "description": "The model used for the chat completion." }),
19515 "service_tier": Schema.optionalKey(ServiceTier),
19516 "system_fingerprint": Schema.optionalKey(
19517 Schema.String.annotate({
19518 "description":
19519 "This fingerprint represents the backend configuration that the model runs with.\n\nCan be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.\n"
19520 })
19521 ),
19522 "object": Schema.Literal("chat.completion").annotate({
19523 "description": "The object type, which is always `chat.completion`."
19524 }),
19525 "usage": Schema.optionalKey(CompletionUsage)
19526}).annotate({ "description": "Represents a chat completion response returned by model, based on the provided input." })
19527export type ChatCompletionRequestMessage =
19528 | ChatCompletionRequestDeveloperMessage
19529 | ChatCompletionRequestSystemMessage
19530 | ChatCompletionRequestUserMessage
19531 | ChatCompletionRequestAssistantMessage
19532 | ChatCompletionRequestToolMessage
19533 | ChatCompletionRequestFunctionMessage
19534export const ChatCompletionRequestMessage = Schema.Union([
19535 ChatCompletionRequestDeveloperMessage,
19536 ChatCompletionRequestSystemMessage,
19537 ChatCompletionRequestUserMessage,
19538 ChatCompletionRequestAssistantMessage,
19539 ChatCompletionRequestToolMessage,
19540 ChatCompletionRequestFunctionMessage
19541], { mode: "oneOf" })
19542export type RunStepObject = {
19543 readonly "id": string
19544 readonly "object": "thread.run.step"
19545 readonly "created_at": number
19546 readonly "assistant_id": string
19547 readonly "thread_id": string
19548 readonly "run_id": string
19549 readonly "type": "message_creation" | "tool_calls"
19550 readonly "status": "in_progress" | "cancelled" | "failed" | "completed" | "expired"
19551 readonly "step_details": {
19552 readonly "type": "message_creation"
19553 readonly "message_creation": { readonly "message_id": string }
19554 } | {
19555 readonly "type": "tool_calls"
19556 readonly "tool_calls": ReadonlyArray<
19557 | RunStepDetailsToolCallsCodeObject
19558 | RunStepDetailsToolCallsFileSearchObject
19559 | RunStepDetailsToolCallsFunctionObject
19560 >
19561 }
19562 readonly "last_error": { readonly "code": "server_error" | "rate_limit_exceeded"; readonly "message": string } | null
19563 readonly "expired_at": number | null
19564 readonly "cancelled_at": number | null
19565 readonly "failed_at": number | null
19566 readonly "completed_at": number | null
19567 readonly "metadata": Metadata
19568 readonly "usage": RunStepCompletionUsage
19569}
19570export const RunStepObject = Schema.Struct({
19571 "id": Schema.String.annotate({
19572 "description": "The identifier of the run step, which can be referenced in API endpoints."
19573 }),
19574 "object": Schema.Literal("thread.run.step").annotate({
19575 "description": "The object type, which is always `thread.run.step`."
19576 }),
19577 "created_at": Schema.Number.annotate({
19578 "description": "The Unix timestamp (in seconds) for when the run step was created.",
19579 "format": "unixtime"
19580 }).check(Schema.isInt()),
19581 "assistant_id": Schema.String.annotate({
19582 "description": "The ID of the [assistant](/docs/api-reference/assistants) associated with the run step."
19583 }),
19584 "thread_id": Schema.String.annotate({
19585 "description": "The ID of the [thread](/docs/api-reference/threads) that was run."
19586 }),
19587 "run_id": Schema.String.annotate({
19588 "description": "The ID of the [run](/docs/api-reference/runs) that this run step is a part of."
19589 }),
19590 "type": Schema.Literals(["message_creation", "tool_calls"]).annotate({
19591 "description": "The type of run step, which can be either `message_creation` or `tool_calls`."
19592 }),
19593 "status": Schema.Literals(["in_progress", "cancelled", "failed", "completed", "expired"]).annotate({
19594 "description":
19595 "The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`."
19596 }),
19597 "step_details": Schema.Union([
19598 Schema.Struct({
19599 "type": Schema.Literal("message_creation").annotate({ "description": "Always `message_creation`." }),
19600 "message_creation": Schema.Struct({
19601 "message_id": Schema.String.annotate({
19602 "description": "The ID of the message that was created by this run step."
19603 })
19604 })
19605 }).annotate({ "title": "Message creation", "description": "The details of the run step." }),
19606 Schema.Struct({
19607 "type": Schema.Literal("tool_calls").annotate({ "description": "Always `tool_calls`." }),
19608 "tool_calls": Schema.Array(
19609 Schema.Union([
19610 RunStepDetailsToolCallsCodeObject,
19611 RunStepDetailsToolCallsFileSearchObject,
19612 RunStepDetailsToolCallsFunctionObject
19613 ], { mode: "oneOf" })
19614 ).annotate({
19615 "description":
19616 "An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n"
19617 })
19618 }).annotate({ "title": "Tool calls", "description": "The details of the run step." })
19619 ], { mode: "oneOf" }),
19620 "last_error": Schema.Union([
19621 Schema.Struct({
19622 "code": Schema.Literals(["server_error", "rate_limit_exceeded"]).annotate({
19623 "description": "One of `server_error` or `rate_limit_exceeded`."
19624 }),
19625 "message": Schema.String.annotate({ "description": "A human-readable description of the error." })
19626 }).annotate({
19627 "description": "The last error associated with this run step. Will be `null` if there are no errors."
19628 }),
19629 Schema.Null
19630 ]),
19631 "expired_at": Schema.Union([
19632 Schema.Number.annotate({
19633 "description":
19634 "The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.",
19635 "format": "unixtime"
19636 }).check(Schema.isInt()),
19637 Schema.Null
19638 ]),
19639 "cancelled_at": Schema.Union([
19640 Schema.Number.annotate({
19641 "description": "The Unix timestamp (in seconds) for when the run step was cancelled.",
19642 "format": "unixtime"
19643 }).check(Schema.isInt()),
19644 Schema.Null
19645 ]),
19646 "failed_at": Schema.Union([
19647 Schema.Number.annotate({
19648 "description": "The Unix timestamp (in seconds) for when the run step failed.",
19649 "format": "unixtime"
19650 }).check(Schema.isInt()),
19651 Schema.Null
19652 ]),
19653 "completed_at": Schema.Union([
19654 Schema.Number.annotate({
19655 "description": "The Unix timestamp (in seconds) for when the run step completed.",
19656 "format": "unixtime"
19657 }).check(Schema.isInt()),
19658 Schema.Null
19659 ]),
19660 "metadata": Metadata,
19661 "usage": RunStepCompletionUsage
19662}).annotate({ "title": "Run steps", "description": "Represents a step in execution of a run.\n" })
19663export type ListMessagesResponse = {
19664 readonly "object": string
19665 readonly "data": ReadonlyArray<MessageObject>
19666 readonly "first_id": string
19667 readonly "last_id": string
19668 readonly "has_more": boolean
19669 readonly [x: string]: unknown
19670}
19671export const ListMessagesResponse = Schema.StructWithRest(
19672 Schema.Struct({
19673 "object": Schema.String,
19674 "data": Schema.Array(MessageObject),
19675 "first_id": Schema.String,
19676 "last_id": Schema.String,
19677 "has_more": Schema.Boolean
19678 }),
19679 [Schema.Record(Schema.String, Schema.Json)]
19680)
19681export type MessageStreamEvent =
19682 | { readonly "event": "thread.message.created"; readonly "data": MessageObject }
19683 | { readonly "event": "thread.message.in_progress"; readonly "data": MessageObject }
19684 | { readonly "event": "thread.message.delta"; readonly "data": MessageDeltaObject }
19685 | { readonly "event": "thread.message.completed"; readonly "data": MessageObject }
19686 | { readonly "event": "thread.message.incomplete"; readonly "data": MessageObject }
19687export const MessageStreamEvent = Schema.Union([
19688 Schema.Struct({ "event": Schema.Literal("thread.message.created"), "data": MessageObject }).annotate({
19689 "description": "Occurs when a [message](/docs/api-reference/messages/object) is created."
19690 }),
19691 Schema.Struct({ "event": Schema.Literal("thread.message.in_progress"), "data": MessageObject }).annotate({
19692 "description": "Occurs when a [message](/docs/api-reference/messages/object) moves to an `in_progress` state."
19693 }),
19694 Schema.Struct({ "event": Schema.Literal("thread.message.delta"), "data": MessageDeltaObject }).annotate({
19695 "description": "Occurs when parts of a [Message](/docs/api-reference/messages/object) are being streamed."
19696 }),
19697 Schema.Struct({ "event": Schema.Literal("thread.message.completed"), "data": MessageObject }).annotate({
19698 "description": "Occurs when a [message](/docs/api-reference/messages/object) is completed."
19699 }),
19700 Schema.Struct({ "event": Schema.Literal("thread.message.incomplete"), "data": MessageObject }).annotate({
19701 "description": "Occurs when a [message](/docs/api-reference/messages/object) ends before it is completed."
19702 })
19703], { mode: "oneOf" })
19704export type RealtimeBetaResponse = {
19705 readonly "id"?: string
19706 readonly "object"?: "realtime.response"
19707 readonly "status"?: "completed" | "cancelled" | "failed" | "incomplete" | "in_progress"
19708 readonly "status_details"?: {
19709 readonly "type"?: "completed" | "cancelled" | "failed" | "incomplete"
19710 readonly "reason"?: "turn_detected" | "client_cancelled" | "max_output_tokens" | "content_filter"
19711 readonly "error"?: { readonly "type"?: string; readonly "code"?: string }
19712 }
19713 readonly "output"?: ReadonlyArray<RealtimeConversationItem>
19714 readonly "metadata"?: Metadata
19715 readonly "usage"?: {
19716 readonly "total_tokens"?: number
19717 readonly "input_tokens"?: number
19718 readonly "output_tokens"?: number
19719 readonly "input_token_details"?: {
19720 readonly "cached_tokens"?: number
19721 readonly "text_tokens"?: number
19722 readonly "image_tokens"?: number
19723 readonly "audio_tokens"?: number
19724 readonly "cached_tokens_details"?: {
19725 readonly "text_tokens"?: number
19726 readonly "image_tokens"?: number
19727 readonly "audio_tokens"?: number
19728 }
19729 }
19730 readonly "output_token_details"?: { readonly "text_tokens"?: number; readonly "audio_tokens"?: number }
19731 }
19732 readonly "conversation_id"?: string
19733 readonly "voice"?:
19734 | string
19735 | "alloy"
19736 | "ash"
19737 | "ballad"
19738 | "coral"
19739 | "echo"
19740 | "sage"
19741 | "shimmer"
19742 | "verse"
19743 | "marin"
19744 | "cedar"
19745 readonly "modalities"?: ReadonlyArray<"text" | "audio">
19746 readonly "output_audio_format"?: "pcm16" | "g711_ulaw" | "g711_alaw"
19747 readonly "temperature"?: number
19748 readonly "max_output_tokens"?: number | "inf"
19749}
19750export const RealtimeBetaResponse = Schema.Struct({
19751 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the response." })),
19752 "object": Schema.optionalKey(
19753 Schema.Literal("realtime.response").annotate({ "description": "The object type, must be `realtime.response`." })
19754 ),
19755 "status": Schema.optionalKey(
19756 Schema.Literals(["completed", "cancelled", "failed", "incomplete", "in_progress"]).annotate({
19757 "description":
19758 "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n"
19759 })
19760 ),
19761 "status_details": Schema.optionalKey(
19762 Schema.Struct({
19763 "type": Schema.optionalKey(
19764 Schema.Literals(["completed", "cancelled", "failed", "incomplete"]).annotate({
19765 "description":
19766 "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n"
19767 })
19768 ),
19769 "reason": Schema.optionalKey(
19770 Schema.Literals(["turn_detected", "client_cancelled", "max_output_tokens", "content_filter"]).annotate({
19771 "description":
19772 "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n"
19773 })
19774 ),
19775 "error": Schema.optionalKey(
19776 Schema.Struct({
19777 "type": Schema.optionalKey(Schema.String.annotate({ "description": "The type of error." })),
19778 "code": Schema.optionalKey(Schema.String.annotate({ "description": "Error code, if any." }))
19779 }).annotate({
19780 "description":
19781 "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n"
19782 })
19783 )
19784 }).annotate({ "description": "Additional details about the status." })
19785 ),
19786 "output": Schema.optionalKey(
19787 Schema.Array(RealtimeConversationItem).annotate({
19788 "description": "The list of output items generated by the response."
19789 })
19790 ),
19791 "metadata": Schema.optionalKey(Metadata),
19792 "usage": Schema.optionalKey(
19793 Schema.Struct({
19794 "total_tokens": Schema.optionalKey(
19795 Schema.Number.annotate({
19796 "description":
19797 "The total number of tokens in the Response including input and output \ntext and audio tokens.\n"
19798 }).check(Schema.isInt())
19799 ),
19800 "input_tokens": Schema.optionalKey(
19801 Schema.Number.annotate({
19802 "description": "The number of input tokens used in the Response, including text and \naudio tokens.\n"
19803 }).check(Schema.isInt())
19804 ),
19805 "output_tokens": Schema.optionalKey(
19806 Schema.Number.annotate({
19807 "description": "The number of output tokens sent in the Response, including text and \naudio tokens.\n"
19808 }).check(Schema.isInt())
19809 ),
19810 "input_token_details": Schema.optionalKey(
19811 Schema.Struct({
19812 "cached_tokens": Schema.optionalKey(
19813 Schema.Number.annotate({ "description": "The number of cached tokens used as input for the Response." })
19814 .check(Schema.isInt())
19815 ),
19816 "text_tokens": Schema.optionalKey(
19817 Schema.Number.annotate({ "description": "The number of text tokens used as input for the Response." })
19818 .check(Schema.isInt())
19819 ),
19820 "image_tokens": Schema.optionalKey(
19821 Schema.Number.annotate({ "description": "The number of image tokens used as input for the Response." })
19822 .check(Schema.isInt())
19823 ),
19824 "audio_tokens": Schema.optionalKey(
19825 Schema.Number.annotate({ "description": "The number of audio tokens used as input for the Response." })
19826 .check(Schema.isInt())
19827 ),
19828 "cached_tokens_details": Schema.optionalKey(
19829 Schema.Struct({
19830 "text_tokens": Schema.optionalKey(
19831 Schema.Number.annotate({
19832 "description": "The number of cached text tokens used as input for the Response."
19833 }).check(Schema.isInt())
19834 ),
19835 "image_tokens": Schema.optionalKey(
19836 Schema.Number.annotate({
19837 "description": "The number of cached image tokens used as input for the Response."
19838 }).check(Schema.isInt())
19839 ),
19840 "audio_tokens": Schema.optionalKey(
19841 Schema.Number.annotate({
19842 "description": "The number of cached audio tokens used as input for the Response."
19843 }).check(Schema.isInt())
19844 )
19845 }).annotate({ "description": "Details about the cached tokens used as input for the Response." })
19846 )
19847 }).annotate({ "description": "Details about the input tokens used in the Response." })
19848 ),
19849 "output_token_details": Schema.optionalKey(
19850 Schema.Struct({
19851 "text_tokens": Schema.optionalKey(
19852 Schema.Number.annotate({ "description": "The number of text tokens used in the Response." }).check(
19853 Schema.isInt()
19854 )
19855 ),
19856 "audio_tokens": Schema.optionalKey(
19857 Schema.Number.annotate({ "description": "The number of audio tokens used in the Response." }).check(
19858 Schema.isInt()
19859 )
19860 )
19861 }).annotate({ "description": "Details about the output tokens used in the Response." })
19862 )
19863 }).annotate({
19864 "description":
19865 "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n"
19866 })
19867 ),
19868 "conversation_id": Schema.optionalKey(Schema.String.annotate({
19869 "description":
19870 "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nby server VAD, the response will be added to the default conversation, thus\nthe `conversation_id` will be an id like `conv_1234`.\n"
19871 })),
19872 "voice": Schema.optionalKey(
19873 Schema.Union([
19874 Schema.String,
19875 Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"])
19876 ]).annotate({
19877 "description":
19878 "The voice the model used to respond.\nCurrent voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, and `verse`.\n"
19879 })
19880 ),
19881 "modalities": Schema.optionalKey(
19882 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
19883 "description":
19884 "The set of modalities the model used to respond. If there are multiple modalities,\nthe model will pick one, for example if `modalities` is `[\"text\", \"audio\"]`, the model\ncould be responding in either text or audio.\n"
19885 })
19886 ),
19887 "output_audio_format": Schema.optionalKey(
19888 Schema.Literals(["pcm16", "g711_ulaw", "g711_alaw"]).annotate({
19889 "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"
19890 })
19891 ),
19892 "temperature": Schema.optionalKey(
19893 Schema.Number.annotate({
19894 "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n"
19895 }).check(Schema.isFinite())
19896 ),
19897 "max_output_tokens": Schema.optionalKey(
19898 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
19899 "description":
19900 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n"
19901 })
19902 )
19903}).annotate({ "description": "The response resource." })
19904export type RealtimeBetaResponseCreateParams = {
19905 readonly "modalities"?: ReadonlyArray<"text" | "audio">
19906 readonly "instructions"?: string
19907 readonly "voice"?: VoiceIdsShared | { readonly "id": string }
19908 readonly "output_audio_format"?: "pcm16" | "g711_ulaw" | "g711_alaw"
19909 readonly "tools"?: ReadonlyArray<
19910 {
19911 readonly "type"?: "function"
19912 readonly "name"?: string
19913 readonly "description"?: string
19914 readonly "parameters"?: {}
19915 }
19916 >
19917 readonly "tool_choice"?: ToolChoiceOptions | ToolChoiceFunction | ToolChoiceMCP
19918 readonly "temperature"?: number
19919 readonly "max_output_tokens"?: number | "inf"
19920 readonly "conversation"?: string | "auto" | "none"
19921 readonly "metadata"?: Metadata
19922 readonly "prompt"?: Prompt
19923 readonly "input"?: ReadonlyArray<RealtimeConversationItem>
19924}
19925export const RealtimeBetaResponseCreateParams = Schema.Struct({
19926 "modalities": Schema.optionalKey(
19927 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
19928 "description": "The set of modalities the model can respond with. To disable audio,\nset this to [\"text\"].\n"
19929 })
19930 ),
19931 "instructions": Schema.optionalKey(Schema.String.annotate({
19932 "description":
19933 "The default system instructions (i.e. system message) prepended to model \ncalls. This field allows the client to guide the model on desired \nresponses. The model can be instructed on response content and format, \n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good \nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion \ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed \nto be followed by the model, but they provide guidance to the model on the \ndesired behavior.\n\nNote that the server sets default instructions which will be used if this \nfield is not set and are visible in the `session.created` event at the \nstart of the session.\n"
19934 })),
19935 "voice": Schema.optionalKey(
19936 Schema.Union([
19937 VoiceIdsShared,
19938 Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) })
19939 .annotate({ "description": "Custom voice reference." })
19940 ]).annotate({
19941 "title": "Voice",
19942 "description":
19943 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with an\n`id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed during\nthe session once the model has responded with audio at least once.\n"
19944 })
19945 ),
19946 "output_audio_format": Schema.optionalKey(
19947 Schema.Literals(["pcm16", "g711_ulaw", "g711_alaw"]).annotate({
19948 "description": "The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.\n"
19949 })
19950 ),
19951 "tools": Schema.optionalKey(
19952 Schema.Array(Schema.Struct({
19953 "type": Schema.optionalKey(
19954 Schema.Literal("function").annotate({ "description": "The type of the tool, i.e. `function`." })
19955 ),
19956 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the function." })),
19957 "description": Schema.optionalKey(
19958 Schema.String.annotate({
19959 "description":
19960 "The description of the function, including guidance on when and how \nto call it, and guidance about what to tell the user when calling \n(if anything).\n"
19961 })
19962 ),
19963 "parameters": Schema.optionalKey(
19964 Schema.Struct({}).annotate({ "description": "Parameters of the function in JSON Schema." })
19965 )
19966 })).annotate({ "description": "Tools (functions) available to the model." })
19967 ),
19968 "tool_choice": Schema.optionalKey(
19969 Schema.Union([ToolChoiceOptions, ToolChoiceFunction, ToolChoiceMCP], { mode: "oneOf" }).annotate({
19970 "description":
19971 "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n"
19972 })
19973 ),
19974 "temperature": Schema.optionalKey(
19975 Schema.Number.annotate({
19976 "description": "Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8.\n"
19977 }).check(Schema.isFinite())
19978 ),
19979 "max_output_tokens": Schema.optionalKey(
19980 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
19981 "description":
19982 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
19983 })
19984 ),
19985 "conversation": Schema.optionalKey(
19986 Schema.Union([Schema.String, Schema.Literals(["auto", "none"])], { mode: "oneOf" }).annotate({
19987 "description":
19988 "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n"
19989 })
19990 ),
19991 "metadata": Schema.optionalKey(Metadata),
19992 "prompt": Schema.optionalKey(Prompt),
19993 "input": Schema.optionalKey(
19994 Schema.Array(RealtimeConversationItem).annotate({
19995 "description":
19996 "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items from the default conversation.\n"
19997 })
19998 )
19999}).annotate({ "description": "Create a new Realtime response with these parameters" })
20000export type RealtimeClientEventConversationItemCreate = {
20001 readonly "event_id"?: string
20002 readonly "type": "conversation.item.create"
20003 readonly "previous_item_id"?: string
20004 readonly "item": RealtimeConversationItem
20005}
20006export const RealtimeClientEventConversationItemCreate = Schema.Struct({
20007 "event_id": Schema.optionalKey(
20008 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
20009 Schema.isMaxLength(512)
20010 )
20011 ),
20012 "type": Schema.Literal("conversation.item.create").annotate({
20013 "description": "The event type, must be `conversation.item.create`."
20014 }),
20015 "previous_item_id": Schema.optionalKey(Schema.String.annotate({
20016 "description":
20017 "The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation.\n\nIf set to `root`, the new item will be added to the beginning of the conversation.\n\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added.\n"
20018 })),
20019 "item": RealtimeConversationItem
20020}).annotate({
20021 "description":
20022 "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n"
20023})
20024export type RealtimeResponse = {
20025 readonly "id"?: string
20026 readonly "object"?: "realtime.response"
20027 readonly "status"?: "completed" | "cancelled" | "failed" | "incomplete" | "in_progress"
20028 readonly "status_details"?: {
20029 readonly "type"?: "completed" | "cancelled" | "failed" | "incomplete"
20030 readonly "reason"?: "turn_detected" | "client_cancelled" | "max_output_tokens" | "content_filter"
20031 readonly "error"?: { readonly "type"?: string; readonly "code"?: string }
20032 }
20033 readonly "output"?: ReadonlyArray<RealtimeConversationItem>
20034 readonly "metadata"?: Metadata
20035 readonly "audio"?: {
20036 readonly "output"?: {
20037 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
20038 readonly "type"?: "audio/pcmu"
20039 } | { readonly "type"?: "audio/pcma" }
20040 readonly "voice"?:
20041 | string
20042 | "alloy"
20043 | "ash"
20044 | "ballad"
20045 | "coral"
20046 | "echo"
20047 | "sage"
20048 | "shimmer"
20049 | "verse"
20050 | "marin"
20051 | "cedar"
20052 }
20053 }
20054 readonly "usage"?: {
20055 readonly "total_tokens"?: number
20056 readonly "input_tokens"?: number
20057 readonly "output_tokens"?: number
20058 readonly "input_token_details"?: {
20059 readonly "cached_tokens"?: number
20060 readonly "text_tokens"?: number
20061 readonly "image_tokens"?: number
20062 readonly "audio_tokens"?: number
20063 readonly "cached_tokens_details"?: {
20064 readonly "text_tokens"?: number
20065 readonly "image_tokens"?: number
20066 readonly "audio_tokens"?: number
20067 }
20068 }
20069 readonly "output_token_details"?: { readonly "text_tokens"?: number; readonly "audio_tokens"?: number }
20070 }
20071 readonly "conversation_id"?: string
20072 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
20073 readonly "max_output_tokens"?: number | "inf"
20074}
20075export const RealtimeResponse = Schema.Struct({
20076 "id": Schema.optionalKey(
20077 Schema.String.annotate({ "description": "The unique ID of the response, will look like `resp_1234`." })
20078 ),
20079 "object": Schema.optionalKey(
20080 Schema.Literal("realtime.response").annotate({ "description": "The object type, must be `realtime.response`." })
20081 ),
20082 "status": Schema.optionalKey(
20083 Schema.Literals(["completed", "cancelled", "failed", "incomplete", "in_progress"]).annotate({
20084 "description":
20085 "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n"
20086 })
20087 ),
20088 "status_details": Schema.optionalKey(
20089 Schema.Struct({
20090 "type": Schema.optionalKey(
20091 Schema.Literals(["completed", "cancelled", "failed", "incomplete"]).annotate({
20092 "description":
20093 "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n"
20094 })
20095 ),
20096 "reason": Schema.optionalKey(
20097 Schema.Literals(["turn_detected", "client_cancelled", "max_output_tokens", "content_filter"]).annotate({
20098 "description":
20099 "The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected` (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter` (the server-side safety filter activated and cut off the response).\n"
20100 })
20101 ),
20102 "error": Schema.optionalKey(
20103 Schema.Struct({
20104 "type": Schema.optionalKey(Schema.String.annotate({ "description": "The type of error." })),
20105 "code": Schema.optionalKey(Schema.String.annotate({ "description": "Error code, if any." }))
20106 }).annotate({
20107 "description":
20108 "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n"
20109 })
20110 )
20111 }).annotate({ "description": "Additional details about the status." })
20112 ),
20113 "output": Schema.optionalKey(
20114 Schema.Array(RealtimeConversationItem).annotate({
20115 "description": "The list of output items generated by the response."
20116 })
20117 ),
20118 "metadata": Schema.optionalKey(Metadata),
20119 "audio": Schema.optionalKey(
20120 Schema.Struct({
20121 "output": Schema.optionalKey(Schema.Struct({
20122 "format": Schema.optionalKey(
20123 Schema.Union([
20124 Schema.Struct({
20125 "type": Schema.optionalKey(
20126 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
20127 ),
20128 "rate": Schema.optionalKey(
20129 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
20130 )
20131 }).annotate({
20132 "title": "PCM audio format",
20133 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
20134 }),
20135 Schema.Struct({
20136 "type": Schema.optionalKey(
20137 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
20138 )
20139 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
20140 Schema.Struct({
20141 "type": Schema.optionalKey(
20142 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
20143 )
20144 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
20145 ]).annotate({ "description": "The format of the output audio." })
20146 ),
20147 "voice": Schema.optionalKey(
20148 Schema.Union([
20149 Schema.String,
20150 Schema.Literals(["alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse", "marin", "cedar"])
20151 ]).annotate({
20152 "description":
20153 "The voice the model uses to respond. Voice cannot be changed during the\nsession once the model has responded with audio at least once. Current\nvoice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`,\n`shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for\nbest quality.\n"
20154 })
20155 )
20156 }))
20157 }).annotate({ "description": "Configuration for audio output." })
20158 ),
20159 "usage": Schema.optionalKey(
20160 Schema.Struct({
20161 "total_tokens": Schema.optionalKey(
20162 Schema.Number.annotate({
20163 "description":
20164 "The total number of tokens in the Response including input and output \ntext and audio tokens.\n"
20165 }).check(Schema.isInt())
20166 ),
20167 "input_tokens": Schema.optionalKey(
20168 Schema.Number.annotate({
20169 "description": "The number of input tokens used in the Response, including text and \naudio tokens.\n"
20170 }).check(Schema.isInt())
20171 ),
20172 "output_tokens": Schema.optionalKey(
20173 Schema.Number.annotate({
20174 "description": "The number of output tokens sent in the Response, including text and \naudio tokens.\n"
20175 }).check(Schema.isInt())
20176 ),
20177 "input_token_details": Schema.optionalKey(
20178 Schema.Struct({
20179 "cached_tokens": Schema.optionalKey(
20180 Schema.Number.annotate({ "description": "The number of cached tokens used as input for the Response." })
20181 .check(Schema.isInt())
20182 ),
20183 "text_tokens": Schema.optionalKey(
20184 Schema.Number.annotate({ "description": "The number of text tokens used as input for the Response." })
20185 .check(Schema.isInt())
20186 ),
20187 "image_tokens": Schema.optionalKey(
20188 Schema.Number.annotate({ "description": "The number of image tokens used as input for the Response." })
20189 .check(Schema.isInt())
20190 ),
20191 "audio_tokens": Schema.optionalKey(
20192 Schema.Number.annotate({ "description": "The number of audio tokens used as input for the Response." })
20193 .check(Schema.isInt())
20194 ),
20195 "cached_tokens_details": Schema.optionalKey(
20196 Schema.Struct({
20197 "text_tokens": Schema.optionalKey(
20198 Schema.Number.annotate({
20199 "description": "The number of cached text tokens used as input for the Response."
20200 }).check(Schema.isInt())
20201 ),
20202 "image_tokens": Schema.optionalKey(
20203 Schema.Number.annotate({
20204 "description": "The number of cached image tokens used as input for the Response."
20205 }).check(Schema.isInt())
20206 ),
20207 "audio_tokens": Schema.optionalKey(
20208 Schema.Number.annotate({
20209 "description": "The number of cached audio tokens used as input for the Response."
20210 }).check(Schema.isInt())
20211 )
20212 }).annotate({ "description": "Details about the cached tokens used as input for the Response." })
20213 )
20214 }).annotate({
20215 "description":
20216 "Details about the input tokens used in the Response. Cached tokens are tokens from previous turns in the conversation that are included as context for the current response. Cached tokens here are counted as a subset of input tokens, meaning input tokens will include cached and uncached tokens."
20217 })
20218 ),
20219 "output_token_details": Schema.optionalKey(
20220 Schema.Struct({
20221 "text_tokens": Schema.optionalKey(
20222 Schema.Number.annotate({ "description": "The number of text tokens used in the Response." }).check(
20223 Schema.isInt()
20224 )
20225 ),
20226 "audio_tokens": Schema.optionalKey(
20227 Schema.Number.annotate({ "description": "The number of audio tokens used in the Response." }).check(
20228 Schema.isInt()
20229 )
20230 )
20231 }).annotate({ "description": "Details about the output tokens used in the Response." })
20232 )
20233 }).annotate({
20234 "description":
20235 "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n"
20236 })
20237 ),
20238 "conversation_id": Schema.optionalKey(Schema.String.annotate({
20239 "description":
20240 "Which conversation the response is added to, determined by the `conversation`\nfield in the `response.create` event. If `auto`, the response will be added to\nthe default conversation and the value of `conversation_id` will be an id like\n`conv_1234`. If `none`, the response will not be added to any conversation and\nthe value of `conversation_id` will be `null`. If responses are being triggered\nautomatically by VAD the response will be added to the default conversation\n"
20241 })),
20242 "output_modalities": Schema.optionalKey(
20243 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
20244 "description":
20245 "The set of modalities the model used to respond, currently the only possible values are\n`[\\\"audio\\\"]`, `[\\\"text\\\"]`. Audio output always include a text transcript. Setting the\noutput to mode `text` will disable audio output from the model.\n"
20246 })
20247 ),
20248 "max_output_tokens": Schema.optionalKey(
20249 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
20250 "description":
20251 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls, that was used in this response.\n"
20252 })
20253 )
20254}).annotate({ "description": "The response resource." })
20255export type RealtimeResponseCreateParams = {
20256 readonly "output_modalities"?: ReadonlyArray<"text" | "audio">
20257 readonly "instructions"?: string
20258 readonly "audio"?: {
20259 readonly "output"?: {
20260 readonly "format"?: { readonly "type"?: "audio/pcm"; readonly "rate"?: 24000 } | {
20261 readonly "type"?: "audio/pcmu"
20262 } | { readonly "type"?: "audio/pcma" }
20263 readonly "voice"?: VoiceIdsShared | { readonly "id": string }
20264 }
20265 }
20266 readonly "tools"?: ReadonlyArray<RealtimeFunctionTool | MCPTool>
20267 readonly "tool_choice"?: ToolChoiceOptions | ToolChoiceFunction | ToolChoiceMCP
20268 readonly "parallel_tool_calls"?: boolean
20269 readonly "reasoning"?: RealtimeReasoning
20270 readonly "max_output_tokens"?: number | "inf"
20271 readonly "conversation"?: string | "auto" | "none"
20272 readonly "metadata"?: Metadata
20273 readonly "prompt"?: Prompt
20274 readonly "input"?: ReadonlyArray<RealtimeConversationItem>
20275}
20276export const RealtimeResponseCreateParams = Schema.Struct({
20277 "output_modalities": Schema.optionalKey(
20278 Schema.Array(Schema.Literals(["text", "audio"])).annotate({
20279 "description":
20280 "The set of modalities the model used to respond, currently the only possible values are\n`[\\\"audio\\\"]`, `[\\\"text\\\"]`. Audio output always include a text transcript. Setting the\noutput to mode `text` will disable audio output from the model.\n"
20281 })
20282 ),
20283 "instructions": Schema.optionalKey(Schema.String.annotate({
20284 "description":
20285 "The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good responses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion into your voice\", \"laugh frequently\"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.\nNote that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.\n"
20286 })),
20287 "audio": Schema.optionalKey(
20288 Schema.Struct({
20289 "output": Schema.optionalKey(Schema.Struct({
20290 "format": Schema.optionalKey(
20291 Schema.Union([
20292 Schema.Struct({
20293 "type": Schema.optionalKey(
20294 Schema.Literal("audio/pcm").annotate({ "description": "The audio format. Always `audio/pcm`." })
20295 ),
20296 "rate": Schema.optionalKey(
20297 Schema.Literal(24000).annotate({ "description": "The sample rate of the audio. Always `24000`." })
20298 )
20299 }).annotate({
20300 "title": "PCM audio format",
20301 "description": "The PCM audio format. Only a 24kHz sample rate is supported."
20302 }),
20303 Schema.Struct({
20304 "type": Schema.optionalKey(
20305 Schema.Literal("audio/pcmu").annotate({ "description": "The audio format. Always `audio/pcmu`." })
20306 )
20307 }).annotate({ "title": "PCMU audio format", "description": "The G.711 μ-law format." }),
20308 Schema.Struct({
20309 "type": Schema.optionalKey(
20310 Schema.Literal("audio/pcma").annotate({ "description": "The audio format. Always `audio/pcma`." })
20311 )
20312 }).annotate({ "title": "PCMA audio format", "description": "The G.711 A-law format." })
20313 ]).annotate({ "description": "The format of the output audio." })
20314 ),
20315 "voice": Schema.optionalKey(
20316 Schema.Union([
20317 VoiceIdsShared,
20318 Schema.Struct({
20319 "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." })
20320 }).annotate({ "description": "Custom voice reference." })
20321 ]).annotate({
20322 "title": "Voice",
20323 "description":
20324 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,\n`marin`, and `cedar`. You may also provide a custom voice object with\nan `id`, for example `{ \"id\": \"voice_1234\" }`. Voice cannot be changed\nduring the session once the model has responded with audio at least once.\nWe recommend `marin` and `cedar` for best quality.\n"
20325 })
20326 )
20327 }))
20328 }).annotate({ "description": "Configuration for audio input and output." })
20329 ),
20330 "tools": Schema.optionalKey(
20331 Schema.Array(Schema.Union([RealtimeFunctionTool, MCPTool], { mode: "oneOf" })).annotate({
20332 "description": "Tools available to the model."
20333 })
20334 ),
20335 "tool_choice": Schema.optionalKey(
20336 Schema.Union([ToolChoiceOptions, ToolChoiceFunction, ToolChoiceMCP], { mode: "oneOf" }).annotate({
20337 "description":
20338 "How the model chooses tools. Provide one of the string modes or force a specific\nfunction/MCP tool.\n"
20339 })
20340 ),
20341 "parallel_tool_calls": Schema.optionalKey(
20342 Schema.Boolean.annotate({
20343 "description":
20344 "Whether the model may call multiple tools in parallel. Only supported by\nreasoning Realtime models such as `gpt-realtime-2`.\n"
20345 })
20346 ),
20347 "reasoning": Schema.optionalKey(RealtimeReasoning),
20348 "max_output_tokens": Schema.optionalKey(
20349 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Literal("inf")], { mode: "oneOf" }).annotate({
20350 "description":
20351 "Maximum number of output tokens for a single assistant response,\ninclusive of tool calls. Provide an integer between 1 and 4096 to\nlimit output tokens, or `inf` for the maximum available tokens for a\ngiven model. Defaults to `inf`.\n"
20352 })
20353 ),
20354 "conversation": Schema.optionalKey(
20355 Schema.Union([Schema.String, Schema.Literals(["auto", "none"])], { mode: "oneOf" }).annotate({
20356 "description":
20357 "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which\nwill not add items to default conversation.\n"
20358 })
20359 ),
20360 "metadata": Schema.optionalKey(Metadata),
20361 "prompt": Schema.optionalKey(Prompt),
20362 "input": Schema.optionalKey(
20363 Schema.Array(RealtimeConversationItem).annotate({
20364 "description":
20365 "Input items to include in the prompt for the model. Using this field\ncreates a new context for this Response instead of using the default\nconversation. An empty array `[]` will clear the context for this Response.\nNote that this can include references to items that previously appeared in the session\nusing their id.\n"
20366 })
20367 )
20368}).annotate({ "description": "Create a new Realtime response with these parameters" })
20369export type RealtimeServerEventConversationItemAdded = {
20370 readonly "event_id": string
20371 readonly "type": "conversation.item.added"
20372 readonly "previous_item_id"?: string | null
20373 readonly "item": RealtimeConversationItem
20374}
20375export const RealtimeServerEventConversationItemAdded = Schema.Struct({
20376 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
20377 "type": Schema.Literal("conversation.item.added").annotate({
20378 "description": "The event type, must be `conversation.item.added`."
20379 }),
20380 "previous_item_id": Schema.optionalKey(
20381 Schema.Union([
20382 Schema.String.annotate({
20383 "description":
20384 "The ID of the item that precedes this one, if any. This is used to\nmaintain ordering when items are inserted.\n"
20385 }),
20386 Schema.Null
20387 ])
20388 ),
20389 "item": RealtimeConversationItem
20390}).annotate({
20391 "description":
20392 "Sent by the server when an Item is added to the default Conversation. This can happen in several cases:\n- When the client sends a `conversation.item.create` event.\n- When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer.\n- When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`).\n\nThe event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary.\n"
20393})
20394export type RealtimeServerEventConversationItemCreated = {
20395 readonly "event_id": string
20396 readonly "type": "conversation.item.created"
20397 readonly "previous_item_id"?: string | null
20398 readonly "item": RealtimeConversationItem
20399}
20400export const RealtimeServerEventConversationItemCreated = Schema.Struct({
20401 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
20402 "type": Schema.Literal("conversation.item.created").annotate({
20403 "description": "The event type, must be `conversation.item.created`."
20404 }),
20405 "previous_item_id": Schema.optionalKey(
20406 Schema.Union([
20407 Schema.String.annotate({
20408 "description":
20409 "The ID of the preceding item in the Conversation context, allows the\nclient to understand the order of the conversation. Can be `null` if the\nitem has no predecessor.\n"
20410 }),
20411 Schema.Null
20412 ])
20413 ),
20414 "item": RealtimeConversationItem
20415}).annotate({
20416 "description":
20417 "Returned when a conversation item is created. There are several scenarios that produce this event:\n - The server is generating a Response, which if successful will produce\n either one or two Items, which will be of type `message`\n (role `assistant`) or type `function_call`.\n - The input audio buffer has been committed, either by the client or the\n server (in `server_vad` mode). The server will take the content of the\n input audio buffer and add it to a new user message Item.\n - The client has sent a `conversation.item.create` event to add a new Item\n to the Conversation.\n"
20418})
20419export type RealtimeServerEventConversationItemDone = {
20420 readonly "event_id": string
20421 readonly "type": "conversation.item.done"
20422 readonly "previous_item_id"?: string | null
20423 readonly "item": RealtimeConversationItem
20424}
20425export const RealtimeServerEventConversationItemDone = Schema.Struct({
20426 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
20427 "type": Schema.Literal("conversation.item.done").annotate({
20428 "description": "The event type, must be `conversation.item.done`."
20429 }),
20430 "previous_item_id": Schema.optionalKey(
20431 Schema.Union([
20432 Schema.String.annotate({
20433 "description":
20434 "The ID of the item that precedes this one, if any. This is used to\nmaintain ordering when items are inserted.\n"
20435 }),
20436 Schema.Null
20437 ])
20438 ),
20439 "item": RealtimeConversationItem
20440}).annotate({
20441 "description":
20442 "Returned when a conversation item is finalized.\n\nThe event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed.\n"
20443})
20444export type RealtimeServerEventConversationItemRetrieved = {
20445 readonly "event_id": string
20446 readonly "type": "conversation.item.retrieved"
20447 readonly "item": RealtimeConversationItem
20448}
20449export const RealtimeServerEventConversationItemRetrieved = Schema.Struct({
20450 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
20451 "type": Schema.Literal("conversation.item.retrieved").annotate({
20452 "description": "The event type, must be `conversation.item.retrieved`."
20453 }),
20454 "item": RealtimeConversationItem
20455}).annotate({
20456 "description":
20457 "Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data.\n"
20458})
20459export type RealtimeServerEventResponseOutputItemAdded = {
20460 readonly "event_id": string
20461 readonly "type": "response.output_item.added"
20462 readonly "response_id": string
20463 readonly "output_index": number
20464 readonly "item": RealtimeConversationItem
20465}
20466export const RealtimeServerEventResponseOutputItemAdded = Schema.Struct({
20467 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
20468 "type": Schema.Literal("response.output_item.added").annotate({
20469 "description": "The event type, must be `response.output_item.added`."
20470 }),
20471 "response_id": Schema.String.annotate({ "description": "The ID of the Response to which the item belongs." }),
20472 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the Response." }).check(
20473 Schema.isInt()
20474 ),
20475 "item": RealtimeConversationItem
20476}).annotate({ "description": "Returned when a new Item is created during Response generation." })
20477export type RealtimeServerEventResponseOutputItemDone = {
20478 readonly "event_id": string
20479 readonly "type": "response.output_item.done"
20480 readonly "response_id": string
20481 readonly "output_index": number
20482 readonly "item": RealtimeConversationItem
20483}
20484export const RealtimeServerEventResponseOutputItemDone = Schema.Struct({
20485 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
20486 "type": Schema.Literal("response.output_item.done").annotate({
20487 "description": "The event type, must be `response.output_item.done`."
20488 }),
20489 "response_id": Schema.String.annotate({ "description": "The ID of the Response to which the item belongs." }),
20490 "output_index": Schema.Number.annotate({ "description": "The index of the output item in the Response." }).check(
20491 Schema.isInt()
20492 ),
20493 "item": RealtimeConversationItem
20494}).annotate({
20495 "description":
20496 "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n"
20497})
20498export type AssistantObject = {
20499 readonly "id": string
20500 readonly "object": "assistant"
20501 readonly "created_at": number
20502 readonly "name": string | null
20503 readonly "description": string | null
20504 readonly "model": string
20505 readonly "instructions": string | null
20506 readonly "tools": ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearch | AssistantToolsFunction>
20507 readonly "tool_resources"?: {
20508 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
20509 readonly "file_search"?: { readonly "vector_store_ids"?: ReadonlyArray<string> }
20510 } | null
20511 readonly "metadata": Metadata
20512 readonly "temperature"?: number | null
20513 readonly "top_p"?: number | null
20514 readonly "response_format"?: AssistantsApiResponseFormatOption | null
20515}
20516export const AssistantObject = Schema.Struct({
20517 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
20518 "object": Schema.Literal("assistant").annotate({ "description": "The object type, which is always `assistant`." }),
20519 "created_at": Schema.Number.annotate({
20520 "description": "The Unix timestamp (in seconds) for when the assistant was created.",
20521 "format": "unixtime"
20522 }).check(Schema.isInt()),
20523 "name": Schema.Union([
20524 Schema.String.annotate({ "description": "The name of the assistant. The maximum length is 256 characters.\n" })
20525 .check(Schema.isMaxLength(256)),
20526 Schema.Null
20527 ]),
20528 "description": Schema.Union([
20529 Schema.String.annotate({
20530 "description": "The description of the assistant. The maximum length is 512 characters.\n"
20531 }).check(Schema.isMaxLength(512)),
20532 Schema.Null
20533 ]),
20534 "model": Schema.String.annotate({
20535 "description":
20536 "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.\n"
20537 }),
20538 "instructions": Schema.Union([
20539 Schema.String.annotate({
20540 "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n"
20541 }).check(Schema.isMaxLength(256000)),
20542 Schema.Null
20543 ]),
20544 "tools": Schema.Array(
20545 Schema.Union([AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction], { mode: "oneOf" })
20546 ).annotate({
20547 "description":
20548 "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n"
20549 }).check(Schema.isMaxLength(128)),
20550 "tool_resources": Schema.optionalKey(Schema.Union([
20551 Schema.Struct({
20552 "code_interpreter": Schema.optionalKey(Schema.Struct({
20553 "file_ids": Schema.optionalKey(
20554 Schema.Array(Schema.String).annotate({
20555 "description":
20556 "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter`` tool. There can be a maximum of 20 files associated with the tool.\n"
20557 }).check(Schema.isMaxLength(20))
20558 )
20559 })),
20560 "file_search": Schema.optionalKey(Schema.Struct({
20561 "vector_store_ids": Schema.optionalKey(
20562 Schema.Array(Schema.String).annotate({
20563 "description":
20564 "The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
20565 }).check(Schema.isMaxLength(1))
20566 )
20567 }))
20568 }).annotate({
20569 "description":
20570 "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
20571 }),
20572 Schema.Null
20573 ])),
20574 "metadata": Metadata,
20575 "temperature": Schema.optionalKey(
20576 Schema.Union([
20577 Schema.Number.annotate({
20578 "description":
20579 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"
20580 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
20581 Schema.Null
20582 ])
20583 ),
20584 "top_p": Schema.optionalKey(Schema.Union([
20585 Schema.Number.annotate({
20586 "description":
20587 "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"
20588 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
20589 Schema.Null
20590 ])),
20591 "response_format": Schema.optionalKey(Schema.Union([AssistantsApiResponseFormatOption, Schema.Null]))
20592}).annotate({ "title": "Assistant", "description": "Represents an `assistant` that can call the model and use tools." })
20593export type CreateAssistantRequest = {
20594 readonly "model": string | AssistantSupportedModels
20595 readonly "name"?: string | null
20596 readonly "description"?: string | null
20597 readonly "instructions"?: string | null
20598 readonly "reasoning_effort"?: ReasoningEffort
20599 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearch | AssistantToolsFunction>
20600 readonly "tool_resources"?: {
20601 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
20602 readonly "file_search"?: {
20603 readonly "vector_store_ids": ReadonlyArray<string>
20604 readonly "vector_stores"?: ReadonlyArray<
20605 {
20606 readonly "file_ids"?: ReadonlyArray<string>
20607 readonly "chunking_strategy"?: { readonly "type": "auto" } | {
20608 readonly "type": "static"
20609 readonly "static": { readonly "max_chunk_size_tokens": number; readonly "chunk_overlap_tokens": number }
20610 }
20611 readonly "metadata"?: Metadata
20612 }
20613 >
20614 } | {
20615 readonly "vector_stores": ReadonlyArray<
20616 {
20617 readonly "file_ids"?: ReadonlyArray<string>
20618 readonly "chunking_strategy"?: { readonly "type": "auto" } | {
20619 readonly "type": "static"
20620 readonly "static": { readonly "max_chunk_size_tokens": number; readonly "chunk_overlap_tokens": number }
20621 }
20622 readonly "metadata"?: Metadata
20623 }
20624 >
20625 readonly "vector_store_ids"?: ReadonlyArray<string>
20626 }
20627 } | null
20628 readonly "metadata"?: Metadata
20629 readonly "temperature"?: number | null
20630 readonly "top_p"?: number | null
20631 readonly "response_format"?: AssistantsApiResponseFormatOption | null
20632}
20633export const CreateAssistantRequest = Schema.Struct({
20634 "model": Schema.Union([Schema.String, AssistantSupportedModels]).annotate({
20635 "description":
20636 "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.\n"
20637 }),
20638 "name": Schema.optionalKey(
20639 Schema.Union([
20640 Schema.String.annotate({ "description": "The name of the assistant. The maximum length is 256 characters.\n" })
20641 .check(Schema.isMaxLength(256)),
20642 Schema.Null
20643 ])
20644 ),
20645 "description": Schema.optionalKey(
20646 Schema.Union([
20647 Schema.String.annotate({
20648 "description": "The description of the assistant. The maximum length is 512 characters.\n"
20649 }).check(Schema.isMaxLength(512)),
20650 Schema.Null
20651 ])
20652 ),
20653 "instructions": Schema.optionalKey(
20654 Schema.Union([
20655 Schema.String.annotate({
20656 "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n"
20657 }).check(Schema.isMaxLength(256000)),
20658 Schema.Null
20659 ])
20660 ),
20661 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
20662 "tools": Schema.optionalKey(
20663 Schema.Array(
20664 Schema.Union([AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction], { mode: "oneOf" })
20665 ).annotate({
20666 "description":
20667 "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n"
20668 }).check(Schema.isMaxLength(128))
20669 ),
20670 "tool_resources": Schema.optionalKey(Schema.Union([
20671 Schema.Struct({
20672 "code_interpreter": Schema.optionalKey(Schema.Struct({
20673 "file_ids": Schema.optionalKey(
20674 Schema.Array(Schema.String).annotate({
20675 "description":
20676 "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"
20677 }).check(Schema.isMaxLength(20))
20678 )
20679 })),
20680 "file_search": Schema.optionalKey(Schema.Union([
20681 Schema.Struct({
20682 "vector_store_ids": Schema.Array(Schema.String).annotate({
20683 "description":
20684 "The [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
20685 }).check(Schema.isMaxLength(1)),
20686 "vector_stores": Schema.optionalKey(
20687 Schema.Array(Schema.Struct({
20688 "file_ids": Schema.optionalKey(
20689 Schema.Array(Schema.String).annotate({
20690 "description":
20691 "A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n"
20692 }).check(Schema.isMaxLength(100000000))
20693 ),
20694 "chunking_strategy": Schema.optionalKey(
20695 Schema.Union([
20696 Schema.Struct({ "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }) })
20697 .annotate({
20698 "title": "Auto Chunking Strategy",
20699 "description":
20700 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
20701 }),
20702 Schema.Struct({
20703 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
20704 "static": Schema.Struct({
20705 "max_chunk_size_tokens": Schema.Number.annotate({
20706 "description":
20707 "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."
20708 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(100)).check(
20709 Schema.isLessThanOrEqualTo(4096)
20710 ),
20711 "chunk_overlap_tokens": Schema.Number.annotate({
20712 "description":
20713 "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"
20714 }).check(Schema.isInt())
20715 })
20716 }).annotate({
20717 "title": "Static Chunking Strategy",
20718 "description":
20719 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
20720 })
20721 ], { mode: "oneOf" })
20722 ),
20723 "metadata": Schema.optionalKey(Metadata)
20724 })).annotate({
20725 "description":
20726 "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
20727 }).check(Schema.isMaxLength(1))
20728 )
20729 }),
20730 Schema.Struct({
20731 "vector_stores": Schema.Array(Schema.Struct({
20732 "file_ids": Schema.optionalKey(
20733 Schema.Array(Schema.String).annotate({
20734 "description":
20735 "A list of [file](/docs/api-reference/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.\n"
20736 }).check(Schema.isMaxLength(100000000))
20737 ),
20738 "chunking_strategy": Schema.optionalKey(
20739 Schema.Union([
20740 Schema.Struct({ "type": Schema.Literal("auto").annotate({ "description": "Always `auto`." }) })
20741 .annotate({
20742 "title": "Auto Chunking Strategy",
20743 "description":
20744 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
20745 }),
20746 Schema.Struct({
20747 "type": Schema.Literal("static").annotate({ "description": "Always `static`." }),
20748 "static": Schema.Struct({
20749 "max_chunk_size_tokens": Schema.Number.annotate({
20750 "description":
20751 "The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`."
20752 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(100)).check(
20753 Schema.isLessThanOrEqualTo(4096)
20754 ),
20755 "chunk_overlap_tokens": Schema.Number.annotate({
20756 "description":
20757 "The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n"
20758 }).check(Schema.isInt())
20759 })
20760 }).annotate({
20761 "title": "Static Chunking Strategy",
20762 "description":
20763 "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
20764 })
20765 ], { mode: "oneOf" })
20766 ),
20767 "metadata": Schema.optionalKey(Metadata)
20768 })).annotate({
20769 "description":
20770 "A helper to create a [vector store](/docs/api-reference/vector-stores/object) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
20771 }).check(Schema.isMaxLength(1)),
20772 "vector_store_ids": Schema.optionalKey(
20773 Schema.Array(Schema.String).annotate({
20774 "description":
20775 "The [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
20776 }).check(Schema.isMaxLength(1))
20777 )
20778 })
20779 ], { mode: "oneOf" }))
20780 }).annotate({
20781 "description":
20782 "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
20783 }),
20784 Schema.Null
20785 ])),
20786 "metadata": Schema.optionalKey(Metadata),
20787 "temperature": Schema.optionalKey(
20788 Schema.Union([
20789 Schema.Number.annotate({
20790 "description":
20791 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"
20792 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
20793 Schema.Null
20794 ])
20795 ),
20796 "top_p": Schema.optionalKey(Schema.Union([
20797 Schema.Number.annotate({
20798 "description":
20799 "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"
20800 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
20801 Schema.Null
20802 ])),
20803 "response_format": Schema.optionalKey(Schema.Union([AssistantsApiResponseFormatOption, Schema.Null]))
20804})
20805export type CreateRunRequest = {
20806 readonly "assistant_id": string
20807 readonly "model"?: string | AssistantSupportedModels | null
20808 readonly "reasoning_effort"?: ReasoningEffort
20809 readonly "instructions"?: string | null
20810 readonly "additional_instructions"?: string | null
20811 readonly "additional_messages"?: ReadonlyArray<
20812 {
20813 readonly "role": "user" | "assistant"
20814 readonly "content":
20815 | string
20816 | ReadonlyArray<MessageContentImageFileObject | MessageContentImageUrlObject | MessageRequestContentTextObject>
20817 readonly "attachments"?:
20818 | ReadonlyArray<
20819 {
20820 readonly "file_id"?: string
20821 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearchTypeOnly>
20822 }
20823 >
20824 | null
20825 readonly "metadata"?: Metadata
20826 }
20827 >
20828 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearch | AssistantToolsFunction>
20829 readonly "metadata"?: Metadata
20830 readonly "temperature"?: number
20831 readonly "top_p"?: number
20832 readonly "stream"?: boolean | null
20833 readonly "max_prompt_tokens"?: number
20834 readonly "max_completion_tokens"?: number
20835 readonly "truncation_strategy"?: {
20836 readonly "type": "auto" | "last_messages"
20837 readonly "last_messages"?: number | null
20838 }
20839 readonly "tool_choice"?: "none" | "auto" | "required" | {
20840 readonly "type": "function" | "code_interpreter" | "file_search"
20841 readonly "function"?: { readonly "name": string }
20842 }
20843 readonly "parallel_tool_calls"?: ParallelToolCalls
20844 readonly "response_format"?: AssistantsApiResponseFormatOption | null
20845}
20846export const CreateRunRequest = Schema.Struct({
20847 "assistant_id": Schema.String.annotate({
20848 "description": "The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run."
20849 }),
20850 "model": Schema.optionalKey(
20851 Schema.Union([
20852 Schema.Union([Schema.String, AssistantSupportedModels]).annotate({
20853 "description":
20854 "The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."
20855 }),
20856 Schema.Null
20857 ])
20858 ),
20859 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
20860 "instructions": Schema.optionalKey(
20861 Schema.Union([Schema.String, Schema.Null]).annotate({
20862 "description":
20863 "Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis."
20864 })
20865 ),
20866 "additional_instructions": Schema.optionalKey(
20867 Schema.Union([Schema.String, Schema.Null]).annotate({
20868 "description":
20869 "Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions."
20870 })
20871 ),
20872 "additional_messages": Schema.optionalKey(Schema.Union([
20873 Schema.Array(Schema.Struct({
20874 "role": Schema.Literals(["user", "assistant"]).annotate({
20875 "description":
20876 "The role of the entity that is creating the message. Allowed values include:\n- `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.\n- `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.\n"
20877 }),
20878 "content": Schema.Union([
20879 Schema.String.annotate({ "title": "Text content", "description": "The text contents of the message." }),
20880 Schema.Array(
20881 Schema.Union([MessageContentImageFileObject, MessageContentImageUrlObject, MessageRequestContentTextObject], {
20882 mode: "oneOf"
20883 })
20884 ).annotate({
20885 "title": "Array of content parts",
20886 "description":
20887 "An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/docs/models)."
20888 }).check(Schema.isMinLength(1))
20889 ], { mode: "oneOf" }),
20890 "attachments": Schema.optionalKey(Schema.Union([
20891 Schema.Array(Schema.Struct({
20892 "file_id": Schema.optionalKey(
20893 Schema.String.annotate({ "description": "The ID of the file to attach to the message." })
20894 ),
20895 "tools": Schema.optionalKey(
20896 Schema.Array(Schema.Union([AssistantToolsCode, AssistantToolsFileSearchTypeOnly], { mode: "oneOf" }))
20897 .annotate({ "description": "The tools to add this file to." })
20898 )
20899 })).annotate({
20900 "description": "A list of files attached to the message, and the tools they should be added to."
20901 }),
20902 Schema.Null
20903 ])),
20904 "metadata": Schema.optionalKey(Metadata)
20905 })).annotate({ "description": "Adds additional messages to the thread before creating the run." })
20906 ])),
20907 "tools": Schema.optionalKey(
20908 Schema.Union([
20909 Schema.Array(
20910 Schema.Union([AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction], { mode: "oneOf" })
20911 ).check(
20912 Schema.isMaxLength(20, {
20913 "description":
20914 "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis."
20915 })
20916 )
20917 ])
20918 ),
20919 "metadata": Schema.optionalKey(Metadata),
20920 "temperature": Schema.optionalKey(
20921 Schema.Union([
20922 Schema.Number.check(Schema.isFinite()).check(
20923 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(2)], {
20924 "description":
20925 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"
20926 })
20927 )
20928 ])
20929 ),
20930 "top_p": Schema.optionalKey(
20931 Schema.Union([
20932 Schema.Number.check(Schema.isFinite()).check(
20933 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(1)], {
20934 "description":
20935 "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"
20936 })
20937 )
20938 ])
20939 ),
20940 "stream": Schema.optionalKey(
20941 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
20942 "description":
20943 "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n"
20944 })
20945 ),
20946 "max_prompt_tokens": Schema.optionalKey(
20947 Schema.Union([
20948 Schema.Number.check(Schema.isInt()).check(
20949 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(256)], {
20950 "description":
20951 "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"
20952 })
20953 )
20954 ])
20955 ),
20956 "max_completion_tokens": Schema.optionalKey(
20957 Schema.Union([
20958 Schema.Number.check(Schema.isInt()).check(
20959 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(256)], {
20960 "description":
20961 "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"
20962 })
20963 )
20964 ])
20965 ),
20966 "truncation_strategy": Schema.optionalKey(Schema.Union([
20967 Schema.Struct({
20968 "type": Schema.Literals(["auto", "last_messages"]).annotate({
20969 "description":
20970 "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`."
20971 }),
20972 "last_messages": Schema.optionalKey(
20973 Schema.Union([
20974 Schema.Number.annotate({
20975 "description":
20976 "The number of most recent messages from the thread when constructing the context for the run."
20977 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
20978 Schema.Null
20979 ])
20980 )
20981 }).annotate({
20982 "title": "Thread Truncation Controls",
20983 "description":
20984 "Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run."
20985 })
20986 ])),
20987 "tool_choice": Schema.optionalKey(
20988 Schema.Union([
20989 Schema.Union([Schema.Literal("none"), Schema.Literal("auto"), Schema.Literal("required")]).annotate({
20990 "description":
20991 "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n"
20992 }),
20993 Schema.Union([
20994 Schema.Struct({
20995 "type": Schema.Literals(["function", "code_interpreter", "file_search"]).annotate({
20996 "description": "The type of the tool. If type is `function`, the function name must be set"
20997 }),
20998 "function": Schema.optionalKey(
20999 Schema.Struct({ "name": Schema.String.annotate({ "description": "The name of the function to call." }) })
21000 )
21001 }).annotate({
21002 "description": "Specifies a tool the model should use. Use to force the model to call a specific tool."
21003 })
21004 ])
21005 ], { mode: "oneOf" }).annotate({
21006 "description":
21007 "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n"
21008 })
21009 ),
21010 "parallel_tool_calls": Schema.optionalKey(ParallelToolCalls),
21011 "response_format": Schema.optionalKey(Schema.Union([AssistantsApiResponseFormatOption, Schema.Null]))
21012})
21013export type CreateThreadAndRunRequest = {
21014 readonly "assistant_id": string
21015 readonly "thread"?: CreateThreadRequest
21016 readonly "model"?:
21017 | string
21018 | "gpt-5"
21019 | "gpt-5-mini"
21020 | "gpt-5-nano"
21021 | "gpt-5-2025-08-07"
21022 | "gpt-5-mini-2025-08-07"
21023 | "gpt-5-nano-2025-08-07"
21024 | "gpt-4.1"
21025 | "gpt-4.1-mini"
21026 | "gpt-4.1-nano"
21027 | "gpt-4.1-2025-04-14"
21028 | "gpt-4.1-mini-2025-04-14"
21029 | "gpt-4.1-nano-2025-04-14"
21030 | "gpt-4o"
21031 | "gpt-4o-2024-11-20"
21032 | "gpt-4o-2024-08-06"
21033 | "gpt-4o-2024-05-13"
21034 | "gpt-4o-mini"
21035 | "gpt-4o-mini-2024-07-18"
21036 | "gpt-4.5-preview"
21037 | "gpt-4.5-preview-2025-02-27"
21038 | "gpt-4-turbo"
21039 | "gpt-4-turbo-2024-04-09"
21040 | "gpt-4-0125-preview"
21041 | "gpt-4-turbo-preview"
21042 | "gpt-4-1106-preview"
21043 | "gpt-4-vision-preview"
21044 | "gpt-4"
21045 | "gpt-4-0314"
21046 | "gpt-4-0613"
21047 | "gpt-4-32k"
21048 | "gpt-4-32k-0314"
21049 | "gpt-4-32k-0613"
21050 | "gpt-3.5-turbo"
21051 | "gpt-3.5-turbo-16k"
21052 | "gpt-3.5-turbo-0613"
21053 | "gpt-3.5-turbo-1106"
21054 | "gpt-3.5-turbo-0125"
21055 | "gpt-3.5-turbo-16k-0613"
21056 | null
21057 readonly "instructions"?: string | null
21058 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearch | AssistantToolsFunction>
21059 readonly "tool_resources"?: {
21060 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
21061 readonly "file_search"?: { readonly "vector_store_ids"?: ReadonlyArray<string> }
21062 }
21063 readonly "metadata"?: Metadata
21064 readonly "temperature"?: number
21065 readonly "top_p"?: number
21066 readonly "stream"?: boolean | null
21067 readonly "max_prompt_tokens"?: number
21068 readonly "max_completion_tokens"?: number
21069 readonly "truncation_strategy"?: {
21070 readonly "type": "auto" | "last_messages"
21071 readonly "last_messages"?: number | null
21072 }
21073 readonly "tool_choice"?: "none" | "auto" | "required" | {
21074 readonly "type": "function" | "code_interpreter" | "file_search"
21075 readonly "function"?: { readonly "name": string }
21076 }
21077 readonly "parallel_tool_calls"?: ParallelToolCalls
21078 readonly "response_format"?: AssistantsApiResponseFormatOption | null
21079}
21080export const CreateThreadAndRunRequest = Schema.Struct({
21081 "assistant_id": Schema.String.annotate({
21082 "description": "The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run."
21083 }),
21084 "thread": Schema.optionalKey(CreateThreadRequest),
21085 "model": Schema.optionalKey(
21086 Schema.Union([
21087 Schema.Union([
21088 Schema.String,
21089 Schema.Literals([
21090 "gpt-5",
21091 "gpt-5-mini",
21092 "gpt-5-nano",
21093 "gpt-5-2025-08-07",
21094 "gpt-5-mini-2025-08-07",
21095 "gpt-5-nano-2025-08-07",
21096 "gpt-4.1",
21097 "gpt-4.1-mini",
21098 "gpt-4.1-nano",
21099 "gpt-4.1-2025-04-14",
21100 "gpt-4.1-mini-2025-04-14",
21101 "gpt-4.1-nano-2025-04-14",
21102 "gpt-4o",
21103 "gpt-4o-2024-11-20",
21104 "gpt-4o-2024-08-06",
21105 "gpt-4o-2024-05-13",
21106 "gpt-4o-mini",
21107 "gpt-4o-mini-2024-07-18",
21108 "gpt-4.5-preview",
21109 "gpt-4.5-preview-2025-02-27",
21110 "gpt-4-turbo",
21111 "gpt-4-turbo-2024-04-09",
21112 "gpt-4-0125-preview",
21113 "gpt-4-turbo-preview",
21114 "gpt-4-1106-preview",
21115 "gpt-4-vision-preview",
21116 "gpt-4",
21117 "gpt-4-0314",
21118 "gpt-4-0613",
21119 "gpt-4-32k",
21120 "gpt-4-32k-0314",
21121 "gpt-4-32k-0613",
21122 "gpt-3.5-turbo",
21123 "gpt-3.5-turbo-16k",
21124 "gpt-3.5-turbo-0613",
21125 "gpt-3.5-turbo-1106",
21126 "gpt-3.5-turbo-0125",
21127 "gpt-3.5-turbo-16k-0613"
21128 ])
21129 ]).annotate({
21130 "description":
21131 "The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used."
21132 }),
21133 Schema.Null
21134 ])
21135 ),
21136 "instructions": Schema.optionalKey(
21137 Schema.Union([Schema.String, Schema.Null]).annotate({
21138 "description":
21139 "Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis."
21140 })
21141 ),
21142 "tools": Schema.optionalKey(
21143 Schema.Union([
21144 Schema.Array(
21145 Schema.Union([AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction], { mode: "oneOf" })
21146 ).check(
21147 Schema.isMaxLength(20, {
21148 "description":
21149 "Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis."
21150 })
21151 )
21152 ])
21153 ),
21154 "tool_resources": Schema.optionalKey(Schema.Union([
21155 Schema.Struct({
21156 "code_interpreter": Schema.optionalKey(Schema.Struct({
21157 "file_ids": Schema.optionalKey(
21158 Schema.Array(Schema.String).annotate({
21159 "description":
21160 "A list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"
21161 }).check(Schema.isMaxLength(20))
21162 )
21163 })),
21164 "file_search": Schema.optionalKey(Schema.Struct({
21165 "vector_store_ids": Schema.optionalKey(
21166 Schema.Array(Schema.String).annotate({
21167 "description":
21168 "The ID of the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
21169 }).check(Schema.isMaxLength(1))
21170 )
21171 }))
21172 }).annotate({
21173 "description":
21174 "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
21175 })
21176 ])),
21177 "metadata": Schema.optionalKey(Metadata),
21178 "temperature": Schema.optionalKey(
21179 Schema.Union([
21180 Schema.Number.check(Schema.isFinite()).check(
21181 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(2)], {
21182 "description":
21183 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"
21184 })
21185 )
21186 ])
21187 ),
21188 "top_p": Schema.optionalKey(
21189 Schema.Union([
21190 Schema.Number.check(Schema.isFinite()).check(
21191 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(1)], {
21192 "description":
21193 "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"
21194 })
21195 )
21196 ])
21197 ),
21198 "stream": Schema.optionalKey(
21199 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
21200 "description":
21201 "If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.\n"
21202 })
21203 ),
21204 "max_prompt_tokens": Schema.optionalKey(
21205 Schema.Union([
21206 Schema.Number.check(Schema.isInt()).check(
21207 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(256)], {
21208 "description":
21209 "The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"
21210 })
21211 )
21212 ])
21213 ),
21214 "max_completion_tokens": Schema.optionalKey(
21215 Schema.Union([
21216 Schema.Number.check(Schema.isInt()).check(
21217 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(256)], {
21218 "description":
21219 "The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n"
21220 })
21221 )
21222 ])
21223 ),
21224 "truncation_strategy": Schema.optionalKey(Schema.Union([
21225 Schema.Struct({
21226 "type": Schema.Literals(["auto", "last_messages"]).annotate({
21227 "description":
21228 "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`."
21229 }),
21230 "last_messages": Schema.optionalKey(
21231 Schema.Union([
21232 Schema.Number.annotate({
21233 "description":
21234 "The number of most recent messages from the thread when constructing the context for the run."
21235 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
21236 Schema.Null
21237 ])
21238 )
21239 }).annotate({
21240 "title": "Thread Truncation Controls",
21241 "description":
21242 "Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run."
21243 })
21244 ])),
21245 "tool_choice": Schema.optionalKey(
21246 Schema.Union([
21247 Schema.Union([Schema.Literal("none"), Schema.Literal("auto"), Schema.Literal("required")]).annotate({
21248 "description":
21249 "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n"
21250 }),
21251 Schema.Union([
21252 Schema.Struct({
21253 "type": Schema.Literals(["function", "code_interpreter", "file_search"]).annotate({
21254 "description": "The type of the tool. If type is `function`, the function name must be set"
21255 }),
21256 "function": Schema.optionalKey(
21257 Schema.Struct({ "name": Schema.String.annotate({ "description": "The name of the function to call." }) })
21258 )
21259 }).annotate({
21260 "description": "Specifies a tool the model should use. Use to force the model to call a specific tool."
21261 })
21262 ])
21263 ], { mode: "oneOf" }).annotate({
21264 "description":
21265 "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n"
21266 })
21267 ),
21268 "parallel_tool_calls": Schema.optionalKey(ParallelToolCalls),
21269 "response_format": Schema.optionalKey(Schema.Union([AssistantsApiResponseFormatOption, Schema.Null]))
21270})
21271export type ModifyAssistantRequest = {
21272 readonly "model"?: string | AssistantSupportedModels
21273 readonly "reasoning_effort"?: ReasoningEffort
21274 readonly "name"?: string | null
21275 readonly "description"?: string | null
21276 readonly "instructions"?: string | null
21277 readonly "tools"?: ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearch | AssistantToolsFunction>
21278 readonly "tool_resources"?: {
21279 readonly "code_interpreter"?: { readonly "file_ids"?: ReadonlyArray<string> }
21280 readonly "file_search"?: { readonly "vector_store_ids"?: ReadonlyArray<string> }
21281 } | null
21282 readonly "metadata"?: Metadata
21283 readonly "temperature"?: number | null
21284 readonly "top_p"?: number | null
21285 readonly "response_format"?: AssistantsApiResponseFormatOption | null
21286}
21287export const ModifyAssistantRequest = Schema.Struct({
21288 "model": Schema.optionalKey(
21289 Schema.Union([Schema.String, AssistantSupportedModels]).annotate({
21290 "description":
21291 "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.\n"
21292 })
21293 ),
21294 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
21295 "name": Schema.optionalKey(
21296 Schema.Union([
21297 Schema.String.annotate({ "description": "The name of the assistant. The maximum length is 256 characters.\n" })
21298 .check(Schema.isMaxLength(256)),
21299 Schema.Null
21300 ])
21301 ),
21302 "description": Schema.optionalKey(
21303 Schema.Union([
21304 Schema.String.annotate({
21305 "description": "The description of the assistant. The maximum length is 512 characters.\n"
21306 }).check(Schema.isMaxLength(512)),
21307 Schema.Null
21308 ])
21309 ),
21310 "instructions": Schema.optionalKey(
21311 Schema.Union([
21312 Schema.String.annotate({
21313 "description": "The system instructions that the assistant uses. The maximum length is 256,000 characters.\n"
21314 }).check(Schema.isMaxLength(256000)),
21315 Schema.Null
21316 ])
21317 ),
21318 "tools": Schema.optionalKey(
21319 Schema.Array(
21320 Schema.Union([AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction], { mode: "oneOf" })
21321 ).annotate({
21322 "description":
21323 "A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.\n"
21324 }).check(Schema.isMaxLength(128))
21325 ),
21326 "tool_resources": Schema.optionalKey(Schema.Union([
21327 Schema.Struct({
21328 "code_interpreter": Schema.optionalKey(Schema.Struct({
21329 "file_ids": Schema.optionalKey(
21330 Schema.Array(Schema.String).annotate({
21331 "description":
21332 "Overrides the list of [file](/docs/api-reference/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n"
21333 }).check(Schema.isMaxLength(20))
21334 )
21335 })),
21336 "file_search": Schema.optionalKey(Schema.Struct({
21337 "vector_store_ids": Schema.optionalKey(
21338 Schema.Array(Schema.String).annotate({
21339 "description":
21340 "Overrides the [vector store](/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.\n"
21341 }).check(Schema.isMaxLength(1))
21342 )
21343 }))
21344 }).annotate({
21345 "description":
21346 "A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs.\n"
21347 }),
21348 Schema.Null
21349 ])),
21350 "metadata": Schema.optionalKey(Metadata),
21351 "temperature": Schema.optionalKey(
21352 Schema.Union([
21353 Schema.Number.annotate({
21354 "description":
21355 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n"
21356 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
21357 Schema.Null
21358 ])
21359 ),
21360 "top_p": Schema.optionalKey(Schema.Union([
21361 Schema.Number.annotate({
21362 "description":
21363 "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or temperature but not both.\n"
21364 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
21365 Schema.Null
21366 ])),
21367 "response_format": Schema.optionalKey(Schema.Union([AssistantsApiResponseFormatOption, Schema.Null]))
21368})
21369export type RunObject = {
21370 readonly "id": string
21371 readonly "object": "thread.run"
21372 readonly "created_at": number
21373 readonly "thread_id": string
21374 readonly "assistant_id": string
21375 readonly "status":
21376 | "queued"
21377 | "in_progress"
21378 | "requires_action"
21379 | "cancelling"
21380 | "cancelled"
21381 | "failed"
21382 | "completed"
21383 | "incomplete"
21384 | "expired"
21385 readonly "required_action": {
21386 readonly "type": "submit_tool_outputs"
21387 readonly "submit_tool_outputs": { readonly "tool_calls": ReadonlyArray<RunToolCallObject> }
21388 }
21389 readonly "last_error": {
21390 readonly "code": "server_error" | "rate_limit_exceeded" | "invalid_prompt"
21391 readonly "message": string
21392 }
21393 readonly "expires_at": never
21394 readonly "started_at": never
21395 readonly "cancelled_at": never
21396 readonly "failed_at": never
21397 readonly "completed_at": never
21398 readonly "incomplete_details": { readonly "reason"?: "max_completion_tokens" | "max_prompt_tokens" }
21399 readonly "model": string
21400 readonly "instructions": string
21401 readonly "tools": ReadonlyArray<AssistantToolsCode | AssistantToolsFileSearch | AssistantToolsFunction>
21402 readonly "metadata": Metadata
21403 readonly "usage": RunCompletionUsage
21404 readonly "temperature"?: number | null
21405 readonly "top_p"?: number | null
21406 readonly "max_prompt_tokens": number
21407 readonly "max_completion_tokens": number
21408 readonly "truncation_strategy": {
21409 readonly "type": "auto" | "last_messages"
21410 readonly "last_messages"?: number | null
21411 }
21412 readonly "tool_choice": "none" | "auto" | "required" | {
21413 readonly "type": "function" | "code_interpreter" | "file_search"
21414 readonly "function"?: { readonly "name": string }
21415 }
21416 readonly "parallel_tool_calls": ParallelToolCalls
21417 readonly "response_format": AssistantsApiResponseFormatOption | null
21418}
21419export const RunObject = Schema.Struct({
21420 "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }),
21421 "object": Schema.Literal("thread.run").annotate({ "description": "The object type, which is always `thread.run`." }),
21422 "created_at": Schema.Number.annotate({
21423 "description": "The Unix timestamp (in seconds) for when the run was created.",
21424 "format": "unixtime"
21425 }).check(Schema.isInt()),
21426 "thread_id": Schema.String.annotate({
21427 "description": "The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run."
21428 }),
21429 "assistant_id": Schema.String.annotate({
21430 "description": "The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run."
21431 }),
21432 "status": Schema.Literals([
21433 "queued",
21434 "in_progress",
21435 "requires_action",
21436 "cancelling",
21437 "cancelled",
21438 "failed",
21439 "completed",
21440 "incomplete",
21441 "expired"
21442 ]).annotate({
21443 "description":
21444 "The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`."
21445 }),
21446 "required_action": Schema.Union([
21447 Schema.Struct({
21448 "type": Schema.Literal("submit_tool_outputs").annotate({
21449 "description": "For now, this is always `submit_tool_outputs`."
21450 }),
21451 "submit_tool_outputs": Schema.Struct({
21452 "tool_calls": Schema.Array(RunToolCallObject).annotate({ "description": "A list of the relevant tool calls." })
21453 }).annotate({ "description": "Details on the tool outputs needed for this run to continue." })
21454 }).annotate({
21455 "description": "Details on the action required to continue the run. Will be `null` if no action is required."
21456 })
21457 ]),
21458 "last_error": Schema.Union([
21459 Schema.Struct({
21460 "code": Schema.Literals(["server_error", "rate_limit_exceeded", "invalid_prompt"]).annotate({
21461 "description": "One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`."
21462 }),
21463 "message": Schema.String.annotate({ "description": "A human-readable description of the error." })
21464 }).annotate({ "description": "The last error associated with this run. Will be `null` if there are no errors." })
21465 ]),
21466 "expires_at": Schema.Never,
21467 "started_at": Schema.Never,
21468 "cancelled_at": Schema.Never,
21469 "failed_at": Schema.Never,
21470 "completed_at": Schema.Never,
21471 "incomplete_details": Schema.Union([
21472 Schema.Struct({
21473 "reason": Schema.optionalKey(
21474 Schema.Literals(["max_completion_tokens", "max_prompt_tokens"]).annotate({
21475 "description":
21476 "The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run."
21477 })
21478 )
21479 }).annotate({ "description": "Details on why the run is incomplete. Will be `null` if the run is not incomplete." })
21480 ]),
21481 "model": Schema.String.annotate({
21482 "description": "The model that the [assistant](/docs/api-reference/assistants) used for this run."
21483 }),
21484 "instructions": Schema.String.annotate({
21485 "description": "The instructions that the [assistant](/docs/api-reference/assistants) used for this run."
21486 }),
21487 "tools": Schema.Array(
21488 Schema.Union([AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction], { mode: "oneOf" })
21489 ).annotate({
21490 "description": "The list of tools that the [assistant](/docs/api-reference/assistants) used for this run."
21491 }).check(Schema.isMaxLength(20)),
21492 "metadata": Metadata,
21493 "usage": RunCompletionUsage,
21494 "temperature": Schema.optionalKey(
21495 Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null]).annotate({
21496 "description": "The sampling temperature used for this run. If not set, defaults to 1."
21497 })
21498 ),
21499 "top_p": Schema.optionalKey(
21500 Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null]).annotate({
21501 "description": "The nucleus sampling value used for this run. If not set, defaults to 1."
21502 })
21503 ),
21504 "max_prompt_tokens": Schema.Union([
21505 Schema.Number.check(Schema.isInt()).check(
21506 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(256)], {
21507 "description": "The maximum number of prompt tokens specified to have been used over the course of the run.\n"
21508 })
21509 )
21510 ]),
21511 "max_completion_tokens": Schema.Union([
21512 Schema.Number.check(Schema.isInt()).check(
21513 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(256)], {
21514 "description":
21515 "The maximum number of completion tokens specified to have been used over the course of the run.\n"
21516 })
21517 )
21518 ]),
21519 "truncation_strategy": Schema.Union([
21520 Schema.Struct({
21521 "type": Schema.Literals(["auto", "last_messages"]).annotate({
21522 "description":
21523 "The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`."
21524 }),
21525 "last_messages": Schema.optionalKey(
21526 Schema.Union([
21527 Schema.Number.annotate({
21528 "description":
21529 "The number of most recent messages from the thread when constructing the context for the run."
21530 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
21531 Schema.Null
21532 ])
21533 )
21534 }).annotate({
21535 "title": "Thread Truncation Controls",
21536 "description":
21537 "Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run."
21538 })
21539 ]),
21540 "tool_choice": Schema.Union([
21541 Schema.Union([Schema.Literal("none"), Schema.Literal("auto"), Schema.Literal("required")]).annotate({
21542 "description":
21543 "`none` means the model will not call any tools and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools before responding to the user.\n"
21544 }),
21545 Schema.Union([
21546 Schema.Struct({
21547 "type": Schema.Literals(["function", "code_interpreter", "file_search"]).annotate({
21548 "description": "The type of the tool. If type is `function`, the function name must be set"
21549 }),
21550 "function": Schema.optionalKey(
21551 Schema.Struct({ "name": Schema.String.annotate({ "description": "The name of the function to call." }) })
21552 )
21553 }).annotate({
21554 "description": "Specifies a tool the model should use. Use to force the model to call a specific tool."
21555 })
21556 ])
21557 ], { mode: "oneOf" }).annotate({
21558 "description":
21559 "Controls which (if any) tool is called by the model.\n`none` means the model will not call any tools and instead generates a message.\n`auto` is the default value and means the model can pick between generating a message or calling one or more tools.\n`required` means the model must call one or more tools before responding to the user.\nSpecifying a particular tool like `{\"type\": \"file_search\"}` or `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.\n"
21560 }),
21561 "parallel_tool_calls": ParallelToolCalls,
21562 "response_format": Schema.Union([AssistantsApiResponseFormatOption, Schema.Null])
21563}).annotate({
21564 "title": "A run on a thread",
21565 "description": "Represents an execution run on a [thread](/docs/api-reference/threads)."
21566})
21567export type ResponseTextParam = {
21568 readonly "format"?: TextResponseFormatConfiguration
21569 readonly "verbosity"?: Verbosity
21570}
21571export const ResponseTextParam = Schema.Struct({
21572 "format": Schema.optionalKey(TextResponseFormatConfiguration),
21573 "verbosity": Schema.optionalKey(Verbosity)
21574}).annotate({
21575 "description":
21576 "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Structured Outputs](/docs/guides/structured-outputs)\n"
21577})
21578export type RealtimeCreateClientSecretRequest = {
21579 readonly "expires_after"?: { readonly "anchor"?: "created_at"; readonly "seconds"?: number }
21580 readonly "session"?: RealtimeSessionCreateRequestGA | RealtimeTranscriptionSessionCreateRequestGA
21581}
21582export const RealtimeCreateClientSecretRequest = Schema.Struct({
21583 "expires_after": Schema.optionalKey(
21584 Schema.Struct({
21585 "anchor": Schema.optionalKey(
21586 Schema.Literal("created_at").annotate({
21587 "description":
21588 "The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported.\n"
21589 })
21590 ),
21591 "seconds": Schema.optionalKey(
21592 Schema.Number.annotate({
21593 "description":
21594 "The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified.\n",
21595 "format": "int64"
21596 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(10)).check(Schema.isLessThanOrEqualTo(7200))
21597 )
21598 }).annotate({
21599 "title": "Client secret expiration",
21600 "description":
21601 "Configuration for the client secret expiration. Expiration refers to the time after which\na client secret will no longer be valid for creating sessions. The session itself may\ncontinue after that time once started. A secret can be used to create multiple sessions\nuntil it expires.\n"
21602 })
21603 ),
21604 "session": Schema.optionalKey(
21605 Schema.Union([RealtimeSessionCreateRequestGA, RealtimeTranscriptionSessionCreateRequestGA], { mode: "oneOf" })
21606 .annotate({
21607 "title": "Session configuration",
21608 "description":
21609 "Session configuration to use for the client secret. Choose either a realtime\nsession or a transcription session.\n"
21610 })
21611 )
21612}).annotate({
21613 "title": "Realtime client secret creation request",
21614 "description":
21615 "Create a session and client secret for the Realtime API. The request can specify\neither a realtime or a transcription session configuration.\n[Learn more about the Realtime API](/docs/guides/realtime).\n"
21616})
21617export type RealtimeCreateClientSecretResponse = {
21618 readonly "value": string
21619 readonly "expires_at": number
21620 readonly "session": RealtimeSessionCreateResponseGA | RealtimeTranscriptionSessionCreateResponseGA
21621}
21622export const RealtimeCreateClientSecretResponse = Schema.Struct({
21623 "value": Schema.String.annotate({ "description": "The generated client secret value." }),
21624 "expires_at": Schema.Number.annotate({
21625 "description": "Expiration timestamp for the client secret, in seconds since epoch.",
21626 "format": "unixtime"
21627 }).check(Schema.isInt()),
21628 "session": Schema.Union([RealtimeSessionCreateResponseGA, RealtimeTranscriptionSessionCreateResponseGA], {
21629 mode: "oneOf"
21630 }).annotate({
21631 "title": "Session configuration",
21632 "description": "The session configuration for either a realtime or transcription session.\n"
21633 })
21634}).annotate({
21635 "title": "Realtime session and client secret",
21636 "description": "Response from creating a session and client secret for the Realtime API.\n"
21637})
21638export type RealtimeServerEventSessionCreated = {
21639 readonly "event_id": string
21640 readonly "type": "session.created"
21641 readonly "session": RealtimeSessionCreateResponseGA | RealtimeTranscriptionSessionCreateResponseGA
21642}
21643export const RealtimeServerEventSessionCreated = Schema.Struct({
21644 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
21645 "type": Schema.Literal("session.created").annotate({ "description": "The event type, must be `session.created`." }),
21646 "session": Schema.Union([RealtimeSessionCreateResponseGA, RealtimeTranscriptionSessionCreateResponseGA], {
21647 mode: "oneOf"
21648 }).annotate({ "description": "The session configuration." })
21649}).annotate({
21650 "description":
21651 "Returned when a Session is created. Emitted automatically when a new\nconnection is established as the first server event. This event will contain\nthe default Session configuration.\n"
21652})
21653export type RealtimeServerEventSessionUpdated = {
21654 readonly "event_id": string
21655 readonly "type": "session.updated"
21656 readonly "session": RealtimeSessionCreateResponseGA | RealtimeTranscriptionSessionCreateResponseGA
21657}
21658export const RealtimeServerEventSessionUpdated = Schema.Struct({
21659 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
21660 "type": Schema.Literal("session.updated").annotate({ "description": "The event type, must be `session.updated`." }),
21661 "session": Schema.Union([RealtimeSessionCreateResponseGA, RealtimeTranscriptionSessionCreateResponseGA], {
21662 mode: "oneOf"
21663 }).annotate({ "description": "The session configuration." })
21664}).annotate({
21665 "description": "Returned when a session is updated with a `session.update` event, unless\nthere is an error.\n"
21666})
21667export type CreateVectorStoreFileBatchRequest = {
21668 readonly "file_ids": ReadonlyArray<string>
21669 readonly "files"?: ReadonlyArray<CreateVectorStoreFileRequest>
21670 readonly "chunking_strategy"?: ChunkingStrategyRequestParam
21671 readonly "attributes"?: VectorStoreFileAttributes
21672} | {
21673 readonly "files": ReadonlyArray<CreateVectorStoreFileRequest>
21674 readonly "file_ids"?: ReadonlyArray<string>
21675 readonly "chunking_strategy"?: ChunkingStrategyRequestParam
21676 readonly "attributes"?: VectorStoreFileAttributes
21677}
21678export const CreateVectorStoreFileBatchRequest = Schema.Union([
21679 Schema.Struct({
21680 "file_ids": Schema.Array(Schema.String).annotate({
21681 "description":
21682 "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`."
21683 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2000)),
21684 "files": Schema.optionalKey(
21685 Schema.Array(CreateVectorStoreFileRequest).annotate({
21686 "description":
21687 "A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`."
21688 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2000))
21689 ),
21690 "chunking_strategy": Schema.optionalKey(ChunkingStrategyRequestParam),
21691 "attributes": Schema.optionalKey(VectorStoreFileAttributes)
21692 }),
21693 Schema.Struct({
21694 "files": Schema.Array(CreateVectorStoreFileRequest).annotate({
21695 "description":
21696 "A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`."
21697 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2000)),
21698 "file_ids": Schema.optionalKey(
21699 Schema.Array(Schema.String).annotate({
21700 "description":
21701 "A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`."
21702 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2000))
21703 ),
21704 "chunking_strategy": Schema.optionalKey(ChunkingStrategyRequestParam),
21705 "attributes": Schema.optionalKey(VectorStoreFileAttributes)
21706 })
21707])
21708export type CodeInterpreterTool = {
21709 readonly "type": "code_interpreter"
21710 readonly "container": string | AutoCodeInterpreterToolParam
21711}
21712export const CodeInterpreterTool = Schema.Struct({
21713 "type": Schema.Literal("code_interpreter").annotate({
21714 "description": "The type of the code interpreter tool. Always `code_interpreter`.\n"
21715 }),
21716 "container": Schema.Union([
21717 Schema.String.annotate({ "description": "The container ID." }),
21718 AutoCodeInterpreterToolParam
21719 ], { mode: "oneOf" }).annotate({
21720 "description":
21721 "The code interpreter container. Can be a container ID or an object that\nspecifies uploaded file IDs to make available to your code, along with an\noptional `memory_limit` setting.\n"
21722 })
21723}).annotate({
21724 "title": "Code interpreter",
21725 "description": "A tool that runs Python code to help generate a response to a prompt.\n"
21726})
21727export type FunctionShellToolParam = {
21728 readonly "type": "shell"
21729 readonly "environment"?: ContainerAutoParam | LocalEnvironmentParam | ContainerReferenceParam | null
21730}
21731export const FunctionShellToolParam = Schema.Struct({
21732 "type": Schema.Literal("shell").annotate({ "description": "The type of the shell tool. Always `shell`." }),
21733 "environment": Schema.optionalKey(
21734 Schema.Union([
21735 Schema.Union([ContainerAutoParam, LocalEnvironmentParam, ContainerReferenceParam], { mode: "oneOf" }),
21736 Schema.Null
21737 ])
21738 )
21739}).annotate({ "title": "Shell tool", "description": "A tool that allows the model to execute shell commands." })
21740export type EvalItemContent = EvalItemContentItem | EvalItemContentArray
21741export const EvalItemContent = Schema.Union([EvalItemContentItem, EvalItemContentArray], { mode: "oneOf" }).annotate({
21742 "title": "Eval content",
21743 "description":
21744 "Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.\n"
21745})
21746export type OutputMessageContent = OutputTextContent | RefusalContent
21747export const OutputMessageContent = Schema.Union([OutputTextContent, RefusalContent], { mode: "oneOf" })
21748export type ResponseContentPartAddedEvent = {
21749 readonly "type": "response.content_part.added"
21750 readonly "item_id": string
21751 readonly "output_index": number
21752 readonly "content_index": number
21753 readonly "part": OutputTextContent | RefusalContent | ReasoningTextContent
21754 readonly "sequence_number": number
21755}
21756export const ResponseContentPartAddedEvent = Schema.Struct({
21757 "type": Schema.Literal("response.content_part.added").annotate({
21758 "description": "The type of the event. Always `response.content_part.added`.\n"
21759 }),
21760 "item_id": Schema.String.annotate({
21761 "description": "The ID of the output item that the content part was added to.\n"
21762 }),
21763 "output_index": Schema.Number.annotate({
21764 "description": "The index of the output item that the content part was added to.\n"
21765 }).check(Schema.isInt()),
21766 "content_index": Schema.Number.annotate({ "description": "The index of the content part that was added.\n" }).check(
21767 Schema.isInt()
21768 ),
21769 "part": Schema.Union([OutputTextContent, RefusalContent, ReasoningTextContent], { mode: "oneOf" }).annotate({
21770 "description": "The content part that was added.\n"
21771 }),
21772 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
21773 Schema.isInt()
21774 )
21775}).annotate({ "description": "Emitted when a new content part is added." })
21776export type ResponseContentPartDoneEvent = {
21777 readonly "type": "response.content_part.done"
21778 readonly "item_id": string
21779 readonly "output_index": number
21780 readonly "content_index": number
21781 readonly "sequence_number": number
21782 readonly "part": OutputTextContent | RefusalContent | ReasoningTextContent
21783}
21784export const ResponseContentPartDoneEvent = Schema.Struct({
21785 "type": Schema.Literal("response.content_part.done").annotate({
21786 "description": "The type of the event. Always `response.content_part.done`.\n"
21787 }),
21788 "item_id": Schema.String.annotate({
21789 "description": "The ID of the output item that the content part was added to.\n"
21790 }),
21791 "output_index": Schema.Number.annotate({
21792 "description": "The index of the output item that the content part was added to.\n"
21793 }).check(Schema.isInt()),
21794 "content_index": Schema.Number.annotate({ "description": "The index of the content part that is done.\n" }).check(
21795 Schema.isInt()
21796 ),
21797 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
21798 Schema.isInt()
21799 ),
21800 "part": Schema.Union([OutputTextContent, RefusalContent, ReasoningTextContent], { mode: "oneOf" }).annotate({
21801 "description": "The content part that is done.\n"
21802 })
21803}).annotate({ "description": "Emitted when a content part is done." })
21804export type Message = {
21805 readonly "type": "message"
21806 readonly "id": string
21807 readonly "status": "in_progress" | "completed" | "incomplete"
21808 readonly "role": "unknown" | "user" | "assistant" | "system" | "critic" | "discriminator" | "developer" | "tool"
21809 readonly "content": ReadonlyArray<
21810 | InputTextContent
21811 | OutputTextContent
21812 | TextContent
21813 | SummaryTextContent
21814 | ReasoningTextContent
21815 | RefusalContent
21816 | InputImageContent
21817 | ComputerScreenshotContent
21818 | InputFileContent
21819 >
21820 readonly "phase"?: "commentary" | "final_answer" | null
21821}
21822export const Message = Schema.Struct({
21823 "type": Schema.Literal("message").annotate({ "description": "The type of the message. Always set to `message`." }),
21824 "id": Schema.String.annotate({ "description": "The unique ID of the message." }),
21825 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
21826 "description":
21827 "The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API."
21828 }),
21829 "role": Schema.Literals(["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"])
21830 .annotate({
21831 "description":
21832 "The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`."
21833 }),
21834 "content": Schema.Array(
21835 Schema.Union([
21836 InputTextContent,
21837 OutputTextContent,
21838 TextContent,
21839 SummaryTextContent,
21840 ReasoningTextContent,
21841 RefusalContent,
21842 InputImageContent,
21843 ComputerScreenshotContent,
21844 InputFileContent
21845 ], { mode: "oneOf" }).annotate({ "description": "A content part that makes up an input or output item." })
21846 ).annotate({ "description": "The content of the message" }),
21847 "phase": Schema.optionalKey(Schema.Union([
21848 Schema.Literals(["commentary", "final_answer"]).annotate({
21849 "description":
21850 "Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages."
21851 }),
21852 Schema.Null
21853 ]))
21854}).annotate({ "title": "Message", "description": "A message to or from the model." })
21855export type EasyInputMessage = {
21856 readonly "role": "user" | "assistant" | "system" | "developer"
21857 readonly "content": string | InputMessageContentList
21858 readonly "phase"?: MessagePhase | null
21859 readonly "type"?: "message"
21860}
21861export const EasyInputMessage = Schema.Struct({
21862 "role": Schema.Literals(["user", "assistant", "system", "developer"]).annotate({
21863 "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"
21864 }),
21865 "content": Schema.Union([
21866 Schema.String.annotate({ "title": "Text input", "description": "A text input to the model.\n" }),
21867 InputMessageContentList
21868 ], { mode: "oneOf" }).annotate({
21869 "description":
21870 "Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n"
21871 }),
21872 "phase": Schema.optionalKey(Schema.Union([MessagePhase, Schema.Null])),
21873 "type": Schema.optionalKey(
21874 Schema.Literal("message").annotate({ "description": "The type of the message input. Always `message`.\n" })
21875 )
21876}).annotate({
21877 "title": "Input message",
21878 "description":
21879 "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n"
21880})
21881export type InputMessageResource = {
21882 readonly "type": "message"
21883 readonly "role": "user" | "system" | "developer"
21884 readonly "status"?: "in_progress" | "completed" | "incomplete"
21885 readonly "content": InputMessageContentList
21886 readonly "id": string
21887}
21888export const InputMessageResource = Schema.Struct({
21889 "type": Schema.Literal("message").annotate({
21890 "description": "The type of the message input. Always set to `message`.\n"
21891 }),
21892 "role": Schema.Literals(["user", "system", "developer"]).annotate({
21893 "description": "The role of the message input. One of `user`, `system`, or `developer`.\n"
21894 }),
21895 "status": Schema.optionalKey(
21896 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
21897 "description":
21898 "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
21899 })
21900 ),
21901 "content": InputMessageContentList,
21902 "id": Schema.String.annotate({ "description": "The unique ID of the message input.\n" })
21903}).annotate({
21904 "title": "Input message",
21905 "description":
21906 "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role.\n"
21907})
21908export type ComputerActionList = ReadonlyArray<ComputerAction>
21909export const ComputerActionList = Schema.Array(ComputerAction).annotate({
21910 "title": "Computer Action List",
21911 "description":
21912 "Flattened batched actions for `computer_use`. Each action includes an\n`type` discriminator and action-specific fields.\n"
21913})
21914export type ThreadItem =
21915 | UserMessageItem
21916 | AssistantMessageItem
21917 | WidgetMessageItem
21918 | ClientToolCallItem
21919 | TaskItem
21920 | TaskGroupItem
21921export const ThreadItem = Schema.Union([
21922 UserMessageItem,
21923 AssistantMessageItem,
21924 WidgetMessageItem,
21925 ClientToolCallItem,
21926 TaskItem,
21927 TaskGroupItem
21928], { mode: "oneOf" }).annotate({ "title": "The thread item" })
21929export type ListAuditLogsResponse = {
21930 readonly "object": "list"
21931 readonly "data": ReadonlyArray<AuditLog>
21932 readonly "first_id"?: string | null
21933 readonly "last_id"?: string | null
21934 readonly "has_more": boolean
21935}
21936export const ListAuditLogsResponse = Schema.Struct({
21937 "object": Schema.Literal("list"),
21938 "data": Schema.Array(AuditLog),
21939 "first_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
21940 "last_id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
21941 "has_more": Schema.Boolean
21942})
21943export type ChatCompletionList = {
21944 readonly "object": "list"
21945 readonly "data": ReadonlyArray<CreateChatCompletionResponse>
21946 readonly "first_id": string
21947 readonly "last_id": string
21948 readonly "has_more": boolean
21949}
21950export const ChatCompletionList = Schema.Struct({
21951 "object": Schema.Literal("list").annotate({
21952 "description": "The type of this object. It is always set to \"list\".\n"
21953 }),
21954 "data": Schema.Array(CreateChatCompletionResponse).annotate({
21955 "description": "An array of chat completion objects.\n"
21956 }),
21957 "first_id": Schema.String.annotate({
21958 "description": "The identifier of the first chat completion in the data array."
21959 }),
21960 "last_id": Schema.String.annotate({ "description": "The identifier of the last chat completion in the data array." }),
21961 "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more Chat Completions available." })
21962}).annotate({ "title": "ChatCompletionList", "description": "An object representing a list of Chat Completions.\n" })
21963export type CreateChatCompletionRequest = {
21964 readonly "metadata"?: Metadata
21965 readonly "top_logprobs"?: number
21966 readonly "temperature"?: number | null
21967 readonly "top_p"?: number | null
21968 readonly "user"?: string | null
21969 readonly "safety_identifier"?: string
21970 readonly "prompt_cache_key"?: string | null
21971 readonly "service_tier"?: ServiceTier
21972 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
21973 readonly "messages": ReadonlyArray<ChatCompletionRequestMessage>
21974 readonly "model":
21975 | string
21976 | "gpt-5.4"
21977 | "gpt-5.4-mini"
21978 | "gpt-5.4-nano"
21979 | "gpt-5.4-mini-2026-03-17"
21980 | "gpt-5.4-nano-2026-03-17"
21981 | "gpt-5.3-chat-latest"
21982 | "gpt-5.2"
21983 | "gpt-5.2-2025-12-11"
21984 | "gpt-5.2-chat-latest"
21985 | "gpt-5.2-pro"
21986 | "gpt-5.2-pro-2025-12-11"
21987 | "gpt-5.1"
21988 | "gpt-5.1-2025-11-13"
21989 | "gpt-5.1-codex"
21990 | "gpt-5.1-mini"
21991 | "gpt-5.1-chat-latest"
21992 | "gpt-5"
21993 | "gpt-5-mini"
21994 | "gpt-5-nano"
21995 | "gpt-5-2025-08-07"
21996 | "gpt-5-mini-2025-08-07"
21997 | "gpt-5-nano-2025-08-07"
21998 | "gpt-5-chat-latest"
21999 | "gpt-4.1"
22000 | "gpt-4.1-mini"
22001 | "gpt-4.1-nano"
22002 | "gpt-4.1-2025-04-14"
22003 | "gpt-4.1-mini-2025-04-14"
22004 | "gpt-4.1-nano-2025-04-14"
22005 | "o4-mini"
22006 | "o4-mini-2025-04-16"
22007 | "o3"
22008 | "o3-2025-04-16"
22009 | "o3-mini"
22010 | "o3-mini-2025-01-31"
22011 | "o1"
22012 | "o1-2024-12-17"
22013 | "o1-preview"
22014 | "o1-preview-2024-09-12"
22015 | "o1-mini"
22016 | "o1-mini-2024-09-12"
22017 | "gpt-4o"
22018 | "gpt-4o-2024-11-20"
22019 | "gpt-4o-2024-08-06"
22020 | "gpt-4o-2024-05-13"
22021 | "gpt-4o-audio-preview"
22022 | "gpt-4o-audio-preview-2024-10-01"
22023 | "gpt-4o-audio-preview-2024-12-17"
22024 | "gpt-4o-audio-preview-2025-06-03"
22025 | "gpt-4o-mini-audio-preview"
22026 | "gpt-4o-mini-audio-preview-2024-12-17"
22027 | "gpt-4o-search-preview"
22028 | "gpt-4o-mini-search-preview"
22029 | "gpt-4o-search-preview-2025-03-11"
22030 | "gpt-4o-mini-search-preview-2025-03-11"
22031 | "chatgpt-4o-latest"
22032 | "codex-mini-latest"
22033 | "gpt-4o-mini"
22034 | "gpt-4o-mini-2024-07-18"
22035 | "gpt-4-turbo"
22036 | "gpt-4-turbo-2024-04-09"
22037 | "gpt-4-0125-preview"
22038 | "gpt-4-turbo-preview"
22039 | "gpt-4-1106-preview"
22040 | "gpt-4-vision-preview"
22041 | "gpt-4"
22042 | "gpt-4-0314"
22043 | "gpt-4-0613"
22044 | "gpt-4-32k"
22045 | "gpt-4-32k-0314"
22046 | "gpt-4-32k-0613"
22047 | "gpt-3.5-turbo"
22048 | "gpt-3.5-turbo-16k"
22049 | "gpt-3.5-turbo-0301"
22050 | "gpt-3.5-turbo-0613"
22051 | "gpt-3.5-turbo-1106"
22052 | "gpt-3.5-turbo-0125"
22053 | "gpt-3.5-turbo-16k-0613"
22054 readonly "modalities"?: ResponseModalities
22055 readonly "verbosity"?: Verbosity
22056 readonly "reasoning_effort"?: ReasoningEffort
22057 readonly "max_completion_tokens"?: number | null
22058 readonly "frequency_penalty"?: number
22059 readonly "presence_penalty"?: number
22060 readonly "web_search_options"?: {
22061 readonly "user_location"?: { readonly "type": "approximate"; readonly "approximate": WebSearchLocation }
22062 readonly "search_context_size"?: WebSearchContextSize
22063 }
22064 readonly "response_format"?: ResponseFormatText | ResponseFormatJsonSchema | ResponseFormatJsonObject
22065 readonly "audio"?: {
22066 readonly "voice": VoiceIdsShared | { readonly "id": string }
22067 readonly "format": "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16"
22068 }
22069 readonly "store"?: boolean | null
22070 readonly "stream"?: boolean | null
22071 readonly "stop"?: StopConfiguration
22072 readonly "logit_bias"?: {}
22073 readonly "logprobs"?: boolean | null
22074 readonly "max_tokens"?: number | null
22075 readonly "n"?: number
22076 readonly "prediction"?: PredictionContent | null
22077 readonly "seed"?: number
22078 readonly "stream_options"?: ChatCompletionStreamOptions
22079 readonly "tools"?: ReadonlyArray<ChatCompletionTool | CustomToolChatCompletions>
22080 readonly "tool_choice"?: ChatCompletionToolChoiceOption
22081 readonly "parallel_tool_calls"?: ParallelToolCalls
22082 readonly "function_call"?: "none" | "auto" | ChatCompletionFunctionCallOption
22083 readonly "functions"?: ReadonlyArray<ChatCompletionFunctions>
22084}
22085export const CreateChatCompletionRequest = Schema.Struct({
22086 "metadata": Schema.optionalKey(Metadata),
22087 "top_logprobs": Schema.optionalKey(
22088 Schema.Union([
22089 Schema.Union([
22090 Schema.Number.check(Schema.isInt()).check(
22091 Schema.makeFilterGroup(
22092 [Schema.isFinite(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)],
22093 {
22094 "description":
22095 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n`logprobs` must be set to `true` if this parameter is used.\n"
22096 }
22097 )
22098 ).check(
22099 Schema.makeFilterGroup([
22100 Schema.isGreaterThanOrEqualTo(0),
22101 Schema.isLessThanOrEqualTo(20),
22102 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)], {
22103 "description":
22104 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
22105 })
22106 ], {
22107 "description":
22108 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
22109 })
22110 )
22111 ])
22112 ])
22113 ),
22114 "temperature": Schema.optionalKey(
22115 Schema.Union([
22116 Schema.Number.annotate({
22117 "description":
22118 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
22119 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
22120 Schema.Null
22121 ])
22122 ),
22123 "top_p": Schema.optionalKey(Schema.Union([
22124 Schema.Number.annotate({
22125 "description":
22126 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
22127 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
22128 Schema.Null
22129 ])),
22130 "user": Schema.optionalKey(
22131 Schema.Union([Schema.String, Schema.Null]).annotate({
22132 "description":
22133 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
22134 })
22135 ),
22136 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
22137 "description":
22138 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
22139 }))])),
22140 "prompt_cache_key": Schema.optionalKey(
22141 Schema.Union([Schema.String, Schema.Null]).annotate({
22142 "description":
22143 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
22144 })
22145 ),
22146 "service_tier": Schema.optionalKey(ServiceTier),
22147 "prompt_cache_retention": Schema.optionalKey(
22148 Schema.Union([
22149 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
22150 "description":
22151 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
22152 }),
22153 Schema.Null
22154 ])
22155 ),
22156 "messages": Schema.Array(ChatCompletionRequestMessage).annotate({
22157 "description":
22158 "A list of messages comprising the conversation so far. Depending on the\n[model](/docs/models) you use, different message types (modalities) are\nsupported, like [text](/docs/guides/text-generation),\n[images](/docs/guides/vision), and [audio](/docs/guides/audio).\n"
22159 }).check(Schema.isMinLength(1)),
22160 "model": Schema.Union([
22161 Schema.String,
22162 Schema.Literals([
22163 "gpt-5.4",
22164 "gpt-5.4-mini",
22165 "gpt-5.4-nano",
22166 "gpt-5.4-mini-2026-03-17",
22167 "gpt-5.4-nano-2026-03-17",
22168 "gpt-5.3-chat-latest",
22169 "gpt-5.2",
22170 "gpt-5.2-2025-12-11",
22171 "gpt-5.2-chat-latest",
22172 "gpt-5.2-pro",
22173 "gpt-5.2-pro-2025-12-11",
22174 "gpt-5.1",
22175 "gpt-5.1-2025-11-13",
22176 "gpt-5.1-codex",
22177 "gpt-5.1-mini",
22178 "gpt-5.1-chat-latest",
22179 "gpt-5",
22180 "gpt-5-mini",
22181 "gpt-5-nano",
22182 "gpt-5-2025-08-07",
22183 "gpt-5-mini-2025-08-07",
22184 "gpt-5-nano-2025-08-07",
22185 "gpt-5-chat-latest",
22186 "gpt-4.1",
22187 "gpt-4.1-mini",
22188 "gpt-4.1-nano",
22189 "gpt-4.1-2025-04-14",
22190 "gpt-4.1-mini-2025-04-14",
22191 "gpt-4.1-nano-2025-04-14",
22192 "o4-mini",
22193 "o4-mini-2025-04-16",
22194 "o3",
22195 "o3-2025-04-16",
22196 "o3-mini",
22197 "o3-mini-2025-01-31",
22198 "o1",
22199 "o1-2024-12-17",
22200 "o1-preview",
22201 "o1-preview-2024-09-12",
22202 "o1-mini",
22203 "o1-mini-2024-09-12",
22204 "gpt-4o",
22205 "gpt-4o-2024-11-20",
22206 "gpt-4o-2024-08-06",
22207 "gpt-4o-2024-05-13",
22208 "gpt-4o-audio-preview",
22209 "gpt-4o-audio-preview-2024-10-01",
22210 "gpt-4o-audio-preview-2024-12-17",
22211 "gpt-4o-audio-preview-2025-06-03",
22212 "gpt-4o-mini-audio-preview",
22213 "gpt-4o-mini-audio-preview-2024-12-17",
22214 "gpt-4o-search-preview",
22215 "gpt-4o-mini-search-preview",
22216 "gpt-4o-search-preview-2025-03-11",
22217 "gpt-4o-mini-search-preview-2025-03-11",
22218 "chatgpt-4o-latest",
22219 "codex-mini-latest",
22220 "gpt-4o-mini",
22221 "gpt-4o-mini-2024-07-18",
22222 "gpt-4-turbo",
22223 "gpt-4-turbo-2024-04-09",
22224 "gpt-4-0125-preview",
22225 "gpt-4-turbo-preview",
22226 "gpt-4-1106-preview",
22227 "gpt-4-vision-preview",
22228 "gpt-4",
22229 "gpt-4-0314",
22230 "gpt-4-0613",
22231 "gpt-4-32k",
22232 "gpt-4-32k-0314",
22233 "gpt-4-32k-0613",
22234 "gpt-3.5-turbo",
22235 "gpt-3.5-turbo-16k",
22236 "gpt-3.5-turbo-0301",
22237 "gpt-3.5-turbo-0613",
22238 "gpt-3.5-turbo-1106",
22239 "gpt-3.5-turbo-0125",
22240 "gpt-3.5-turbo-16k-0613"
22241 ])
22242 ]).annotate({
22243 "description":
22244 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
22245 }),
22246 "modalities": Schema.optionalKey(ResponseModalities),
22247 "verbosity": Schema.optionalKey(Verbosity),
22248 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
22249 "max_completion_tokens": Schema.optionalKey(
22250 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
22251 "description":
22252 "An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
22253 })
22254 ),
22255 "frequency_penalty": Schema.optionalKey(
22256 Schema.Union([
22257 Schema.Number.check(Schema.isFinite()).check(
22258 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(-2), Schema.isLessThanOrEqualTo(2)], {
22259 "description":
22260 "Number between -2.0 and 2.0. Positive values penalize new tokens based on\ntheir existing frequency in the text so far, decreasing the model's\nlikelihood to repeat the same line verbatim.\n"
22261 })
22262 )
22263 ])
22264 ),
22265 "presence_penalty": Schema.optionalKey(
22266 Schema.Union([
22267 Schema.Number.check(Schema.isFinite()).check(
22268 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(-2), Schema.isLessThanOrEqualTo(2)], {
22269 "description":
22270 "Number between -2.0 and 2.0. Positive values penalize new tokens based on\nwhether they appear in the text so far, increasing the model's likelihood\nto talk about new topics.\n"
22271 })
22272 )
22273 ])
22274 ),
22275 "web_search_options": Schema.optionalKey(
22276 Schema.Struct({
22277 "user_location": Schema.optionalKey(
22278 Schema.Union([
22279 Schema.Struct({
22280 "type": Schema.Literal("approximate").annotate({
22281 "description": "The type of location approximation. Always `approximate`.\n"
22282 }),
22283 "approximate": WebSearchLocation
22284 }).annotate({ "description": "Approximate location parameters for the search.\n" })
22285 ])
22286 ),
22287 "search_context_size": Schema.optionalKey(WebSearchContextSize)
22288 }).annotate({
22289 "title": "Web search",
22290 "description":
22291 "This tool searches the web for relevant results to use in a response.\nLearn more about the [web search tool](/docs/guides/tools-web-search?api-mode=chat).\n"
22292 })
22293 ),
22294 "response_format": Schema.optionalKey(
22295 Schema.Union([ResponseFormatText, ResponseFormatJsonSchema, ResponseFormatJsonObject], { mode: "oneOf" }).annotate({
22296 "description":
22297 "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"
22298 })
22299 ),
22300 "audio": Schema.optionalKey(Schema.Union([
22301 Schema.Struct({
22302 "voice": Schema.Union([
22303 VoiceIdsShared,
22304 Schema.Struct({ "id": Schema.String.annotate({ "description": "The custom voice ID, e.g. `voice_1234`." }) })
22305 .annotate({ "description": "Custom voice reference." })
22306 ]).annotate({
22307 "title": "Voice",
22308 "description":
22309 "The voice the model uses to respond. Supported built-in voices are\n`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`,\n`sage`, `shimmer`, `marin`, and `cedar`. You may also provide a\ncustom voice object with an `id`, for example `{ \"id\": \"voice_1234\" }`.\n"
22310 }),
22311 "format": Schema.Literals(["wav", "aac", "mp3", "flac", "opus", "pcm16"]).annotate({
22312 "description": "Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`,\n`opus`, or `pcm16`.\n"
22313 })
22314 }).annotate({
22315 "description":
22316 "Parameters for audio output. Required when audio output is requested with\n`modalities: [\"audio\"]`. [Learn more](/docs/guides/audio).\n"
22317 })
22318 ])),
22319 "store": Schema.optionalKey(
22320 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
22321 "description":
22322 "Whether or not to store the output of this chat completion request for\nuse in our [model distillation](/docs/guides/distillation) or\n[evals](/docs/guides/evals) products.\n\nSupports text and image inputs. Note: image inputs over 8MB will be dropped.\n"
22323 })
22324 ),
22325 "stream": Schema.optionalKey(
22326 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
22327 "description":
22328 "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](/docs/api-reference/chat/streaming)\nfor more information, along with the [streaming responses](/docs/guides/streaming-responses)\nguide for more information on how to handle the streaming events.\n"
22329 })
22330 ),
22331 "stop": Schema.optionalKey(StopConfiguration),
22332 "logit_bias": Schema.optionalKey(Schema.Union([
22333 Schema.Struct({}).annotate({
22334 "description":
22335 "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a JSON object that maps tokens (specified by their token ID in the\ntokenizer) to an associated bias value from -100 to 100. Mathematically,\nthe bias is added to the logits generated by the model prior to sampling.\nThe exact effect will vary per model, but values between -1 and 1 should\ndecrease or increase likelihood of selection; values like -100 or 100\nshould result in a ban or exclusive selection of the relevant token.\n"
22336 })
22337 ])),
22338 "logprobs": Schema.optionalKey(
22339 Schema.Union([Schema.Boolean, Schema.Null]).annotate({
22340 "description":
22341 "Whether to return log probabilities of the output tokens or not. If true,\nreturns the log probabilities of each output token returned in the\n`content` of `message`.\n"
22342 })
22343 ),
22344 "max_tokens": Schema.optionalKey(
22345 Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({
22346 "description":
22347 "The maximum number of [tokens](/tokenizer) that can be generated in the\nchat completion. This value can be used to control\n[costs](https://openai.com/api/pricing/) for text generated via API.\n\nThis value is now deprecated in favor of `max_completion_tokens`, and is\nnot compatible with [o-series models](/docs/guides/reasoning).\n"
22348 })
22349 ),
22350 "n": Schema.optionalKey(
22351 Schema.Union([
22352 Schema.Number.check(Schema.isInt()).check(
22353 Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(128)], {
22354 "description":
22355 "How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs."
22356 })
22357 )
22358 ])
22359 ),
22360 "prediction": Schema.optionalKey(Schema.Union([
22361 Schema.Union([PredictionContent], { mode: "oneOf" }).annotate({
22362 "description":
22363 "Configuration for a [Predicted Output](/docs/guides/predicted-outputs),\nwhich can greatly improve response times when large parts of the model\nresponse are known ahead of time. This is most common when you are\nregenerating a file with only minor changes to most of the content.\n"
22364 }),
22365 Schema.Null
22366 ])),
22367 "seed": Schema.optionalKey(
22368 Schema.Union([
22369 Schema.Number.check(Schema.isInt()).check(
22370 Schema.makeFilterGroup([
22371 Schema.isFinite(),
22372 Schema.isGreaterThanOrEqualTo(-9223372036854776000),
22373 Schema.isLessThanOrEqualTo(9223372036854776000)
22374 ], {
22375 "description":
22376 "This feature is in Beta.\nIf specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.\nDeterminism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.\n"
22377 })
22378 )
22379 ])
22380 ),
22381 "stream_options": Schema.optionalKey(ChatCompletionStreamOptions),
22382 "tools": Schema.optionalKey(
22383 Schema.Array(Schema.Union([ChatCompletionTool, CustomToolChatCompletions], { mode: "oneOf" })).annotate({
22384 "description":
22385 "A list of tools the model may call. You can provide either\n[custom tools](/docs/guides/function-calling#custom-tools) or\n[function tools](/docs/guides/function-calling).\n"
22386 })
22387 ),
22388 "tool_choice": Schema.optionalKey(ChatCompletionToolChoiceOption),
22389 "parallel_tool_calls": Schema.optionalKey(ParallelToolCalls),
22390 "function_call": Schema.optionalKey(
22391 Schema.Union([
22392 Schema.Literals(["none", "auto"]).annotate({
22393 "description":
22394 "`none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function.\n"
22395 }),
22396 ChatCompletionFunctionCallOption
22397 ], { mode: "oneOf" }).annotate({
22398 "description":
22399 "Deprecated in favor of `tool_choice`.\n\nControls which (if any) function is called by the model.\n\n`none` means the model will not call a function and instead generates a\nmessage.\n\n`auto` means the model can pick between generating a message or calling a\nfunction.\n\nSpecifying a particular function via `{\"name\": \"my_function\"}` forces the\nmodel to call that function.\n\n`none` is the default when no functions are present. `auto` is the default\nif functions are present.\n"
22400 })
22401 ),
22402 "functions": Schema.optionalKey(
22403 Schema.Array(ChatCompletionFunctions).annotate({
22404 "description": "Deprecated in favor of `tools`.\n\nA list of functions the model may generate JSON inputs for.\n"
22405 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128))
22406 )
22407})
22408export type ListRunStepsResponse = {
22409 readonly "object": string
22410 readonly "data": ReadonlyArray<RunStepObject>
22411 readonly "first_id": string
22412 readonly "last_id": string
22413 readonly "has_more": boolean
22414 readonly [x: string]: unknown
22415}
22416export const ListRunStepsResponse = Schema.StructWithRest(
22417 Schema.Struct({
22418 "object": Schema.String,
22419 "data": Schema.Array(RunStepObject),
22420 "first_id": Schema.String,
22421 "last_id": Schema.String,
22422 "has_more": Schema.Boolean
22423 }),
22424 [Schema.Record(Schema.String, Schema.Json)]
22425)
22426export type RunStepStreamEvent =
22427 | { readonly "event": "thread.run.step.created"; readonly "data": RunStepObject }
22428 | { readonly "event": "thread.run.step.in_progress"; readonly "data": RunStepObject }
22429 | { readonly "event": "thread.run.step.delta"; readonly "data": RunStepDeltaObject }
22430 | { readonly "event": "thread.run.step.completed"; readonly "data": RunStepObject }
22431 | { readonly "event": "thread.run.step.failed"; readonly "data": RunStepObject }
22432 | { readonly "event": "thread.run.step.cancelled"; readonly "data": RunStepObject }
22433 | { readonly "event": "thread.run.step.expired"; readonly "data": RunStepObject }
22434export const RunStepStreamEvent = Schema.Union([
22435 Schema.Struct({ "event": Schema.Literal("thread.run.step.created"), "data": RunStepObject }).annotate({
22436 "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is created."
22437 }),
22438 Schema.Struct({ "event": Schema.Literal("thread.run.step.in_progress"), "data": RunStepObject }).annotate({
22439 "description":
22440 "Occurs when a [run step](/docs/api-reference/run-steps/step-object) moves to an `in_progress` state."
22441 }),
22442 Schema.Struct({ "event": Schema.Literal("thread.run.step.delta"), "data": RunStepDeltaObject }).annotate({
22443 "description": "Occurs when parts of a [run step](/docs/api-reference/run-steps/step-object) are being streamed."
22444 }),
22445 Schema.Struct({ "event": Schema.Literal("thread.run.step.completed"), "data": RunStepObject }).annotate({
22446 "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is completed."
22447 }),
22448 Schema.Struct({ "event": Schema.Literal("thread.run.step.failed"), "data": RunStepObject }).annotate({
22449 "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) fails."
22450 }),
22451 Schema.Struct({ "event": Schema.Literal("thread.run.step.cancelled"), "data": RunStepObject }).annotate({
22452 "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) is cancelled."
22453 }),
22454 Schema.Struct({ "event": Schema.Literal("thread.run.step.expired"), "data": RunStepObject }).annotate({
22455 "description": "Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires."
22456 })
22457], { mode: "oneOf" })
22458export type RealtimeServerEventResponseCreated = {
22459 readonly "event_id": string
22460 readonly "type": "response.created"
22461 readonly "response": RealtimeResponse
22462}
22463export const RealtimeServerEventResponseCreated = Schema.Struct({
22464 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
22465 "type": Schema.Literal("response.created").annotate({ "description": "The event type, must be `response.created`." }),
22466 "response": RealtimeResponse
22467}).annotate({
22468 "description":
22469 "Returned when a new Response is created. The first event of response creation,\nwhere the response is in an initial state of `in_progress`.\n"
22470})
22471export type RealtimeServerEventResponseDone = {
22472 readonly "event_id": string
22473 readonly "type": "response.done"
22474 readonly "response": RealtimeResponse
22475}
22476export const RealtimeServerEventResponseDone = Schema.Struct({
22477 "event_id": Schema.String.annotate({ "description": "The unique ID of the server event." }),
22478 "type": Schema.Literal("response.done").annotate({ "description": "The event type, must be `response.done`." }),
22479 "response": RealtimeResponse
22480}).annotate({
22481 "description":
22482 "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n\nClients should check the `status` field of the Response to determine if it was successful\n(`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`.\n\nA response will contain all output items that were generated during the response, excluding\nany audio content.\n"
22483})
22484export type RealtimeClientEventResponseCreate = {
22485 readonly "event_id"?: string
22486 readonly "type": "response.create"
22487 readonly "response"?: RealtimeResponseCreateParams
22488}
22489export const RealtimeClientEventResponseCreate = Schema.Struct({
22490 "event_id": Schema.optionalKey(
22491 Schema.String.annotate({ "description": "Optional client-generated ID used to identify this event." }).check(
22492 Schema.isMaxLength(512)
22493 )
22494 ),
22495 "type": Schema.Literal("response.create").annotate({ "description": "The event type, must be `response.create`." }),
22496 "response": Schema.optionalKey(RealtimeResponseCreateParams)
22497}).annotate({
22498 "description":
22499 "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n"
22500})
22501export type ListAssistantsResponse = {
22502 readonly "object": string
22503 readonly "data": ReadonlyArray<AssistantObject>
22504 readonly "first_id": string
22505 readonly "last_id": string
22506 readonly "has_more": boolean
22507}
22508export const ListAssistantsResponse = Schema.Struct({
22509 "object": Schema.String,
22510 "data": Schema.Array(AssistantObject),
22511 "first_id": Schema.String,
22512 "last_id": Schema.String,
22513 "has_more": Schema.Boolean
22514})
22515export type ListRunsResponse = {
22516 readonly "object": string
22517 readonly "data": ReadonlyArray<RunObject>
22518 readonly "first_id": string
22519 readonly "last_id": string
22520 readonly "has_more": boolean
22521}
22522export const ListRunsResponse = Schema.Struct({
22523 "object": Schema.String,
22524 "data": Schema.Array(RunObject),
22525 "first_id": Schema.String,
22526 "last_id": Schema.String,
22527 "has_more": Schema.Boolean
22528})
22529export type RunStreamEvent =
22530 | { readonly "event": "thread.run.created"; readonly "data": RunObject }
22531 | { readonly "event": "thread.run.queued"; readonly "data": RunObject }
22532 | { readonly "event": "thread.run.in_progress"; readonly "data": RunObject }
22533 | { readonly "event": "thread.run.requires_action"; readonly "data": RunObject }
22534 | { readonly "event": "thread.run.completed"; readonly "data": RunObject }
22535 | { readonly "event": "thread.run.incomplete"; readonly "data": RunObject }
22536 | { readonly "event": "thread.run.failed"; readonly "data": RunObject }
22537 | { readonly "event": "thread.run.cancelling"; readonly "data": RunObject }
22538 | { readonly "event": "thread.run.cancelled"; readonly "data": RunObject }
22539 | { readonly "event": "thread.run.expired"; readonly "data": RunObject }
22540export const RunStreamEvent = Schema.Union([
22541 Schema.Struct({ "event": Schema.Literal("thread.run.created"), "data": RunObject }).annotate({
22542 "description": "Occurs when a new [run](/docs/api-reference/runs/object) is created."
22543 }),
22544 Schema.Struct({ "event": Schema.Literal("thread.run.queued"), "data": RunObject }).annotate({
22545 "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `queued` status."
22546 }),
22547 Schema.Struct({ "event": Schema.Literal("thread.run.in_progress"), "data": RunObject }).annotate({
22548 "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to an `in_progress` status."
22549 }),
22550 Schema.Struct({ "event": Schema.Literal("thread.run.requires_action"), "data": RunObject }).annotate({
22551 "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `requires_action` status."
22552 }),
22553 Schema.Struct({ "event": Schema.Literal("thread.run.completed"), "data": RunObject }).annotate({
22554 "description": "Occurs when a [run](/docs/api-reference/runs/object) is completed."
22555 }),
22556 Schema.Struct({ "event": Schema.Literal("thread.run.incomplete"), "data": RunObject }).annotate({
22557 "description": "Occurs when a [run](/docs/api-reference/runs/object) ends with status `incomplete`."
22558 }),
22559 Schema.Struct({ "event": Schema.Literal("thread.run.failed"), "data": RunObject }).annotate({
22560 "description": "Occurs when a [run](/docs/api-reference/runs/object) fails."
22561 }),
22562 Schema.Struct({ "event": Schema.Literal("thread.run.cancelling"), "data": RunObject }).annotate({
22563 "description": "Occurs when a [run](/docs/api-reference/runs/object) moves to a `cancelling` status."
22564 }),
22565 Schema.Struct({ "event": Schema.Literal("thread.run.cancelled"), "data": RunObject }).annotate({
22566 "description": "Occurs when a [run](/docs/api-reference/runs/object) is cancelled."
22567 }),
22568 Schema.Struct({ "event": Schema.Literal("thread.run.expired"), "data": RunObject }).annotate({
22569 "description": "Occurs when a [run](/docs/api-reference/runs/object) expires."
22570 })
22571], { mode: "oneOf" })
22572export type Tool =
22573 | FunctionTool
22574 | FileSearchTool
22575 | ComputerTool
22576 | ComputerUsePreviewTool
22577 | WebSearchTool
22578 | MCPTool
22579 | CodeInterpreterTool
22580 | ImageGenTool
22581 | LocalShellToolParam
22582 | FunctionShellToolParam
22583 | CustomToolParam
22584 | NamespaceToolParam
22585 | ToolSearchToolParam
22586 | WebSearchPreviewTool
22587 | ApplyPatchToolParam
22588export const Tool = Schema.Union([
22589 FunctionTool,
22590 FileSearchTool,
22591 ComputerTool,
22592 ComputerUsePreviewTool,
22593 WebSearchTool,
22594 MCPTool,
22595 CodeInterpreterTool,
22596 ImageGenTool,
22597 LocalShellToolParam,
22598 FunctionShellToolParam,
22599 CustomToolParam,
22600 NamespaceToolParam,
22601 ToolSearchToolParam,
22602 WebSearchPreviewTool,
22603 ApplyPatchToolParam
22604], { mode: "oneOf" }).annotate({ "description": "A tool that can be used to generate a response.\n" })
22605export type CreateEvalItem = { readonly "role": string; readonly "content": string } | {
22606 readonly "role": "user" | "assistant" | "system" | "developer"
22607 readonly "content": EvalItemContent
22608 readonly "type"?: "message"
22609}
22610export const CreateEvalItem = Schema.Union([
22611 Schema.Struct({
22612 "role": Schema.String.annotate({
22613 "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")."
22614 }),
22615 "content": Schema.String.annotate({ "description": "The content of the message." })
22616 }).annotate({
22617 "title": "CreateEvalItem",
22618 "description":
22619 "A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
22620 }),
22621 Schema.Struct({
22622 "role": Schema.Literals(["user", "assistant", "system", "developer"]).annotate({
22623 "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"
22624 }),
22625 "content": EvalItemContent,
22626 "type": Schema.optionalKey(
22627 Schema.Literal("message").annotate({ "description": "The type of the message input. Always `message`.\n" })
22628 )
22629 }).annotate({
22630 "title": "CreateEvalItem",
22631 "description":
22632 "A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
22633 })
22634], { mode: "oneOf" })
22635export type EvalItem = {
22636 readonly "role": "user" | "assistant" | "system" | "developer"
22637 readonly "content": EvalItemContent
22638 readonly "type"?: "message"
22639}
22640export const EvalItem = Schema.Struct({
22641 "role": Schema.Literals(["user", "assistant", "system", "developer"]).annotate({
22642 "description": "The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n"
22643 }),
22644 "content": EvalItemContent,
22645 "type": Schema.optionalKey(
22646 Schema.Literal("message").annotate({ "description": "The type of the message input. Always `message`.\n" })
22647 )
22648}).annotate({
22649 "title": "Eval message object",
22650 "description":
22651 "A message input to the model with a role indicating instruction following\nhierarchy. Instructions given with the `developer` or `system` role take\nprecedence over instructions given with the `user` role. Messages with the\n`assistant` role are presumed to have been generated by the model in previous\ninteractions.\n"
22652})
22653export type OutputMessage = {
22654 readonly "id": string
22655 readonly "type": "message"
22656 readonly "role": "assistant"
22657 readonly "content": ReadonlyArray<OutputMessageContent>
22658 readonly "phase"?: MessagePhase | null
22659 readonly "status": "in_progress" | "completed" | "incomplete"
22660}
22661export const OutputMessage = Schema.Struct({
22662 "id": Schema.String.annotate({ "description": "The unique ID of the output message.\n" }),
22663 "type": Schema.Literal("message").annotate({ "description": "The type of the output message. Always `message`.\n" }),
22664 "role": Schema.Literal("assistant").annotate({
22665 "description": "The role of the output message. Always `assistant`.\n"
22666 }),
22667 "content": Schema.Array(OutputMessageContent).annotate({ "description": "The content of the output message.\n" }),
22668 "phase": Schema.optionalKey(Schema.Union([MessagePhase, Schema.Null])),
22669 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
22670 "description":
22671 "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"
22672 })
22673}).annotate({ "title": "Output message", "description": "An output message from the model.\n" })
22674export type ComputerToolCall = {
22675 readonly "type": "computer_call"
22676 readonly "id": string
22677 readonly "call_id": string
22678 readonly "action"?: ComputerAction
22679 readonly "actions"?: ComputerActionList
22680 readonly "pending_safety_checks": ReadonlyArray<ComputerCallSafetyCheckParam>
22681 readonly "status": "in_progress" | "completed" | "incomplete"
22682}
22683export const ComputerToolCall = Schema.Struct({
22684 "type": Schema.Literal("computer_call").annotate({
22685 "description": "The type of the computer call. Always `computer_call`."
22686 }),
22687 "id": Schema.String.annotate({ "description": "The unique ID of the computer call." }),
22688 "call_id": Schema.String.annotate({
22689 "description": "An identifier used when responding to the tool call with output.\n"
22690 }),
22691 "action": Schema.optionalKey(ComputerAction),
22692 "actions": Schema.optionalKey(ComputerActionList),
22693 "pending_safety_checks": Schema.Array(ComputerCallSafetyCheckParam).annotate({
22694 "description": "The pending safety checks for the computer call.\n"
22695 }),
22696 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
22697 "description":
22698 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
22699 })
22700}).annotate({
22701 "title": "Computer tool call",
22702 "description":
22703 "A tool call to a computer use tool. See the\n[computer use guide](/docs/guides/tools-computer-use) for more information.\n"
22704})
22705export type ThreadItemListResource = {
22706 readonly "object": "list"
22707 readonly "data": ReadonlyArray<ThreadItem>
22708 readonly "first_id": string | null
22709 readonly "last_id": string | null
22710 readonly "has_more": boolean
22711}
22712export const ThreadItemListResource = Schema.Struct({
22713 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
22714 "data": Schema.Array(ThreadItem).annotate({ "description": "A list of items" }),
22715 "first_id": Schema.Union([
22716 Schema.String.annotate({ "description": "The ID of the first item in the list." }),
22717 Schema.Null
22718 ]),
22719 "last_id": Schema.Union([
22720 Schema.String.annotate({ "description": "The ID of the last item in the list." }),
22721 Schema.Null
22722 ]),
22723 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." })
22724}).annotate({
22725 "title": "Thread Items",
22726 "description": "A paginated list of thread items rendered for the ChatKit API."
22727})
22728export type InputItem =
22729 | EasyInputMessage
22730 | {
22731 readonly "type"?: "message"
22732 readonly "role": "user" | "system" | "developer"
22733 readonly "status"?: "in_progress" | "completed" | "incomplete"
22734 readonly "content": InputMessageContentList
22735 }
22736 | {
22737 readonly "id": string
22738 readonly "type": "message"
22739 readonly "role": "assistant"
22740 readonly "content": ReadonlyArray<OutputMessageContent>
22741 readonly "phase"?: MessagePhase | null
22742 readonly "status": "in_progress" | "completed" | "incomplete"
22743 }
22744 | {
22745 readonly "id": string
22746 readonly "type": "file_search_call"
22747 readonly "status": "in_progress" | "searching" | "completed" | "incomplete" | "failed"
22748 readonly "queries": ReadonlyArray<string>
22749 readonly "results"?:
22750 | ReadonlyArray<
22751 {
22752 readonly "file_id"?: string
22753 readonly "text"?: string
22754 readonly "filename"?: string
22755 readonly "attributes"?: VectorStoreFileAttributes
22756 readonly "score"?: number
22757 }
22758 >
22759 | null
22760 }
22761 | {
22762 readonly "type": "computer_call"
22763 readonly "id": string
22764 readonly "call_id": string
22765 readonly "action"?: ComputerAction
22766 readonly "actions"?: ComputerActionList
22767 readonly "pending_safety_checks": ReadonlyArray<ComputerCallSafetyCheckParam>
22768 readonly "status": "in_progress" | "completed" | "incomplete"
22769 }
22770 | {
22771 readonly "id"?: string | null
22772 readonly "call_id": string
22773 readonly "type": "computer_call_output"
22774 readonly "output": ComputerScreenshotImage
22775 readonly "acknowledged_safety_checks"?: ReadonlyArray<ComputerCallSafetyCheckParam> | null
22776 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22777 }
22778 | {
22779 readonly "id": string
22780 readonly "type": "web_search_call"
22781 readonly "status": "in_progress" | "searching" | "completed" | "failed" | "incomplete"
22782 readonly "action"?:
22783 | {
22784 readonly "type": "search"
22785 readonly "query"?: string
22786 readonly "queries"?: ReadonlyArray<string>
22787 readonly "sources"?: ReadonlyArray<
22788 { readonly "type": "url"; readonly "url": string } | { readonly "type": "api"; readonly "name": string }
22789 >
22790 }
22791 | { readonly "type": "open_page"; readonly "url"?: string | null }
22792 | { readonly "type": "find_in_page"; readonly "url": string; readonly "pattern": string }
22793 }
22794 | {
22795 readonly "id"?: string
22796 readonly "type": "function_call"
22797 readonly "call_id": string
22798 readonly "namespace"?: string
22799 readonly "name": string
22800 readonly "arguments": string
22801 readonly "status"?: "in_progress" | "completed" | "incomplete"
22802 }
22803 | {
22804 readonly "id"?: string | null
22805 readonly "call_id": string
22806 readonly "type": "function_call_output"
22807 readonly "output":
22808 | string
22809 | ReadonlyArray<InputTextContentParam | InputImageContentParamAutoParam | InputFileContentParam>
22810 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22811 }
22812 | {
22813 readonly "id"?: string | null
22814 readonly "call_id"?: string | null
22815 readonly "type": "tool_search_call"
22816 readonly "execution"?: "server" | "client"
22817 readonly "arguments": {}
22818 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22819 }
22820 | {
22821 readonly "id"?: string | null
22822 readonly "call_id"?: string | null
22823 readonly "type": "tool_search_output"
22824 readonly "execution"?: "server" | "client"
22825 readonly "tools": ReadonlyArray<Tool>
22826 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22827 }
22828 | {
22829 readonly "type": "reasoning"
22830 readonly "id": string
22831 readonly "encrypted_content"?: string | null
22832 readonly "summary": ReadonlyArray<SummaryTextContent>
22833 readonly "content"?: ReadonlyArray<ReasoningTextContent>
22834 readonly "status"?: "in_progress" | "completed" | "incomplete"
22835 }
22836 | { readonly "id"?: string | null; readonly "type": "compaction"; readonly "encrypted_content": string }
22837 | {
22838 readonly "type": "image_generation_call"
22839 readonly "id": string
22840 readonly "status": "in_progress" | "completed" | "generating" | "failed"
22841 readonly "result": string | null
22842 }
22843 | {
22844 readonly "type": "code_interpreter_call"
22845 readonly "id": string
22846 readonly "status": "in_progress" | "completed" | "incomplete" | "interpreting" | "failed"
22847 readonly "container_id": string
22848 readonly "code": string | null
22849 readonly "outputs": ReadonlyArray<CodeInterpreterOutputLogs | CodeInterpreterOutputImage> | null
22850 }
22851 | {
22852 readonly "type": "local_shell_call"
22853 readonly "id": string
22854 readonly "call_id": string
22855 readonly "action": LocalShellExecAction
22856 readonly "status": "in_progress" | "completed" | "incomplete"
22857 }
22858 | {
22859 readonly "type": "local_shell_call_output"
22860 readonly "id": string
22861 readonly "output": string
22862 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22863 readonly "call_id": unknown
22864 }
22865 | {
22866 readonly "id"?: string | null
22867 readonly "call_id": string
22868 readonly "type": "shell_call"
22869 readonly "action": {
22870 readonly "commands": ReadonlyArray<string>
22871 readonly "timeout_ms"?: number | null
22872 readonly "max_output_length"?: number | null
22873 }
22874 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22875 readonly "environment"?: LocalEnvironmentParam | ContainerReferenceParam | null
22876 }
22877 | {
22878 readonly "id"?: string | null
22879 readonly "call_id": string
22880 readonly "type": "shell_call_output"
22881 readonly "output": ReadonlyArray<FunctionShellCallOutputContentParam>
22882 readonly "status"?: "in_progress" | "completed" | "incomplete" | null
22883 readonly "max_output_length"?: number | null
22884 }
22885 | {
22886 readonly "type": "apply_patch_call"
22887 readonly "id"?: string | null
22888 readonly "call_id": string
22889 readonly "status": "in_progress" | "completed"
22890 readonly "operation":
22891 | ApplyPatchCreateFileOperationParam
22892 | ApplyPatchDeleteFileOperationParam
22893 | ApplyPatchUpdateFileOperationParam
22894 }
22895 | {
22896 readonly "type": "apply_patch_call_output"
22897 readonly "id"?: string | null
22898 readonly "call_id": string
22899 readonly "status": "completed" | "failed"
22900 readonly "output"?: string | null
22901 }
22902 | {
22903 readonly "type": "mcp_list_tools"
22904 readonly "id": string
22905 readonly "server_label": string
22906 readonly "tools": ReadonlyArray<MCPListToolsTool>
22907 readonly "error"?: string | null
22908 }
22909 | {
22910 readonly "type": "mcp_approval_request"
22911 readonly "id": string
22912 readonly "server_label": string
22913 readonly "name": string
22914 readonly "arguments": string
22915 }
22916 | {
22917 readonly "type": "mcp_approval_response"
22918 readonly "id"?: string | null
22919 readonly "approval_request_id": string
22920 readonly "approve": boolean
22921 readonly "reason"?: string | null
22922 readonly "request_id": unknown
22923 }
22924 | {
22925 readonly "type": "mcp_call"
22926 readonly "id": string
22927 readonly "server_label": string
22928 readonly "name": string
22929 readonly "arguments": string
22930 readonly "output"?: string | null
22931 readonly "error"?: string | null
22932 readonly "status"?: "in_progress" | "completed" | "incomplete" | "calling" | "failed"
22933 readonly "approval_request_id"?: string | null
22934 }
22935 | {
22936 readonly "type": "custom_tool_call_output"
22937 readonly "id"?: string
22938 readonly "call_id": string
22939 readonly "output": string | ReadonlyArray<FunctionAndCustomToolCallOutput>
22940 }
22941 | {
22942 readonly "type": "custom_tool_call"
22943 readonly "id"?: string
22944 readonly "call_id": string
22945 readonly "namespace"?: string
22946 readonly "name": string
22947 readonly "input": string
22948 }
22949 | CompactionTriggerItemParam
22950 | ItemReferenceParam
22951export const InputItem = Schema.Union([
22952 EasyInputMessage,
22953 Schema.Union([
22954 Schema.Struct({
22955 "type": Schema.optionalKey(
22956 Schema.Literal("message").annotate({
22957 "description": "The type of the message input. Always set to `message`.\n"
22958 })
22959 ),
22960 "role": Schema.Literals(["user", "system", "developer"]).annotate({
22961 "description": "The role of the message input. One of `user`, `system`, or `developer`.\n"
22962 }),
22963 "status": Schema.optionalKey(
22964 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
22965 "description":
22966 "The status of item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
22967 })
22968 ),
22969 "content": InputMessageContentList
22970 }).annotate({ "title": "Input message", "description": "Content item used to generate a response.\n" }),
22971 Schema.Struct({
22972 "id": Schema.String.annotate({ "description": "The unique ID of the output message.\n" }),
22973 "type": Schema.Literal("message").annotate({
22974 "description": "The type of the output message. Always `message`.\n"
22975 }),
22976 "role": Schema.Literal("assistant").annotate({
22977 "description": "The role of the output message. Always `assistant`.\n"
22978 }),
22979 "content": Schema.Array(OutputMessageContent).annotate({ "description": "The content of the output message.\n" }),
22980 "phase": Schema.optionalKey(Schema.Union([MessagePhase, Schema.Null])),
22981 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
22982 "description":
22983 "The status of the message input. One of `in_progress`, `completed`, or\n`incomplete`. Populated when input items are returned via API.\n"
22984 })
22985 }).annotate({ "title": "Output message", "description": "Content item used to generate a response.\n" }),
22986 Schema.Struct({
22987 "id": Schema.String.annotate({ "description": "The unique ID of the file search tool call.\n" }),
22988 "type": Schema.Literal("file_search_call").annotate({
22989 "description": "The type of the file search tool call. Always `file_search_call`.\n"
22990 }),
22991 "status": Schema.Literals(["in_progress", "searching", "completed", "incomplete", "failed"]).annotate({
22992 "description":
22993 "The status of the file search tool call. One of `in_progress`,\n`searching`, `incomplete` or `failed`,\n"
22994 }),
22995 "queries": Schema.Array(Schema.String).annotate({ "description": "The queries used to search for files.\n" }),
22996 "results": Schema.optionalKey(Schema.Union([
22997 Schema.Array(Schema.Struct({
22998 "file_id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the file.\n" })),
22999 "text": Schema.optionalKey(
23000 Schema.String.annotate({ "description": "The text that was retrieved from the file.\n" })
23001 ),
23002 "filename": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the file.\n" })),
23003 "attributes": Schema.optionalKey(VectorStoreFileAttributes),
23004 "score": Schema.optionalKey(
23005 Schema.Number.annotate({
23006 "description": "The relevance score of the file - a value between 0 and 1.\n",
23007 "format": "float"
23008 }).check(Schema.isFinite())
23009 )
23010 })).annotate({ "description": "The results of the file search tool call.\n" }),
23011 Schema.Null
23012 ]))
23013 }).annotate({ "title": "File search tool call", "description": "Content item used to generate a response.\n" }),
23014 Schema.Struct({
23015 "type": Schema.Literal("computer_call").annotate({
23016 "description": "The type of the computer call. Always `computer_call`."
23017 }),
23018 "id": Schema.String.annotate({ "description": "The unique ID of the computer call." }),
23019 "call_id": Schema.String.annotate({
23020 "description": "An identifier used when responding to the tool call with output.\n"
23021 }),
23022 "action": Schema.optionalKey(ComputerAction),
23023 "actions": Schema.optionalKey(ComputerActionList),
23024 "pending_safety_checks": Schema.Array(ComputerCallSafetyCheckParam).annotate({
23025 "description": "The pending safety checks for the computer call.\n"
23026 }),
23027 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23028 "description":
23029 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
23030 })
23031 }).annotate({ "title": "Computer tool call", "description": "Content item used to generate a response.\n" }),
23032 Schema.Struct({
23033 "id": Schema.optionalKey(
23034 Schema.Union([
23035 Schema.String.annotate({ "description": "The ID of the computer tool call output." }),
23036 Schema.Null
23037 ])
23038 ),
23039 "call_id": Schema.String.annotate({ "description": "The ID of the computer tool call that produced the output." })
23040 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23041 "type": Schema.Literal("computer_call_output").annotate({
23042 "description": "The type of the computer tool call output. Always `computer_call_output`."
23043 }),
23044 "output": ComputerScreenshotImage,
23045 "acknowledged_safety_checks": Schema.optionalKey(
23046 Schema.Union([
23047 Schema.Array(ComputerCallSafetyCheckParam).annotate({
23048 "description": "The safety checks reported by the API that have been acknowledged by the developer."
23049 }),
23050 Schema.Null
23051 ])
23052 ),
23053 "status": Schema.optionalKey(
23054 Schema.Union([
23055 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23056 "description":
23057 "The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API."
23058 }),
23059 Schema.Null
23060 ])
23061 )
23062 }).annotate({ "title": "Computer tool call output", "description": "Content item used to generate a response.\n" }),
23063 Schema.Struct({
23064 "id": Schema.String.annotate({ "description": "The unique ID of the web search tool call.\n" }),
23065 "type": Schema.Literal("web_search_call").annotate({
23066 "description": "The type of the web search tool call. Always `web_search_call`.\n"
23067 }),
23068 "status": Schema.Literals(["in_progress", "searching", "completed", "failed", "incomplete"]).annotate({
23069 "description": "The status of the web search tool call.\n"
23070 }),
23071 "action": Schema.optionalKey(Schema.Union([
23072 Schema.Struct({
23073 "type": Schema.Literal("search").annotate({ "description": "The action type.\n" }),
23074 "query": Schema.optionalKey(Schema.String.annotate({ "description": "[DEPRECATED] The search query.\n" })),
23075 "queries": Schema.optionalKey(
23076 Schema.Array(Schema.String.annotate({ "description": "A search query.\n" })).annotate({
23077 "title": "Search queries",
23078 "description": "The search queries.\n"
23079 })
23080 ),
23081 "sources": Schema.optionalKey(
23082 Schema.Array(
23083 Schema.Union([
23084 Schema.Struct({
23085 "type": Schema.Literal("url").annotate({ "description": "The type of source. Always `url`.\n" }),
23086 "url": Schema.String.annotate({ "description": "The URL of the source.\n", "format": "uri" })
23087 }).annotate({ "title": "Web search source", "description": "A source used in the search.\n" }),
23088 Schema.Struct({
23089 "type": Schema.Literal("api").annotate({ "description": "The type of source. Always `api`.\n" }),
23090 "name": Schema.String.annotate({
23091 "description":
23092 "The name of the API source, such as `oai-weather`, `oai-sports`, or `oai-finance`.\n"
23093 })
23094 }).annotate({ "title": "Web search API source", "description": "An API source used in the search.\n" })
23095 ])
23096 ).annotate({ "title": "Web search sources", "description": "The sources used in the search.\n" })
23097 )
23098 }).annotate({
23099 "title": "Search action",
23100 "description":
23101 "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n"
23102 }),
23103 Schema.Struct({
23104 "type": Schema.Literal("open_page").annotate({ "description": "The action type. Always `open_page`.\n" }),
23105 "url": Schema.optionalKey(
23106 Schema.Union([Schema.String.annotate({ "format": "uri" }), Schema.Null]).annotate({
23107 "description": "The URL opened by the model.\n"
23108 })
23109 )
23110 }).annotate({
23111 "title": "Open page action",
23112 "description":
23113 "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n"
23114 }),
23115 Schema.Struct({
23116 "type": Schema.Literal("find_in_page").annotate({ "description": "The action type.\n" }),
23117 "url": Schema.String.annotate({
23118 "description": "The URL of the page searched for the pattern.\n",
23119 "format": "uri"
23120 }),
23121 "pattern": Schema.String.annotate({ "description": "The pattern or text to search for within the page.\n" })
23122 }).annotate({
23123 "title": "Find action",
23124 "description":
23125 "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n"
23126 })
23127 ], { mode: "oneOf" }))
23128 }).annotate({ "title": "Web search tool call", "description": "Content item used to generate a response.\n" }),
23129 Schema.Struct({
23130 "id": Schema.optionalKey(Schema.String.annotate({ "description": "The unique ID of the function tool call.\n" })),
23131 "type": Schema.Literal("function_call").annotate({
23132 "description": "The type of the function tool call. Always `function_call`.\n"
23133 }),
23134 "call_id": Schema.String.annotate({
23135 "description": "The unique ID of the function tool call generated by the model.\n"
23136 }),
23137 "namespace": Schema.optionalKey(
23138 Schema.String.annotate({ "description": "The namespace of the function to run.\n" })
23139 ),
23140 "name": Schema.String.annotate({ "description": "The name of the function to run.\n" }),
23141 "arguments": Schema.String.annotate({
23142 "description": "A JSON string of the arguments to pass to the function.\n"
23143 }),
23144 "status": Schema.optionalKey(
23145 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23146 "description":
23147 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
23148 })
23149 )
23150 }).annotate({ "title": "Function tool call", "description": "Content item used to generate a response.\n" }),
23151 Schema.Struct({
23152 "id": Schema.optionalKey(
23153 Schema.Union([
23154 Schema.String.annotate({
23155 "description":
23156 "The unique ID of the function tool call output. Populated when this item is returned via API."
23157 }),
23158 Schema.Null
23159 ])
23160 ),
23161 "call_id": Schema.String.annotate({
23162 "description": "The unique ID of the function tool call generated by the model."
23163 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23164 "type": Schema.Literal("function_call_output").annotate({
23165 "description": "The type of the function tool call output. Always `function_call_output`."
23166 }),
23167 "output": Schema.Union([
23168 Schema.String.annotate({ "description": "A JSON string of the output of the function tool call." }).check(
23169 Schema.isMaxLength(10485760)
23170 ),
23171 Schema.Array(
23172 Schema.Union([InputTextContentParam, InputImageContentParamAutoParam, InputFileContentParam], {
23173 mode: "oneOf"
23174 }).annotate({ "description": "A piece of message content, such as text, an image, or a file." })
23175 ).annotate({ "description": "An array of content outputs (text, image, file) for the function tool call." })
23176 ], { mode: "oneOf" }).annotate({ "description": "Text, image, or file output of the function tool call." }),
23177 "status": Schema.optionalKey(
23178 Schema.Union([
23179 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23180 "description":
23181 "The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API."
23182 }),
23183 Schema.Null
23184 ])
23185 )
23186 }).annotate({ "title": "Function tool call output", "description": "Content item used to generate a response.\n" }),
23187 Schema.Struct({
23188 "id": Schema.optionalKey(
23189 Schema.Union([
23190 Schema.String.annotate({ "description": "The unique ID of this tool search call." }),
23191 Schema.Null
23192 ])
23193 ),
23194 "call_id": Schema.optionalKey(
23195 Schema.Union([
23196 Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." })
23197 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23198 Schema.Null
23199 ])
23200 ),
23201 "type": Schema.Literal("tool_search_call").annotate({
23202 "description": "The item type. Always `tool_search_call`."
23203 }),
23204 "execution": Schema.optionalKey(
23205 Schema.Literals(["server", "client"]).annotate({
23206 "description": "Whether tool search was executed by the server or by the client."
23207 })
23208 ),
23209 "arguments": Schema.Struct({}).annotate({ "description": "The arguments supplied to the tool search call." }),
23210 "status": Schema.optionalKey(
23211 Schema.Union([
23212 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23213 "description": "The status of the tool search call."
23214 }),
23215 Schema.Null
23216 ])
23217 )
23218 }).annotate({ "description": "Content item used to generate a response.\n" }),
23219 Schema.Struct({
23220 "id": Schema.optionalKey(
23221 Schema.Union([
23222 Schema.String.annotate({ "description": "The unique ID of this tool search output." }),
23223 Schema.Null
23224 ])
23225 ),
23226 "call_id": Schema.optionalKey(
23227 Schema.Union([
23228 Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." })
23229 .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23230 Schema.Null
23231 ])
23232 ),
23233 "type": Schema.Literal("tool_search_output").annotate({
23234 "description": "The item type. Always `tool_search_output`."
23235 }),
23236 "execution": Schema.optionalKey(
23237 Schema.Literals(["server", "client"]).annotate({
23238 "description": "Whether tool search was executed by the server or by the client."
23239 })
23240 ),
23241 "tools": Schema.Array(Tool).annotate({
23242 "description": "The loaded tool definitions returned by the tool search output."
23243 }),
23244 "status": Schema.optionalKey(
23245 Schema.Union([
23246 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23247 "description": "The status of the tool search output."
23248 }),
23249 Schema.Null
23250 ])
23251 )
23252 }).annotate({ "description": "Content item used to generate a response.\n" }),
23253 Schema.Struct({
23254 "type": Schema.Literal("reasoning").annotate({ "description": "The type of the object. Always `reasoning`.\n" }),
23255 "id": Schema.String.annotate({ "description": "The unique identifier of the reasoning content.\n" }),
23256 "encrypted_content": Schema.optionalKey(
23257 Schema.Union([
23258 Schema.String.annotate({
23259 "description":
23260 "The encrypted content of the reasoning item - populated when a response is\ngenerated with `reasoning.encrypted_content` in the `include` parameter.\n"
23261 }),
23262 Schema.Null
23263 ])
23264 ),
23265 "summary": Schema.Array(SummaryTextContent).annotate({ "description": "Reasoning summary content.\n" }),
23266 "content": Schema.optionalKey(
23267 Schema.Array(ReasoningTextContent).annotate({ "description": "Reasoning text content.\n" })
23268 ),
23269 "status": Schema.optionalKey(
23270 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23271 "description":
23272 "The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n"
23273 })
23274 )
23275 }).annotate({ "title": "Reasoning", "description": "Content item used to generate a response.\n" }),
23276 Schema.Struct({
23277 "id": Schema.optionalKey(
23278 Schema.Union([Schema.String.annotate({ "description": "The ID of the compaction item." }), Schema.Null])
23279 ),
23280 "type": Schema.Literal("compaction").annotate({ "description": "The type of the item. Always `compaction`." }),
23281 "encrypted_content": Schema.String.annotate({ "description": "The encrypted content of the compaction summary." })
23282 .check(Schema.isMaxLength(10485760))
23283 }).annotate({ "title": "Compaction item", "description": "Content item used to generate a response.\n" }),
23284 Schema.Struct({
23285 "type": Schema.Literal("image_generation_call").annotate({
23286 "description": "The type of the image generation call. Always `image_generation_call`.\n"
23287 }),
23288 "id": Schema.String.annotate({ "description": "The unique ID of the image generation call.\n" }),
23289 "status": Schema.Literals(["in_progress", "completed", "generating", "failed"]).annotate({
23290 "description": "The status of the image generation call.\n"
23291 }),
23292 "result": Schema.Union([
23293 Schema.String.annotate({ "description": "The generated image encoded in base64.\n" }),
23294 Schema.Null
23295 ])
23296 }).annotate({ "title": "Image generation call", "description": "Content item used to generate a response.\n" }),
23297 Schema.Struct({
23298 "type": Schema.Literal("code_interpreter_call").annotate({
23299 "description": "The type of the code interpreter tool call. Always `code_interpreter_call`.\n"
23300 }),
23301 "id": Schema.String.annotate({ "description": "The unique ID of the code interpreter tool call.\n" }),
23302 "status": Schema.Literals(["in_progress", "completed", "incomplete", "interpreting", "failed"]).annotate({
23303 "description":
23304 "The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n"
23305 }),
23306 "container_id": Schema.String.annotate({ "description": "The ID of the container used to run the code.\n" }),
23307 "code": Schema.Union([
23308 Schema.String.annotate({ "description": "The code to run, or null if not available.\n" }),
23309 Schema.Null
23310 ]),
23311 "outputs": Schema.Union([
23312 Schema.Array(Schema.Union([CodeInterpreterOutputLogs, CodeInterpreterOutputImage], { mode: "oneOf" })).annotate(
23313 {
23314 "description":
23315 "The outputs generated by the code interpreter, such as logs or images.\nCan be null if no outputs are available.\n"
23316 }
23317 ),
23318 Schema.Null
23319 ])
23320 }).annotate({
23321 "title": "Code interpreter tool call",
23322 "description": "Content item used to generate a response.\n"
23323 }),
23324 Schema.Struct({
23325 "type": Schema.Literal("local_shell_call").annotate({
23326 "description": "The type of the local shell call. Always `local_shell_call`.\n"
23327 }),
23328 "id": Schema.String.annotate({ "description": "The unique ID of the local shell call.\n" }),
23329 "call_id": Schema.String.annotate({
23330 "description": "The unique ID of the local shell tool call generated by the model.\n"
23331 }),
23332 "action": LocalShellExecAction,
23333 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23334 "description": "The status of the local shell call.\n"
23335 })
23336 }).annotate({ "title": "Local shell call", "description": "Content item used to generate a response.\n" }),
23337 Schema.Struct({
23338 "type": Schema.Literal("local_shell_call_output").annotate({
23339 "description": "The type of the local shell tool call output. Always `local_shell_call_output`.\n"
23340 }),
23341 "id": Schema.String.annotate({
23342 "description": "The unique ID of the local shell tool call generated by the model.\n"
23343 }),
23344 "output": Schema.String.annotate({
23345 "description": "A JSON string of the output of the local shell tool call.\n"
23346 }),
23347 "status": Schema.optionalKey(
23348 Schema.Union([
23349 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23350 "description": "The status of the item. One of `in_progress`, `completed`, or `incomplete`.\n"
23351 }),
23352 Schema.Null
23353 ])
23354 ),
23355 "call_id": Schema.Unknown
23356 }).annotate({ "title": "Local shell call output", "description": "Content item used to generate a response.\n" }),
23357 Schema.Struct({
23358 "id": Schema.optionalKey(
23359 Schema.Union([
23360 Schema.String.annotate({
23361 "description": "The unique ID of the shell tool call. Populated when this item is returned via API."
23362 }),
23363 Schema.Null
23364 ])
23365 ),
23366 "call_id": Schema.String.annotate({
23367 "description": "The unique ID of the shell tool call generated by the model."
23368 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23369 "type": Schema.Literal("shell_call").annotate({ "description": "The type of the item. Always `shell_call`." }),
23370 "action": Schema.Struct({
23371 "commands": Schema.Array(Schema.String).annotate({
23372 "description": "Ordered shell commands for the execution environment to run."
23373 }),
23374 "timeout_ms": Schema.optionalKey(
23375 Schema.Union([
23376 Schema.Number.annotate({
23377 "description": "Maximum wall-clock time in milliseconds to allow the shell commands to run."
23378 }).check(Schema.isInt()),
23379 Schema.Null
23380 ])
23381 ),
23382 "max_output_length": Schema.optionalKey(
23383 Schema.Union([
23384 Schema.Number.annotate({
23385 "description": "Maximum number of UTF-8 characters to capture from combined stdout and stderr output."
23386 }).check(Schema.isInt()),
23387 Schema.Null
23388 ])
23389 )
23390 }).annotate({
23391 "title": "Shell action",
23392 "description": "The shell commands and limits that describe how to run the tool call."
23393 }),
23394 "status": Schema.optionalKey(
23395 Schema.Union([
23396 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23397 "title": "Shell call status",
23398 "description": "The status of the shell call. One of `in_progress`, `completed`, or `incomplete`."
23399 }),
23400 Schema.Null
23401 ])
23402 ),
23403 "environment": Schema.optionalKey(
23404 Schema.Union([
23405 Schema.Union([LocalEnvironmentParam, ContainerReferenceParam], { mode: "oneOf" }).annotate({
23406 "description": "The environment to execute the shell commands in."
23407 }),
23408 Schema.Null
23409 ])
23410 )
23411 }).annotate({ "title": "Shell tool call", "description": "Content item used to generate a response.\n" }),
23412 Schema.Struct({
23413 "id": Schema.optionalKey(
23414 Schema.Union([
23415 Schema.String.annotate({
23416 "description": "The unique ID of the shell tool call output. Populated when this item is returned via API."
23417 }),
23418 Schema.Null
23419 ])
23420 ),
23421 "call_id": Schema.String.annotate({
23422 "description": "The unique ID of the shell tool call generated by the model."
23423 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23424 "type": Schema.Literal("shell_call_output").annotate({
23425 "description": "The type of the item. Always `shell_call_output`."
23426 }),
23427 "output": Schema.Array(FunctionShellCallOutputContentParam).annotate({
23428 "description": "Captured chunks of stdout and stderr output, along with their associated outcomes."
23429 }),
23430 "status": Schema.optionalKey(
23431 Schema.Union([
23432 Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23433 "title": "Shell call status",
23434 "description": "The status of the shell call output."
23435 }),
23436 Schema.Null
23437 ])
23438 ),
23439 "max_output_length": Schema.optionalKey(
23440 Schema.Union([
23441 Schema.Number.annotate({
23442 "description": "The maximum number of UTF-8 characters captured for this shell call's combined output."
23443 }).check(Schema.isInt()),
23444 Schema.Null
23445 ])
23446 )
23447 }).annotate({ "title": "Shell tool call output", "description": "Content item used to generate a response.\n" }),
23448 Schema.Struct({
23449 "type": Schema.Literal("apply_patch_call").annotate({
23450 "description": "The type of the item. Always `apply_patch_call`."
23451 }),
23452 "id": Schema.optionalKey(
23453 Schema.Union([
23454 Schema.String.annotate({
23455 "description": "The unique ID of the apply patch tool call. Populated when this item is returned via API."
23456 }),
23457 Schema.Null
23458 ])
23459 ),
23460 "call_id": Schema.String.annotate({
23461 "description": "The unique ID of the apply patch tool call generated by the model."
23462 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23463 "status": Schema.Literals(["in_progress", "completed"]).annotate({
23464 "title": "Apply patch call status",
23465 "description": "The status of the apply patch tool call. One of `in_progress` or `completed`."
23466 }),
23467 "operation": Schema.Union([
23468 ApplyPatchCreateFileOperationParam,
23469 ApplyPatchDeleteFileOperationParam,
23470 ApplyPatchUpdateFileOperationParam
23471 ], { mode: "oneOf" }).annotate({
23472 "title": "Apply patch operation",
23473 "description": "The specific create, delete, or update instruction for the apply_patch tool call."
23474 })
23475 }).annotate({ "title": "Apply patch tool call", "description": "Content item used to generate a response.\n" }),
23476 Schema.Struct({
23477 "type": Schema.Literal("apply_patch_call_output").annotate({
23478 "description": "The type of the item. Always `apply_patch_call_output`."
23479 }),
23480 "id": Schema.optionalKey(
23481 Schema.Union([
23482 Schema.String.annotate({
23483 "description":
23484 "The unique ID of the apply patch tool call output. Populated when this item is returned via API."
23485 }),
23486 Schema.Null
23487 ])
23488 ),
23489 "call_id": Schema.String.annotate({
23490 "description": "The unique ID of the apply patch tool call generated by the model."
23491 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)),
23492 "status": Schema.Literals(["completed", "failed"]).annotate({
23493 "title": "Apply patch call output status",
23494 "description": "The status of the apply patch tool call output. One of `completed` or `failed`."
23495 }),
23496 "output": Schema.optionalKey(
23497 Schema.Union([
23498 Schema.String.annotate({
23499 "description": "Optional human-readable log text from the apply patch tool (e.g., patch results or errors)."
23500 }).check(Schema.isMaxLength(10485760)),
23501 Schema.Null
23502 ])
23503 )
23504 }).annotate({
23505 "title": "Apply patch tool call output",
23506 "description": "Content item used to generate a response.\n"
23507 }),
23508 Schema.Struct({
23509 "type": Schema.Literal("mcp_list_tools").annotate({
23510 "description": "The type of the item. Always `mcp_list_tools`.\n"
23511 }),
23512 "id": Schema.String.annotate({ "description": "The unique ID of the list.\n" }),
23513 "server_label": Schema.String.annotate({ "description": "The label of the MCP server.\n" }),
23514 "tools": Schema.Array(MCPListToolsTool).annotate({ "description": "The tools available on the server.\n" }),
23515 "error": Schema.optionalKey(
23516 Schema.Union([
23517 Schema.String.annotate({ "description": "Error message if the server could not list tools.\n" }),
23518 Schema.Null
23519 ])
23520 )
23521 }).annotate({ "title": "MCP list tools", "description": "Content item used to generate a response.\n" }),
23522 Schema.Struct({
23523 "type": Schema.Literal("mcp_approval_request").annotate({
23524 "description": "The type of the item. Always `mcp_approval_request`.\n"
23525 }),
23526 "id": Schema.String.annotate({ "description": "The unique ID of the approval request.\n" }),
23527 "server_label": Schema.String.annotate({ "description": "The label of the MCP server making the request.\n" }),
23528 "name": Schema.String.annotate({ "description": "The name of the tool to run.\n" }),
23529 "arguments": Schema.String.annotate({ "description": "A JSON string of arguments for the tool.\n" })
23530 }).annotate({ "title": "MCP approval request", "description": "Content item used to generate a response.\n" }),
23531 Schema.Struct({
23532 "type": Schema.Literal("mcp_approval_response").annotate({
23533 "description": "The type of the item. Always `mcp_approval_response`.\n"
23534 }),
23535 "id": Schema.optionalKey(
23536 Schema.Union([
23537 Schema.String.annotate({ "description": "The unique ID of the approval response\n" }),
23538 Schema.Null
23539 ])
23540 ),
23541 "approval_request_id": Schema.String.annotate({
23542 "description": "The ID of the approval request being answered.\n"
23543 }),
23544 "approve": Schema.Boolean.annotate({ "description": "Whether the request was approved.\n" }),
23545 "reason": Schema.optionalKey(
23546 Schema.Union([Schema.String.annotate({ "description": "Optional reason for the decision.\n" }), Schema.Null])
23547 ),
23548 "request_id": Schema.Unknown
23549 }).annotate({ "title": "MCP approval response", "description": "Content item used to generate a response.\n" }),
23550 Schema.Struct({
23551 "type": Schema.Literal("mcp_call").annotate({ "description": "The type of the item. Always `mcp_call`.\n" }),
23552 "id": Schema.String.annotate({ "description": "The unique ID of the tool call.\n" }),
23553 "server_label": Schema.String.annotate({ "description": "The label of the MCP server running the tool.\n" }),
23554 "name": Schema.String.annotate({ "description": "The name of the tool that was run.\n" }),
23555 "arguments": Schema.String.annotate({ "description": "A JSON string of the arguments passed to the tool.\n" }),
23556 "output": Schema.optionalKey(
23557 Schema.Union([Schema.String.annotate({ "description": "The output from the tool call.\n" }), Schema.Null])
23558 ),
23559 "error": Schema.optionalKey(
23560 Schema.Union([
23561 Schema.String.annotate({ "description": "The error from the tool call, if any.\n" }),
23562 Schema.Null
23563 ])
23564 ),
23565 "status": Schema.optionalKey(
23566 Schema.Literals(["in_progress", "completed", "incomplete", "calling", "failed"]).annotate({
23567 "description":
23568 "The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n"
23569 })
23570 ),
23571 "approval_request_id": Schema.optionalKey(
23572 Schema.Union([
23573 Schema.String.annotate({
23574 "description":
23575 "Unique identifier for the MCP tool call approval request.\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\n"
23576 }),
23577 Schema.Null
23578 ])
23579 )
23580 }).annotate({ "title": "MCP tool call", "description": "Content item used to generate a response.\n" }),
23581 Schema.Struct({
23582 "type": Schema.Literal("custom_tool_call_output").annotate({
23583 "description": "The type of the custom tool call output. Always `custom_tool_call_output`.\n"
23584 }),
23585 "id": Schema.optionalKey(
23586 Schema.String.annotate({
23587 "description": "The unique ID of the custom tool call output in the OpenAI platform.\n"
23588 })
23589 ),
23590 "call_id": Schema.String.annotate({
23591 "description": "The call ID, used to map this custom tool call output to a custom tool call.\n"
23592 }),
23593 "output": Schema.Union([
23594 Schema.String.annotate({
23595 "title": "string output",
23596 "description": "A string of the output of the custom tool call.\n"
23597 }),
23598 Schema.Array(FunctionAndCustomToolCallOutput).annotate({
23599 "title": "output content list",
23600 "description": "Text, image, or file output of the custom tool call.\n"
23601 })
23602 ], { mode: "oneOf" }).annotate({
23603 "description":
23604 "The output from the custom tool call generated by your code.\nCan be a string or an list of output content.\n"
23605 })
23606 }).annotate({ "title": "Custom tool call output", "description": "Content item used to generate a response.\n" }),
23607 Schema.Struct({
23608 "type": Schema.Literal("custom_tool_call").annotate({
23609 "description": "The type of the custom tool call. Always `custom_tool_call`.\n"
23610 }),
23611 "id": Schema.optionalKey(
23612 Schema.String.annotate({ "description": "The unique ID of the custom tool call in the OpenAI platform.\n" })
23613 ),
23614 "call_id": Schema.String.annotate({
23615 "description": "An identifier used to map this custom tool call to a tool call output.\n"
23616 }),
23617 "namespace": Schema.optionalKey(
23618 Schema.String.annotate({ "description": "The namespace of the custom tool being called.\n" })
23619 ),
23620 "name": Schema.String.annotate({ "description": "The name of the custom tool being called.\n" }),
23621 "input": Schema.String.annotate({ "description": "The input for the custom tool call generated by the model.\n" })
23622 }).annotate({ "title": "Custom tool call", "description": "Content item used to generate a response.\n" })
23623 ], { mode: "oneOf" }).annotate({
23624 "title": "Item",
23625 "description":
23626 "An item representing part of the context for the response to be\ngenerated by the model. Can contain text, images, and audio inputs,\nas well as previous assistant responses and tool call outputs.\n"
23627 }),
23628 CompactionTriggerItemParam,
23629 ItemReferenceParam
23630], { mode: "oneOf" })
23631export type ToolsArray = ReadonlyArray<Tool>
23632export const ToolsArray = Schema.Array(Tool).annotate({
23633 "description":
23634 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
23635})
23636export type ToolSearchOutput = {
23637 readonly "type": "tool_search_output"
23638 readonly "id": string
23639 readonly "call_id": string | null
23640 readonly "execution": "server" | "client"
23641 readonly "tools": ReadonlyArray<Tool>
23642 readonly "status": "in_progress" | "completed" | "incomplete"
23643 readonly "created_by"?: string
23644}
23645export const ToolSearchOutput = Schema.Struct({
23646 "type": Schema.Literal("tool_search_output").annotate({
23647 "description": "The type of the item. Always `tool_search_output`."
23648 }),
23649 "id": Schema.String.annotate({ "description": "The unique ID of the tool search output item." }),
23650 "call_id": Schema.Union([
23651 Schema.String.annotate({ "description": "The unique ID of the tool search call generated by the model." }),
23652 Schema.Null
23653 ]),
23654 "execution": Schema.Literals(["server", "client"]).annotate({
23655 "description": "Whether tool search was executed by the server or by the client."
23656 }),
23657 "tools": Schema.Array(Tool).annotate({ "description": "The loaded tool definitions returned by tool search." }),
23658 "status": Schema.Literals(["in_progress", "completed", "incomplete"]).annotate({
23659 "description": "The status of the tool search output item that was recorded."
23660 }),
23661 "created_by": Schema.optionalKey(
23662 Schema.String.annotate({ "description": "The identifier of the actor that created the item." })
23663 )
23664})
23665export type CreateEvalLabelModelGrader = {
23666 readonly "type": "label_model"
23667 readonly "name": string
23668 readonly "model": string
23669 readonly "input": ReadonlyArray<CreateEvalItem>
23670 readonly "labels": ReadonlyArray<string>
23671 readonly "passing_labels": ReadonlyArray<string>
23672}
23673export const CreateEvalLabelModelGrader = Schema.Struct({
23674 "type": Schema.Literal("label_model").annotate({ "description": "The object type, which is always `label_model`." }),
23675 "name": Schema.String.annotate({ "description": "The name of the grader." }),
23676 "model": Schema.String.annotate({
23677 "description": "The model to use for the evaluation. Must support structured outputs."
23678 }),
23679 "input": Schema.Array(CreateEvalItem).annotate({
23680 "description":
23681 "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
23682 }),
23683 "labels": Schema.Array(Schema.String).annotate({
23684 "description": "The labels to classify to each item in the evaluation."
23685 }),
23686 "passing_labels": Schema.Array(Schema.String).annotate({
23687 "description": "The labels that indicate a passing result. Must be a subset of labels."
23688 })
23689}).annotate({
23690 "title": "LabelModelGrader",
23691 "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n"
23692})
23693export type CreateEvalRunRequest = {
23694 readonly "name"?: string
23695 readonly "metadata"?: Metadata
23696 readonly "data_source": {
23697 readonly "type": "jsonl"
23698 readonly "source": EvalJsonlFileContentSource | EvalJsonlFileIdSource
23699 } | {
23700 readonly "type": "completions"
23701 readonly "input_messages"?: {
23702 readonly "type": "template"
23703 readonly "template": ReadonlyArray<EasyInputMessage | EvalItem>
23704 } | { readonly "type": "item_reference"; readonly "item_reference": string }
23705 readonly "sampling_params"?: {
23706 readonly "reasoning_effort"?: ReasoningEffort
23707 readonly "temperature"?: number
23708 readonly "max_completion_tokens"?: number
23709 readonly "top_p"?: number
23710 readonly "seed"?: number
23711 readonly "response_format"?: ResponseFormatText | ResponseFormatJsonSchema | ResponseFormatJsonObject
23712 readonly "tools"?: ReadonlyArray<ChatCompletionTool>
23713 }
23714 readonly "model"?: string
23715 readonly "source": EvalJsonlFileContentSource | EvalJsonlFileIdSource | EvalStoredCompletionsSource
23716 } | {
23717 readonly "type": "responses"
23718 readonly "input_messages"?: {
23719 readonly "type": "template"
23720 readonly "template": ReadonlyArray<{ readonly "role": string; readonly "content": string } | EvalItem>
23721 } | { readonly "type": "item_reference"; readonly "item_reference": string }
23722 readonly "sampling_params"?: {
23723 readonly "reasoning_effort"?: ReasoningEffort
23724 readonly "temperature"?: number
23725 readonly "max_completion_tokens"?: number
23726 readonly "top_p"?: number
23727 readonly "seed"?: number
23728 readonly "tools"?: ReadonlyArray<Tool>
23729 readonly "text"?: { readonly "format"?: TextResponseFormatConfiguration }
23730 }
23731 readonly "model"?: string
23732 readonly "source": EvalJsonlFileContentSource | EvalJsonlFileIdSource | EvalResponsesSource
23733 }
23734}
23735export const CreateEvalRunRequest = Schema.Struct({
23736 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the run." })),
23737 "metadata": Schema.optionalKey(Metadata),
23738 "data_source": Schema.Union([
23739 Schema.Struct({
23740 "type": Schema.Literal("jsonl").annotate({ "description": "The type of data source. Always `jsonl`." }),
23741 "source": Schema.Union([EvalJsonlFileContentSource, EvalJsonlFileIdSource], { mode: "oneOf" }).annotate({
23742 "description": "Determines what populates the `item` namespace in the data source."
23743 })
23744 }).annotate({ "title": "JsonlRunDataSource", "description": "Details about the run's data source." }),
23745 Schema.Struct({
23746 "type": Schema.Literal("completions").annotate({
23747 "description": "The type of run data source. Always `completions`."
23748 }),
23749 "input_messages": Schema.optionalKey(
23750 Schema.Union([
23751 Schema.Struct({
23752 "type": Schema.Literal("template").annotate({
23753 "description": "The type of input messages. Always `template`."
23754 }),
23755 "template": Schema.Array(Schema.Union([EasyInputMessage, EvalItem], { mode: "oneOf" })).annotate({
23756 "description":
23757 "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
23758 })
23759 }).annotate({ "title": "TemplateInputMessages" }),
23760 Schema.Struct({
23761 "type": Schema.Literal("item_reference").annotate({
23762 "description": "The type of input messages. Always `item_reference`."
23763 }),
23764 "item_reference": Schema.String.annotate({
23765 "description": "A reference to a variable in the `item` namespace. Ie, \"item.input_trajectory\""
23766 })
23767 }).annotate({ "title": "ItemReferenceInputMessages" })
23768 ], { mode: "oneOf" }).annotate({
23769 "description":
23770 "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."
23771 })
23772 ),
23773 "sampling_params": Schema.optionalKey(Schema.Struct({
23774 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
23775 "temperature": Schema.optionalKey(
23776 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs." }).check(
23777 Schema.isFinite()
23778 )
23779 ),
23780 "max_completion_tokens": Schema.optionalKey(
23781 Schema.Number.annotate({ "description": "The maximum number of tokens in the generated output." }).check(
23782 Schema.isInt()
23783 )
23784 ),
23785 "top_p": Schema.optionalKey(
23786 Schema.Number.annotate({
23787 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens."
23788 }).check(Schema.isFinite())
23789 ),
23790 "seed": Schema.optionalKey(
23791 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling." })
23792 .check(Schema.isInt())
23793 ),
23794 "response_format": Schema.optionalKey(
23795 Schema.Union([ResponseFormatText, ResponseFormatJsonSchema, ResponseFormatJsonObject], { mode: "oneOf" })
23796 .annotate({
23797 "description":
23798 "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"
23799 })
23800 ),
23801 "tools": Schema.optionalKey(
23802 Schema.Array(ChatCompletionTool).annotate({
23803 "description":
23804 "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n"
23805 })
23806 )
23807 })),
23808 "model": Schema.optionalKey(
23809 Schema.String.annotate({
23810 "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")."
23811 })
23812 ),
23813 "source": Schema.Union([EvalJsonlFileContentSource, EvalJsonlFileIdSource, EvalStoredCompletionsSource], {
23814 mode: "oneOf"
23815 }).annotate({ "description": "Determines what populates the `item` namespace in this run's data source." })
23816 }).annotate({ "title": "CompletionsRunDataSource", "description": "Details about the run's data source." }),
23817 Schema.Struct({
23818 "type": Schema.Literal("responses").annotate({
23819 "description": "The type of run data source. Always `responses`."
23820 }),
23821 "input_messages": Schema.optionalKey(
23822 Schema.Union([
23823 Schema.Struct({
23824 "type": Schema.Literal("template").annotate({
23825 "description": "The type of input messages. Always `template`."
23826 }),
23827 "template": Schema.Array(
23828 Schema.Union([
23829 Schema.Struct({
23830 "role": Schema.String.annotate({
23831 "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")."
23832 }),
23833 "content": Schema.String.annotate({ "description": "The content of the message." })
23834 }).annotate({ "title": "ChatMessage" }),
23835 EvalItem
23836 ], { mode: "oneOf" })
23837 ).annotate({
23838 "description":
23839 "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
23840 })
23841 }).annotate({ "title": "InputMessagesTemplate" }),
23842 Schema.Struct({
23843 "type": Schema.Literal("item_reference").annotate({
23844 "description": "The type of input messages. Always `item_reference`."
23845 }),
23846 "item_reference": Schema.String.annotate({
23847 "description": "A reference to a variable in the `item` namespace. Ie, \"item.name\""
23848 })
23849 }).annotate({ "title": "InputMessagesItemReference" })
23850 ], { mode: "oneOf" }).annotate({
23851 "description":
23852 "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."
23853 })
23854 ),
23855 "sampling_params": Schema.optionalKey(Schema.Struct({
23856 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
23857 "temperature": Schema.optionalKey(
23858 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs." }).check(
23859 Schema.isFinite()
23860 )
23861 ),
23862 "max_completion_tokens": Schema.optionalKey(
23863 Schema.Number.annotate({ "description": "The maximum number of tokens in the generated output." }).check(
23864 Schema.isInt()
23865 )
23866 ),
23867 "top_p": Schema.optionalKey(
23868 Schema.Number.annotate({
23869 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens."
23870 }).check(Schema.isFinite())
23871 ),
23872 "seed": Schema.optionalKey(
23873 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling." })
23874 .check(Schema.isInt())
23875 ),
23876 "tools": Schema.optionalKey(
23877 Schema.Array(Tool).annotate({
23878 "description":
23879 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code. Learn more about\n [function calling](/docs/guides/function-calling).\n"
23880 })
23881 ),
23882 "text": Schema.optionalKey(
23883 Schema.Struct({ "format": Schema.optionalKey(TextResponseFormatConfiguration) }).annotate({
23884 "description":
23885 "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Structured Outputs](/docs/guides/structured-outputs)\n"
23886 })
23887 )
23888 })),
23889 "model": Schema.optionalKey(
23890 Schema.String.annotate({
23891 "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")."
23892 })
23893 ),
23894 "source": Schema.Union([EvalJsonlFileContentSource, EvalJsonlFileIdSource, EvalResponsesSource], {
23895 mode: "oneOf"
23896 }).annotate({ "description": "Determines what populates the `item` namespace in this run's data source." })
23897 }).annotate({ "title": "ResponsesRunDataSource", "description": "Details about the run's data source." })
23898 ], { mode: "oneOf" })
23899}).annotate({ "title": "CreateEvalRunRequest" })
23900export type EvalGraderLabelModel = {
23901 readonly "type": "label_model"
23902 readonly "name": string
23903 readonly "model": string
23904 readonly "input": ReadonlyArray<EvalItem>
23905 readonly "labels": ReadonlyArray<string>
23906 readonly "passing_labels": ReadonlyArray<string>
23907}
23908export const EvalGraderLabelModel = Schema.Struct({
23909 "type": Schema.Literal("label_model").annotate({ "description": "The object type, which is always `label_model`." }),
23910 "name": Schema.String.annotate({ "description": "The name of the grader." }),
23911 "model": Schema.String.annotate({
23912 "description": "The model to use for the evaluation. Must support structured outputs."
23913 }),
23914 "input": Schema.Array(EvalItem),
23915 "labels": Schema.Array(Schema.String).annotate({
23916 "description": "The labels to assign to each item in the evaluation."
23917 }),
23918 "passing_labels": Schema.Array(Schema.String).annotate({
23919 "description": "The labels that indicate a passing result. Must be a subset of labels."
23920 })
23921}).annotate({
23922 "title": "LabelModelGrader",
23923 "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n"
23924})
23925export type EvalGraderScoreModel = {
23926 readonly "type": "score_model"
23927 readonly "name": string
23928 readonly "model": string
23929 readonly "sampling_params"?: {
23930 readonly "seed"?: number | null
23931 readonly "top_p"?: number | null
23932 readonly "temperature"?: number | null
23933 readonly "max_completions_tokens"?: number | null
23934 readonly "reasoning_effort"?: ReasoningEffort
23935 }
23936 readonly "input": ReadonlyArray<EvalItem>
23937 readonly "range"?: ReadonlyArray<number>
23938 readonly "pass_threshold"?: number
23939}
23940export const EvalGraderScoreModel = Schema.Struct({
23941 "type": Schema.Literal("score_model").annotate({ "description": "The object type, which is always `score_model`." }),
23942 "name": Schema.String.annotate({ "description": "The name of the grader." }),
23943 "model": Schema.String.annotate({ "description": "The model to use for the evaluation." }),
23944 "sampling_params": Schema.optionalKey(
23945 Schema.Struct({
23946 "seed": Schema.optionalKey(
23947 Schema.Union([
23948 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling.\n" })
23949 .check(Schema.isInt()),
23950 Schema.Null
23951 ])
23952 ),
23953 "top_p": Schema.optionalKey(
23954 Schema.Union([
23955 Schema.Number.annotate({
23956 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n"
23957 }).check(Schema.isFinite()),
23958 Schema.Null
23959 ])
23960 ),
23961 "temperature": Schema.optionalKey(
23962 Schema.Union([
23963 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs.\n" })
23964 .check(Schema.isFinite()),
23965 Schema.Null
23966 ])
23967 ),
23968 "max_completions_tokens": Schema.optionalKey(
23969 Schema.Union([
23970 Schema.Number.annotate({
23971 "description": "The maximum number of tokens the grader model may generate in its response.\n"
23972 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
23973 Schema.Null
23974 ])
23975 ),
23976 "reasoning_effort": Schema.optionalKey(ReasoningEffort)
23977 }).annotate({ "description": "The sampling parameters for the model." })
23978 ),
23979 "input": Schema.Array(EvalItem).annotate({
23980 "description":
23981 "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n"
23982 }),
23983 "range": Schema.optionalKey(
23984 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({
23985 "description": "The range of the score. Defaults to `[0, 1]`."
23986 })
23987 ),
23988 "pass_threshold": Schema.optionalKey(
23989 Schema.Number.annotate({ "description": "The threshold for the score." }).check(Schema.isFinite())
23990 )
23991}).annotate({
23992 "title": "ScoreModelGrader",
23993 "description": "A ScoreModelGrader object that uses a model to assign a score to the input.\n"
23994})
23995export type EvalRun = {
23996 readonly "object": "eval.run"
23997 readonly "id": string
23998 readonly "eval_id": string
23999 readonly "status": string
24000 readonly "model": string
24001 readonly "name": string
24002 readonly "created_at": number
24003 readonly "report_url": string
24004 readonly "result_counts": {
24005 readonly "total": number
24006 readonly "errored": number
24007 readonly "failed": number
24008 readonly "passed": number
24009 }
24010 readonly "per_model_usage": ReadonlyArray<
24011 {
24012 readonly "model_name": string
24013 readonly "invocation_count": number
24014 readonly "prompt_tokens": number
24015 readonly "completion_tokens": number
24016 readonly "total_tokens": number
24017 readonly "cached_tokens": number
24018 }
24019 >
24020 readonly "per_testing_criteria_results": ReadonlyArray<
24021 { readonly "testing_criteria": string; readonly "passed": number; readonly "failed": number }
24022 >
24023 readonly "data_source": {
24024 readonly "type": "jsonl"
24025 readonly "source": EvalJsonlFileContentSource | EvalJsonlFileIdSource
24026 } | {
24027 readonly "type": "completions"
24028 readonly "input_messages"?: {
24029 readonly "type": "template"
24030 readonly "template": ReadonlyArray<EasyInputMessage | EvalItem>
24031 } | { readonly "type": "item_reference"; readonly "item_reference": string }
24032 readonly "sampling_params"?: {
24033 readonly "reasoning_effort"?: ReasoningEffort
24034 readonly "temperature"?: number
24035 readonly "max_completion_tokens"?: number
24036 readonly "top_p"?: number
24037 readonly "seed"?: number
24038 readonly "response_format"?: ResponseFormatText | ResponseFormatJsonSchema | ResponseFormatJsonObject
24039 readonly "tools"?: ReadonlyArray<ChatCompletionTool>
24040 }
24041 readonly "model"?: string
24042 readonly "source": EvalJsonlFileContentSource | EvalJsonlFileIdSource | EvalStoredCompletionsSource
24043 } | {
24044 readonly "type": "responses"
24045 readonly "input_messages"?: {
24046 readonly "type": "template"
24047 readonly "template": ReadonlyArray<{ readonly "role": string; readonly "content": string } | EvalItem>
24048 } | { readonly "type": "item_reference"; readonly "item_reference": string }
24049 readonly "sampling_params"?: {
24050 readonly "reasoning_effort"?: ReasoningEffort
24051 readonly "temperature"?: number
24052 readonly "max_completion_tokens"?: number
24053 readonly "top_p"?: number
24054 readonly "seed"?: number
24055 readonly "tools"?: ReadonlyArray<Tool>
24056 readonly "text"?: { readonly "format"?: TextResponseFormatConfiguration }
24057 }
24058 readonly "model"?: string
24059 readonly "source": EvalJsonlFileContentSource | EvalJsonlFileIdSource | EvalResponsesSource
24060 }
24061 readonly "metadata": Metadata
24062 readonly "error": EvalApiError
24063}
24064export const EvalRun = Schema.Struct({
24065 "object": Schema.Literal("eval.run").annotate({ "description": "The type of the object. Always \"eval.run\"." }),
24066 "id": Schema.String.annotate({ "description": "Unique identifier for the evaluation run." }),
24067 "eval_id": Schema.String.annotate({ "description": "The identifier of the associated evaluation." }),
24068 "status": Schema.String.annotate({ "description": "The status of the evaluation run." }),
24069 "model": Schema.String.annotate({ "description": "The model that is evaluated, if applicable." }),
24070 "name": Schema.String.annotate({ "description": "The name of the evaluation run." }),
24071 "created_at": Schema.Number.annotate({
24072 "description": "Unix timestamp (in seconds) when the evaluation run was created.",
24073 "format": "unixtime"
24074 }).check(Schema.isInt()),
24075 "report_url": Schema.String.annotate({
24076 "description": "The URL to the rendered evaluation run report on the UI dashboard.",
24077 "format": "uri"
24078 }),
24079 "result_counts": Schema.Struct({
24080 "total": Schema.Number.annotate({ "description": "Total number of executed output items." }).check(Schema.isInt()),
24081 "errored": Schema.Number.annotate({ "description": "Number of output items that resulted in an error." }).check(
24082 Schema.isInt()
24083 ),
24084 "failed": Schema.Number.annotate({ "description": "Number of output items that failed to pass the evaluation." })
24085 .check(Schema.isInt()),
24086 "passed": Schema.Number.annotate({ "description": "Number of output items that passed the evaluation." }).check(
24087 Schema.isInt()
24088 )
24089 }).annotate({ "description": "Counters summarizing the outcomes of the evaluation run." }),
24090 "per_model_usage": Schema.Array(Schema.Struct({
24091 "model_name": Schema.String.annotate({ "description": "The name of the model." }),
24092 "invocation_count": Schema.Number.annotate({ "description": "The number of invocations." }).check(Schema.isInt()),
24093 "prompt_tokens": Schema.Number.annotate({ "description": "The number of prompt tokens used." }).check(
24094 Schema.isInt()
24095 ),
24096 "completion_tokens": Schema.Number.annotate({ "description": "The number of completion tokens generated." }).check(
24097 Schema.isInt()
24098 ),
24099 "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(Schema.isInt()),
24100 "cached_tokens": Schema.Number.annotate({ "description": "The number of tokens retrieved from cache." }).check(
24101 Schema.isInt()
24102 )
24103 })).annotate({ "description": "Usage statistics for each model during the evaluation run." }),
24104 "per_testing_criteria_results": Schema.Array(Schema.Struct({
24105 "testing_criteria": Schema.String.annotate({ "description": "A description of the testing criteria." }),
24106 "passed": Schema.Number.annotate({ "description": "Number of tests passed for this criteria." }).check(
24107 Schema.isInt()
24108 ),
24109 "failed": Schema.Number.annotate({ "description": "Number of tests failed for this criteria." }).check(
24110 Schema.isInt()
24111 )
24112 })).annotate({ "description": "Results per testing criteria applied during the evaluation run." }),
24113 "data_source": Schema.Union([
24114 Schema.Struct({
24115 "type": Schema.Literal("jsonl").annotate({ "description": "The type of data source. Always `jsonl`." }),
24116 "source": Schema.Union([EvalJsonlFileContentSource, EvalJsonlFileIdSource], { mode: "oneOf" }).annotate({
24117 "description": "Determines what populates the `item` namespace in the data source."
24118 })
24119 }).annotate({ "title": "JsonlRunDataSource", "description": "Information about the run's data source." }),
24120 Schema.Struct({
24121 "type": Schema.Literal("completions").annotate({
24122 "description": "The type of run data source. Always `completions`."
24123 }),
24124 "input_messages": Schema.optionalKey(
24125 Schema.Union([
24126 Schema.Struct({
24127 "type": Schema.Literal("template").annotate({
24128 "description": "The type of input messages. Always `template`."
24129 }),
24130 "template": Schema.Array(Schema.Union([EasyInputMessage, EvalItem], { mode: "oneOf" })).annotate({
24131 "description":
24132 "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
24133 })
24134 }).annotate({ "title": "TemplateInputMessages" }),
24135 Schema.Struct({
24136 "type": Schema.Literal("item_reference").annotate({
24137 "description": "The type of input messages. Always `item_reference`."
24138 }),
24139 "item_reference": Schema.String.annotate({
24140 "description": "A reference to a variable in the `item` namespace. Ie, \"item.input_trajectory\""
24141 })
24142 }).annotate({ "title": "ItemReferenceInputMessages" })
24143 ], { mode: "oneOf" }).annotate({
24144 "description":
24145 "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."
24146 })
24147 ),
24148 "sampling_params": Schema.optionalKey(Schema.Struct({
24149 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
24150 "temperature": Schema.optionalKey(
24151 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs." }).check(
24152 Schema.isFinite()
24153 )
24154 ),
24155 "max_completion_tokens": Schema.optionalKey(
24156 Schema.Number.annotate({ "description": "The maximum number of tokens in the generated output." }).check(
24157 Schema.isInt()
24158 )
24159 ),
24160 "top_p": Schema.optionalKey(
24161 Schema.Number.annotate({
24162 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens."
24163 }).check(Schema.isFinite())
24164 ),
24165 "seed": Schema.optionalKey(
24166 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling." })
24167 .check(Schema.isInt())
24168 ),
24169 "response_format": Schema.optionalKey(
24170 Schema.Union([ResponseFormatText, ResponseFormatJsonSchema, ResponseFormatJsonObject], { mode: "oneOf" })
24171 .annotate({
24172 "description":
24173 "An object specifying the format that the model must output.\n\nSetting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables\nStructured Outputs which ensures the model will match your supplied JSON\nschema. Learn more in the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n"
24174 })
24175 ),
24176 "tools": Schema.optionalKey(
24177 Schema.Array(ChatCompletionTool).annotate({
24178 "description":
24179 "A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported.\n"
24180 })
24181 )
24182 })),
24183 "model": Schema.optionalKey(
24184 Schema.String.annotate({
24185 "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")."
24186 })
24187 ),
24188 "source": Schema.Union([EvalJsonlFileContentSource, EvalJsonlFileIdSource, EvalStoredCompletionsSource], {
24189 mode: "oneOf"
24190 }).annotate({ "description": "Determines what populates the `item` namespace in this run's data source." })
24191 }).annotate({ "title": "CompletionsRunDataSource", "description": "Information about the run's data source." }),
24192 Schema.Struct({
24193 "type": Schema.Literal("responses").annotate({
24194 "description": "The type of run data source. Always `responses`."
24195 }),
24196 "input_messages": Schema.optionalKey(
24197 Schema.Union([
24198 Schema.Struct({
24199 "type": Schema.Literal("template").annotate({
24200 "description": "The type of input messages. Always `template`."
24201 }),
24202 "template": Schema.Array(
24203 Schema.Union([
24204 Schema.Struct({
24205 "role": Schema.String.annotate({
24206 "description": "The role of the message (e.g. \"system\", \"assistant\", \"user\")."
24207 }),
24208 "content": Schema.String.annotate({ "description": "The content of the message." })
24209 }).annotate({ "title": "ChatMessage" }),
24210 EvalItem
24211 ], { mode: "oneOf" })
24212 ).annotate({
24213 "description":
24214 "A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}."
24215 })
24216 }).annotate({ "title": "InputMessagesTemplate" }),
24217 Schema.Struct({
24218 "type": Schema.Literal("item_reference").annotate({
24219 "description": "The type of input messages. Always `item_reference`."
24220 }),
24221 "item_reference": Schema.String.annotate({
24222 "description": "A reference to a variable in the `item` namespace. Ie, \"item.name\""
24223 })
24224 }).annotate({ "title": "InputMessagesItemReference" })
24225 ], { mode: "oneOf" }).annotate({
24226 "description":
24227 "Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace."
24228 })
24229 ),
24230 "sampling_params": Schema.optionalKey(Schema.Struct({
24231 "reasoning_effort": Schema.optionalKey(ReasoningEffort),
24232 "temperature": Schema.optionalKey(
24233 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs." }).check(
24234 Schema.isFinite()
24235 )
24236 ),
24237 "max_completion_tokens": Schema.optionalKey(
24238 Schema.Number.annotate({ "description": "The maximum number of tokens in the generated output." }).check(
24239 Schema.isInt()
24240 )
24241 ),
24242 "top_p": Schema.optionalKey(
24243 Schema.Number.annotate({
24244 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens."
24245 }).check(Schema.isFinite())
24246 ),
24247 "seed": Schema.optionalKey(
24248 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling." })
24249 .check(Schema.isInt())
24250 ),
24251 "tools": Schema.optionalKey(
24252 Schema.Array(Tool).annotate({
24253 "description":
24254 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nThe two categories of tools you can provide the model are:\n\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code. Learn more about\n [function calling](/docs/guides/function-calling).\n"
24255 })
24256 ),
24257 "text": Schema.optionalKey(
24258 Schema.Struct({ "format": Schema.optionalKey(TextResponseFormatConfiguration) }).annotate({
24259 "description":
24260 "Configuration options for a text response from the model. Can be plain\ntext or structured JSON data. Learn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Structured Outputs](/docs/guides/structured-outputs)\n"
24261 })
24262 )
24263 })),
24264 "model": Schema.optionalKey(
24265 Schema.String.annotate({
24266 "description": "The name of the model to use for generating completions (e.g. \"o3-mini\")."
24267 })
24268 ),
24269 "source": Schema.Union([EvalJsonlFileContentSource, EvalJsonlFileIdSource, EvalResponsesSource], {
24270 mode: "oneOf"
24271 }).annotate({ "description": "Determines what populates the `item` namespace in this run's data source." })
24272 }).annotate({ "title": "ResponsesRunDataSource", "description": "Information about the run's data source." })
24273 ], { mode: "oneOf" }),
24274 "metadata": Metadata,
24275 "error": EvalApiError
24276}).annotate({ "title": "EvalRun", "description": "A schema representing an evaluation run.\n" })
24277export type GraderLabelModel = {
24278 readonly "type": "label_model"
24279 readonly "name": string
24280 readonly "model": string
24281 readonly "input": ReadonlyArray<EvalItem>
24282 readonly "labels": ReadonlyArray<string>
24283 readonly "passing_labels": ReadonlyArray<string>
24284}
24285export const GraderLabelModel = Schema.Struct({
24286 "type": Schema.Literal("label_model").annotate({ "description": "The object type, which is always `label_model`." }),
24287 "name": Schema.String.annotate({ "description": "The name of the grader." }),
24288 "model": Schema.String.annotate({
24289 "description": "The model to use for the evaluation. Must support structured outputs."
24290 }),
24291 "input": Schema.Array(EvalItem),
24292 "labels": Schema.Array(Schema.String).annotate({
24293 "description": "The labels to assign to each item in the evaluation."
24294 }),
24295 "passing_labels": Schema.Array(Schema.String).annotate({
24296 "description": "The labels that indicate a passing result. Must be a subset of labels."
24297 })
24298}).annotate({
24299 "title": "LabelModelGrader",
24300 "description": "A LabelModelGrader object which uses a model to assign labels to each item\nin the evaluation.\n"
24301})
24302export type GraderScoreModel = {
24303 readonly "type": "score_model"
24304 readonly "name": string
24305 readonly "model": string
24306 readonly "sampling_params"?: {
24307 readonly "seed"?: number | null
24308 readonly "top_p"?: number | null
24309 readonly "temperature"?: number | null
24310 readonly "max_completions_tokens"?: number | null
24311 readonly "reasoning_effort"?: ReasoningEffort
24312 }
24313 readonly "input": ReadonlyArray<EvalItem>
24314 readonly "range"?: ReadonlyArray<number>
24315}
24316export const GraderScoreModel = Schema.Struct({
24317 "type": Schema.Literal("score_model").annotate({ "description": "The object type, which is always `score_model`." }),
24318 "name": Schema.String.annotate({ "description": "The name of the grader." }),
24319 "model": Schema.String.annotate({ "description": "The model to use for the evaluation." }),
24320 "sampling_params": Schema.optionalKey(
24321 Schema.Struct({
24322 "seed": Schema.optionalKey(
24323 Schema.Union([
24324 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling.\n" })
24325 .check(Schema.isInt()),
24326 Schema.Null
24327 ])
24328 ),
24329 "top_p": Schema.optionalKey(
24330 Schema.Union([
24331 Schema.Number.annotate({
24332 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n"
24333 }).check(Schema.isFinite()),
24334 Schema.Null
24335 ])
24336 ),
24337 "temperature": Schema.optionalKey(
24338 Schema.Union([
24339 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs.\n" })
24340 .check(Schema.isFinite()),
24341 Schema.Null
24342 ])
24343 ),
24344 "max_completions_tokens": Schema.optionalKey(
24345 Schema.Union([
24346 Schema.Number.annotate({
24347 "description": "The maximum number of tokens the grader model may generate in its response.\n"
24348 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
24349 Schema.Null
24350 ])
24351 ),
24352 "reasoning_effort": Schema.optionalKey(ReasoningEffort)
24353 }).annotate({ "description": "The sampling parameters for the model." })
24354 ),
24355 "input": Schema.Array(EvalItem).annotate({
24356 "description":
24357 "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n"
24358 }),
24359 "range": Schema.optionalKey(
24360 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({
24361 "description": "The range of the score. Defaults to `[0, 1]`."
24362 })
24363 )
24364}).annotate({
24365 "title": "ScoreModelGrader",
24366 "description": "A ScoreModelGrader object that uses a model to assign a score to the input.\n"
24367})
24368export type InputParam = string | ReadonlyArray<InputItem>
24369export const InputParam = Schema.Union([
24370 Schema.String.annotate({
24371 "title": "Text input",
24372 "description": "A text input to the model, equivalent to a text input with the\n`user` role.\n"
24373 }),
24374 Schema.Array(InputItem).annotate({
24375 "title": "Input item list",
24376 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
24377 })
24378], { mode: "oneOf" }).annotate({
24379 "description":
24380 "Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Image inputs](/docs/guides/images)\n- [File inputs](/docs/guides/pdf-files)\n- [Conversation state](/docs/guides/conversation-state)\n- [Function calling](/docs/guides/function-calling)\n"
24381})
24382export type CreateConversationBody = {
24383 readonly "metadata"?: {} | null | null
24384 readonly "items"?: ReadonlyArray<InputItem> | null
24385}
24386export const CreateConversationBody = Schema.Struct({
24387 "metadata": Schema.optionalKey(Schema.Union([
24388 Schema.Union([
24389 Schema.Struct({}).annotate({
24390 "description":
24391 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
24392 }),
24393 Schema.Null
24394 ]).annotate({
24395 "description":
24396 "Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.\n Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters."
24397 }),
24398 Schema.Null
24399 ])),
24400 "items": Schema.optionalKey(
24401 Schema.Union([
24402 Schema.Array(InputItem).annotate({
24403 "description": "Initial items to include in the conversation context. You may add up to 20 items at a time."
24404 }).check(Schema.isMaxLength(20)),
24405 Schema.Null
24406 ])
24407 )
24408})
24409export type TokenCountsBody = {
24410 readonly "model"?: string | null
24411 readonly "input"?: string | ReadonlyArray<InputItem> | null
24412 readonly "previous_response_id"?: string | null
24413 readonly "tools"?: ReadonlyArray<Tool> | null
24414 readonly "text"?: ResponseTextParam | null
24415 readonly "reasoning"?: {
24416 readonly "effort"?: ReasoningEffort
24417 readonly "summary"?: "auto" | "concise" | "detailed" | null
24418 readonly "generate_summary"?: "auto" | "concise" | "detailed" | null
24419 } | null
24420 readonly "truncation"?: "auto" | "disabled"
24421 readonly "instructions"?: string | null
24422 readonly "conversation"?: ConversationParam | null
24423 readonly "tool_choice"?:
24424 | ToolChoiceOptions
24425 | ToolChoiceAllowed
24426 | ToolChoiceTypes
24427 | ToolChoiceFunction
24428 | ToolChoiceMCP
24429 | ToolChoiceCustom
24430 | SpecificApplyPatchParam
24431 | SpecificFunctionShellParam
24432 | null
24433 readonly "parallel_tool_calls"?: boolean | null
24434}
24435export const TokenCountsBody = Schema.Struct({
24436 "model": Schema.optionalKey(
24437 Schema.Union([
24438 Schema.String.annotate({
24439 "description":
24440 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/docs/models) to browse and compare available models."
24441 }),
24442 Schema.Null
24443 ])
24444 ),
24445 "input": Schema.optionalKey(
24446 Schema.Union([
24447 Schema.Union([
24448 Schema.String.annotate({
24449 "description": "A text input to the model, equivalent to a text input with the `user` role."
24450 }).check(Schema.isMaxLength(10485760)),
24451 Schema.Array(InputItem).annotate({
24452 "description": "A list of one or many input items to the model, containing different content types."
24453 })
24454 ], { mode: "oneOf" }).annotate({
24455 "description": "Text, image, or file inputs to the model, used to generate a response"
24456 }),
24457 Schema.Null
24458 ])
24459 ),
24460 "previous_response_id": Schema.optionalKey(
24461 Schema.Union([
24462 Schema.String.annotate({
24463 "description":
24464 "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`."
24465 }),
24466 Schema.Null
24467 ])
24468 ),
24469 "tools": Schema.optionalKey(
24470 Schema.Union([
24471 Schema.Array(Tool).annotate({
24472 "description":
24473 "An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter."
24474 }),
24475 Schema.Null
24476 ])
24477 ),
24478 "text": Schema.optionalKey(Schema.Union([ResponseTextParam, Schema.Null])),
24479 "reasoning": Schema.optionalKey(Schema.Union([
24480 Schema.Struct({
24481 "effort": Schema.optionalKey(ReasoningEffort),
24482 "summary": Schema.optionalKey(Schema.Union([
24483 Schema.Literals(["auto", "concise", "detailed"]).annotate({
24484 "description":
24485 "A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n\n`concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`.\n"
24486 }),
24487 Schema.Null
24488 ])),
24489 "generate_summary": Schema.optionalKey(
24490 Schema.Union([
24491 Schema.Literals(["auto", "concise", "detailed"]).annotate({
24492 "description":
24493 "**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n"
24494 }),
24495 Schema.Null
24496 ])
24497 )
24498 }).annotate({
24499 "title": "Reasoning",
24500 "description":
24501 "**gpt-5 and o-series models only** Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning)."
24502 }),
24503 Schema.Null
24504 ])),
24505 "truncation": Schema.optionalKey(
24506 Schema.Literals(["auto", "disabled"]).annotate({
24507 "description":
24508 "The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error."
24509 })
24510 ),
24511 "instructions": Schema.optionalKey(Schema.Union([
24512 Schema.String.annotate({
24513 "description":
24514 "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses."
24515 }),
24516 Schema.Null
24517 ])),
24518 "conversation": Schema.optionalKey(Schema.Union([ConversationParam, Schema.Null])),
24519 "tool_choice": Schema.optionalKey(
24520 Schema.Union([
24521 Schema.Union([
24522 ToolChoiceOptions,
24523 ToolChoiceAllowed,
24524 ToolChoiceTypes,
24525 ToolChoiceFunction,
24526 ToolChoiceMCP,
24527 ToolChoiceCustom,
24528 SpecificApplyPatchParam,
24529 SpecificFunctionShellParam
24530 ], { mode: "oneOf" }).annotate({ "description": "Controls which tool the model should use, if any." }),
24531 Schema.Null
24532 ])
24533 ),
24534 "parallel_tool_calls": Schema.optionalKey(
24535 Schema.Union([
24536 Schema.Boolean.annotate({ "description": "Whether to allow the model to run tool calls in parallel." }),
24537 Schema.Null
24538 ])
24539 )
24540})
24541export type CompactResponseMethodPublicBody = {
24542 readonly "model": ModelIdsCompaction
24543 readonly "input"?: string | ReadonlyArray<InputItem> | null
24544 readonly "previous_response_id"?: string | null
24545 readonly "instructions"?: string | null
24546 readonly "prompt_cache_key"?: string | null
24547 readonly "prompt_cache_retention"?: "in_memory" | "in-memory" | "24h" | null
24548 readonly "service_tier"?: "auto" | "default" | "flex" | "priority" | null
24549}
24550export const CompactResponseMethodPublicBody = Schema.Struct({
24551 "model": ModelIdsCompaction,
24552 "input": Schema.optionalKey(
24553 Schema.Union([
24554 Schema.Union([
24555 Schema.String.annotate({
24556 "description": "A text input to the model, equivalent to a text input with the `user` role."
24557 }).check(Schema.isMaxLength(10485760)),
24558 Schema.Array(InputItem).annotate({
24559 "description": "A list of one or many input items to the model, containing different content types."
24560 })
24561 ], { mode: "oneOf" }).annotate({
24562 "description": "Text, image, or file inputs to the model, used to generate a response"
24563 }),
24564 Schema.Null
24565 ])
24566 ),
24567 "previous_response_id": Schema.optionalKey(
24568 Schema.Union([
24569 Schema.String.annotate({
24570 "description":
24571 "The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`."
24572 }),
24573 Schema.Null
24574 ])
24575 ),
24576 "instructions": Schema.optionalKey(Schema.Union([
24577 Schema.String.annotate({
24578 "description":
24579 "A system (or developer) message inserted into the model's context.\nWhen used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses."
24580 }),
24581 Schema.Null
24582 ])),
24583 "prompt_cache_key": Schema.optionalKey(
24584 Schema.Union([
24585 Schema.String.annotate({ "description": "A key to use when reading from or writing to the prompt cache." }).check(
24586 Schema.isMaxLength(64)
24587 ),
24588 Schema.Null
24589 ])
24590 ),
24591 "prompt_cache_retention": Schema.optionalKey(
24592 Schema.Union([
24593 Schema.Literals(["in_memory", "in-memory", "24h"]).annotate({
24594 "description": "How long to retain a prompt cache entry created by this request."
24595 }),
24596 Schema.Null
24597 ])
24598 ),
24599 "service_tier": Schema.optionalKey(
24600 Schema.Union([
24601 Schema.Literals(["auto", "default", "flex", "priority"]).annotate({
24602 "description": "The service tier to use for this request."
24603 }),
24604 Schema.Null
24605 ])
24606 )
24607})
24608export type ConversationItem =
24609 | Message
24610 | FunctionToolCallResource
24611 | FunctionToolCallOutputResource
24612 | FileSearchToolCall
24613 | WebSearchToolCall
24614 | ImageGenToolCall
24615 | ComputerToolCall
24616 | ComputerToolCallOutputResource
24617 | ToolSearchCall
24618 | ToolSearchOutput
24619 | ReasoningItem
24620 | CompactionBody
24621 | CodeInterpreterToolCall
24622 | LocalShellToolCall
24623 | LocalShellToolCallOutput
24624 | FunctionShellCall
24625 | FunctionShellCallOutput
24626 | ApplyPatchToolCall
24627 | ApplyPatchToolCallOutput
24628 | MCPListTools
24629 | MCPApprovalRequest
24630 | MCPApprovalResponseResource
24631 | MCPToolCall
24632 | CustomToolCall
24633 | CustomToolCallOutput
24634export const ConversationItem = Schema.Union([
24635 Message,
24636 FunctionToolCallResource,
24637 FunctionToolCallOutputResource,
24638 FileSearchToolCall,
24639 WebSearchToolCall,
24640 ImageGenToolCall,
24641 ComputerToolCall,
24642 ComputerToolCallOutputResource,
24643 ToolSearchCall,
24644 ToolSearchOutput,
24645 ReasoningItem,
24646 CompactionBody,
24647 CodeInterpreterToolCall,
24648 LocalShellToolCall,
24649 LocalShellToolCallOutput,
24650 FunctionShellCall,
24651 FunctionShellCallOutput,
24652 ApplyPatchToolCall,
24653 ApplyPatchToolCallOutput,
24654 MCPListTools,
24655 MCPApprovalRequest,
24656 MCPApprovalResponseResource,
24657 MCPToolCall,
24658 CustomToolCall,
24659 CustomToolCallOutput
24660], { mode: "oneOf" }).annotate({
24661 "title": "Conversation item",
24662 "description":
24663 "A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](/docs/api-reference/responses/object#responses/object-output)."
24664})
24665export type ItemResource =
24666 | InputMessageResource
24667 | OutputMessage
24668 | FileSearchToolCall
24669 | ComputerToolCall
24670 | ComputerToolCallOutputResource
24671 | WebSearchToolCall
24672 | FunctionToolCallResource
24673 | FunctionToolCallOutputResource
24674 | ToolSearchCall
24675 | ToolSearchOutput
24676 | ReasoningItem
24677 | CompactionBody
24678 | ImageGenToolCall
24679 | CodeInterpreterToolCall
24680 | LocalShellToolCall
24681 | LocalShellToolCallOutput
24682 | FunctionShellCall
24683 | FunctionShellCallOutput
24684 | ApplyPatchToolCall
24685 | ApplyPatchToolCallOutput
24686 | MCPListTools
24687 | MCPApprovalRequest
24688 | MCPApprovalResponseResource
24689 | MCPToolCall
24690 | CustomToolCallResource
24691 | CustomToolCallOutputResource
24692export const ItemResource = Schema.Union([
24693 InputMessageResource,
24694 OutputMessage,
24695 FileSearchToolCall,
24696 ComputerToolCall,
24697 ComputerToolCallOutputResource,
24698 WebSearchToolCall,
24699 FunctionToolCallResource,
24700 FunctionToolCallOutputResource,
24701 ToolSearchCall,
24702 ToolSearchOutput,
24703 ReasoningItem,
24704 CompactionBody,
24705 ImageGenToolCall,
24706 CodeInterpreterToolCall,
24707 LocalShellToolCall,
24708 LocalShellToolCallOutput,
24709 FunctionShellCall,
24710 FunctionShellCallOutput,
24711 ApplyPatchToolCall,
24712 ApplyPatchToolCallOutput,
24713 MCPListTools,
24714 MCPApprovalRequest,
24715 MCPApprovalResponseResource,
24716 MCPToolCall,
24717 CustomToolCallResource,
24718 CustomToolCallOutputResource
24719], { mode: "oneOf" }).annotate({ "description": "Content item used to generate a response.\n" })
24720export type OutputItem =
24721 | OutputMessage
24722 | FileSearchToolCall
24723 | FunctionToolCall
24724 | FunctionToolCallOutputResource
24725 | WebSearchToolCall
24726 | ComputerToolCall
24727 | ComputerToolCallOutputResource
24728 | ReasoningItem
24729 | ToolSearchCall
24730 | ToolSearchOutput
24731 | CompactionBody
24732 | ImageGenToolCall
24733 | CodeInterpreterToolCall
24734 | LocalShellToolCall
24735 | LocalShellToolCallOutput
24736 | FunctionShellCall
24737 | FunctionShellCallOutput
24738 | ApplyPatchToolCall
24739 | ApplyPatchToolCallOutput
24740 | MCPToolCall
24741 | MCPListTools
24742 | MCPApprovalRequest
24743 | MCPApprovalResponseResource
24744 | CustomToolCall
24745 | CustomToolCallOutputResource
24746export const OutputItem = Schema.Union([
24747 OutputMessage,
24748 FileSearchToolCall,
24749 FunctionToolCall,
24750 FunctionToolCallOutputResource,
24751 WebSearchToolCall,
24752 ComputerToolCall,
24753 ComputerToolCallOutputResource,
24754 ReasoningItem,
24755 ToolSearchCall,
24756 ToolSearchOutput,
24757 CompactionBody,
24758 ImageGenToolCall,
24759 CodeInterpreterToolCall,
24760 LocalShellToolCall,
24761 LocalShellToolCallOutput,
24762 FunctionShellCall,
24763 FunctionShellCallOutput,
24764 ApplyPatchToolCall,
24765 ApplyPatchToolCallOutput,
24766 MCPToolCall,
24767 MCPListTools,
24768 MCPApprovalRequest,
24769 MCPApprovalResponseResource,
24770 CustomToolCall,
24771 CustomToolCallOutputResource
24772], { mode: "oneOf" })
24773export type ResponseOutputItemAddedEvent = {
24774 readonly "type": "response.output_item.added"
24775 readonly "output_index": number
24776 readonly "sequence_number": number
24777 readonly "item":
24778 | OutputMessage
24779 | FileSearchToolCall
24780 | FunctionToolCall
24781 | FunctionToolCallOutputResource
24782 | WebSearchToolCall
24783 | ComputerToolCall
24784 | ComputerToolCallOutputResource
24785 | ReasoningItem
24786 | ToolSearchCall
24787 | ToolSearchOutput
24788 | CompactionBody
24789 | ImageGenToolCall
24790 | CodeInterpreterToolCall
24791 | LocalShellToolCall
24792 | LocalShellToolCallOutput
24793 | FunctionShellCall
24794 | FunctionShellCallOutput
24795 | ApplyPatchToolCall
24796 | ApplyPatchToolCallOutput
24797 | MCPToolCall
24798 | MCPListTools
24799 | MCPApprovalRequest
24800 | MCPApprovalResponseResource
24801 | CustomToolCall
24802 | CustomToolCallOutputResource
24803}
24804export const ResponseOutputItemAddedEvent = Schema.Struct({
24805 "type": Schema.Literal("response.output_item.added").annotate({
24806 "description": "The type of the event. Always `response.output_item.added`.\n"
24807 }),
24808 "output_index": Schema.Number.annotate({ "description": "The index of the output item that was added.\n" }).check(
24809 Schema.isInt()
24810 ),
24811 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
24812 Schema.isInt()
24813 ),
24814 "item": Schema.Union([
24815 OutputMessage,
24816 FileSearchToolCall,
24817 FunctionToolCall,
24818 FunctionToolCallOutputResource,
24819 WebSearchToolCall,
24820 ComputerToolCall,
24821 ComputerToolCallOutputResource,
24822 ReasoningItem,
24823 ToolSearchCall,
24824 ToolSearchOutput,
24825 CompactionBody,
24826 ImageGenToolCall,
24827 CodeInterpreterToolCall,
24828 LocalShellToolCall,
24829 LocalShellToolCallOutput,
24830 FunctionShellCall,
24831 FunctionShellCallOutput,
24832 ApplyPatchToolCall,
24833 ApplyPatchToolCallOutput,
24834 MCPToolCall,
24835 MCPListTools,
24836 MCPApprovalRequest,
24837 MCPApprovalResponseResource,
24838 CustomToolCall,
24839 CustomToolCallOutputResource
24840 ], { mode: "oneOf" }).annotate({ "description": "The output item that was added.\n" })
24841}).annotate({ "description": "Emitted when a new output item is added." })
24842export type ResponseOutputItemDoneEvent = {
24843 readonly "type": "response.output_item.done"
24844 readonly "output_index": number
24845 readonly "sequence_number": number
24846 readonly "item":
24847 | OutputMessage
24848 | FileSearchToolCall
24849 | FunctionToolCall
24850 | FunctionToolCallOutputResource
24851 | WebSearchToolCall
24852 | ComputerToolCall
24853 | ComputerToolCallOutputResource
24854 | ReasoningItem
24855 | ToolSearchCall
24856 | ToolSearchOutput
24857 | CompactionBody
24858 | ImageGenToolCall
24859 | CodeInterpreterToolCall
24860 | LocalShellToolCall
24861 | LocalShellToolCallOutput
24862 | FunctionShellCall
24863 | FunctionShellCallOutput
24864 | ApplyPatchToolCall
24865 | ApplyPatchToolCallOutput
24866 | MCPToolCall
24867 | MCPListTools
24868 | MCPApprovalRequest
24869 | MCPApprovalResponseResource
24870 | CustomToolCall
24871 | CustomToolCallOutputResource
24872}
24873export const ResponseOutputItemDoneEvent = Schema.Struct({
24874 "type": Schema.Literal("response.output_item.done").annotate({
24875 "description": "The type of the event. Always `response.output_item.done`.\n"
24876 }),
24877 "output_index": Schema.Number.annotate({ "description": "The index of the output item that was marked done.\n" })
24878 .check(Schema.isInt()),
24879 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event.\n" }).check(
24880 Schema.isInt()
24881 ),
24882 "item": Schema.Union([
24883 OutputMessage,
24884 FileSearchToolCall,
24885 FunctionToolCall,
24886 FunctionToolCallOutputResource,
24887 WebSearchToolCall,
24888 ComputerToolCall,
24889 ComputerToolCallOutputResource,
24890 ReasoningItem,
24891 ToolSearchCall,
24892 ToolSearchOutput,
24893 CompactionBody,
24894 ImageGenToolCall,
24895 CodeInterpreterToolCall,
24896 LocalShellToolCall,
24897 LocalShellToolCallOutput,
24898 FunctionShellCall,
24899 FunctionShellCallOutput,
24900 ApplyPatchToolCall,
24901 ApplyPatchToolCallOutput,
24902 MCPToolCall,
24903 MCPListTools,
24904 MCPApprovalRequest,
24905 MCPApprovalResponseResource,
24906 CustomToolCall,
24907 CustomToolCallOutputResource
24908 ], { mode: "oneOf" }).annotate({ "description": "The output item that was marked done.\n" })
24909}).annotate({ "description": "Emitted when an output item is marked done." })
24910export type ItemField =
24911 | Message
24912 | FunctionToolCall
24913 | ToolSearchCall
24914 | ToolSearchOutput
24915 | FunctionToolCallOutput
24916 | FileSearchToolCall
24917 | WebSearchToolCall
24918 | ImageGenToolCall
24919 | ComputerToolCall
24920 | ComputerToolCallOutputResource
24921 | ReasoningItem
24922 | CompactionBody
24923 | CodeInterpreterToolCall
24924 | LocalShellToolCall
24925 | LocalShellToolCallOutput
24926 | FunctionShellCall
24927 | FunctionShellCallOutput
24928 | ApplyPatchToolCall
24929 | ApplyPatchToolCallOutput
24930 | MCPListTools
24931 | MCPApprovalRequest
24932 | MCPApprovalResponseResource
24933 | MCPToolCall
24934 | CustomToolCall
24935 | CustomToolCallOutput
24936export const ItemField = Schema.Union([
24937 Message,
24938 FunctionToolCall,
24939 ToolSearchCall,
24940 ToolSearchOutput,
24941 FunctionToolCallOutput,
24942 FileSearchToolCall,
24943 WebSearchToolCall,
24944 ImageGenToolCall,
24945 ComputerToolCall,
24946 ComputerToolCallOutputResource,
24947 ReasoningItem,
24948 CompactionBody,
24949 CodeInterpreterToolCall,
24950 LocalShellToolCall,
24951 LocalShellToolCallOutput,
24952 FunctionShellCall,
24953 FunctionShellCallOutput,
24954 ApplyPatchToolCall,
24955 ApplyPatchToolCallOutput,
24956 MCPListTools,
24957 MCPApprovalRequest,
24958 MCPApprovalResponseResource,
24959 MCPToolCall,
24960 CustomToolCall,
24961 CustomToolCallOutput
24962], { mode: "oneOf" }).annotate({
24963 "description": "An item representing a message, tool call, tool output, reasoning, or other response element."
24964})
24965export type CreateEvalRequest = {
24966 readonly "name"?: string
24967 readonly "metadata"?: Metadata
24968 readonly "data_source_config":
24969 | { readonly "type": "custom"; readonly "item_schema": {}; readonly "include_sample_schema"?: boolean }
24970 | { readonly "type": "logs"; readonly "metadata"?: {} }
24971 | { readonly "type": "stored_completions"; readonly "metadata"?: {} }
24972 readonly "testing_criteria": ReadonlyArray<
24973 | CreateEvalLabelModelGrader
24974 | EvalGraderStringCheck
24975 | EvalGraderTextSimilarity
24976 | EvalGraderPython
24977 | EvalGraderScoreModel
24978 >
24979}
24980export const CreateEvalRequest = Schema.Struct({
24981 "name": Schema.optionalKey(Schema.String.annotate({ "description": "The name of the evaluation." })),
24982 "metadata": Schema.optionalKey(Metadata),
24983 "data_source_config": Schema.Union([
24984 Schema.Struct({
24985 "type": Schema.Literal("custom").annotate({ "description": "The type of data source. Always `custom`." }),
24986 "item_schema": Schema.Struct({}).annotate({ "description": "The json schema for each row in the data source." }),
24987 "include_sample_schema": Schema.optionalKey(
24988 Schema.Boolean.annotate({
24989 "description":
24990 "Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)"
24991 })
24992 )
24993 }).annotate({
24994 "title": "CustomDataSourceConfig",
24995 "description":
24996 "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation."
24997 }),
24998 Schema.Struct({
24999 "type": Schema.Literal("logs").annotate({ "description": "The type of data source. Always `logs`." }),
25000 "metadata": Schema.optionalKey(
25001 Schema.Struct({}).annotate({ "description": "Metadata filters for the logs data source." })
25002 )
25003 }).annotate({
25004 "title": "LogsDataSourceConfig",
25005 "description":
25006 "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation."
25007 }),
25008 Schema.Struct({
25009 "type": Schema.Literal("stored_completions").annotate({
25010 "description": "The type of data source. Always `stored_completions`."
25011 }),
25012 "metadata": Schema.optionalKey(
25013 Schema.Struct({}).annotate({ "description": "Metadata filters for the stored completions data source." })
25014 )
25015 }).annotate({
25016 "title": "StoredCompletionsDataSourceConfig",
25017 "description":
25018 "The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation."
25019 })
25020 ], { mode: "oneOf" }),
25021 "testing_criteria": Schema.Array(
25022 Schema.Union([
25023 CreateEvalLabelModelGrader,
25024 EvalGraderStringCheck,
25025 EvalGraderTextSimilarity,
25026 EvalGraderPython,
25027 EvalGraderScoreModel
25028 ], { mode: "oneOf" })
25029 ).annotate({
25030 "description":
25031 "A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`)."
25032 })
25033}).annotate({ "title": "CreateEvalRequest" })
25034export type Eval = {
25035 readonly "object": "eval"
25036 readonly "id": string
25037 readonly "name": string
25038 readonly "data_source_config": { readonly "type": "custom"; readonly "schema": {} } | {
25039 readonly "type": "logs"
25040 readonly "metadata"?: Metadata
25041 readonly "schema": {}
25042 } | { readonly "type": "stored_completions"; readonly "metadata"?: Metadata; readonly "schema": {} }
25043 readonly "testing_criteria": ReadonlyArray<
25044 EvalGraderLabelModel | EvalGraderStringCheck | EvalGraderTextSimilarity | EvalGraderPython | EvalGraderScoreModel
25045 >
25046 readonly "created_at": number
25047 readonly "metadata": Metadata
25048}
25049export const Eval = Schema.Struct({
25050 "object": Schema.Literal("eval").annotate({ "description": "The object type." }),
25051 "id": Schema.String.annotate({ "description": "Unique identifier for the evaluation." }),
25052 "name": Schema.String.annotate({ "description": "The name of the evaluation." }),
25053 "data_source_config": Schema.Union([
25054 Schema.Struct({
25055 "type": Schema.Literal("custom").annotate({ "description": "The type of data source. Always `custom`." }),
25056 "schema": Schema.Struct({}).annotate({
25057 "description":
25058 "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"
25059 })
25060 }).annotate({
25061 "title": "CustomDataSourceConfig",
25062 "description": "Configuration of data sources used in runs of the evaluation."
25063 }),
25064 Schema.Struct({
25065 "type": Schema.Literal("logs").annotate({ "description": "The type of data source. Always `logs`." }),
25066 "metadata": Schema.optionalKey(Metadata),
25067 "schema": Schema.Struct({}).annotate({
25068 "description":
25069 "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"
25070 })
25071 }).annotate({
25072 "title": "LogsDataSourceConfig",
25073 "description": "Configuration of data sources used in runs of the evaluation."
25074 }),
25075 Schema.Struct({
25076 "type": Schema.Literal("stored_completions").annotate({
25077 "description": "The type of data source. Always `stored_completions`."
25078 }),
25079 "metadata": Schema.optionalKey(Metadata),
25080 "schema": Schema.Struct({}).annotate({
25081 "description":
25082 "The json schema for the run data source items.\nLearn how to build JSON schemas [here](https://json-schema.org/).\n"
25083 })
25084 }).annotate({
25085 "title": "StoredCompletionsDataSourceConfig",
25086 "description": "Configuration of data sources used in runs of the evaluation."
25087 })
25088 ], { mode: "oneOf" }),
25089 "testing_criteria": Schema.Array(
25090 Schema.Union([
25091 EvalGraderLabelModel,
25092 EvalGraderStringCheck,
25093 EvalGraderTextSimilarity,
25094 EvalGraderPython,
25095 EvalGraderScoreModel
25096 ], { mode: "oneOf" })
25097 ).annotate({ "description": "A list of testing criteria." }),
25098 "created_at": Schema.Number.annotate({
25099 "description": "The Unix timestamp (in seconds) for when the eval was created.",
25100 "format": "unixtime"
25101 }).check(Schema.isInt()),
25102 "metadata": Metadata
25103}).annotate({
25104 "title": "Eval",
25105 "description":
25106 "An Eval object with a data source config and testing criteria.\nAn Eval represents a task to be done for your LLM integration.\nLike:\n - Improve the quality of my chatbot\n - See how well my chatbot handles customer support\n - Check if o4-mini is better at my usecase than gpt-4o\n"
25107})
25108export type EvalRunList = {
25109 readonly "object": "list"
25110 readonly "data": ReadonlyArray<EvalRun>
25111 readonly "first_id": string
25112 readonly "last_id": string
25113 readonly "has_more": boolean
25114}
25115export const EvalRunList = Schema.Struct({
25116 "object": Schema.Literal("list").annotate({
25117 "description": "The type of this object. It is always set to \"list\".\n"
25118 }),
25119 "data": Schema.Array(EvalRun).annotate({ "description": "An array of eval run objects.\n" }),
25120 "first_id": Schema.String.annotate({ "description": "The identifier of the first eval run in the data array." }),
25121 "last_id": Schema.String.annotate({ "description": "The identifier of the last eval run in the data array." }),
25122 "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more evals available." })
25123}).annotate({ "title": "EvalRunList", "description": "An object representing a list of runs for an evaluation.\n" })
25124export type FineTuneReinforcementMethod = {
25125 readonly "grader":
25126 | {
25127 readonly "type": "string_check"
25128 readonly "name": string
25129 readonly "input": string
25130 readonly "reference": string
25131 readonly "operation": "eq" | "ne" | "like" | "ilike"
25132 }
25133 | {
25134 readonly "type": "text_similarity"
25135 readonly "name": string
25136 readonly "input": string
25137 readonly "reference": string
25138 readonly "evaluation_metric":
25139 | "cosine"
25140 | "fuzzy_match"
25141 | "bleu"
25142 | "gleu"
25143 | "meteor"
25144 | "rouge_1"
25145 | "rouge_2"
25146 | "rouge_3"
25147 | "rouge_4"
25148 | "rouge_5"
25149 | "rouge_l"
25150 }
25151 | { readonly "type": "python"; readonly "name": string; readonly "source": string; readonly "image_tag"?: string }
25152 | {
25153 readonly "type": "score_model"
25154 readonly "name": string
25155 readonly "model": string
25156 readonly "sampling_params"?: {
25157 readonly "seed"?: number | null
25158 readonly "top_p"?: number | null
25159 readonly "temperature"?: number | null
25160 readonly "max_completions_tokens"?: number | null
25161 readonly "reasoning_effort"?: ReasoningEffort
25162 }
25163 readonly "input": ReadonlyArray<EvalItem>
25164 readonly "range"?: ReadonlyArray<number>
25165 }
25166 | {
25167 readonly "type": "multi"
25168 readonly "name": string
25169 readonly "graders": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderLabelModel
25170 readonly "calculate_output": string
25171 }
25172 readonly "hyperparameters"?: FineTuneReinforcementHyperparameters
25173}
25174export const FineTuneReinforcementMethod = Schema.Struct({
25175 "grader": Schema.Union([
25176 Schema.Struct({
25177 "type": Schema.Literal("string_check").annotate({
25178 "description": "The object type, which is always `string_check`."
25179 }),
25180 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25181 "input": Schema.String.annotate({ "description": "The input text. This may include template strings." }),
25182 "reference": Schema.String.annotate({ "description": "The reference text. This may include template strings." }),
25183 "operation": Schema.Literals(["eq", "ne", "like", "ilike"]).annotate({
25184 "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."
25185 })
25186 }).annotate({ "title": "StringCheckGrader", "description": "The grader used for the fine-tuning job." }),
25187 Schema.Struct({
25188 "type": Schema.Literal("text_similarity").annotate({ "description": "The type of grader." }),
25189 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25190 "input": Schema.String.annotate({ "description": "The text being graded." }),
25191 "reference": Schema.String.annotate({ "description": "The text being graded against." }),
25192 "evaluation_metric": Schema.Literals([
25193 "cosine",
25194 "fuzzy_match",
25195 "bleu",
25196 "gleu",
25197 "meteor",
25198 "rouge_1",
25199 "rouge_2",
25200 "rouge_3",
25201 "rouge_4",
25202 "rouge_5",
25203 "rouge_l"
25204 ]).annotate({
25205 "description":
25206 "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"
25207 })
25208 }).annotate({ "title": "TextSimilarityGrader", "description": "The grader used for the fine-tuning job." }),
25209 Schema.Struct({
25210 "type": Schema.Literal("python").annotate({ "description": "The object type, which is always `python`." }),
25211 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25212 "source": Schema.String.annotate({ "description": "The source code of the python script." }),
25213 "image_tag": Schema.optionalKey(
25214 Schema.String.annotate({ "description": "The image tag to use for the python script." })
25215 )
25216 }).annotate({ "title": "PythonGrader", "description": "The grader used for the fine-tuning job." }),
25217 Schema.Struct({
25218 "type": Schema.Literal("score_model").annotate({
25219 "description": "The object type, which is always `score_model`."
25220 }),
25221 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25222 "model": Schema.String.annotate({ "description": "The model to use for the evaluation." }),
25223 "sampling_params": Schema.optionalKey(
25224 Schema.Struct({
25225 "seed": Schema.optionalKey(
25226 Schema.Union([
25227 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling.\n" })
25228 .check(Schema.isInt()),
25229 Schema.Null
25230 ])
25231 ),
25232 "top_p": Schema.optionalKey(
25233 Schema.Union([
25234 Schema.Number.annotate({
25235 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n"
25236 }).check(Schema.isFinite()),
25237 Schema.Null
25238 ])
25239 ),
25240 "temperature": Schema.optionalKey(
25241 Schema.Union([
25242 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs.\n" })
25243 .check(Schema.isFinite()),
25244 Schema.Null
25245 ])
25246 ),
25247 "max_completions_tokens": Schema.optionalKey(
25248 Schema.Union([
25249 Schema.Number.annotate({
25250 "description": "The maximum number of tokens the grader model may generate in its response.\n"
25251 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
25252 Schema.Null
25253 ])
25254 ),
25255 "reasoning_effort": Schema.optionalKey(ReasoningEffort)
25256 }).annotate({ "description": "The sampling parameters for the model." })
25257 ),
25258 "input": Schema.Array(EvalItem).annotate({
25259 "description":
25260 "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n"
25261 }),
25262 "range": Schema.optionalKey(
25263 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({
25264 "description": "The range of the score. Defaults to `[0, 1]`."
25265 })
25266 )
25267 }).annotate({ "title": "ScoreModelGrader", "description": "The grader used for the fine-tuning job." }),
25268 Schema.Struct({
25269 "type": Schema.Literal("multi").annotate({ "description": "The object type, which is always `multi`." }),
25270 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25271 "graders": Schema.Union([
25272 GraderStringCheck,
25273 GraderTextSimilarity,
25274 GraderPython,
25275 GraderScoreModel,
25276 GraderLabelModel
25277 ], { mode: "oneOf" }),
25278 "calculate_output": Schema.String.annotate({
25279 "description": "A formula to calculate the output based on grader results."
25280 })
25281 }).annotate({ "title": "MultiGrader", "description": "The grader used for the fine-tuning job." })
25282 ], { mode: "oneOf" }),
25283 "hyperparameters": Schema.optionalKey(FineTuneReinforcementHyperparameters)
25284}).annotate({ "description": "Configuration for the reinforcement fine-tuning method." })
25285export type RunGraderRequest = {
25286 readonly "grader":
25287 | {
25288 readonly "type": "string_check"
25289 readonly "name": string
25290 readonly "input": string
25291 readonly "reference": string
25292 readonly "operation": "eq" | "ne" | "like" | "ilike"
25293 }
25294 | {
25295 readonly "type": "text_similarity"
25296 readonly "name": string
25297 readonly "input": string
25298 readonly "reference": string
25299 readonly "evaluation_metric":
25300 | "cosine"
25301 | "fuzzy_match"
25302 | "bleu"
25303 | "gleu"
25304 | "meteor"
25305 | "rouge_1"
25306 | "rouge_2"
25307 | "rouge_3"
25308 | "rouge_4"
25309 | "rouge_5"
25310 | "rouge_l"
25311 }
25312 | { readonly "type": "python"; readonly "name": string; readonly "source": string; readonly "image_tag"?: string }
25313 | {
25314 readonly "type": "score_model"
25315 readonly "name": string
25316 readonly "model": string
25317 readonly "sampling_params"?: {
25318 readonly "seed"?: number | null
25319 readonly "top_p"?: number | null
25320 readonly "temperature"?: number | null
25321 readonly "max_completions_tokens"?: number | null
25322 readonly "reasoning_effort"?: ReasoningEffort
25323 }
25324 readonly "input": ReadonlyArray<EvalItem>
25325 readonly "range"?: ReadonlyArray<number>
25326 }
25327 | {
25328 readonly "type": "multi"
25329 readonly "name": string
25330 readonly "graders": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderLabelModel
25331 readonly "calculate_output": string
25332 }
25333 readonly "item"?: {}
25334 readonly "model_sample": string
25335}
25336export const RunGraderRequest = Schema.Struct({
25337 "grader": Schema.Union([
25338 Schema.Struct({
25339 "type": Schema.Literal("string_check").annotate({
25340 "description": "The object type, which is always `string_check`."
25341 }),
25342 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25343 "input": Schema.String.annotate({ "description": "The input text. This may include template strings." }),
25344 "reference": Schema.String.annotate({ "description": "The reference text. This may include template strings." }),
25345 "operation": Schema.Literals(["eq", "ne", "like", "ilike"]).annotate({
25346 "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."
25347 })
25348 }).annotate({ "title": "StringCheckGrader", "description": "The grader used for the fine-tuning job." }),
25349 Schema.Struct({
25350 "type": Schema.Literal("text_similarity").annotate({ "description": "The type of grader." }),
25351 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25352 "input": Schema.String.annotate({ "description": "The text being graded." }),
25353 "reference": Schema.String.annotate({ "description": "The text being graded against." }),
25354 "evaluation_metric": Schema.Literals([
25355 "cosine",
25356 "fuzzy_match",
25357 "bleu",
25358 "gleu",
25359 "meteor",
25360 "rouge_1",
25361 "rouge_2",
25362 "rouge_3",
25363 "rouge_4",
25364 "rouge_5",
25365 "rouge_l"
25366 ]).annotate({
25367 "description":
25368 "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"
25369 })
25370 }).annotate({ "title": "TextSimilarityGrader", "description": "The grader used for the fine-tuning job." }),
25371 Schema.Struct({
25372 "type": Schema.Literal("python").annotate({ "description": "The object type, which is always `python`." }),
25373 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25374 "source": Schema.String.annotate({ "description": "The source code of the python script." }),
25375 "image_tag": Schema.optionalKey(
25376 Schema.String.annotate({ "description": "The image tag to use for the python script." })
25377 )
25378 }).annotate({ "title": "PythonGrader", "description": "The grader used for the fine-tuning job." }),
25379 Schema.Struct({
25380 "type": Schema.Literal("score_model").annotate({
25381 "description": "The object type, which is always `score_model`."
25382 }),
25383 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25384 "model": Schema.String.annotate({ "description": "The model to use for the evaluation." }),
25385 "sampling_params": Schema.optionalKey(
25386 Schema.Struct({
25387 "seed": Schema.optionalKey(
25388 Schema.Union([
25389 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling.\n" })
25390 .check(Schema.isInt()),
25391 Schema.Null
25392 ])
25393 ),
25394 "top_p": Schema.optionalKey(
25395 Schema.Union([
25396 Schema.Number.annotate({
25397 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n"
25398 }).check(Schema.isFinite()),
25399 Schema.Null
25400 ])
25401 ),
25402 "temperature": Schema.optionalKey(
25403 Schema.Union([
25404 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs.\n" })
25405 .check(Schema.isFinite()),
25406 Schema.Null
25407 ])
25408 ),
25409 "max_completions_tokens": Schema.optionalKey(
25410 Schema.Union([
25411 Schema.Number.annotate({
25412 "description": "The maximum number of tokens the grader model may generate in its response.\n"
25413 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
25414 Schema.Null
25415 ])
25416 ),
25417 "reasoning_effort": Schema.optionalKey(ReasoningEffort)
25418 }).annotate({ "description": "The sampling parameters for the model." })
25419 ),
25420 "input": Schema.Array(EvalItem).annotate({
25421 "description":
25422 "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n"
25423 }),
25424 "range": Schema.optionalKey(
25425 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({
25426 "description": "The range of the score. Defaults to `[0, 1]`."
25427 })
25428 )
25429 }).annotate({ "title": "ScoreModelGrader", "description": "The grader used for the fine-tuning job." }),
25430 Schema.Struct({
25431 "type": Schema.Literal("multi").annotate({ "description": "The object type, which is always `multi`." }),
25432 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25433 "graders": Schema.Union([
25434 GraderStringCheck,
25435 GraderTextSimilarity,
25436 GraderPython,
25437 GraderScoreModel,
25438 GraderLabelModel
25439 ], { mode: "oneOf" }),
25440 "calculate_output": Schema.String.annotate({
25441 "description": "A formula to calculate the output based on grader results."
25442 })
25443 }).annotate({ "title": "MultiGrader", "description": "The grader used for the fine-tuning job." })
25444 ], { mode: "oneOf" }),
25445 "item": Schema.optionalKey(
25446 Schema.Struct({}).annotate({
25447 "description":
25448 "The dataset item provided to the grader. This will be used to populate \nthe `item` namespace. See [the guide](/docs/guides/graders) for more details. \n"
25449 })
25450 ),
25451 "model_sample": Schema.String.annotate({
25452 "description":
25453 "The model sample to be evaluated. This value will be used to populate \nthe `sample` namespace. See [the guide](/docs/guides/graders) for more details.\nThe `output_json` variable will be populated if the model sample is a \nvalid JSON string.\n \n"
25454 })
25455}).annotate({ "title": "RunGraderRequest" })
25456export type ValidateGraderRequest = {
25457 readonly "grader":
25458 | {
25459 readonly "type": "string_check"
25460 readonly "name": string
25461 readonly "input": string
25462 readonly "reference": string
25463 readonly "operation": "eq" | "ne" | "like" | "ilike"
25464 }
25465 | {
25466 readonly "type": "text_similarity"
25467 readonly "name": string
25468 readonly "input": string
25469 readonly "reference": string
25470 readonly "evaluation_metric":
25471 | "cosine"
25472 | "fuzzy_match"
25473 | "bleu"
25474 | "gleu"
25475 | "meteor"
25476 | "rouge_1"
25477 | "rouge_2"
25478 | "rouge_3"
25479 | "rouge_4"
25480 | "rouge_5"
25481 | "rouge_l"
25482 }
25483 | { readonly "type": "python"; readonly "name": string; readonly "source": string; readonly "image_tag"?: string }
25484 | {
25485 readonly "type": "score_model"
25486 readonly "name": string
25487 readonly "model": string
25488 readonly "sampling_params"?: {
25489 readonly "seed"?: number | null
25490 readonly "top_p"?: number | null
25491 readonly "temperature"?: number | null
25492 readonly "max_completions_tokens"?: number | null
25493 readonly "reasoning_effort"?: ReasoningEffort
25494 }
25495 readonly "input": ReadonlyArray<EvalItem>
25496 readonly "range"?: ReadonlyArray<number>
25497 }
25498 | {
25499 readonly "type": "multi"
25500 readonly "name": string
25501 readonly "graders": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderLabelModel
25502 readonly "calculate_output": string
25503 }
25504}
25505export const ValidateGraderRequest = Schema.Struct({
25506 "grader": Schema.Union([
25507 Schema.Struct({
25508 "type": Schema.Literal("string_check").annotate({
25509 "description": "The object type, which is always `string_check`."
25510 }),
25511 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25512 "input": Schema.String.annotate({ "description": "The input text. This may include template strings." }),
25513 "reference": Schema.String.annotate({ "description": "The reference text. This may include template strings." }),
25514 "operation": Schema.Literals(["eq", "ne", "like", "ilike"]).annotate({
25515 "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."
25516 })
25517 }).annotate({ "title": "StringCheckGrader", "description": "The grader used for the fine-tuning job." }),
25518 Schema.Struct({
25519 "type": Schema.Literal("text_similarity").annotate({ "description": "The type of grader." }),
25520 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25521 "input": Schema.String.annotate({ "description": "The text being graded." }),
25522 "reference": Schema.String.annotate({ "description": "The text being graded against." }),
25523 "evaluation_metric": Schema.Literals([
25524 "cosine",
25525 "fuzzy_match",
25526 "bleu",
25527 "gleu",
25528 "meteor",
25529 "rouge_1",
25530 "rouge_2",
25531 "rouge_3",
25532 "rouge_4",
25533 "rouge_5",
25534 "rouge_l"
25535 ]).annotate({
25536 "description":
25537 "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"
25538 })
25539 }).annotate({ "title": "TextSimilarityGrader", "description": "The grader used for the fine-tuning job." }),
25540 Schema.Struct({
25541 "type": Schema.Literal("python").annotate({ "description": "The object type, which is always `python`." }),
25542 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25543 "source": Schema.String.annotate({ "description": "The source code of the python script." }),
25544 "image_tag": Schema.optionalKey(
25545 Schema.String.annotate({ "description": "The image tag to use for the python script." })
25546 )
25547 }).annotate({ "title": "PythonGrader", "description": "The grader used for the fine-tuning job." }),
25548 Schema.Struct({
25549 "type": Schema.Literal("score_model").annotate({
25550 "description": "The object type, which is always `score_model`."
25551 }),
25552 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25553 "model": Schema.String.annotate({ "description": "The model to use for the evaluation." }),
25554 "sampling_params": Schema.optionalKey(
25555 Schema.Struct({
25556 "seed": Schema.optionalKey(
25557 Schema.Union([
25558 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling.\n" })
25559 .check(Schema.isInt()),
25560 Schema.Null
25561 ])
25562 ),
25563 "top_p": Schema.optionalKey(
25564 Schema.Union([
25565 Schema.Number.annotate({
25566 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n"
25567 }).check(Schema.isFinite()),
25568 Schema.Null
25569 ])
25570 ),
25571 "temperature": Schema.optionalKey(
25572 Schema.Union([
25573 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs.\n" })
25574 .check(Schema.isFinite()),
25575 Schema.Null
25576 ])
25577 ),
25578 "max_completions_tokens": Schema.optionalKey(
25579 Schema.Union([
25580 Schema.Number.annotate({
25581 "description": "The maximum number of tokens the grader model may generate in its response.\n"
25582 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
25583 Schema.Null
25584 ])
25585 ),
25586 "reasoning_effort": Schema.optionalKey(ReasoningEffort)
25587 }).annotate({ "description": "The sampling parameters for the model." })
25588 ),
25589 "input": Schema.Array(EvalItem).annotate({
25590 "description":
25591 "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n"
25592 }),
25593 "range": Schema.optionalKey(
25594 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({
25595 "description": "The range of the score. Defaults to `[0, 1]`."
25596 })
25597 )
25598 }).annotate({ "title": "ScoreModelGrader", "description": "The grader used for the fine-tuning job." }),
25599 Schema.Struct({
25600 "type": Schema.Literal("multi").annotate({ "description": "The object type, which is always `multi`." }),
25601 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25602 "graders": Schema.Union([
25603 GraderStringCheck,
25604 GraderTextSimilarity,
25605 GraderPython,
25606 GraderScoreModel,
25607 GraderLabelModel
25608 ], { mode: "oneOf" }),
25609 "calculate_output": Schema.String.annotate({
25610 "description": "A formula to calculate the output based on grader results."
25611 })
25612 }).annotate({ "title": "MultiGrader", "description": "The grader used for the fine-tuning job." })
25613 ], { mode: "oneOf" })
25614}).annotate({ "title": "ValidateGraderRequest" })
25615export type ValidateGraderResponse = {
25616 readonly "grader"?:
25617 | {
25618 readonly "type": "string_check"
25619 readonly "name": string
25620 readonly "input": string
25621 readonly "reference": string
25622 readonly "operation": "eq" | "ne" | "like" | "ilike"
25623 }
25624 | {
25625 readonly "type": "text_similarity"
25626 readonly "name": string
25627 readonly "input": string
25628 readonly "reference": string
25629 readonly "evaluation_metric":
25630 | "cosine"
25631 | "fuzzy_match"
25632 | "bleu"
25633 | "gleu"
25634 | "meteor"
25635 | "rouge_1"
25636 | "rouge_2"
25637 | "rouge_3"
25638 | "rouge_4"
25639 | "rouge_5"
25640 | "rouge_l"
25641 }
25642 | { readonly "type": "python"; readonly "name": string; readonly "source": string; readonly "image_tag"?: string }
25643 | {
25644 readonly "type": "score_model"
25645 readonly "name": string
25646 readonly "model": string
25647 readonly "sampling_params"?: {
25648 readonly "seed"?: number | null
25649 readonly "top_p"?: number | null
25650 readonly "temperature"?: number | null
25651 readonly "max_completions_tokens"?: number | null
25652 readonly "reasoning_effort"?: ReasoningEffort
25653 }
25654 readonly "input": ReadonlyArray<EvalItem>
25655 readonly "range"?: ReadonlyArray<number>
25656 }
25657 | {
25658 readonly "type": "multi"
25659 readonly "name": string
25660 readonly "graders": GraderStringCheck | GraderTextSimilarity | GraderPython | GraderScoreModel | GraderLabelModel
25661 readonly "calculate_output": string
25662 }
25663}
25664export const ValidateGraderResponse = Schema.Struct({
25665 "grader": Schema.optionalKey(Schema.Union([
25666 Schema.Struct({
25667 "type": Schema.Literal("string_check").annotate({
25668 "description": "The object type, which is always `string_check`."
25669 }),
25670 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25671 "input": Schema.String.annotate({ "description": "The input text. This may include template strings." }),
25672 "reference": Schema.String.annotate({ "description": "The reference text. This may include template strings." }),
25673 "operation": Schema.Literals(["eq", "ne", "like", "ilike"]).annotate({
25674 "description": "The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`."
25675 })
25676 }).annotate({ "title": "StringCheckGrader", "description": "The grader used for the fine-tuning job." }),
25677 Schema.Struct({
25678 "type": Schema.Literal("text_similarity").annotate({ "description": "The type of grader." }),
25679 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25680 "input": Schema.String.annotate({ "description": "The text being graded." }),
25681 "reference": Schema.String.annotate({ "description": "The text being graded against." }),
25682 "evaluation_metric": Schema.Literals([
25683 "cosine",
25684 "fuzzy_match",
25685 "bleu",
25686 "gleu",
25687 "meteor",
25688 "rouge_1",
25689 "rouge_2",
25690 "rouge_3",
25691 "rouge_4",
25692 "rouge_5",
25693 "rouge_l"
25694 ]).annotate({
25695 "description":
25696 "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n"
25697 })
25698 }).annotate({ "title": "TextSimilarityGrader", "description": "The grader used for the fine-tuning job." }),
25699 Schema.Struct({
25700 "type": Schema.Literal("python").annotate({ "description": "The object type, which is always `python`." }),
25701 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25702 "source": Schema.String.annotate({ "description": "The source code of the python script." }),
25703 "image_tag": Schema.optionalKey(
25704 Schema.String.annotate({ "description": "The image tag to use for the python script." })
25705 )
25706 }).annotate({ "title": "PythonGrader", "description": "The grader used for the fine-tuning job." }),
25707 Schema.Struct({
25708 "type": Schema.Literal("score_model").annotate({
25709 "description": "The object type, which is always `score_model`."
25710 }),
25711 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25712 "model": Schema.String.annotate({ "description": "The model to use for the evaluation." }),
25713 "sampling_params": Schema.optionalKey(
25714 Schema.Struct({
25715 "seed": Schema.optionalKey(
25716 Schema.Union([
25717 Schema.Number.annotate({ "description": "A seed value to initialize the randomness, during sampling.\n" })
25718 .check(Schema.isInt()),
25719 Schema.Null
25720 ])
25721 ),
25722 "top_p": Schema.optionalKey(
25723 Schema.Union([
25724 Schema.Number.annotate({
25725 "description": "An alternative to temperature for nucleus sampling; 1.0 includes all tokens.\n"
25726 }).check(Schema.isFinite()),
25727 Schema.Null
25728 ])
25729 ),
25730 "temperature": Schema.optionalKey(
25731 Schema.Union([
25732 Schema.Number.annotate({ "description": "A higher temperature increases randomness in the outputs.\n" })
25733 .check(Schema.isFinite()),
25734 Schema.Null
25735 ])
25736 ),
25737 "max_completions_tokens": Schema.optionalKey(
25738 Schema.Union([
25739 Schema.Number.annotate({
25740 "description": "The maximum number of tokens the grader model may generate in its response.\n"
25741 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)),
25742 Schema.Null
25743 ])
25744 ),
25745 "reasoning_effort": Schema.optionalKey(ReasoningEffort)
25746 }).annotate({ "description": "The sampling parameters for the model." })
25747 ),
25748 "input": Schema.Array(EvalItem).annotate({
25749 "description":
25750 "The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.\n"
25751 }),
25752 "range": Schema.optionalKey(
25753 Schema.Array(Schema.Number.check(Schema.isFinite())).annotate({
25754 "description": "The range of the score. Defaults to `[0, 1]`."
25755 })
25756 )
25757 }).annotate({ "title": "ScoreModelGrader", "description": "The grader used for the fine-tuning job." }),
25758 Schema.Struct({
25759 "type": Schema.Literal("multi").annotate({ "description": "The object type, which is always `multi`." }),
25760 "name": Schema.String.annotate({ "description": "The name of the grader." }),
25761 "graders": Schema.Union([
25762 GraderStringCheck,
25763 GraderTextSimilarity,
25764 GraderPython,
25765 GraderScoreModel,
25766 GraderLabelModel
25767 ], { mode: "oneOf" }),
25768 "calculate_output": Schema.String.annotate({
25769 "description": "A formula to calculate the output based on grader results."
25770 })
25771 }).annotate({ "title": "MultiGrader", "description": "The grader used for the fine-tuning job." })
25772 ], { mode: "oneOf" }))
25773}).annotate({ "title": "ValidateGraderResponse" })
25774export type CreateResponse = {
25775 readonly "metadata"?: Metadata
25776 readonly "top_logprobs"?: number
25777 readonly "temperature"?: number | null
25778 readonly "top_p"?: number | null
25779 readonly "user"?: string | null
25780 readonly "safety_identifier"?: string
25781 readonly "prompt_cache_key"?: string | null
25782 readonly "service_tier"?: ServiceTier
25783 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
25784 readonly "previous_response_id"?: string | null
25785 readonly "model"?:
25786 | ModelIdsShared
25787 | "o1-pro"
25788 | "o1-pro-2025-03-19"
25789 | "o3-pro"
25790 | "o3-pro-2025-06-10"
25791 | "o3-deep-research"
25792 | "o3-deep-research-2025-06-26"
25793 | "o4-mini-deep-research"
25794 | "o4-mini-deep-research-2025-06-26"
25795 | "computer-use-preview"
25796 | "computer-use-preview-2025-03-11"
25797 | "gpt-5-codex"
25798 | "gpt-5-pro"
25799 | "gpt-5-pro-2025-10-06"
25800 | "gpt-5.1-codex-max"
25801 readonly "reasoning"?: Reasoning | null
25802 readonly "background"?: boolean | null
25803 readonly "max_tool_calls"?: number | null
25804 readonly "text"?: ResponseTextParam
25805 readonly "tools"?: ToolsArray
25806 readonly "tool_choice"?: ToolChoiceParam
25807 readonly "prompt"?: Prompt
25808 readonly "truncation"?: "auto" | "disabled" | null
25809 readonly "input"?: InputParam
25810 readonly "include"?: ReadonlyArray<IncludeEnum> | null
25811 readonly "parallel_tool_calls"?: boolean | null
25812 readonly "store"?: boolean | null
25813 readonly "instructions"?: string | null
25814 readonly "stream"?: boolean | null
25815 readonly "stream_options"?: ResponseStreamOptions
25816 readonly "conversation"?: ConversationParam | null
25817 readonly "context_management"?: ReadonlyArray<ContextManagementParam> | null
25818 readonly "max_output_tokens"?: number | null
25819}
25820export const CreateResponse = Schema.Struct({
25821 "metadata": Schema.optionalKey(Metadata),
25822 "top_logprobs": Schema.optionalKey(
25823 Schema.Union([
25824 Schema.Number.annotate({
25825 "description":
25826 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
25827 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)).check(
25828 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)], {
25829 "description":
25830 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
25831 })
25832 )
25833 ])
25834 ),
25835 "temperature": Schema.optionalKey(
25836 Schema.Union([
25837 Schema.Number.annotate({
25838 "description":
25839 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
25840 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
25841 Schema.Null
25842 ])
25843 ),
25844 "top_p": Schema.optionalKey(Schema.Union([
25845 Schema.Number.annotate({
25846 "description":
25847 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
25848 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
25849 Schema.Null
25850 ])),
25851 "user": Schema.optionalKey(
25852 Schema.Union([Schema.String, Schema.Null]).annotate({
25853 "description":
25854 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
25855 })
25856 ),
25857 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
25858 "description":
25859 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
25860 }))])),
25861 "prompt_cache_key": Schema.optionalKey(
25862 Schema.Union([Schema.String, Schema.Null]).annotate({
25863 "description":
25864 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
25865 })
25866 ),
25867 "service_tier": Schema.optionalKey(ServiceTier),
25868 "prompt_cache_retention": Schema.optionalKey(
25869 Schema.Union([
25870 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
25871 "description":
25872 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
25873 }),
25874 Schema.Null
25875 ])
25876 ),
25877 "previous_response_id": Schema.optionalKey(
25878 Schema.Union([
25879 Schema.String.annotate({
25880 "description":
25881 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
25882 }),
25883 Schema.Null
25884 ])
25885 ),
25886 "model": Schema.optionalKey(
25887 Schema.Union([
25888 ModelIdsShared,
25889 Schema.Literals([
25890 "o1-pro",
25891 "o1-pro-2025-03-19",
25892 "o3-pro",
25893 "o3-pro-2025-06-10",
25894 "o3-deep-research",
25895 "o3-deep-research-2025-06-26",
25896 "o4-mini-deep-research",
25897 "o4-mini-deep-research-2025-06-26",
25898 "computer-use-preview",
25899 "computer-use-preview-2025-03-11",
25900 "gpt-5-codex",
25901 "gpt-5-pro",
25902 "gpt-5-pro-2025-10-06",
25903 "gpt-5.1-codex-max"
25904 ]).annotate({ "title": "ResponsesOnlyModel" })
25905 ]).annotate({
25906 "description":
25907 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
25908 })
25909 ),
25910 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
25911 "background": Schema.optionalKey(
25912 Schema.Union([
25913 Schema.Boolean.annotate({
25914 "description": "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
25915 }),
25916 Schema.Null
25917 ])
25918 ),
25919 "max_tool_calls": Schema.optionalKey(
25920 Schema.Union([
25921 Schema.Number.annotate({
25922 "description":
25923 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
25924 }).check(Schema.isInt()),
25925 Schema.Null
25926 ])
25927 ),
25928 "text": Schema.optionalKey(ResponseTextParam),
25929 "tools": Schema.optionalKey(ToolsArray),
25930 "tool_choice": Schema.optionalKey(ToolChoiceParam),
25931 "prompt": Schema.optionalKey(Prompt),
25932 "truncation": Schema.optionalKey(Schema.Union([
25933 Schema.Literals(["auto", "disabled"]).annotate({
25934 "description":
25935 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
25936 }),
25937 Schema.Null
25938 ])),
25939 "input": Schema.optionalKey(InputParam),
25940 "include": Schema.optionalKey(Schema.Union([
25941 Schema.Array(IncludeEnum).annotate({
25942 "description":
25943 "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program)."
25944 }),
25945 Schema.Null
25946 ])),
25947 "parallel_tool_calls": Schema.optionalKey(
25948 Schema.Union([
25949 Schema.Boolean.annotate({ "description": "Whether to allow the model to run tool calls in parallel.\n" }),
25950 Schema.Null
25951 ])
25952 ),
25953 "store": Schema.optionalKey(
25954 Schema.Union([
25955 Schema.Boolean.annotate({
25956 "description": "Whether to store the generated model response for later retrieval via\nAPI.\n"
25957 }),
25958 Schema.Null
25959 ])
25960 ),
25961 "instructions": Schema.optionalKey(Schema.Union([
25962 Schema.String.annotate({
25963 "description":
25964 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
25965 }),
25966 Schema.Null
25967 ])),
25968 "stream": Schema.optionalKey(Schema.Union([
25969 Schema.Boolean.annotate({
25970 "description":
25971 "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](/docs/api-reference/responses-streaming)\nfor more information.\n"
25972 }),
25973 Schema.Null
25974 ])),
25975 "stream_options": Schema.optionalKey(ResponseStreamOptions),
25976 "conversation": Schema.optionalKey(Schema.Union([ConversationParam, Schema.Null])),
25977 "context_management": Schema.optionalKey(
25978 Schema.Union([
25979 Schema.Array(ContextManagementParam).annotate({
25980 "description": "Context management configuration for this request.\n"
25981 }).check(Schema.isMinLength(1)),
25982 Schema.Null
25983 ])
25984 ),
25985 "max_output_tokens": Schema.optionalKey(
25986 Schema.Union([
25987 Schema.Number.annotate({
25988 "description":
25989 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
25990 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(16)),
25991 Schema.Null
25992 ])
25993 )
25994})
25995export type ResponsesClientEventResponseCreate = {
25996 readonly "type": "response.create"
25997 readonly "metadata"?: Metadata
25998 readonly "top_logprobs"?: number
25999 readonly "temperature"?: number | null
26000 readonly "top_p"?: number | null
26001 readonly "user"?: string | null
26002 readonly "safety_identifier"?: string
26003 readonly "prompt_cache_key"?: string | null
26004 readonly "service_tier"?: ServiceTier
26005 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
26006 readonly "previous_response_id"?: string | null
26007 readonly "model"?:
26008 | ModelIdsShared
26009 | "o1-pro"
26010 | "o1-pro-2025-03-19"
26011 | "o3-pro"
26012 | "o3-pro-2025-06-10"
26013 | "o3-deep-research"
26014 | "o3-deep-research-2025-06-26"
26015 | "o4-mini-deep-research"
26016 | "o4-mini-deep-research-2025-06-26"
26017 | "computer-use-preview"
26018 | "computer-use-preview-2025-03-11"
26019 | "gpt-5-codex"
26020 | "gpt-5-pro"
26021 | "gpt-5-pro-2025-10-06"
26022 | "gpt-5.1-codex-max"
26023 readonly "reasoning"?: Reasoning | null
26024 readonly "background"?: boolean | null
26025 readonly "max_tool_calls"?: number | null
26026 readonly "text"?: ResponseTextParam
26027 readonly "tools"?: ToolsArray
26028 readonly "tool_choice"?: ToolChoiceParam
26029 readonly "prompt"?: Prompt
26030 readonly "truncation"?: "auto" | "disabled" | null
26031 readonly "input"?: InputParam
26032 readonly "include"?: ReadonlyArray<IncludeEnum> | null
26033 readonly "parallel_tool_calls"?: boolean | null
26034 readonly "store"?: boolean | null
26035 readonly "instructions"?: string | null
26036 readonly "stream"?: boolean | null
26037 readonly "stream_options"?: ResponseStreamOptions
26038 readonly "conversation"?: ConversationParam | null
26039 readonly "context_management"?: ReadonlyArray<ContextManagementParam> | null
26040 readonly "max_output_tokens"?: number | null
26041}
26042export const ResponsesClientEventResponseCreate = Schema.Struct({
26043 "type": Schema.Literal("response.create").annotate({
26044 "description": "The type of the client event. Always `response.create`.\n"
26045 }),
26046 "metadata": Schema.optionalKey(Metadata),
26047 "top_logprobs": Schema.optionalKey(
26048 Schema.Union([
26049 Schema.Number.annotate({
26050 "description":
26051 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
26052 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)).check(
26053 Schema.makeFilterGroup([Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(20)], {
26054 "description":
26055 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
26056 })
26057 )
26058 ])
26059 ),
26060 "temperature": Schema.optionalKey(
26061 Schema.Union([
26062 Schema.Number.annotate({
26063 "description":
26064 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
26065 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
26066 Schema.Null
26067 ])
26068 ),
26069 "top_p": Schema.optionalKey(Schema.Union([
26070 Schema.Number.annotate({
26071 "description":
26072 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
26073 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
26074 Schema.Null
26075 ])),
26076 "user": Schema.optionalKey(
26077 Schema.Union([Schema.String, Schema.Null]).annotate({
26078 "description":
26079 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26080 })
26081 ),
26082 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
26083 "description":
26084 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26085 }))])),
26086 "prompt_cache_key": Schema.optionalKey(
26087 Schema.Union([Schema.String, Schema.Null]).annotate({
26088 "description":
26089 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
26090 })
26091 ),
26092 "service_tier": Schema.optionalKey(ServiceTier),
26093 "prompt_cache_retention": Schema.optionalKey(
26094 Schema.Union([
26095 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
26096 "description":
26097 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
26098 }),
26099 Schema.Null
26100 ])
26101 ),
26102 "previous_response_id": Schema.optionalKey(
26103 Schema.Union([
26104 Schema.String.annotate({
26105 "description":
26106 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
26107 }),
26108 Schema.Null
26109 ])
26110 ),
26111 "model": Schema.optionalKey(
26112 Schema.Union([
26113 ModelIdsShared,
26114 Schema.Literals([
26115 "o1-pro",
26116 "o1-pro-2025-03-19",
26117 "o3-pro",
26118 "o3-pro-2025-06-10",
26119 "o3-deep-research",
26120 "o3-deep-research-2025-06-26",
26121 "o4-mini-deep-research",
26122 "o4-mini-deep-research-2025-06-26",
26123 "computer-use-preview",
26124 "computer-use-preview-2025-03-11",
26125 "gpt-5-codex",
26126 "gpt-5-pro",
26127 "gpt-5-pro-2025-10-06",
26128 "gpt-5.1-codex-max"
26129 ]).annotate({ "title": "ResponsesOnlyModel" })
26130 ]).annotate({
26131 "description":
26132 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
26133 })
26134 ),
26135 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
26136 "background": Schema.optionalKey(
26137 Schema.Union([
26138 Schema.Boolean.annotate({
26139 "description": "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
26140 }),
26141 Schema.Null
26142 ])
26143 ),
26144 "max_tool_calls": Schema.optionalKey(
26145 Schema.Union([
26146 Schema.Number.annotate({
26147 "description":
26148 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
26149 }).check(Schema.isInt()),
26150 Schema.Null
26151 ])
26152 ),
26153 "text": Schema.optionalKey(ResponseTextParam),
26154 "tools": Schema.optionalKey(ToolsArray),
26155 "tool_choice": Schema.optionalKey(ToolChoiceParam),
26156 "prompt": Schema.optionalKey(Prompt),
26157 "truncation": Schema.optionalKey(Schema.Union([
26158 Schema.Literals(["auto", "disabled"]).annotate({
26159 "description":
26160 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
26161 }),
26162 Schema.Null
26163 ])),
26164 "input": Schema.optionalKey(InputParam),
26165 "include": Schema.optionalKey(Schema.Union([
26166 Schema.Array(IncludeEnum).annotate({
26167 "description":
26168 "Specify additional output data to include in the model response. Currently supported values are:\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n- `file_search_call.results`: Include the search results of the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program)."
26169 }),
26170 Schema.Null
26171 ])),
26172 "parallel_tool_calls": Schema.optionalKey(
26173 Schema.Union([
26174 Schema.Boolean.annotate({ "description": "Whether to allow the model to run tool calls in parallel.\n" }),
26175 Schema.Null
26176 ])
26177 ),
26178 "store": Schema.optionalKey(
26179 Schema.Union([
26180 Schema.Boolean.annotate({
26181 "description": "Whether to store the generated model response for later retrieval via\nAPI.\n"
26182 }),
26183 Schema.Null
26184 ])
26185 ),
26186 "instructions": Schema.optionalKey(Schema.Union([
26187 Schema.String.annotate({
26188 "description":
26189 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
26190 }),
26191 Schema.Null
26192 ])),
26193 "stream": Schema.optionalKey(Schema.Union([
26194 Schema.Boolean.annotate({
26195 "description":
26196 "If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](/docs/api-reference/responses-streaming)\nfor more information.\n"
26197 }),
26198 Schema.Null
26199 ])),
26200 "stream_options": Schema.optionalKey(ResponseStreamOptions),
26201 "conversation": Schema.optionalKey(Schema.Union([ConversationParam, Schema.Null])),
26202 "context_management": Schema.optionalKey(
26203 Schema.Union([
26204 Schema.Array(ContextManagementParam).annotate({
26205 "description": "Context management configuration for this request.\n"
26206 }).check(Schema.isMinLength(1)),
26207 Schema.Null
26208 ])
26209 ),
26210 "max_output_tokens": Schema.optionalKey(
26211 Schema.Union([
26212 Schema.Number.annotate({
26213 "description":
26214 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
26215 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(16)),
26216 Schema.Null
26217 ])
26218 )
26219}).annotate({
26220 "description":
26221 "Client event for creating a response over a persistent WebSocket connection.\nThis payload uses the same top-level fields as `POST /v1/responses`.\n\nNotes:\n- `stream` is implicit over WebSocket and should not be sent.\n- `background` is not supported over WebSocket.\n"
26222})
26223export type ConversationItemList = {
26224 readonly "object": "list"
26225 readonly "data": ReadonlyArray<ConversationItem>
26226 readonly "has_more": boolean
26227 readonly "first_id": string
26228 readonly "last_id": string
26229}
26230export const ConversationItemList = Schema.Struct({
26231 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
26232 "data": Schema.Array(ConversationItem).annotate({ "description": "A list of conversation items." }),
26233 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }),
26234 "first_id": Schema.String.annotate({ "description": "The ID of the first item in the list." }),
26235 "last_id": Schema.String.annotate({ "description": "The ID of the last item in the list." })
26236}).annotate({ "title": "The conversation item list", "description": "A list of Conversation items." })
26237export type ResponseItemList = {
26238 readonly "object": "list"
26239 readonly "data": ReadonlyArray<ItemResource>
26240 readonly "has_more": boolean
26241 readonly "first_id": string
26242 readonly "last_id": string
26243}
26244export const ResponseItemList = Schema.Struct({
26245 "object": Schema.Literal("list").annotate({ "description": "The type of object returned, must be `list`." }),
26246 "data": Schema.Array(ItemResource).annotate({ "description": "A list of items used to generate this response." }),
26247 "has_more": Schema.Boolean.annotate({ "description": "Whether there are more items available." }),
26248 "first_id": Schema.String.annotate({ "description": "The ID of the first item in the list." }),
26249 "last_id": Schema.String.annotate({ "description": "The ID of the last item in the list." })
26250}).annotate({ "description": "A list of Response items." })
26251export type Response = {
26252 readonly "metadata": {} | null
26253 readonly "top_logprobs"?: number | null
26254 readonly "temperature": number | null
26255 readonly "top_p": number | null
26256 readonly "user"?: string | null
26257 readonly "safety_identifier"?: string
26258 readonly "prompt_cache_key"?: string | null
26259 readonly "service_tier"?: ServiceTier
26260 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
26261 readonly "previous_response_id"?: string | null
26262 readonly "model":
26263 | ModelIdsShared
26264 | "o1-pro"
26265 | "o1-pro-2025-03-19"
26266 | "o3-pro"
26267 | "o3-pro-2025-06-10"
26268 | "o3-deep-research"
26269 | "o3-deep-research-2025-06-26"
26270 | "o4-mini-deep-research"
26271 | "o4-mini-deep-research-2025-06-26"
26272 | "computer-use-preview"
26273 | "computer-use-preview-2025-03-11"
26274 | "gpt-5-codex"
26275 | "gpt-5-pro"
26276 | "gpt-5-pro-2025-10-06"
26277 | "gpt-5.1-codex-max"
26278 readonly "reasoning"?: Reasoning | null
26279 readonly "background"?: boolean | null
26280 readonly "max_tool_calls"?: number | null
26281 readonly "text"?: ResponseTextParam
26282 readonly "tools": ReadonlyArray<Tool>
26283 readonly "tool_choice":
26284 | ToolChoiceOptions
26285 | ToolChoiceAllowed
26286 | ToolChoiceTypes
26287 | ToolChoiceFunction
26288 | ToolChoiceMCP
26289 | ToolChoiceCustom
26290 | SpecificApplyPatchParam
26291 | SpecificFunctionShellParam
26292 readonly "prompt"?: Prompt
26293 readonly "truncation"?: "auto" | "disabled" | null
26294 readonly "id": string
26295 readonly "object": "response"
26296 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
26297 readonly "created_at": number
26298 readonly "completed_at"?: number | null
26299 readonly "error": ResponseError
26300 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
26301 readonly "output": ReadonlyArray<OutputItem>
26302 readonly "instructions": string | ReadonlyArray<InputItem> | null
26303 readonly "output_text"?: string | null
26304 readonly "usage"?: ResponseUsage | null
26305 readonly "parallel_tool_calls": boolean
26306 readonly "conversation"?: Conversation_2 | null
26307 readonly "max_output_tokens"?: number | null
26308}
26309export const Response = Schema.Struct({
26310 "metadata": Schema.Union([
26311 Schema.Struct({}).annotate({
26312 "description":
26313 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
26314 }),
26315 Schema.Null
26316 ]),
26317 "top_logprobs": Schema.optionalKey(
26318 Schema.Union([
26319 Schema.Number.annotate({
26320 "description":
26321 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
26322 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
26323 Schema.Null
26324 ])
26325 ),
26326 "temperature": Schema.Union([
26327 Schema.Number.annotate({
26328 "description":
26329 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
26330 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
26331 Schema.Null
26332 ]),
26333 "top_p": Schema.Union([
26334 Schema.Number.annotate({
26335 "description":
26336 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
26337 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
26338 Schema.Null
26339 ]),
26340 "user": Schema.optionalKey(
26341 Schema.Union([Schema.String, Schema.Null]).annotate({
26342 "description":
26343 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26344 })
26345 ),
26346 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
26347 "description":
26348 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26349 }))])),
26350 "prompt_cache_key": Schema.optionalKey(
26351 Schema.Union([Schema.String, Schema.Null]).annotate({
26352 "description":
26353 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
26354 })
26355 ),
26356 "service_tier": Schema.optionalKey(ServiceTier),
26357 "prompt_cache_retention": Schema.optionalKey(
26358 Schema.Union([
26359 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
26360 "description":
26361 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
26362 }),
26363 Schema.Null
26364 ])
26365 ),
26366 "previous_response_id": Schema.optionalKey(
26367 Schema.Union([
26368 Schema.String.annotate({
26369 "description":
26370 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
26371 }),
26372 Schema.Null
26373 ])
26374 ),
26375 "model": Schema.Union([
26376 ModelIdsShared,
26377 Schema.Literals([
26378 "o1-pro",
26379 "o1-pro-2025-03-19",
26380 "o3-pro",
26381 "o3-pro-2025-06-10",
26382 "o3-deep-research",
26383 "o3-deep-research-2025-06-26",
26384 "o4-mini-deep-research",
26385 "o4-mini-deep-research-2025-06-26",
26386 "computer-use-preview",
26387 "computer-use-preview-2025-03-11",
26388 "gpt-5-codex",
26389 "gpt-5-pro",
26390 "gpt-5-pro-2025-10-06",
26391 "gpt-5.1-codex-max"
26392 ]).annotate({ "title": "ResponsesOnlyModel" })
26393 ]).annotate({
26394 "description":
26395 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
26396 }),
26397 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
26398 "background": Schema.optionalKey(
26399 Schema.Union([
26400 Schema.Boolean.annotate({
26401 "description": "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
26402 }),
26403 Schema.Null
26404 ])
26405 ),
26406 "max_tool_calls": Schema.optionalKey(
26407 Schema.Union([
26408 Schema.Number.annotate({
26409 "description":
26410 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
26411 }).check(Schema.isInt()),
26412 Schema.Null
26413 ])
26414 ),
26415 "text": Schema.optionalKey(ResponseTextParam),
26416 "tools": Schema.Array(Tool).annotate({
26417 "description":
26418 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
26419 }),
26420 "tool_choice": Schema.Union([
26421 ToolChoiceOptions,
26422 ToolChoiceAllowed,
26423 ToolChoiceTypes,
26424 ToolChoiceFunction,
26425 ToolChoiceMCP,
26426 ToolChoiceCustom,
26427 SpecificApplyPatchParam,
26428 SpecificFunctionShellParam
26429 ], { mode: "oneOf" }).annotate({
26430 "description":
26431 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
26432 }),
26433 "prompt": Schema.optionalKey(Prompt),
26434 "truncation": Schema.optionalKey(Schema.Union([
26435 Schema.Literals(["auto", "disabled"]).annotate({
26436 "description":
26437 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
26438 }),
26439 Schema.Null
26440 ])),
26441 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
26442 "object": Schema.Literal("response").annotate({
26443 "description": "The object type of this resource - always set to `response`.\n"
26444 }),
26445 "status": Schema.optionalKey(
26446 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
26447 "description":
26448 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
26449 })
26450 ),
26451 "created_at": Schema.Number.annotate({
26452 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
26453 "format": "unixtime"
26454 }).check(Schema.isFinite()),
26455 "completed_at": Schema.optionalKey(
26456 Schema.Union([
26457 Schema.Number.annotate({
26458 "description":
26459 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
26460 "format": "unixtime"
26461 }).check(Schema.isFinite()),
26462 Schema.Null
26463 ])
26464 ),
26465 "error": ResponseError,
26466 "incomplete_details": Schema.Union([
26467 Schema.Struct({
26468 "reason": Schema.optionalKey(
26469 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
26470 "description": "The reason why the response is incomplete."
26471 })
26472 )
26473 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
26474 Schema.Null
26475 ]),
26476 "output": Schema.Array(OutputItem).annotate({
26477 "description":
26478 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
26479 }),
26480 "instructions": Schema.Union([
26481 Schema.Union([
26482 Schema.String.annotate({
26483 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
26484 }),
26485 Schema.Array(InputItem).annotate({
26486 "title": "Input item list",
26487 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
26488 })
26489 ], { mode: "oneOf" }).annotate({
26490 "description":
26491 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
26492 }),
26493 Schema.Null
26494 ]),
26495 "output_text": Schema.optionalKey(
26496 Schema.Union([
26497 Schema.String.annotate({
26498 "description":
26499 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
26500 }),
26501 Schema.Null
26502 ])
26503 ),
26504 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
26505 "parallel_tool_calls": Schema.Boolean.annotate({
26506 "description": "Whether to allow the model to run tool calls in parallel.\n"
26507 }),
26508 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
26509 "max_output_tokens": Schema.optionalKey(
26510 Schema.Union([
26511 Schema.Number.annotate({
26512 "description":
26513 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
26514 }).check(Schema.isInt()),
26515 Schema.Null
26516 ])
26517 )
26518}).annotate({ "title": "The response object" })
26519export type ResponseCompletedEvent = {
26520 readonly "type": "response.completed"
26521 readonly "response": {
26522 readonly "metadata": {} | null
26523 readonly "top_logprobs"?: number | null
26524 readonly "temperature": number | null
26525 readonly "top_p": number | null
26526 readonly "user"?: string | null
26527 readonly "safety_identifier"?: string
26528 readonly "prompt_cache_key"?: string | null
26529 readonly "service_tier"?: ServiceTier
26530 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
26531 readonly "previous_response_id"?: string | null
26532 readonly "model":
26533 | ModelIdsShared
26534 | "o1-pro"
26535 | "o1-pro-2025-03-19"
26536 | "o3-pro"
26537 | "o3-pro-2025-06-10"
26538 | "o3-deep-research"
26539 | "o3-deep-research-2025-06-26"
26540 | "o4-mini-deep-research"
26541 | "o4-mini-deep-research-2025-06-26"
26542 | "computer-use-preview"
26543 | "computer-use-preview-2025-03-11"
26544 | "gpt-5-codex"
26545 | "gpt-5-pro"
26546 | "gpt-5-pro-2025-10-06"
26547 | "gpt-5.1-codex-max"
26548 readonly "reasoning"?: Reasoning | null
26549 readonly "background"?: boolean | null
26550 readonly "max_tool_calls"?: number | null
26551 readonly "text"?: ResponseTextParam
26552 readonly "tools": ReadonlyArray<Tool>
26553 readonly "tool_choice":
26554 | ToolChoiceOptions
26555 | ToolChoiceAllowed
26556 | ToolChoiceTypes
26557 | ToolChoiceFunction
26558 | ToolChoiceMCP
26559 | ToolChoiceCustom
26560 | SpecificApplyPatchParam
26561 | SpecificFunctionShellParam
26562 readonly "prompt"?: Prompt
26563 readonly "truncation"?: "auto" | "disabled" | null
26564 readonly "id": string
26565 readonly "object": "response"
26566 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
26567 readonly "created_at": number
26568 readonly "completed_at"?: number | null
26569 readonly "error": ResponseError
26570 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
26571 readonly "output": ReadonlyArray<OutputItem>
26572 readonly "instructions": string | ReadonlyArray<InputItem> | null
26573 readonly "output_text"?: string | null
26574 readonly "usage"?: ResponseUsage | null
26575 readonly "parallel_tool_calls": boolean
26576 readonly "conversation"?: Conversation_2 | null
26577 readonly "max_output_tokens"?: number | null
26578 }
26579 readonly "sequence_number": number
26580}
26581export const ResponseCompletedEvent = Schema.Struct({
26582 "type": Schema.Literal("response.completed").annotate({
26583 "description": "The type of the event. Always `response.completed`.\n"
26584 }),
26585 "response": Schema.Struct({
26586 "metadata": Schema.Union([
26587 Schema.Struct({}).annotate({
26588 "description":
26589 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
26590 }),
26591 Schema.Null
26592 ]),
26593 "top_logprobs": Schema.optionalKey(
26594 Schema.Union([
26595 Schema.Number.annotate({
26596 "description":
26597 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
26598 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
26599 Schema.Null
26600 ])
26601 ),
26602 "temperature": Schema.Union([
26603 Schema.Number.annotate({
26604 "description":
26605 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
26606 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
26607 Schema.Null
26608 ]),
26609 "top_p": Schema.Union([
26610 Schema.Number.annotate({
26611 "description":
26612 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
26613 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
26614 Schema.Null
26615 ]),
26616 "user": Schema.optionalKey(
26617 Schema.Union([Schema.String, Schema.Null]).annotate({
26618 "description":
26619 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26620 })
26621 ),
26622 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
26623 "description":
26624 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26625 }))])),
26626 "prompt_cache_key": Schema.optionalKey(
26627 Schema.Union([Schema.String, Schema.Null]).annotate({
26628 "description":
26629 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
26630 })
26631 ),
26632 "service_tier": Schema.optionalKey(ServiceTier),
26633 "prompt_cache_retention": Schema.optionalKey(
26634 Schema.Union([
26635 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
26636 "description":
26637 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
26638 }),
26639 Schema.Null
26640 ])
26641 ),
26642 "previous_response_id": Schema.optionalKey(
26643 Schema.Union([
26644 Schema.String.annotate({
26645 "description":
26646 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
26647 }),
26648 Schema.Null
26649 ])
26650 ),
26651 "model": Schema.Union([
26652 ModelIdsShared,
26653 Schema.Literals([
26654 "o1-pro",
26655 "o1-pro-2025-03-19",
26656 "o3-pro",
26657 "o3-pro-2025-06-10",
26658 "o3-deep-research",
26659 "o3-deep-research-2025-06-26",
26660 "o4-mini-deep-research",
26661 "o4-mini-deep-research-2025-06-26",
26662 "computer-use-preview",
26663 "computer-use-preview-2025-03-11",
26664 "gpt-5-codex",
26665 "gpt-5-pro",
26666 "gpt-5-pro-2025-10-06",
26667 "gpt-5.1-codex-max"
26668 ]).annotate({ "title": "ResponsesOnlyModel" })
26669 ]).annotate({
26670 "description":
26671 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
26672 }),
26673 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
26674 "background": Schema.optionalKey(
26675 Schema.Union([
26676 Schema.Boolean.annotate({
26677 "description":
26678 "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
26679 }),
26680 Schema.Null
26681 ])
26682 ),
26683 "max_tool_calls": Schema.optionalKey(
26684 Schema.Union([
26685 Schema.Number.annotate({
26686 "description":
26687 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
26688 }).check(Schema.isInt()),
26689 Schema.Null
26690 ])
26691 ),
26692 "text": Schema.optionalKey(ResponseTextParam),
26693 "tools": Schema.Array(Tool).annotate({
26694 "description":
26695 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
26696 }),
26697 "tool_choice": Schema.Union([
26698 ToolChoiceOptions,
26699 ToolChoiceAllowed,
26700 ToolChoiceTypes,
26701 ToolChoiceFunction,
26702 ToolChoiceMCP,
26703 ToolChoiceCustom,
26704 SpecificApplyPatchParam,
26705 SpecificFunctionShellParam
26706 ], { mode: "oneOf" }).annotate({
26707 "description":
26708 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
26709 }),
26710 "prompt": Schema.optionalKey(Prompt),
26711 "truncation": Schema.optionalKey(Schema.Union([
26712 Schema.Literals(["auto", "disabled"]).annotate({
26713 "description":
26714 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
26715 }),
26716 Schema.Null
26717 ])),
26718 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
26719 "object": Schema.Literal("response").annotate({
26720 "description": "The object type of this resource - always set to `response`.\n"
26721 }),
26722 "status": Schema.optionalKey(
26723 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
26724 "description":
26725 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
26726 })
26727 ),
26728 "created_at": Schema.Number.annotate({
26729 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
26730 "format": "unixtime"
26731 }).check(Schema.isFinite()),
26732 "completed_at": Schema.optionalKey(
26733 Schema.Union([
26734 Schema.Number.annotate({
26735 "description":
26736 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
26737 "format": "unixtime"
26738 }).check(Schema.isFinite()),
26739 Schema.Null
26740 ])
26741 ),
26742 "error": ResponseError,
26743 "incomplete_details": Schema.Union([
26744 Schema.Struct({
26745 "reason": Schema.optionalKey(
26746 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
26747 "description": "The reason why the response is incomplete."
26748 })
26749 )
26750 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
26751 Schema.Null
26752 ]),
26753 "output": Schema.Array(OutputItem).annotate({
26754 "description":
26755 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
26756 }),
26757 "instructions": Schema.Union([
26758 Schema.Union([
26759 Schema.String.annotate({
26760 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
26761 }),
26762 Schema.Array(InputItem).annotate({
26763 "title": "Input item list",
26764 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
26765 })
26766 ], { mode: "oneOf" }).annotate({
26767 "description":
26768 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
26769 }),
26770 Schema.Null
26771 ]),
26772 "output_text": Schema.optionalKey(
26773 Schema.Union([
26774 Schema.String.annotate({
26775 "description":
26776 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
26777 }),
26778 Schema.Null
26779 ])
26780 ),
26781 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
26782 "parallel_tool_calls": Schema.Boolean.annotate({
26783 "description": "Whether to allow the model to run tool calls in parallel.\n"
26784 }),
26785 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
26786 "max_output_tokens": Schema.optionalKey(
26787 Schema.Union([
26788 Schema.Number.annotate({
26789 "description":
26790 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
26791 }).check(Schema.isInt()),
26792 Schema.Null
26793 ])
26794 )
26795 }).annotate({ "title": "The response object", "description": "Properties of the completed response.\n" }),
26796 "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check(
26797 Schema.isInt()
26798 )
26799}).annotate({ "description": "Emitted when the model response is complete." })
26800export type ResponseCreatedEvent = {
26801 readonly "type": "response.created"
26802 readonly "response": {
26803 readonly "metadata": {} | null
26804 readonly "top_logprobs"?: number | null
26805 readonly "temperature": number | null
26806 readonly "top_p": number | null
26807 readonly "user"?: string | null
26808 readonly "safety_identifier"?: string
26809 readonly "prompt_cache_key"?: string | null
26810 readonly "service_tier"?: ServiceTier
26811 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
26812 readonly "previous_response_id"?: string | null
26813 readonly "model":
26814 | ModelIdsShared
26815 | "o1-pro"
26816 | "o1-pro-2025-03-19"
26817 | "o3-pro"
26818 | "o3-pro-2025-06-10"
26819 | "o3-deep-research"
26820 | "o3-deep-research-2025-06-26"
26821 | "o4-mini-deep-research"
26822 | "o4-mini-deep-research-2025-06-26"
26823 | "computer-use-preview"
26824 | "computer-use-preview-2025-03-11"
26825 | "gpt-5-codex"
26826 | "gpt-5-pro"
26827 | "gpt-5-pro-2025-10-06"
26828 | "gpt-5.1-codex-max"
26829 readonly "reasoning"?: Reasoning | null
26830 readonly "background"?: boolean | null
26831 readonly "max_tool_calls"?: number | null
26832 readonly "text"?: ResponseTextParam
26833 readonly "tools": ReadonlyArray<Tool>
26834 readonly "tool_choice":
26835 | ToolChoiceOptions
26836 | ToolChoiceAllowed
26837 | ToolChoiceTypes
26838 | ToolChoiceFunction
26839 | ToolChoiceMCP
26840 | ToolChoiceCustom
26841 | SpecificApplyPatchParam
26842 | SpecificFunctionShellParam
26843 readonly "prompt"?: Prompt
26844 readonly "truncation"?: "auto" | "disabled" | null
26845 readonly "id": string
26846 readonly "object": "response"
26847 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
26848 readonly "created_at": number
26849 readonly "completed_at"?: number | null
26850 readonly "error": ResponseError
26851 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
26852 readonly "output": ReadonlyArray<OutputItem>
26853 readonly "instructions": string | ReadonlyArray<InputItem> | null
26854 readonly "output_text"?: string | null
26855 readonly "usage"?: ResponseUsage | null
26856 readonly "parallel_tool_calls": boolean
26857 readonly "conversation"?: Conversation_2 | null
26858 readonly "max_output_tokens"?: number | null
26859 }
26860 readonly "sequence_number": number
26861}
26862export const ResponseCreatedEvent = Schema.Struct({
26863 "type": Schema.Literal("response.created").annotate({
26864 "description": "The type of the event. Always `response.created`.\n"
26865 }),
26866 "response": Schema.Struct({
26867 "metadata": Schema.Union([
26868 Schema.Struct({}).annotate({
26869 "description":
26870 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
26871 }),
26872 Schema.Null
26873 ]),
26874 "top_logprobs": Schema.optionalKey(
26875 Schema.Union([
26876 Schema.Number.annotate({
26877 "description":
26878 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
26879 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
26880 Schema.Null
26881 ])
26882 ),
26883 "temperature": Schema.Union([
26884 Schema.Number.annotate({
26885 "description":
26886 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
26887 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
26888 Schema.Null
26889 ]),
26890 "top_p": Schema.Union([
26891 Schema.Number.annotate({
26892 "description":
26893 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
26894 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
26895 Schema.Null
26896 ]),
26897 "user": Schema.optionalKey(
26898 Schema.Union([Schema.String, Schema.Null]).annotate({
26899 "description":
26900 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26901 })
26902 ),
26903 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
26904 "description":
26905 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
26906 }))])),
26907 "prompt_cache_key": Schema.optionalKey(
26908 Schema.Union([Schema.String, Schema.Null]).annotate({
26909 "description":
26910 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
26911 })
26912 ),
26913 "service_tier": Schema.optionalKey(ServiceTier),
26914 "prompt_cache_retention": Schema.optionalKey(
26915 Schema.Union([
26916 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
26917 "description":
26918 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
26919 }),
26920 Schema.Null
26921 ])
26922 ),
26923 "previous_response_id": Schema.optionalKey(
26924 Schema.Union([
26925 Schema.String.annotate({
26926 "description":
26927 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
26928 }),
26929 Schema.Null
26930 ])
26931 ),
26932 "model": Schema.Union([
26933 ModelIdsShared,
26934 Schema.Literals([
26935 "o1-pro",
26936 "o1-pro-2025-03-19",
26937 "o3-pro",
26938 "o3-pro-2025-06-10",
26939 "o3-deep-research",
26940 "o3-deep-research-2025-06-26",
26941 "o4-mini-deep-research",
26942 "o4-mini-deep-research-2025-06-26",
26943 "computer-use-preview",
26944 "computer-use-preview-2025-03-11",
26945 "gpt-5-codex",
26946 "gpt-5-pro",
26947 "gpt-5-pro-2025-10-06",
26948 "gpt-5.1-codex-max"
26949 ]).annotate({ "title": "ResponsesOnlyModel" })
26950 ]).annotate({
26951 "description":
26952 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
26953 }),
26954 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
26955 "background": Schema.optionalKey(
26956 Schema.Union([
26957 Schema.Boolean.annotate({
26958 "description":
26959 "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
26960 }),
26961 Schema.Null
26962 ])
26963 ),
26964 "max_tool_calls": Schema.optionalKey(
26965 Schema.Union([
26966 Schema.Number.annotate({
26967 "description":
26968 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
26969 }).check(Schema.isInt()),
26970 Schema.Null
26971 ])
26972 ),
26973 "text": Schema.optionalKey(ResponseTextParam),
26974 "tools": Schema.Array(Tool).annotate({
26975 "description":
26976 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
26977 }),
26978 "tool_choice": Schema.Union([
26979 ToolChoiceOptions,
26980 ToolChoiceAllowed,
26981 ToolChoiceTypes,
26982 ToolChoiceFunction,
26983 ToolChoiceMCP,
26984 ToolChoiceCustom,
26985 SpecificApplyPatchParam,
26986 SpecificFunctionShellParam
26987 ], { mode: "oneOf" }).annotate({
26988 "description":
26989 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
26990 }),
26991 "prompt": Schema.optionalKey(Prompt),
26992 "truncation": Schema.optionalKey(Schema.Union([
26993 Schema.Literals(["auto", "disabled"]).annotate({
26994 "description":
26995 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
26996 }),
26997 Schema.Null
26998 ])),
26999 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
27000 "object": Schema.Literal("response").annotate({
27001 "description": "The object type of this resource - always set to `response`.\n"
27002 }),
27003 "status": Schema.optionalKey(
27004 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
27005 "description":
27006 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
27007 })
27008 ),
27009 "created_at": Schema.Number.annotate({
27010 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
27011 "format": "unixtime"
27012 }).check(Schema.isFinite()),
27013 "completed_at": Schema.optionalKey(
27014 Schema.Union([
27015 Schema.Number.annotate({
27016 "description":
27017 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
27018 "format": "unixtime"
27019 }).check(Schema.isFinite()),
27020 Schema.Null
27021 ])
27022 ),
27023 "error": ResponseError,
27024 "incomplete_details": Schema.Union([
27025 Schema.Struct({
27026 "reason": Schema.optionalKey(
27027 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
27028 "description": "The reason why the response is incomplete."
27029 })
27030 )
27031 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
27032 Schema.Null
27033 ]),
27034 "output": Schema.Array(OutputItem).annotate({
27035 "description":
27036 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
27037 }),
27038 "instructions": Schema.Union([
27039 Schema.Union([
27040 Schema.String.annotate({
27041 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
27042 }),
27043 Schema.Array(InputItem).annotate({
27044 "title": "Input item list",
27045 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
27046 })
27047 ], { mode: "oneOf" }).annotate({
27048 "description":
27049 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
27050 }),
27051 Schema.Null
27052 ]),
27053 "output_text": Schema.optionalKey(
27054 Schema.Union([
27055 Schema.String.annotate({
27056 "description":
27057 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
27058 }),
27059 Schema.Null
27060 ])
27061 ),
27062 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
27063 "parallel_tool_calls": Schema.Boolean.annotate({
27064 "description": "Whether to allow the model to run tool calls in parallel.\n"
27065 }),
27066 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
27067 "max_output_tokens": Schema.optionalKey(
27068 Schema.Union([
27069 Schema.Number.annotate({
27070 "description":
27071 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
27072 }).check(Schema.isInt()),
27073 Schema.Null
27074 ])
27075 )
27076 }).annotate({ "title": "The response object", "description": "The response that was created.\n" }),
27077 "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check(
27078 Schema.isInt()
27079 )
27080}).annotate({ "description": "An event that is emitted when a response is created.\n" })
27081export type ResponseFailedEvent = {
27082 readonly "type": "response.failed"
27083 readonly "sequence_number": number
27084 readonly "response": {
27085 readonly "metadata": {} | null
27086 readonly "top_logprobs"?: number | null
27087 readonly "temperature": number | null
27088 readonly "top_p": number | null
27089 readonly "user"?: string | null
27090 readonly "safety_identifier"?: string
27091 readonly "prompt_cache_key"?: string | null
27092 readonly "service_tier"?: ServiceTier
27093 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
27094 readonly "previous_response_id"?: string | null
27095 readonly "model":
27096 | ModelIdsShared
27097 | "o1-pro"
27098 | "o1-pro-2025-03-19"
27099 | "o3-pro"
27100 | "o3-pro-2025-06-10"
27101 | "o3-deep-research"
27102 | "o3-deep-research-2025-06-26"
27103 | "o4-mini-deep-research"
27104 | "o4-mini-deep-research-2025-06-26"
27105 | "computer-use-preview"
27106 | "computer-use-preview-2025-03-11"
27107 | "gpt-5-codex"
27108 | "gpt-5-pro"
27109 | "gpt-5-pro-2025-10-06"
27110 | "gpt-5.1-codex-max"
27111 readonly "reasoning"?: Reasoning | null
27112 readonly "background"?: boolean | null
27113 readonly "max_tool_calls"?: number | null
27114 readonly "text"?: ResponseTextParam
27115 readonly "tools": ReadonlyArray<Tool>
27116 readonly "tool_choice":
27117 | ToolChoiceOptions
27118 | ToolChoiceAllowed
27119 | ToolChoiceTypes
27120 | ToolChoiceFunction
27121 | ToolChoiceMCP
27122 | ToolChoiceCustom
27123 | SpecificApplyPatchParam
27124 | SpecificFunctionShellParam
27125 readonly "prompt"?: Prompt
27126 readonly "truncation"?: "auto" | "disabled" | null
27127 readonly "id": string
27128 readonly "object": "response"
27129 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
27130 readonly "created_at": number
27131 readonly "completed_at"?: number | null
27132 readonly "error": ResponseError
27133 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
27134 readonly "output": ReadonlyArray<OutputItem>
27135 readonly "instructions": string | ReadonlyArray<InputItem> | null
27136 readonly "output_text"?: string | null
27137 readonly "usage"?: ResponseUsage | null
27138 readonly "parallel_tool_calls": boolean
27139 readonly "conversation"?: Conversation_2 | null
27140 readonly "max_output_tokens"?: number | null
27141 }
27142}
27143export const ResponseFailedEvent = Schema.Struct({
27144 "type": Schema.Literal("response.failed").annotate({
27145 "description": "The type of the event. Always `response.failed`.\n"
27146 }),
27147 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
27148 Schema.isInt()
27149 ),
27150 "response": Schema.Struct({
27151 "metadata": Schema.Union([
27152 Schema.Struct({}).annotate({
27153 "description":
27154 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
27155 }),
27156 Schema.Null
27157 ]),
27158 "top_logprobs": Schema.optionalKey(
27159 Schema.Union([
27160 Schema.Number.annotate({
27161 "description":
27162 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
27163 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
27164 Schema.Null
27165 ])
27166 ),
27167 "temperature": Schema.Union([
27168 Schema.Number.annotate({
27169 "description":
27170 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
27171 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
27172 Schema.Null
27173 ]),
27174 "top_p": Schema.Union([
27175 Schema.Number.annotate({
27176 "description":
27177 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
27178 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
27179 Schema.Null
27180 ]),
27181 "user": Schema.optionalKey(
27182 Schema.Union([Schema.String, Schema.Null]).annotate({
27183 "description":
27184 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
27185 })
27186 ),
27187 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
27188 "description":
27189 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
27190 }))])),
27191 "prompt_cache_key": Schema.optionalKey(
27192 Schema.Union([Schema.String, Schema.Null]).annotate({
27193 "description":
27194 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
27195 })
27196 ),
27197 "service_tier": Schema.optionalKey(ServiceTier),
27198 "prompt_cache_retention": Schema.optionalKey(
27199 Schema.Union([
27200 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
27201 "description":
27202 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
27203 }),
27204 Schema.Null
27205 ])
27206 ),
27207 "previous_response_id": Schema.optionalKey(
27208 Schema.Union([
27209 Schema.String.annotate({
27210 "description":
27211 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
27212 }),
27213 Schema.Null
27214 ])
27215 ),
27216 "model": Schema.Union([
27217 ModelIdsShared,
27218 Schema.Literals([
27219 "o1-pro",
27220 "o1-pro-2025-03-19",
27221 "o3-pro",
27222 "o3-pro-2025-06-10",
27223 "o3-deep-research",
27224 "o3-deep-research-2025-06-26",
27225 "o4-mini-deep-research",
27226 "o4-mini-deep-research-2025-06-26",
27227 "computer-use-preview",
27228 "computer-use-preview-2025-03-11",
27229 "gpt-5-codex",
27230 "gpt-5-pro",
27231 "gpt-5-pro-2025-10-06",
27232 "gpt-5.1-codex-max"
27233 ]).annotate({ "title": "ResponsesOnlyModel" })
27234 ]).annotate({
27235 "description":
27236 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
27237 }),
27238 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
27239 "background": Schema.optionalKey(
27240 Schema.Union([
27241 Schema.Boolean.annotate({
27242 "description":
27243 "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
27244 }),
27245 Schema.Null
27246 ])
27247 ),
27248 "max_tool_calls": Schema.optionalKey(
27249 Schema.Union([
27250 Schema.Number.annotate({
27251 "description":
27252 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
27253 }).check(Schema.isInt()),
27254 Schema.Null
27255 ])
27256 ),
27257 "text": Schema.optionalKey(ResponseTextParam),
27258 "tools": Schema.Array(Tool).annotate({
27259 "description":
27260 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
27261 }),
27262 "tool_choice": Schema.Union([
27263 ToolChoiceOptions,
27264 ToolChoiceAllowed,
27265 ToolChoiceTypes,
27266 ToolChoiceFunction,
27267 ToolChoiceMCP,
27268 ToolChoiceCustom,
27269 SpecificApplyPatchParam,
27270 SpecificFunctionShellParam
27271 ], { mode: "oneOf" }).annotate({
27272 "description":
27273 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
27274 }),
27275 "prompt": Schema.optionalKey(Prompt),
27276 "truncation": Schema.optionalKey(Schema.Union([
27277 Schema.Literals(["auto", "disabled"]).annotate({
27278 "description":
27279 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
27280 }),
27281 Schema.Null
27282 ])),
27283 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
27284 "object": Schema.Literal("response").annotate({
27285 "description": "The object type of this resource - always set to `response`.\n"
27286 }),
27287 "status": Schema.optionalKey(
27288 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
27289 "description":
27290 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
27291 })
27292 ),
27293 "created_at": Schema.Number.annotate({
27294 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
27295 "format": "unixtime"
27296 }).check(Schema.isFinite()),
27297 "completed_at": Schema.optionalKey(
27298 Schema.Union([
27299 Schema.Number.annotate({
27300 "description":
27301 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
27302 "format": "unixtime"
27303 }).check(Schema.isFinite()),
27304 Schema.Null
27305 ])
27306 ),
27307 "error": ResponseError,
27308 "incomplete_details": Schema.Union([
27309 Schema.Struct({
27310 "reason": Schema.optionalKey(
27311 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
27312 "description": "The reason why the response is incomplete."
27313 })
27314 )
27315 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
27316 Schema.Null
27317 ]),
27318 "output": Schema.Array(OutputItem).annotate({
27319 "description":
27320 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
27321 }),
27322 "instructions": Schema.Union([
27323 Schema.Union([
27324 Schema.String.annotate({
27325 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
27326 }),
27327 Schema.Array(InputItem).annotate({
27328 "title": "Input item list",
27329 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
27330 })
27331 ], { mode: "oneOf" }).annotate({
27332 "description":
27333 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
27334 }),
27335 Schema.Null
27336 ]),
27337 "output_text": Schema.optionalKey(
27338 Schema.Union([
27339 Schema.String.annotate({
27340 "description":
27341 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
27342 }),
27343 Schema.Null
27344 ])
27345 ),
27346 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
27347 "parallel_tool_calls": Schema.Boolean.annotate({
27348 "description": "Whether to allow the model to run tool calls in parallel.\n"
27349 }),
27350 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
27351 "max_output_tokens": Schema.optionalKey(
27352 Schema.Union([
27353 Schema.Number.annotate({
27354 "description":
27355 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
27356 }).check(Schema.isInt()),
27357 Schema.Null
27358 ])
27359 )
27360 }).annotate({ "title": "The response object", "description": "The response that failed.\n" })
27361}).annotate({ "description": "An event that is emitted when a response fails.\n" })
27362export type ResponseInProgressEvent = {
27363 readonly "type": "response.in_progress"
27364 readonly "response": {
27365 readonly "metadata": {} | null
27366 readonly "top_logprobs"?: number | null
27367 readonly "temperature": number | null
27368 readonly "top_p": number | null
27369 readonly "user"?: string | null
27370 readonly "safety_identifier"?: string
27371 readonly "prompt_cache_key"?: string | null
27372 readonly "service_tier"?: ServiceTier
27373 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
27374 readonly "previous_response_id"?: string | null
27375 readonly "model":
27376 | ModelIdsShared
27377 | "o1-pro"
27378 | "o1-pro-2025-03-19"
27379 | "o3-pro"
27380 | "o3-pro-2025-06-10"
27381 | "o3-deep-research"
27382 | "o3-deep-research-2025-06-26"
27383 | "o4-mini-deep-research"
27384 | "o4-mini-deep-research-2025-06-26"
27385 | "computer-use-preview"
27386 | "computer-use-preview-2025-03-11"
27387 | "gpt-5-codex"
27388 | "gpt-5-pro"
27389 | "gpt-5-pro-2025-10-06"
27390 | "gpt-5.1-codex-max"
27391 readonly "reasoning"?: Reasoning | null
27392 readonly "background"?: boolean | null
27393 readonly "max_tool_calls"?: number | null
27394 readonly "text"?: ResponseTextParam
27395 readonly "tools": ReadonlyArray<Tool>
27396 readonly "tool_choice":
27397 | ToolChoiceOptions
27398 | ToolChoiceAllowed
27399 | ToolChoiceTypes
27400 | ToolChoiceFunction
27401 | ToolChoiceMCP
27402 | ToolChoiceCustom
27403 | SpecificApplyPatchParam
27404 | SpecificFunctionShellParam
27405 readonly "prompt"?: Prompt
27406 readonly "truncation"?: "auto" | "disabled" | null
27407 readonly "id": string
27408 readonly "object": "response"
27409 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
27410 readonly "created_at": number
27411 readonly "completed_at"?: number | null
27412 readonly "error": ResponseError
27413 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
27414 readonly "output": ReadonlyArray<OutputItem>
27415 readonly "instructions": string | ReadonlyArray<InputItem> | null
27416 readonly "output_text"?: string | null
27417 readonly "usage"?: ResponseUsage | null
27418 readonly "parallel_tool_calls": boolean
27419 readonly "conversation"?: Conversation_2 | null
27420 readonly "max_output_tokens"?: number | null
27421 }
27422 readonly "sequence_number": number
27423}
27424export const ResponseInProgressEvent = Schema.Struct({
27425 "type": Schema.Literal("response.in_progress").annotate({
27426 "description": "The type of the event. Always `response.in_progress`.\n"
27427 }),
27428 "response": Schema.Struct({
27429 "metadata": Schema.Union([
27430 Schema.Struct({}).annotate({
27431 "description":
27432 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
27433 }),
27434 Schema.Null
27435 ]),
27436 "top_logprobs": Schema.optionalKey(
27437 Schema.Union([
27438 Schema.Number.annotate({
27439 "description":
27440 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
27441 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
27442 Schema.Null
27443 ])
27444 ),
27445 "temperature": Schema.Union([
27446 Schema.Number.annotate({
27447 "description":
27448 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
27449 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
27450 Schema.Null
27451 ]),
27452 "top_p": Schema.Union([
27453 Schema.Number.annotate({
27454 "description":
27455 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
27456 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
27457 Schema.Null
27458 ]),
27459 "user": Schema.optionalKey(
27460 Schema.Union([Schema.String, Schema.Null]).annotate({
27461 "description":
27462 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
27463 })
27464 ),
27465 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
27466 "description":
27467 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
27468 }))])),
27469 "prompt_cache_key": Schema.optionalKey(
27470 Schema.Union([Schema.String, Schema.Null]).annotate({
27471 "description":
27472 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
27473 })
27474 ),
27475 "service_tier": Schema.optionalKey(ServiceTier),
27476 "prompt_cache_retention": Schema.optionalKey(
27477 Schema.Union([
27478 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
27479 "description":
27480 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
27481 }),
27482 Schema.Null
27483 ])
27484 ),
27485 "previous_response_id": Schema.optionalKey(
27486 Schema.Union([
27487 Schema.String.annotate({
27488 "description":
27489 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
27490 }),
27491 Schema.Null
27492 ])
27493 ),
27494 "model": Schema.Union([
27495 ModelIdsShared,
27496 Schema.Literals([
27497 "o1-pro",
27498 "o1-pro-2025-03-19",
27499 "o3-pro",
27500 "o3-pro-2025-06-10",
27501 "o3-deep-research",
27502 "o3-deep-research-2025-06-26",
27503 "o4-mini-deep-research",
27504 "o4-mini-deep-research-2025-06-26",
27505 "computer-use-preview",
27506 "computer-use-preview-2025-03-11",
27507 "gpt-5-codex",
27508 "gpt-5-pro",
27509 "gpt-5-pro-2025-10-06",
27510 "gpt-5.1-codex-max"
27511 ]).annotate({ "title": "ResponsesOnlyModel" })
27512 ]).annotate({
27513 "description":
27514 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
27515 }),
27516 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
27517 "background": Schema.optionalKey(
27518 Schema.Union([
27519 Schema.Boolean.annotate({
27520 "description":
27521 "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
27522 }),
27523 Schema.Null
27524 ])
27525 ),
27526 "max_tool_calls": Schema.optionalKey(
27527 Schema.Union([
27528 Schema.Number.annotate({
27529 "description":
27530 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
27531 }).check(Schema.isInt()),
27532 Schema.Null
27533 ])
27534 ),
27535 "text": Schema.optionalKey(ResponseTextParam),
27536 "tools": Schema.Array(Tool).annotate({
27537 "description":
27538 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
27539 }),
27540 "tool_choice": Schema.Union([
27541 ToolChoiceOptions,
27542 ToolChoiceAllowed,
27543 ToolChoiceTypes,
27544 ToolChoiceFunction,
27545 ToolChoiceMCP,
27546 ToolChoiceCustom,
27547 SpecificApplyPatchParam,
27548 SpecificFunctionShellParam
27549 ], { mode: "oneOf" }).annotate({
27550 "description":
27551 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
27552 }),
27553 "prompt": Schema.optionalKey(Prompt),
27554 "truncation": Schema.optionalKey(Schema.Union([
27555 Schema.Literals(["auto", "disabled"]).annotate({
27556 "description":
27557 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
27558 }),
27559 Schema.Null
27560 ])),
27561 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
27562 "object": Schema.Literal("response").annotate({
27563 "description": "The object type of this resource - always set to `response`.\n"
27564 }),
27565 "status": Schema.optionalKey(
27566 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
27567 "description":
27568 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
27569 })
27570 ),
27571 "created_at": Schema.Number.annotate({
27572 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
27573 "format": "unixtime"
27574 }).check(Schema.isFinite()),
27575 "completed_at": Schema.optionalKey(
27576 Schema.Union([
27577 Schema.Number.annotate({
27578 "description":
27579 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
27580 "format": "unixtime"
27581 }).check(Schema.isFinite()),
27582 Schema.Null
27583 ])
27584 ),
27585 "error": ResponseError,
27586 "incomplete_details": Schema.Union([
27587 Schema.Struct({
27588 "reason": Schema.optionalKey(
27589 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
27590 "description": "The reason why the response is incomplete."
27591 })
27592 )
27593 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
27594 Schema.Null
27595 ]),
27596 "output": Schema.Array(OutputItem).annotate({
27597 "description":
27598 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
27599 }),
27600 "instructions": Schema.Union([
27601 Schema.Union([
27602 Schema.String.annotate({
27603 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
27604 }),
27605 Schema.Array(InputItem).annotate({
27606 "title": "Input item list",
27607 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
27608 })
27609 ], { mode: "oneOf" }).annotate({
27610 "description":
27611 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
27612 }),
27613 Schema.Null
27614 ]),
27615 "output_text": Schema.optionalKey(
27616 Schema.Union([
27617 Schema.String.annotate({
27618 "description":
27619 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
27620 }),
27621 Schema.Null
27622 ])
27623 ),
27624 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
27625 "parallel_tool_calls": Schema.Boolean.annotate({
27626 "description": "Whether to allow the model to run tool calls in parallel.\n"
27627 }),
27628 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
27629 "max_output_tokens": Schema.optionalKey(
27630 Schema.Union([
27631 Schema.Number.annotate({
27632 "description":
27633 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
27634 }).check(Schema.isInt()),
27635 Schema.Null
27636 ])
27637 )
27638 }).annotate({ "title": "The response object", "description": "The response that is in progress.\n" }),
27639 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
27640 Schema.isInt()
27641 )
27642}).annotate({ "description": "Emitted when the response is in progress." })
27643export type ResponseIncompleteEvent = {
27644 readonly "type": "response.incomplete"
27645 readonly "response": {
27646 readonly "metadata": {} | null
27647 readonly "top_logprobs"?: number | null
27648 readonly "temperature": number | null
27649 readonly "top_p": number | null
27650 readonly "user"?: string | null
27651 readonly "safety_identifier"?: string
27652 readonly "prompt_cache_key"?: string | null
27653 readonly "service_tier"?: ServiceTier
27654 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
27655 readonly "previous_response_id"?: string | null
27656 readonly "model":
27657 | ModelIdsShared
27658 | "o1-pro"
27659 | "o1-pro-2025-03-19"
27660 | "o3-pro"
27661 | "o3-pro-2025-06-10"
27662 | "o3-deep-research"
27663 | "o3-deep-research-2025-06-26"
27664 | "o4-mini-deep-research"
27665 | "o4-mini-deep-research-2025-06-26"
27666 | "computer-use-preview"
27667 | "computer-use-preview-2025-03-11"
27668 | "gpt-5-codex"
27669 | "gpt-5-pro"
27670 | "gpt-5-pro-2025-10-06"
27671 | "gpt-5.1-codex-max"
27672 readonly "reasoning"?: Reasoning | null
27673 readonly "background"?: boolean | null
27674 readonly "max_tool_calls"?: number | null
27675 readonly "text"?: ResponseTextParam
27676 readonly "tools": ReadonlyArray<Tool>
27677 readonly "tool_choice":
27678 | ToolChoiceOptions
27679 | ToolChoiceAllowed
27680 | ToolChoiceTypes
27681 | ToolChoiceFunction
27682 | ToolChoiceMCP
27683 | ToolChoiceCustom
27684 | SpecificApplyPatchParam
27685 | SpecificFunctionShellParam
27686 readonly "prompt"?: Prompt
27687 readonly "truncation"?: "auto" | "disabled" | null
27688 readonly "id": string
27689 readonly "object": "response"
27690 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
27691 readonly "created_at": number
27692 readonly "completed_at"?: number | null
27693 readonly "error": ResponseError
27694 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
27695 readonly "output": ReadonlyArray<OutputItem>
27696 readonly "instructions": string | ReadonlyArray<InputItem> | null
27697 readonly "output_text"?: string | null
27698 readonly "usage"?: ResponseUsage | null
27699 readonly "parallel_tool_calls": boolean
27700 readonly "conversation"?: Conversation_2 | null
27701 readonly "max_output_tokens"?: number | null
27702 }
27703 readonly "sequence_number": number
27704}
27705export const ResponseIncompleteEvent = Schema.Struct({
27706 "type": Schema.Literal("response.incomplete").annotate({
27707 "description": "The type of the event. Always `response.incomplete`.\n"
27708 }),
27709 "response": Schema.Struct({
27710 "metadata": Schema.Union([
27711 Schema.Struct({}).annotate({
27712 "description":
27713 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
27714 }),
27715 Schema.Null
27716 ]),
27717 "top_logprobs": Schema.optionalKey(
27718 Schema.Union([
27719 Schema.Number.annotate({
27720 "description":
27721 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
27722 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
27723 Schema.Null
27724 ])
27725 ),
27726 "temperature": Schema.Union([
27727 Schema.Number.annotate({
27728 "description":
27729 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
27730 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
27731 Schema.Null
27732 ]),
27733 "top_p": Schema.Union([
27734 Schema.Number.annotate({
27735 "description":
27736 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
27737 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
27738 Schema.Null
27739 ]),
27740 "user": Schema.optionalKey(
27741 Schema.Union([Schema.String, Schema.Null]).annotate({
27742 "description":
27743 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
27744 })
27745 ),
27746 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
27747 "description":
27748 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
27749 }))])),
27750 "prompt_cache_key": Schema.optionalKey(
27751 Schema.Union([Schema.String, Schema.Null]).annotate({
27752 "description":
27753 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
27754 })
27755 ),
27756 "service_tier": Schema.optionalKey(ServiceTier),
27757 "prompt_cache_retention": Schema.optionalKey(
27758 Schema.Union([
27759 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
27760 "description":
27761 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
27762 }),
27763 Schema.Null
27764 ])
27765 ),
27766 "previous_response_id": Schema.optionalKey(
27767 Schema.Union([
27768 Schema.String.annotate({
27769 "description":
27770 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
27771 }),
27772 Schema.Null
27773 ])
27774 ),
27775 "model": Schema.Union([
27776 ModelIdsShared,
27777 Schema.Literals([
27778 "o1-pro",
27779 "o1-pro-2025-03-19",
27780 "o3-pro",
27781 "o3-pro-2025-06-10",
27782 "o3-deep-research",
27783 "o3-deep-research-2025-06-26",
27784 "o4-mini-deep-research",
27785 "o4-mini-deep-research-2025-06-26",
27786 "computer-use-preview",
27787 "computer-use-preview-2025-03-11",
27788 "gpt-5-codex",
27789 "gpt-5-pro",
27790 "gpt-5-pro-2025-10-06",
27791 "gpt-5.1-codex-max"
27792 ]).annotate({ "title": "ResponsesOnlyModel" })
27793 ]).annotate({
27794 "description":
27795 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
27796 }),
27797 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
27798 "background": Schema.optionalKey(
27799 Schema.Union([
27800 Schema.Boolean.annotate({
27801 "description":
27802 "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
27803 }),
27804 Schema.Null
27805 ])
27806 ),
27807 "max_tool_calls": Schema.optionalKey(
27808 Schema.Union([
27809 Schema.Number.annotate({
27810 "description":
27811 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
27812 }).check(Schema.isInt()),
27813 Schema.Null
27814 ])
27815 ),
27816 "text": Schema.optionalKey(ResponseTextParam),
27817 "tools": Schema.Array(Tool).annotate({
27818 "description":
27819 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
27820 }),
27821 "tool_choice": Schema.Union([
27822 ToolChoiceOptions,
27823 ToolChoiceAllowed,
27824 ToolChoiceTypes,
27825 ToolChoiceFunction,
27826 ToolChoiceMCP,
27827 ToolChoiceCustom,
27828 SpecificApplyPatchParam,
27829 SpecificFunctionShellParam
27830 ], { mode: "oneOf" }).annotate({
27831 "description":
27832 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
27833 }),
27834 "prompt": Schema.optionalKey(Prompt),
27835 "truncation": Schema.optionalKey(Schema.Union([
27836 Schema.Literals(["auto", "disabled"]).annotate({
27837 "description":
27838 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
27839 }),
27840 Schema.Null
27841 ])),
27842 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
27843 "object": Schema.Literal("response").annotate({
27844 "description": "The object type of this resource - always set to `response`.\n"
27845 }),
27846 "status": Schema.optionalKey(
27847 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
27848 "description":
27849 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
27850 })
27851 ),
27852 "created_at": Schema.Number.annotate({
27853 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
27854 "format": "unixtime"
27855 }).check(Schema.isFinite()),
27856 "completed_at": Schema.optionalKey(
27857 Schema.Union([
27858 Schema.Number.annotate({
27859 "description":
27860 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
27861 "format": "unixtime"
27862 }).check(Schema.isFinite()),
27863 Schema.Null
27864 ])
27865 ),
27866 "error": ResponseError,
27867 "incomplete_details": Schema.Union([
27868 Schema.Struct({
27869 "reason": Schema.optionalKey(
27870 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
27871 "description": "The reason why the response is incomplete."
27872 })
27873 )
27874 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
27875 Schema.Null
27876 ]),
27877 "output": Schema.Array(OutputItem).annotate({
27878 "description":
27879 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
27880 }),
27881 "instructions": Schema.Union([
27882 Schema.Union([
27883 Schema.String.annotate({
27884 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
27885 }),
27886 Schema.Array(InputItem).annotate({
27887 "title": "Input item list",
27888 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
27889 })
27890 ], { mode: "oneOf" }).annotate({
27891 "description":
27892 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
27893 }),
27894 Schema.Null
27895 ]),
27896 "output_text": Schema.optionalKey(
27897 Schema.Union([
27898 Schema.String.annotate({
27899 "description":
27900 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
27901 }),
27902 Schema.Null
27903 ])
27904 ),
27905 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
27906 "parallel_tool_calls": Schema.Boolean.annotate({
27907 "description": "Whether to allow the model to run tool calls in parallel.\n"
27908 }),
27909 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
27910 "max_output_tokens": Schema.optionalKey(
27911 Schema.Union([
27912 Schema.Number.annotate({
27913 "description":
27914 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
27915 }).check(Schema.isInt()),
27916 Schema.Null
27917 ])
27918 )
27919 }).annotate({ "title": "The response object", "description": "The response that was incomplete.\n" }),
27920 "sequence_number": Schema.Number.annotate({ "description": "The sequence number of this event." }).check(
27921 Schema.isInt()
27922 )
27923}).annotate({ "description": "An event that is emitted when a response finishes as incomplete.\n" })
27924export type ResponseQueuedEvent = {
27925 readonly "type": "response.queued"
27926 readonly "response": {
27927 readonly "metadata": {} | null
27928 readonly "top_logprobs"?: number | null
27929 readonly "temperature": number | null
27930 readonly "top_p": number | null
27931 readonly "user"?: string | null
27932 readonly "safety_identifier"?: string
27933 readonly "prompt_cache_key"?: string | null
27934 readonly "service_tier"?: ServiceTier
27935 readonly "prompt_cache_retention"?: "in_memory" | "in_memory" | "24h" | null
27936 readonly "previous_response_id"?: string | null
27937 readonly "model":
27938 | ModelIdsShared
27939 | "o1-pro"
27940 | "o1-pro-2025-03-19"
27941 | "o3-pro"
27942 | "o3-pro-2025-06-10"
27943 | "o3-deep-research"
27944 | "o3-deep-research-2025-06-26"
27945 | "o4-mini-deep-research"
27946 | "o4-mini-deep-research-2025-06-26"
27947 | "computer-use-preview"
27948 | "computer-use-preview-2025-03-11"
27949 | "gpt-5-codex"
27950 | "gpt-5-pro"
27951 | "gpt-5-pro-2025-10-06"
27952 | "gpt-5.1-codex-max"
27953 readonly "reasoning"?: Reasoning | null
27954 readonly "background"?: boolean | null
27955 readonly "max_tool_calls"?: number | null
27956 readonly "text"?: ResponseTextParam
27957 readonly "tools": ReadonlyArray<Tool>
27958 readonly "tool_choice":
27959 | ToolChoiceOptions
27960 | ToolChoiceAllowed
27961 | ToolChoiceTypes
27962 | ToolChoiceFunction
27963 | ToolChoiceMCP
27964 | ToolChoiceCustom
27965 | SpecificApplyPatchParam
27966 | SpecificFunctionShellParam
27967 readonly "prompt"?: Prompt
27968 readonly "truncation"?: "auto" | "disabled" | null
27969 readonly "id": string
27970 readonly "object": "response"
27971 readonly "status"?: "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"
27972 readonly "created_at": number
27973 readonly "completed_at"?: number | null
27974 readonly "error": ResponseError
27975 readonly "incomplete_details": { readonly "reason"?: "max_output_tokens" | "content_filter" } | null
27976 readonly "output": ReadonlyArray<OutputItem>
27977 readonly "instructions": string | ReadonlyArray<InputItem> | null
27978 readonly "output_text"?: string | null
27979 readonly "usage"?: ResponseUsage | null
27980 readonly "parallel_tool_calls": boolean
27981 readonly "conversation"?: Conversation_2 | null
27982 readonly "max_output_tokens"?: number | null
27983 }
27984 readonly "sequence_number": number
27985}
27986export const ResponseQueuedEvent = Schema.Struct({
27987 "type": Schema.Literal("response.queued").annotate({
27988 "description": "The type of the event. Always 'response.queued'."
27989 }),
27990 "response": Schema.Struct({
27991 "metadata": Schema.Union([
27992 Schema.Struct({}).annotate({
27993 "description":
27994 "Set of 16 key-value pairs that can be attached to an object. This can be\nuseful for storing additional information about the object in a structured\nformat, and querying for objects via API or the dashboard.\n\nKeys are strings with a maximum length of 64 characters. Values are strings\nwith a maximum length of 512 characters.\n"
27995 }),
27996 Schema.Null
27997 ]),
27998 "top_logprobs": Schema.optionalKey(
27999 Schema.Union([
28000 Schema.Number.annotate({
28001 "description":
28002 "An integer between 0 and 20 specifying the maximum number of most likely\ntokens to return at each token position, each with an associated log\nprobability. In some cases, the number of returned tokens may be fewer than\nrequested.\n"
28003 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)),
28004 Schema.Null
28005 ])
28006 ),
28007 "temperature": Schema.Union([
28008 Schema.Number.annotate({
28009 "description":
28010 "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\nWe generally recommend altering this or `top_p` but not both.\n"
28011 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)),
28012 Schema.Null
28013 ]),
28014 "top_p": Schema.Union([
28015 Schema.Number.annotate({
28016 "description":
28017 "An alternative to sampling with temperature, called nucleus sampling,\nwhere the model considers the results of the tokens with top_p probability\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\nare considered.\n\nWe generally recommend altering this or `temperature` but not both.\n"
28018 }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)),
28019 Schema.Null
28020 ]),
28021 "user": Schema.optionalKey(
28022 Schema.Union([Schema.String, Schema.Null]).annotate({
28023 "description":
28024 "This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\nA stable identifier for your end-users.\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
28025 })
28026 ),
28027 "safety_identifier": Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMaxLength(64, {
28028 "description":
28029 "A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\nThe IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/docs/guides/safety-best-practices#safety-identifiers).\n"
28030 }))])),
28031 "prompt_cache_key": Schema.optionalKey(
28032 Schema.Union([Schema.String, Schema.Null]).annotate({
28033 "description":
28034 "Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](/docs/guides/prompt-caching).\n"
28035 })
28036 ),
28037 "service_tier": Schema.optionalKey(ServiceTier),
28038 "prompt_cache_retention": Schema.optionalKey(
28039 Schema.Union([
28040 Schema.Literals(["in_memory", "in_memory", "24h"]).annotate({
28041 "description":
28042 "The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](/docs/guides/prompt-caching#prompt-cache-retention).\n"
28043 }),
28044 Schema.Null
28045 ])
28046 ),
28047 "previous_response_id": Schema.optionalKey(
28048 Schema.Union([
28049 Schema.String.annotate({
28050 "description":
28051 "The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about\n[conversation state](/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\n"
28052 }),
28053 Schema.Null
28054 ])
28055 ),
28056 "model": Schema.Union([
28057 ModelIdsShared,
28058 Schema.Literals([
28059 "o1-pro",
28060 "o1-pro-2025-03-19",
28061 "o3-pro",
28062 "o3-pro-2025-06-10",
28063 "o3-deep-research",
28064 "o3-deep-research-2025-06-26",
28065 "o4-mini-deep-research",
28066 "o4-mini-deep-research-2025-06-26",
28067 "computer-use-preview",
28068 "computer-use-preview-2025-03-11",
28069 "gpt-5-codex",
28070 "gpt-5-pro",
28071 "gpt-5-pro-2025-10-06",
28072 "gpt-5.1-codex-max"
28073 ]).annotate({ "title": "ResponsesOnlyModel" })
28074 ]).annotate({
28075 "description":
28076 "Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\noffers a wide range of models with different capabilities, performance\ncharacteristics, and price points. Refer to the [model guide](/docs/models)\nto browse and compare available models.\n"
28077 }),
28078 "reasoning": Schema.optionalKey(Schema.Union([Reasoning, Schema.Null])),
28079 "background": Schema.optionalKey(
28080 Schema.Union([
28081 Schema.Boolean.annotate({
28082 "description":
28083 "Whether to run the model response in the background.\n[Learn more](/docs/guides/background).\n"
28084 }),
28085 Schema.Null
28086 ])
28087 ),
28088 "max_tool_calls": Schema.optionalKey(
28089 Schema.Union([
28090 Schema.Number.annotate({
28091 "description":
28092 "The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\n"
28093 }).check(Schema.isInt()),
28094 Schema.Null
28095 ])
28096 ),
28097 "text": Schema.optionalKey(ResponseTextParam),
28098 "tools": Schema.Array(Tool).annotate({
28099 "description":
28100 "An array of tools the model may call while generating a response. You\ncan specify which tool to use by setting the `tool_choice` parameter.\n\nWe support the following categories of tools:\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\n model's capabilities, like [web search](/docs/guides/tools-web-search)\n or [file search](/docs/guides/tools-file-search). Learn more about\n [built-in tools](/docs/guides/tools).\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\n or predefined connectors such as Google Drive and SharePoint. Learn more about\n [MCP Tools](/docs/guides/tools-connectors-mcp).\n- **Function calls (custom tools)**: Functions that are defined by you,\n enabling the model to call your own code with strongly typed arguments\n and outputs. Learn more about\n [function calling](/docs/guides/function-calling). You can also use\n custom tools to call your own code.\n"
28101 }),
28102 "tool_choice": Schema.Union([
28103 ToolChoiceOptions,
28104 ToolChoiceAllowed,
28105 ToolChoiceTypes,
28106 ToolChoiceFunction,
28107 ToolChoiceMCP,
28108 ToolChoiceCustom,
28109 SpecificApplyPatchParam,
28110 SpecificFunctionShellParam
28111 ], { mode: "oneOf" }).annotate({
28112 "description":
28113 "How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n"
28114 }),
28115 "prompt": Schema.optionalKey(Prompt),
28116 "truncation": Schema.optionalKey(Schema.Union([
28117 Schema.Literals(["auto", "disabled"]).annotate({
28118 "description":
28119 "The truncation strategy to use for the model response.\n- `auto`: If the input to this Response exceeds\n the model's context window size, the model will truncate the\n response to fit the context window by dropping items from the beginning of the conversation.\n- `disabled` (default): If the input size will exceed the context window\n size for a model, the request will fail with a 400 error.\n"
28120 }),
28121 Schema.Null
28122 ])),
28123 "id": Schema.String.annotate({ "description": "Unique identifier for this Response.\n" }),
28124 "object": Schema.Literal("response").annotate({
28125 "description": "The object type of this resource - always set to `response`.\n"
28126 }),
28127 "status": Schema.optionalKey(
28128 Schema.Literals(["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"]).annotate({
28129 "description":
28130 "The status of the response generation. One of `completed`, `failed`,\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\n"
28131 })
28132 ),
28133 "created_at": Schema.Number.annotate({
28134 "description": "Unix timestamp (in seconds) of when this Response was created.\n",
28135 "format": "unixtime"
28136 }).check(Schema.isFinite()),
28137 "completed_at": Schema.optionalKey(
28138 Schema.Union([
28139 Schema.Number.annotate({
28140 "description":
28141 "Unix timestamp (in seconds) of when this Response was completed.\nOnly present when the status is `completed`.\n",
28142 "format": "unixtime"
28143 }).check(Schema.isFinite()),
28144 Schema.Null
28145 ])
28146 ),
28147 "error": ResponseError,
28148 "incomplete_details": Schema.Union([
28149 Schema.Struct({
28150 "reason": Schema.optionalKey(
28151 Schema.Literals(["max_output_tokens", "content_filter"]).annotate({
28152 "description": "The reason why the response is incomplete."
28153 })
28154 )
28155 }).annotate({ "description": "Details about why the response is incomplete.\n" }),
28156 Schema.Null
28157 ]),
28158 "output": Schema.Array(OutputItem).annotate({
28159 "description":
28160 "An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and\n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n"
28161 }),
28162 "instructions": Schema.Union([
28163 Schema.Union([
28164 Schema.String.annotate({
28165 "description": "A text input to the model, equivalent to a text input with the\n`developer` role.\n"
28166 }),
28167 Schema.Array(InputItem).annotate({
28168 "title": "Input item list",
28169 "description": "A list of one or many input items to the model, containing\ndifferent content types.\n"
28170 })
28171 ], { mode: "oneOf" }).annotate({
28172 "description":
28173 "A system (or developer) message inserted into the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n"
28174 }),
28175 Schema.Null
28176 ]),
28177 "output_text": Schema.optionalKey(
28178 Schema.Union([
28179 Schema.String.annotate({
28180 "description":
28181 "SDK-only convenience property that contains the aggregated text output\nfrom all `output_text` items in the `output` array, if any are present.\nSupported in the Python and JavaScript SDKs.\n"
28182 }),
28183 Schema.Null
28184 ])
28185 ),
28186 "usage": Schema.optionalKey(Schema.Union([ResponseUsage, Schema.Null])),
28187 "parallel_tool_calls": Schema.Boolean.annotate({
28188 "description": "Whether to allow the model to run tool calls in parallel.\n"
28189 }),
28190 "conversation": Schema.optionalKey(Schema.Union([Conversation_2, Schema.Null])),
28191 "max_output_tokens": Schema.optionalKey(
28192 Schema.Union([
28193 Schema.Number.annotate({
28194 "description":
28195 "An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n"
28196 }).check(Schema.isInt()),
28197 Schema.Null
28198 ])
28199 )
28200 }).annotate({ "title": "The response object", "description": "The full response object that is queued." }),
28201 "sequence_number": Schema.Number.annotate({ "description": "The sequence number for this event." }).check(
28202 Schema.isInt()
28203 )
28204}).annotate({
28205 "title": "ResponseQueuedEvent",
28206 "description": "Emitted when a response is queued and waiting to be processed.\n"
28207})
28208export type CompactResource = {
28209 readonly "id": string
28210 readonly "object": "response.compaction"
28211 readonly "output": ReadonlyArray<ItemField>
28212 readonly "created_at": number
28213 readonly "usage": {
28214 readonly "input_tokens": number
28215 readonly "input_tokens_details": { readonly "cached_tokens": number }
28216 readonly "output_tokens": number
28217 readonly "output_tokens_details": { readonly "reasoning_tokens": number }
28218 readonly "total_tokens": number
28219 }
28220}
28221export const CompactResource = Schema.Struct({
28222 "id": Schema.String.annotate({ "description": "The unique identifier for the compacted response." }),
28223 "object": Schema.Literal("response.compaction").annotate({
28224 "description": "The object type. Always `response.compaction`."
28225 }),
28226 "output": Schema.Array(ItemField).annotate({ "description": "The compacted list of output items." }),
28227 "created_at": Schema.Number.annotate({
28228 "description": "Unix timestamp (in seconds) when the compacted conversation was created.",
28229 "format": "unixtime"
28230 }).check(Schema.isInt()),
28231 "usage": Schema.Struct({
28232 "input_tokens": Schema.Number.annotate({ "description": "The number of input tokens." }).check(Schema.isInt()),
28233 "input_tokens_details": Schema.Struct({
28234 "cached_tokens": Schema.Number.annotate({
28235 "description":
28236 "The number of tokens that were retrieved from the cache. \n[More on prompt caching](/docs/guides/prompt-caching).\n"
28237 }).check(Schema.isInt())
28238 }).annotate({ "description": "A detailed breakdown of the input tokens." }),
28239 "output_tokens": Schema.Number.annotate({ "description": "The number of output tokens." }).check(Schema.isInt()),
28240 "output_tokens_details": Schema.Struct({
28241 "reasoning_tokens": Schema.Number.annotate({ "description": "The number of reasoning tokens." }).check(
28242 Schema.isInt()
28243 )
28244 }).annotate({ "description": "A detailed breakdown of the output tokens." }),
28245 "total_tokens": Schema.Number.annotate({ "description": "The total number of tokens used." }).check(Schema.isInt())
28246 }).annotate({
28247 "description": "Token accounting for the compaction pass, including cached, reasoning, and total tokens."
28248 })
28249}).annotate({ "title": "The compacted response object" })
28250export type EvalList = {
28251 readonly "object": "list"
28252 readonly "data": ReadonlyArray<Eval>
28253 readonly "first_id": string
28254 readonly "last_id": string
28255 readonly "has_more": boolean
28256}
28257export const EvalList = Schema.Struct({
28258 "object": Schema.Literal("list").annotate({
28259 "description": "The type of this object. It is always set to \"list\".\n"
28260 }),
28261 "data": Schema.Array(Eval).annotate({ "description": "An array of eval objects.\n" }),
28262 "first_id": Schema.String.annotate({ "description": "The identifier of the first eval in the data array." }),
28263 "last_id": Schema.String.annotate({ "description": "The identifier of the last eval in the data array." }),
28264 "has_more": Schema.Boolean.annotate({ "description": "Indicates whether there are more evals available." })
28265}).annotate({ "title": "EvalList", "description": "An object representing a list of evals.\n" })
28266export type FineTuneMethod = {
28267 readonly "type": "supervised" | "dpo" | "reinforcement"
28268 readonly "supervised"?: FineTuneSupervisedMethod
28269 readonly "dpo"?: FineTuneDPOMethod
28270 readonly "reinforcement"?: FineTuneReinforcementMethod
28271}
28272export const FineTuneMethod = Schema.Struct({
28273 "type": Schema.Literals(["supervised", "dpo", "reinforcement"]).annotate({
28274 "description": "The type of method. Is either `supervised`, `dpo`, or `reinforcement`."
28275 }),
28276 "supervised": Schema.optionalKey(FineTuneSupervisedMethod),
28277 "dpo": Schema.optionalKey(FineTuneDPOMethod),
28278 "reinforcement": Schema.optionalKey(FineTuneReinforcementMethod)
28279}).annotate({ "description": "The method used for fine-tuning." })
28280export type ResponseStreamEvent =
28281 | ResponseAudioDeltaEvent
28282 | ResponseAudioDoneEvent
28283 | ResponseAudioTranscriptDeltaEvent
28284 | ResponseAudioTranscriptDoneEvent
28285 | ResponseCodeInterpreterCallCodeDeltaEvent
28286 | ResponseCodeInterpreterCallCodeDoneEvent
28287 | ResponseCodeInterpreterCallCompletedEvent
28288 | ResponseCodeInterpreterCallInProgressEvent
28289 | ResponseCodeInterpreterCallInterpretingEvent
28290 | ResponseCompletedEvent
28291 | ResponseContentPartAddedEvent
28292 | ResponseContentPartDoneEvent
28293 | ResponseCreatedEvent
28294 | ResponseErrorEvent
28295 | ResponseFileSearchCallCompletedEvent
28296 | ResponseFileSearchCallInProgressEvent
28297 | ResponseFileSearchCallSearchingEvent
28298 | ResponseFunctionCallArgumentsDeltaEvent
28299 | ResponseFunctionCallArgumentsDoneEvent
28300 | ResponseInProgressEvent
28301 | ResponseFailedEvent
28302 | ResponseIncompleteEvent
28303 | ResponseOutputItemAddedEvent
28304 | ResponseOutputItemDoneEvent
28305 | ResponseReasoningSummaryPartAddedEvent
28306 | ResponseReasoningSummaryPartDoneEvent
28307 | ResponseReasoningSummaryTextDeltaEvent
28308 | ResponseReasoningSummaryTextDoneEvent
28309 | ResponseReasoningTextDeltaEvent
28310 | ResponseReasoningTextDoneEvent
28311 | ResponseRefusalDeltaEvent
28312 | ResponseRefusalDoneEvent
28313 | ResponseTextDeltaEvent
28314 | ResponseTextDoneEvent
28315 | ResponseWebSearchCallCompletedEvent
28316 | ResponseWebSearchCallInProgressEvent
28317 | ResponseWebSearchCallSearchingEvent
28318 | ResponseImageGenCallCompletedEvent
28319 | ResponseImageGenCallGeneratingEvent
28320 | ResponseImageGenCallInProgressEvent
28321 | ResponseImageGenCallPartialImageEvent
28322 | ResponseMCPCallArgumentsDeltaEvent
28323 | ResponseMCPCallArgumentsDoneEvent
28324 | ResponseMCPCallCompletedEvent
28325 | ResponseMCPCallFailedEvent
28326 | ResponseMCPCallInProgressEvent
28327 | ResponseMCPListToolsCompletedEvent
28328 | ResponseMCPListToolsFailedEvent
28329 | ResponseMCPListToolsInProgressEvent
28330 | ResponseOutputTextAnnotationAddedEvent
28331 | ResponseQueuedEvent
28332 | ResponseCustomToolCallInputDeltaEvent
28333 | ResponseCustomToolCallInputDoneEvent
28334 | ResponseKeepAliveEvent
28335 | ResponseApplyPatchCallOperationDiffDeltaEvent
28336 | ResponseApplyPatchCallOperationDiffDoneEvent
28337export const ResponseStreamEvent = Schema.Union([
28338 ResponseAudioDeltaEvent,
28339 ResponseAudioDoneEvent,
28340 ResponseAudioTranscriptDeltaEvent,
28341 ResponseAudioTranscriptDoneEvent,
28342 ResponseCodeInterpreterCallCodeDeltaEvent,
28343 ResponseCodeInterpreterCallCodeDoneEvent,
28344 ResponseCodeInterpreterCallCompletedEvent,
28345 ResponseCodeInterpreterCallInProgressEvent,
28346 ResponseCodeInterpreterCallInterpretingEvent,
28347 ResponseCompletedEvent,
28348 ResponseContentPartAddedEvent,
28349 ResponseContentPartDoneEvent,
28350 ResponseCreatedEvent,
28351 ResponseErrorEvent,
28352 ResponseFileSearchCallCompletedEvent,
28353 ResponseFileSearchCallInProgressEvent,
28354 ResponseFileSearchCallSearchingEvent,
28355 ResponseFunctionCallArgumentsDeltaEvent,
28356 ResponseFunctionCallArgumentsDoneEvent,
28357 ResponseInProgressEvent,
28358 ResponseFailedEvent,
28359 ResponseIncompleteEvent,
28360 ResponseOutputItemAddedEvent,
28361 ResponseOutputItemDoneEvent,
28362 ResponseReasoningSummaryPartAddedEvent,
28363 ResponseReasoningSummaryPartDoneEvent,
28364 ResponseReasoningSummaryTextDeltaEvent,
28365 ResponseReasoningSummaryTextDoneEvent,
28366 ResponseReasoningTextDeltaEvent,
28367 ResponseReasoningTextDoneEvent,
28368 ResponseRefusalDeltaEvent,
28369 ResponseRefusalDoneEvent,
28370 ResponseTextDeltaEvent,
28371 ResponseTextDoneEvent,
28372 ResponseWebSearchCallCompletedEvent,
28373 ResponseWebSearchCallInProgressEvent,
28374 ResponseWebSearchCallSearchingEvent,
28375 ResponseImageGenCallCompletedEvent,
28376 ResponseImageGenCallGeneratingEvent,
28377 ResponseImageGenCallInProgressEvent,
28378 ResponseImageGenCallPartialImageEvent,
28379 ResponseMCPCallArgumentsDeltaEvent,
28380 ResponseMCPCallArgumentsDoneEvent,
28381 ResponseMCPCallCompletedEvent,
28382 ResponseMCPCallFailedEvent,
28383 ResponseMCPCallInProgressEvent,
28384 ResponseMCPListToolsCompletedEvent,
28385 ResponseMCPListToolsFailedEvent,
28386 ResponseMCPListToolsInProgressEvent,
28387 ResponseOutputTextAnnotationAddedEvent,
28388 ResponseQueuedEvent,
28389 ResponseCustomToolCallInputDeltaEvent,
28390 ResponseCustomToolCallInputDoneEvent,
28391 ResponseKeepAliveEvent,
28392 ResponseApplyPatchCallOperationDiffDeltaEvent,
28393 ResponseApplyPatchCallOperationDiffDoneEvent
28394])
28395export type CreateFineTuningJobRequest = {
28396 readonly "model": string | "babbage-002" | "davinci-002" | "gpt-3.5-turbo" | "gpt-4o-mini"
28397 readonly "training_file": string
28398 readonly "hyperparameters"?: {
28399 readonly "batch_size"?: "auto" | number
28400 readonly "learning_rate_multiplier"?: "auto" | number
28401 readonly "n_epochs"?: "auto" | number
28402 }
28403 readonly "suffix"?: string
28404 readonly "validation_file"?: string | null
28405 readonly "integrations"?: ReadonlyArray<
28406 {
28407 readonly "type": "wandb"
28408 readonly "wandb": {
28409 readonly "project": string
28410 readonly "name"?: string | null
28411 readonly "entity"?: string | null
28412 readonly "tags"?: ReadonlyArray<string>
28413 }
28414 }
28415 >
28416 readonly "seed"?: number
28417 readonly "method"?: FineTuneMethod
28418 readonly "metadata"?: Metadata
28419}
28420export const CreateFineTuningJobRequest = Schema.Struct({
28421 "model": Schema.Union([
28422 Schema.String,
28423 Schema.Literals(["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"])
28424 ]).annotate({
28425 "description":
28426 "The name of the model to fine-tune. You can select one of the\n[supported models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned).\n"
28427 }),
28428 "training_file": Schema.String.annotate({
28429 "description":
28430 "The ID of an uploaded file that contains training data.\n\nSee [upload file](/docs/api-reference/files/create) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`.\n\nThe contents of the file should differ depending on if the model uses the [chat](/docs/api-reference/fine-tuning/chat-input), [completions](/docs/api-reference/fine-tuning/completions-input) format, or if the fine-tuning method uses the [preference](/docs/api-reference/fine-tuning/preference-input) format.\n\nSee the [fine-tuning guide](/docs/guides/model-optimization) for more details.\n"
28431 }),
28432 "hyperparameters": Schema.optionalKey(
28433 Schema.Struct({
28434 "batch_size": Schema.optionalKey(
28435 Schema.Union([
28436 Schema.Literal("auto"),
28437 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(
28438 Schema.isLessThanOrEqualTo(256)
28439 )
28440 ], { mode: "oneOf" }).annotate({
28441 "description":
28442 "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n"
28443 })
28444 ),
28445 "learning_rate_multiplier": Schema.optionalKey(
28446 Schema.Union([Schema.Literal("auto"), Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThan(0))], {
28447 mode: "oneOf"
28448 }).annotate({
28449 "description":
28450 "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n"
28451 })
28452 ),
28453 "n_epochs": Schema.optionalKey(
28454 Schema.Union([
28455 Schema.Literal("auto"),
28456 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(
28457 Schema.isLessThanOrEqualTo(50)
28458 )
28459 ], { mode: "oneOf" }).annotate({
28460 "description":
28461 "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n"
28462 })
28463 )
28464 }).annotate({
28465 "description":
28466 "The hyperparameters used for the fine-tuning job.\nThis value is now deprecated in favor of `method`, and should be passed in under the `method` parameter.\n"
28467 })
28468 ),
28469 "suffix": Schema.optionalKey(
28470 Schema.Union([
28471 Schema.String.check(
28472 Schema.makeFilterGroup([Schema.isMinLength(1), Schema.isMaxLength(64)], {
28473 "description":
28474 "A string of up to 64 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.\n"
28475 })
28476 )
28477 ])
28478 ),
28479 "validation_file": Schema.optionalKey(
28480 Schema.Union([Schema.String, Schema.Null]).annotate({
28481 "description":
28482 "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe fine-tuning results file.\nThe same data should not be present in both train and validation files.\n\nYour dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](/docs/guides/model-optimization) for more details.\n"
28483 })
28484 ),
28485 "integrations": Schema.optionalKey(Schema.Union([
28486 Schema.Array(Schema.Struct({
28487 "type": Schema.Literal("wandb").annotate({
28488 "description":
28489 "The type of integration to enable. Currently, only \"wandb\" (Weights and Biases) is supported.\n"
28490 }),
28491 "wandb": Schema.Struct({
28492 "project": Schema.String.annotate({
28493 "description": "The name of the project that the new run will be created under.\n"
28494 }),
28495 "name": Schema.optionalKey(
28496 Schema.Union([Schema.String, Schema.Null]).annotate({
28497 "description": "A display name to set for the run. If not set, we will use the Job ID as the name.\n"
28498 })
28499 ),
28500 "entity": Schema.optionalKey(
28501 Schema.Union([Schema.String, Schema.Null]).annotate({
28502 "description":
28503 "The entity to use for the run. This allows you to set the team or username of the WandB user that you would\nlike associated with the run. If not set, the default entity for the registered WandB API key is used.\n"
28504 })
28505 ),
28506 "tags": Schema.optionalKey(
28507 Schema.Array(Schema.String).annotate({
28508 "description":
28509 "A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some\ndefault tags are generated by OpenAI: \"openai/finetune\", \"openai/{base-model}\", \"openai/{ftjob-abcdef}\".\n"
28510 })
28511 )
28512 }).annotate({
28513 "description":
28514 "The settings for your integration with Weights and Biases. This payload specifies the project that\nmetrics will be sent to. Optionally, you can set an explicit display name for your run, add tags\nto your run, and set a default entity (team, username, etc) to be associated with your run.\n"
28515 })
28516 })).annotate({ "description": "A list of integrations to enable for your fine-tuning job." })
28517 ])),
28518 "seed": Schema.optionalKey(
28519 Schema.Union([
28520 Schema.Number.check(Schema.isInt()).check(
28521 Schema.makeFilterGroup([
28522 Schema.isFinite(),
28523 Schema.isGreaterThanOrEqualTo(0),
28524 Schema.isLessThanOrEqualTo(2147483647)
28525 ], {
28526 "description":
28527 "The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases.\nIf a seed is not specified, one will be generated for you.\n"
28528 })
28529 )
28530 ])
28531 ),
28532 "method": Schema.optionalKey(FineTuneMethod),
28533 "metadata": Schema.optionalKey(Metadata)
28534})
28535export type FineTuningJob = {
28536 readonly "id": string
28537 readonly "created_at": number
28538 readonly "error": { readonly "code": string; readonly "message": string; readonly "param": string | null } | null
28539 readonly "fine_tuned_model": string | null
28540 readonly "finished_at": number | null
28541 readonly "hyperparameters": {
28542 readonly "batch_size"?: "auto" | number | null
28543 readonly "learning_rate_multiplier"?: "auto" | number
28544 readonly "n_epochs"?: "auto" | number
28545 }
28546 readonly "model": string
28547 readonly "object": "fine_tuning.job"
28548 readonly "organization_id": string
28549 readonly "result_files": ReadonlyArray<string>
28550 readonly "status": "validating_files" | "queued" | "running" | "succeeded" | "failed" | "cancelled"
28551 readonly "trained_tokens": number | null
28552 readonly "training_file": string
28553 readonly "validation_file": string | null
28554 readonly "integrations"?: ReadonlyArray<FineTuningIntegration> | null
28555 readonly "seed": number
28556 readonly "estimated_finish"?: number | null
28557 readonly "method"?: FineTuneMethod
28558 readonly "metadata"?: Metadata
28559}
28560export const FineTuningJob = Schema.Struct({
28561 "id": Schema.String.annotate({
28562 "description": "The object identifier, which can be referenced in the API endpoints."
28563 }),
28564 "created_at": Schema.Number.annotate({
28565 "description": "The Unix timestamp (in seconds) for when the fine-tuning job was created.",
28566 "format": "unixtime"
28567 }).check(Schema.isInt()),
28568 "error": Schema.Union([
28569 Schema.Struct({
28570 "code": Schema.String.annotate({ "description": "A machine-readable error code." }),
28571 "message": Schema.String.annotate({ "description": "A human-readable error message." }),
28572 "param": Schema.Union([
28573 Schema.String.annotate({
28574 "description":
28575 "The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific."
28576 }),
28577 Schema.Null
28578 ])
28579 }).annotate({
28580 "description":
28581 "For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure."
28582 }),
28583 Schema.Null
28584 ]),
28585 "fine_tuned_model": Schema.Union([
28586 Schema.String.annotate({
28587 "description":
28588 "The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running."
28589 }),
28590 Schema.Null
28591 ]),
28592 "finished_at": Schema.Union([
28593 Schema.Number.annotate({
28594 "description":
28595 "The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.",
28596 "format": "unixtime"
28597 }).check(Schema.isInt()),
28598 Schema.Null
28599 ]),
28600 "hyperparameters": Schema.Struct({
28601 "batch_size": Schema.optionalKey(
28602 Schema.Union([
28603 Schema.Union([
28604 Schema.Literal("auto"),
28605 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(
28606 Schema.isLessThanOrEqualTo(256)
28607 )
28608 ], { mode: "oneOf" }).annotate({
28609 "description":
28610 "Number of examples in each batch. A larger batch size means that model parameters\nare updated less frequently, but with lower variance.\n"
28611 }),
28612 Schema.Null
28613 ])
28614 ),
28615 "learning_rate_multiplier": Schema.optionalKey(
28616 Schema.Union([Schema.Literal("auto"), Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThan(0))], {
28617 mode: "oneOf"
28618 }).annotate({
28619 "description":
28620 "Scaling factor for the learning rate. A smaller learning rate may be useful to avoid\noverfitting.\n"
28621 })
28622 ),
28623 "n_epochs": Schema.optionalKey(
28624 Schema.Union([
28625 Schema.Literal("auto"),
28626 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(
28627 Schema.isLessThanOrEqualTo(50)
28628 )
28629 ], { mode: "oneOf" }).annotate({
28630 "description":
28631 "The number of epochs to train the model for. An epoch refers to one full cycle\nthrough the training dataset.\n"
28632 })
28633 )
28634 }).annotate({
28635 "description":
28636 "The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs."
28637 }),
28638 "model": Schema.String.annotate({ "description": "The base model that is being fine-tuned." }),
28639 "object": Schema.Literal("fine_tuning.job").annotate({
28640 "description": "The object type, which is always \"fine_tuning.job\"."
28641 }),
28642 "organization_id": Schema.String.annotate({ "description": "The organization that owns the fine-tuning job." }),
28643 "result_files": Schema.Array(Schema.String).annotate({
28644 "description":
28645 "The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents)."
28646 }),
28647 "status": Schema.Literals(["validating_files", "queued", "running", "succeeded", "failed", "cancelled"]).annotate({
28648 "description":
28649 "The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`."
28650 }),
28651 "trained_tokens": Schema.Union([
28652 Schema.Number.annotate({
28653 "description":
28654 "The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running."
28655 }).check(Schema.isInt()),
28656 Schema.Null
28657 ]),
28658 "training_file": Schema.String.annotate({
28659 "description":
28660 "The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents)."
28661 }),
28662 "validation_file": Schema.Union([
28663 Schema.String.annotate({
28664 "description":
28665 "The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents)."
28666 }),
28667 Schema.Null
28668 ]),
28669 "integrations": Schema.optionalKey(
28670 Schema.Union([
28671 Schema.Array(Schema.Union([FineTuningIntegration], { mode: "oneOf" })).annotate({
28672 "description": "A list of integrations to enable for this fine-tuning job."
28673 }).check(Schema.isMaxLength(5)),
28674 Schema.Null
28675 ])
28676 ),
28677 "seed": Schema.Number.annotate({ "description": "The seed used for the fine-tuning job." }).check(Schema.isInt()),
28678 "estimated_finish": Schema.optionalKey(
28679 Schema.Union([
28680 Schema.Number.annotate({
28681 "description":
28682 "The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.",
28683 "format": "unixtime"
28684 }).check(Schema.isInt()),
28685 Schema.Null
28686 ])
28687 ),
28688 "method": Schema.optionalKey(FineTuneMethod),
28689 "metadata": Schema.optionalKey(Metadata)
28690}).annotate({
28691 "title": "FineTuningJob",
28692 "description": "The `fine_tuning.job` object represents a fine-tuning job that has been created through the API.\n"
28693})
28694export type ListPaginatedFineTuningJobsResponse = {
28695 readonly "data": ReadonlyArray<FineTuningJob>
28696 readonly "has_more": boolean
28697 readonly "object": "list"
28698}
28699export const ListPaginatedFineTuningJobsResponse = Schema.Struct({
28700 "data": Schema.Array(FineTuningJob),
28701 "has_more": Schema.Boolean,
28702 "object": Schema.Literal("list")
28703})
28704// schemas
28705export type ListAssistantsParams = {
28706 readonly "limit"?: number
28707 readonly "order"?: "asc" | "desc"
28708 readonly "after"?: string
28709 readonly "before"?: string
28710}
28711export const ListAssistantsParams = Schema.Struct({
28712 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28713 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
28714 "after": Schema.optionalKey(Schema.String),
28715 "before": Schema.optionalKey(Schema.String)
28716})
28717export type ListAssistants200 = ListAssistantsResponse
28718export const ListAssistants200 = ListAssistantsResponse
28719export type CreateAssistantRequestJson = CreateAssistantRequest
28720export const CreateAssistantRequestJson = CreateAssistantRequest
28721export type CreateAssistant200 = AssistantObject
28722export const CreateAssistant200 = AssistantObject
28723export type GetAssistant200 = AssistantObject
28724export const GetAssistant200 = AssistantObject
28725export type ModifyAssistantRequestJson = ModifyAssistantRequest
28726export const ModifyAssistantRequestJson = ModifyAssistantRequest
28727export type ModifyAssistant200 = AssistantObject
28728export const ModifyAssistant200 = AssistantObject
28729export type DeleteAssistant200 = DeleteAssistantResponse
28730export const DeleteAssistant200 = DeleteAssistantResponse
28731export type CreateSpeechRequestJson = CreateSpeechRequest
28732export const CreateSpeechRequestJson = CreateSpeechRequest
28733export type CreateSpeech200Sse = CreateSpeechResponseStreamEvent
28734export const CreateSpeech200Sse = CreateSpeechResponseStreamEvent
28735export type CreateTranscriptionRequestFormData = CreateTranscriptionRequest
28736export const CreateTranscriptionRequestFormData = CreateTranscriptionRequest
28737export type CreateTranscription200 =
28738 | CreateTranscriptionResponseJson
28739 | CreateTranscriptionResponseDiarizedJson
28740 | CreateTranscriptionResponseVerboseJson
28741export const CreateTranscription200 = Schema.Union([
28742 CreateTranscriptionResponseJson,
28743 CreateTranscriptionResponseDiarizedJson,
28744 CreateTranscriptionResponseVerboseJson
28745], { mode: "oneOf" })
28746export type CreateTranscription200Sse = CreateTranscriptionResponseStreamEvent
28747export const CreateTranscription200Sse = CreateTranscriptionResponseStreamEvent
28748export type CreateTranslationRequestFormData = CreateTranslationRequest
28749export const CreateTranslationRequestFormData = CreateTranslationRequest
28750export type CreateTranslation200 = CreateTranslationResponseJson | CreateTranslationResponseVerboseJson
28751export const CreateTranslation200 = Schema.Union(
28752 [CreateTranslationResponseJson, CreateTranslationResponseVerboseJson],
28753 { mode: "oneOf" }
28754)
28755export type ListVoiceConsentsParams = { readonly "after"?: string; readonly "limit"?: number }
28756export const ListVoiceConsentsParams = Schema.Struct({
28757 "after": Schema.optionalKey(Schema.String),
28758 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt()))
28759})
28760export type ListVoiceConsents200 = VoiceConsentListResource
28761export const ListVoiceConsents200 = VoiceConsentListResource
28762export type CreateVoiceConsentRequestFormData = CreateVoiceConsentRequest
28763export const CreateVoiceConsentRequestFormData = CreateVoiceConsentRequest
28764export type CreateVoiceConsent200 = VoiceConsentResource
28765export const CreateVoiceConsent200 = VoiceConsentResource
28766export type GetVoiceConsent200 = VoiceConsentResource
28767export const GetVoiceConsent200 = VoiceConsentResource
28768export type UpdateVoiceConsentRequestJson = UpdateVoiceConsentRequest
28769export const UpdateVoiceConsentRequestJson = UpdateVoiceConsentRequest
28770export type UpdateVoiceConsent200 = VoiceConsentResource
28771export const UpdateVoiceConsent200 = VoiceConsentResource
28772export type DeleteVoiceConsent200 = VoiceConsentDeletedResource
28773export const DeleteVoiceConsent200 = VoiceConsentDeletedResource
28774export type CreateVoiceRequestFormData = CreateVoiceRequest
28775export const CreateVoiceRequestFormData = CreateVoiceRequest
28776export type CreateVoice200 = VoiceResource
28777export const CreateVoice200 = VoiceResource
28778export type ListBatchesParams = { readonly "after"?: string; readonly "limit"?: number }
28779export const ListBatchesParams = Schema.Struct({
28780 "after": Schema.optionalKey(Schema.String),
28781 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt()))
28782})
28783export type ListBatches200 = ListBatchesResponse
28784export const ListBatches200 = ListBatchesResponse
28785export type CreateBatchRequestJson = {
28786 readonly "input_file_id": string
28787 readonly "endpoint":
28788 | "/v1/responses"
28789 | "/v1/chat/completions"
28790 | "/v1/embeddings"
28791 | "/v1/completions"
28792 | "/v1/moderations"
28793 | "/v1/images/generations"
28794 | "/v1/images/edits"
28795 | "/v1/videos"
28796 readonly "completion_window": "24h"
28797 readonly "metadata"?: Metadata
28798 readonly "output_expires_after"?: BatchFileExpirationAfter
28799}
28800export const CreateBatchRequestJson = Schema.Struct({
28801 "input_file_id": Schema.String.annotate({
28802 "description":
28803 "The ID of an uploaded file that contains requests for the new batch.\n\nSee [upload file](/docs/api-reference/files/create) for how to upload a file.\n\nYour input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size.\n"
28804 }),
28805 "endpoint": Schema.Literals([
28806 "/v1/responses",
28807 "/v1/chat/completions",
28808 "/v1/embeddings",
28809 "/v1/completions",
28810 "/v1/moderations",
28811 "/v1/images/generations",
28812 "/v1/images/edits",
28813 "/v1/videos"
28814 ]).annotate({
28815 "description":
28816 "The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch."
28817 }),
28818 "completion_window": Schema.Literal("24h").annotate({
28819 "description": "The time frame within which the batch should be processed. Currently only `24h` is supported."
28820 }),
28821 "metadata": Schema.optionalKey(Metadata),
28822 "output_expires_after": Schema.optionalKey(BatchFileExpirationAfter)
28823})
28824export type CreateBatch200 = Batch
28825export const CreateBatch200 = Batch
28826export type RetrieveBatch200 = Batch
28827export const RetrieveBatch200 = Batch
28828export type CancelBatch200 = Batch
28829export const CancelBatch200 = Batch
28830export type ListChatCompletionsParams = {
28831 readonly "model"?: string
28832 readonly "metadata"?: Metadata
28833 readonly "after"?: string
28834 readonly "limit"?: number
28835 readonly "order"?: "asc" | "desc"
28836}
28837export const ListChatCompletionsParams = Schema.Struct({
28838 "model": Schema.optionalKey(Schema.String),
28839 "metadata": Schema.optionalKey(Metadata),
28840 "after": Schema.optionalKey(Schema.String),
28841 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28842 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
28843})
28844export type ListChatCompletions200 = ChatCompletionList
28845export const ListChatCompletions200 = ChatCompletionList
28846export type CreateChatCompletionRequestJson = CreateChatCompletionRequest
28847export const CreateChatCompletionRequestJson = CreateChatCompletionRequest
28848export type CreateChatCompletion200 = CreateChatCompletionResponse
28849export const CreateChatCompletion200 = CreateChatCompletionResponse
28850export type CreateChatCompletion200Sse = CreateChatCompletionStreamResponse
28851export const CreateChatCompletion200Sse = CreateChatCompletionStreamResponse
28852export type GetChatCompletion200 = CreateChatCompletionResponse
28853export const GetChatCompletion200 = CreateChatCompletionResponse
28854export type UpdateChatCompletionRequestJson = { readonly "metadata": Metadata }
28855export const UpdateChatCompletionRequestJson = Schema.Struct({ "metadata": Metadata })
28856export type UpdateChatCompletion200 = CreateChatCompletionResponse
28857export const UpdateChatCompletion200 = CreateChatCompletionResponse
28858export type DeleteChatCompletion200 = ChatCompletionDeleted
28859export const DeleteChatCompletion200 = ChatCompletionDeleted
28860export type GetChatCompletionMessagesParams = {
28861 readonly "after"?: string
28862 readonly "limit"?: number
28863 readonly "order"?: "asc" | "desc"
28864}
28865export const GetChatCompletionMessagesParams = Schema.Struct({
28866 "after": Schema.optionalKey(Schema.String),
28867 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28868 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
28869})
28870export type GetChatCompletionMessages200 = ChatCompletionMessageList
28871export const GetChatCompletionMessages200 = ChatCompletionMessageList
28872export type CreateCompletionRequestJson = CreateCompletionRequest
28873export const CreateCompletionRequestJson = CreateCompletionRequest
28874export type CreateCompletion200 = CreateCompletionResponse
28875export const CreateCompletion200 = CreateCompletionResponse
28876export type ListContainersParams = {
28877 readonly "limit"?: number
28878 readonly "order"?: "asc" | "desc"
28879 readonly "after"?: string
28880 readonly "name"?: string
28881}
28882export const ListContainersParams = Schema.Struct({
28883 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28884 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
28885 "after": Schema.optionalKey(Schema.String),
28886 "name": Schema.optionalKey(Schema.String)
28887})
28888export type ListContainers200 = ContainerListResource
28889export const ListContainers200 = ContainerListResource
28890export type CreateContainerRequestJson = CreateContainerBody
28891export const CreateContainerRequestJson = CreateContainerBody
28892export type CreateContainer200 = ContainerResource
28893export const CreateContainer200 = ContainerResource
28894export type RetrieveContainer200 = ContainerResource
28895export const RetrieveContainer200 = ContainerResource
28896export type ListContainerFilesParams = {
28897 readonly "limit"?: number
28898 readonly "order"?: "asc" | "desc"
28899 readonly "after"?: string
28900}
28901export const ListContainerFilesParams = Schema.Struct({
28902 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28903 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
28904 "after": Schema.optionalKey(Schema.String)
28905})
28906export type ListContainerFiles200 = ContainerFileListResource
28907export const ListContainerFiles200 = ContainerFileListResource
28908export type CreateContainerFileRequestJson = CreateContainerFileBody
28909export const CreateContainerFileRequestJson = CreateContainerFileBody
28910export type CreateContainerFileRequestFormData = CreateContainerFileBody
28911export const CreateContainerFileRequestFormData = CreateContainerFileBody
28912export type CreateContainerFile200 = ContainerFileResource
28913export const CreateContainerFile200 = ContainerFileResource
28914export type RetrieveContainerFile200 = ContainerFileResource
28915export const RetrieveContainerFile200 = ContainerFileResource
28916export type ListConversationItemsParams = {
28917 readonly "limit"?: number
28918 readonly "order"?: "asc" | "desc"
28919 readonly "after"?: string
28920 readonly "include"?: ReadonlyArray<IncludeEnum>
28921}
28922export const ListConversationItemsParams = Schema.Struct({
28923 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28924 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
28925 "after": Schema.optionalKey(Schema.String),
28926 "include": Schema.optionalKey(Schema.Array(IncludeEnum))
28927})
28928export type ListConversationItems200 = ConversationItemList
28929export const ListConversationItems200 = ConversationItemList
28930export type CreateConversationItemsParams = { readonly "include"?: ReadonlyArray<IncludeEnum> }
28931export const CreateConversationItemsParams = Schema.Struct({ "include": Schema.optionalKey(Schema.Array(IncludeEnum)) })
28932export type CreateConversationItemsRequestJson = {
28933 readonly "items": ReadonlyArray<InputItem>
28934 readonly [x: string]: unknown
28935}
28936export const CreateConversationItemsRequestJson = Schema.StructWithRest(
28937 Schema.Struct({
28938 "items": Schema.Array(InputItem).annotate({
28939 "description": "The items to add to the conversation. You may add up to 20 items at a time.\n"
28940 }).check(Schema.isMaxLength(20))
28941 }),
28942 [Schema.Record(Schema.String, Schema.Unknown)]
28943)
28944export type CreateConversationItems200 = ConversationItemList
28945export const CreateConversationItems200 = ConversationItemList
28946export type GetConversationItemParams = { readonly "include"?: ReadonlyArray<IncludeEnum> }
28947export const GetConversationItemParams = Schema.Struct({ "include": Schema.optionalKey(Schema.Array(IncludeEnum)) })
28948export type GetConversationItem200 = ConversationItem
28949export const GetConversationItem200 = ConversationItem
28950export type DeleteConversationItem200 = ConversationResource
28951export const DeleteConversationItem200 = ConversationResource
28952export type CreateEmbeddingRequestJson = CreateEmbeddingRequest
28953export const CreateEmbeddingRequestJson = CreateEmbeddingRequest
28954export type CreateEmbedding200 = CreateEmbeddingResponse
28955export const CreateEmbedding200 = CreateEmbeddingResponse
28956export type ListEvalsParams = {
28957 readonly "after"?: string
28958 readonly "limit"?: number
28959 readonly "order"?: "asc" | "desc"
28960 readonly "order_by"?: "created_at" | "updated_at"
28961}
28962export const ListEvalsParams = Schema.Struct({
28963 "after": Schema.optionalKey(Schema.String),
28964 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
28965 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
28966 "order_by": Schema.optionalKey(Schema.Literals(["created_at", "updated_at"]))
28967})
28968export type ListEvals200 = EvalList
28969export const ListEvals200 = EvalList
28970export type CreateEvalRequestJson = CreateEvalRequest
28971export const CreateEvalRequestJson = CreateEvalRequest
28972export type CreateEval201 = Eval
28973export const CreateEval201 = Eval
28974export type GetEval200 = Eval
28975export const GetEval200 = Eval
28976export type UpdateEvalRequestJson = { readonly "name"?: string; readonly "metadata"?: Metadata }
28977export const UpdateEvalRequestJson = Schema.Struct({
28978 "name": Schema.optionalKey(Schema.String.annotate({ "description": "Rename the evaluation." })),
28979 "metadata": Schema.optionalKey(Metadata)
28980})
28981export type UpdateEval200 = Eval
28982export const UpdateEval200 = Eval
28983export type DeleteEval200 = { readonly "object": string; readonly "deleted": boolean; readonly "eval_id": string }
28984export const DeleteEval200 = Schema.Struct({
28985 "object": Schema.String,
28986 "deleted": Schema.Boolean,
28987 "eval_id": Schema.String
28988})
28989export type DeleteEval404 = Error
28990export const DeleteEval404 = Error
28991export type GetEvalRunsParams = {
28992 readonly "after"?: string
28993 readonly "limit"?: number
28994 readonly "order"?: "asc" | "desc"
28995 readonly "status"?: "queued" | "in_progress" | "completed" | "canceled" | "failed"
28996}
28997export const GetEvalRunsParams = Schema.Struct({
28998 "after": Schema.optionalKey(Schema.String),
28999 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29000 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
29001 "status": Schema.optionalKey(Schema.Literals(["queued", "in_progress", "completed", "canceled", "failed"]))
29002})
29003export type GetEvalRuns200 = EvalRunList
29004export const GetEvalRuns200 = EvalRunList
29005export type CreateEvalRunRequestJson = CreateEvalRunRequest
29006export const CreateEvalRunRequestJson = CreateEvalRunRequest
29007export type CreateEvalRun201 = EvalRun
29008export const CreateEvalRun201 = EvalRun
29009export type CreateEvalRun400 = Error
29010export const CreateEvalRun400 = Error
29011export type GetEvalRun200 = EvalRun
29012export const GetEvalRun200 = EvalRun
29013export type CancelEvalRun200 = EvalRun
29014export const CancelEvalRun200 = EvalRun
29015export type DeleteEvalRun200 = { readonly "object"?: string; readonly "deleted"?: boolean; readonly "run_id"?: string }
29016export const DeleteEvalRun200 = Schema.Struct({
29017 "object": Schema.optionalKey(Schema.String),
29018 "deleted": Schema.optionalKey(Schema.Boolean),
29019 "run_id": Schema.optionalKey(Schema.String)
29020})
29021export type DeleteEvalRun404 = Error
29022export const DeleteEvalRun404 = Error
29023export type GetEvalRunOutputItemsParams = {
29024 readonly "after"?: string
29025 readonly "limit"?: number
29026 readonly "status"?: "fail" | "pass"
29027 readonly "order"?: "asc" | "desc"
29028}
29029export const GetEvalRunOutputItemsParams = Schema.Struct({
29030 "after": Schema.optionalKey(Schema.String),
29031 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29032 "status": Schema.optionalKey(Schema.Literals(["fail", "pass"])),
29033 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29034})
29035export type GetEvalRunOutputItems200 = EvalRunOutputItemList
29036export const GetEvalRunOutputItems200 = EvalRunOutputItemList
29037export type GetEvalRunOutputItem200 = EvalRunOutputItem
29038export const GetEvalRunOutputItem200 = EvalRunOutputItem
29039export type ListFilesParams = {
29040 readonly "purpose"?: string
29041 readonly "limit"?: number
29042 readonly "order"?: "asc" | "desc"
29043 readonly "after"?: string
29044}
29045export const ListFilesParams = Schema.Struct({
29046 "purpose": Schema.optionalKey(Schema.String),
29047 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29048 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
29049 "after": Schema.optionalKey(Schema.String)
29050})
29051export type ListFiles200 = ListFilesResponse
29052export const ListFiles200 = ListFilesResponse
29053export type CreateFileRequestFormData = CreateFileRequest
29054export const CreateFileRequestFormData = CreateFileRequest
29055export type CreateFile200 = OpenAIFile
29056export const CreateFile200 = OpenAIFile
29057export type RetrieveFile200 = OpenAIFile
29058export const RetrieveFile200 = OpenAIFile
29059export type DeleteFile200 = DeleteFileResponse
29060export const DeleteFile200 = DeleteFileResponse
29061export type DownloadFile200 = string
29062export const DownloadFile200 = Schema.String
29063export type RunGraderRequestJson = RunGraderRequest
29064export const RunGraderRequestJson = RunGraderRequest
29065export type RunGrader200 = RunGraderResponse
29066export const RunGrader200 = RunGraderResponse
29067export type ValidateGraderRequestJson = ValidateGraderRequest
29068export const ValidateGraderRequestJson = ValidateGraderRequest
29069export type ValidateGrader200 = ValidateGraderResponse
29070export const ValidateGrader200 = ValidateGraderResponse
29071export type ListFineTuningCheckpointPermissionsParams = {
29072 readonly "project_id"?: string
29073 readonly "after"?: string
29074 readonly "limit"?: number
29075 readonly "order"?: "ascending" | "descending"
29076}
29077export const ListFineTuningCheckpointPermissionsParams = Schema.Struct({
29078 "project_id": Schema.optionalKey(Schema.String),
29079 "after": Schema.optionalKey(Schema.String),
29080 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29081 "order": Schema.optionalKey(Schema.Literals(["ascending", "descending"]))
29082})
29083export type ListFineTuningCheckpointPermissions200 = ListFineTuningCheckpointPermissionResponse
29084export const ListFineTuningCheckpointPermissions200 = ListFineTuningCheckpointPermissionResponse
29085export type CreateFineTuningCheckpointPermissionRequestJson = CreateFineTuningCheckpointPermissionRequest
29086export const CreateFineTuningCheckpointPermissionRequestJson = CreateFineTuningCheckpointPermissionRequest
29087export type CreateFineTuningCheckpointPermission200 = ListFineTuningCheckpointPermissionResponse
29088export const CreateFineTuningCheckpointPermission200 = ListFineTuningCheckpointPermissionResponse
29089export type DeleteFineTuningCheckpointPermission200 = DeleteFineTuningCheckpointPermissionResponse
29090export const DeleteFineTuningCheckpointPermission200 = DeleteFineTuningCheckpointPermissionResponse
29091export type ListPaginatedFineTuningJobsParams = {
29092 readonly "after"?: string
29093 readonly "limit"?: number
29094 readonly "metadata"?: {}
29095}
29096export const ListPaginatedFineTuningJobsParams = Schema.Struct({
29097 "after": Schema.optionalKey(Schema.String),
29098 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29099 "metadata": Schema.optionalKey(Schema.Union([Schema.Struct({})]))
29100})
29101export type ListPaginatedFineTuningJobs200 = ListPaginatedFineTuningJobsResponse
29102export const ListPaginatedFineTuningJobs200 = ListPaginatedFineTuningJobsResponse
29103export type CreateFineTuningJobRequestJson = CreateFineTuningJobRequest
29104export const CreateFineTuningJobRequestJson = CreateFineTuningJobRequest
29105export type CreateFineTuningJob200 = FineTuningJob
29106export const CreateFineTuningJob200 = FineTuningJob
29107export type RetrieveFineTuningJob200 = FineTuningJob
29108export const RetrieveFineTuningJob200 = FineTuningJob
29109export type CancelFineTuningJob200 = FineTuningJob
29110export const CancelFineTuningJob200 = FineTuningJob
29111export type ListFineTuningJobCheckpointsParams = { readonly "after"?: string; readonly "limit"?: number }
29112export const ListFineTuningJobCheckpointsParams = Schema.Struct({
29113 "after": Schema.optionalKey(Schema.String),
29114 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt()))
29115})
29116export type ListFineTuningJobCheckpoints200 = ListFineTuningJobCheckpointsResponse
29117export const ListFineTuningJobCheckpoints200 = ListFineTuningJobCheckpointsResponse
29118export type ListFineTuningEventsParams = { readonly "after"?: string; readonly "limit"?: number }
29119export const ListFineTuningEventsParams = Schema.Struct({
29120 "after": Schema.optionalKey(Schema.String),
29121 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt()))
29122})
29123export type ListFineTuningEvents200 = ListFineTuningJobEventsResponse
29124export const ListFineTuningEvents200 = ListFineTuningJobEventsResponse
29125export type PauseFineTuningJob200 = FineTuningJob
29126export const PauseFineTuningJob200 = FineTuningJob
29127export type ResumeFineTuningJob200 = FineTuningJob
29128export const ResumeFineTuningJob200 = FineTuningJob
29129export type CreateImageEditRequestJson = EditImageBodyJsonParam
29130export const CreateImageEditRequestJson = EditImageBodyJsonParam
29131export type CreateImageEditRequestFormData = CreateImageEditRequest
29132export const CreateImageEditRequestFormData = CreateImageEditRequest
29133export type CreateImageEdit200 = ImagesResponse
29134export const CreateImageEdit200 = ImagesResponse
29135export type CreateImageEdit200Sse = ImageEditStreamEvent
29136export const CreateImageEdit200Sse = ImageEditStreamEvent
29137export type CreateImageRequestJson = CreateImageRequest
29138export const CreateImageRequestJson = CreateImageRequest
29139export type CreateImage200 = ImagesResponse
29140export const CreateImage200 = ImagesResponse
29141export type CreateImage200Sse = ImageGenStreamEvent
29142export const CreateImage200Sse = ImageGenStreamEvent
29143export type CreateImageVariationRequestFormData = CreateImageVariationRequest
29144export const CreateImageVariationRequestFormData = CreateImageVariationRequest
29145export type CreateImageVariation200 = ImagesResponse
29146export const CreateImageVariation200 = ImagesResponse
29147export type ListModels200 = ListModelsResponse
29148export const ListModels200 = ListModelsResponse
29149export type RetrieveModel200 = Model
29150export const RetrieveModel200 = Model
29151export type DeleteModel200 = DeleteModelResponse
29152export const DeleteModel200 = DeleteModelResponse
29153export type CreateModerationRequestJson = CreateModerationRequest
29154export const CreateModerationRequestJson = CreateModerationRequest
29155export type CreateModeration200 = CreateModerationResponse
29156export const CreateModeration200 = CreateModerationResponse
29157export type AdminApiKeysListParams = {
29158 readonly "after"?: string | null
29159 readonly "order"?: "asc" | "desc"
29160 readonly "limit"?: number
29161}
29162export const AdminApiKeysListParams = Schema.Struct({
29163 "after": Schema.optionalKey(
29164 Schema.Union([Schema.String, Schema.Null]).annotate({
29165 "description": "Return keys with IDs that come after this ID in the pagination order."
29166 })
29167 ),
29168 "order": Schema.optionalKey(
29169 Schema.Literals(["asc", "desc"]).annotate({
29170 "description": "Order results by creation time, ascending or descending."
29171 })
29172 ),
29173 "limit": Schema.optionalKey(
29174 Schema.Number.annotate({ "description": "Maximum number of keys to return." }).check(Schema.isInt())
29175 )
29176})
29177export type AdminApiKeysList200 = ApiKeyList
29178export const AdminApiKeysList200 = ApiKeyList
29179export type AdminApiKeysCreateRequestJson = { readonly "name": string }
29180export const AdminApiKeysCreateRequestJson = Schema.Struct({ "name": Schema.String })
29181export type AdminApiKeysCreate200 = AdminApiKeyCreateResponse
29182export const AdminApiKeysCreate200 = AdminApiKeyCreateResponse
29183export type AdminApiKeysGet200 = AdminApiKey
29184export const AdminApiKeysGet200 = AdminApiKey
29185export type AdminApiKeysDelete200 = {
29186 readonly "id": string
29187 readonly "object": "organization.admin_api_key.deleted"
29188 readonly "deleted": boolean
29189}
29190export const AdminApiKeysDelete200 = Schema.Struct({
29191 "id": Schema.String,
29192 "object": Schema.Literal("organization.admin_api_key.deleted"),
29193 "deleted": Schema.Boolean
29194})
29195export type ListAuditLogsParams = {
29196 readonly "effective_at[gt]"?: number
29197 readonly "effective_at[gte]"?: number
29198 readonly "effective_at[lt]"?: number
29199 readonly "effective_at[lte]"?: number
29200 readonly "project_ids[]"?: ReadonlyArray<string>
29201 readonly "event_types[]"?: ReadonlyArray<AuditLogEventType>
29202 readonly "actor_ids[]"?: ReadonlyArray<string>
29203 readonly "actor_emails[]"?: ReadonlyArray<string>
29204 readonly "resource_ids[]"?: ReadonlyArray<string>
29205 readonly "limit"?: number
29206 readonly "after"?: string
29207 readonly "before"?: string
29208}
29209export const ListAuditLogsParams = Schema.Struct({
29210 "effective_at[gt]": Schema.optionalKey(
29211 Schema.Number.annotate({
29212 "description": "Return only events whose `effective_at` (Unix seconds) is greater than this value."
29213 }).check(Schema.isInt())
29214 ),
29215 "effective_at[gte]": Schema.optionalKey(
29216 Schema.Number.annotate({
29217 "description": "Return only events whose `effective_at` (Unix seconds) is greater than or equal to this value."
29218 }).check(Schema.isInt())
29219 ),
29220 "effective_at[lt]": Schema.optionalKey(
29221 Schema.Number.annotate({
29222 "description": "Return only events whose `effective_at` (Unix seconds) is less than this value."
29223 }).check(Schema.isInt())
29224 ),
29225 "effective_at[lte]": Schema.optionalKey(
29226 Schema.Number.annotate({
29227 "description": "Return only events whose `effective_at` (Unix seconds) is less than or equal to this value."
29228 }).check(Schema.isInt())
29229 ),
29230 "project_ids[]": Schema.optionalKey(Schema.Array(Schema.String)),
29231 "event_types[]": Schema.optionalKey(Schema.Array(AuditLogEventType)),
29232 "actor_ids[]": Schema.optionalKey(Schema.Array(Schema.String)),
29233 "actor_emails[]": Schema.optionalKey(Schema.Array(Schema.String)),
29234 "resource_ids[]": Schema.optionalKey(Schema.Array(Schema.String)),
29235 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29236 "after": Schema.optionalKey(Schema.String),
29237 "before": Schema.optionalKey(Schema.String)
29238})
29239export type ListAuditLogs200 = ListAuditLogsResponse
29240export const ListAuditLogs200 = ListAuditLogsResponse
29241export type ListOrganizationCertificatesParams = {
29242 readonly "limit"?: number
29243 readonly "after"?: string
29244 readonly "order"?: "asc" | "desc"
29245}
29246export const ListOrganizationCertificatesParams = Schema.Struct({
29247 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29248 "after": Schema.optionalKey(Schema.String),
29249 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29250})
29251export type ListOrganizationCertificates200 = ListCertificatesResponse
29252export const ListOrganizationCertificates200 = ListCertificatesResponse
29253export type UploadCertificateRequestJson = UploadCertificateRequest
29254export const UploadCertificateRequestJson = UploadCertificateRequest
29255export type UploadCertificate200 = Certificate
29256export const UploadCertificate200 = Certificate
29257export type ActivateOrganizationCertificatesRequestJson = ToggleCertificatesRequest
29258export const ActivateOrganizationCertificatesRequestJson = ToggleCertificatesRequest
29259export type ActivateOrganizationCertificates200 = OrganizationCertificateActivationResponse
29260export const ActivateOrganizationCertificates200 = OrganizationCertificateActivationResponse
29261export type DeactivateOrganizationCertificatesRequestJson = ToggleCertificatesRequest
29262export const DeactivateOrganizationCertificatesRequestJson = ToggleCertificatesRequest
29263export type DeactivateOrganizationCertificates200 = OrganizationCertificateDeactivationResponse
29264export const DeactivateOrganizationCertificates200 = OrganizationCertificateDeactivationResponse
29265export type GetCertificateParams = { readonly "include"?: ReadonlyArray<"content"> }
29266export const GetCertificateParams = Schema.Struct({
29267 "include": Schema.optionalKey(Schema.Array(Schema.Literal("content")))
29268})
29269export type GetCertificate200 = Certificate
29270export const GetCertificate200 = Certificate
29271export type ModifyCertificateRequestJson = ModifyCertificateRequest
29272export const ModifyCertificateRequestJson = ModifyCertificateRequest
29273export type ModifyCertificate200 = Certificate
29274export const ModifyCertificate200 = Certificate
29275export type DeleteCertificate200 = DeleteCertificateResponse
29276export const DeleteCertificate200 = DeleteCertificateResponse
29277export type UsageCostsParams = {
29278 readonly "start_time": number
29279 readonly "end_time"?: number
29280 readonly "bucket_width"?: "1d"
29281 readonly "project_ids"?: ReadonlyArray<string>
29282 readonly "api_key_ids"?: ReadonlyArray<string>
29283 readonly "group_by"?: ReadonlyArray<"project_id" | "line_item" | "api_key_id">
29284 readonly "limit"?: number
29285 readonly "page"?: string
29286}
29287export const UsageCostsParams = Schema.Struct({
29288 "start_time": Schema.Number.check(Schema.isInt()),
29289 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29290 "bucket_width": Schema.optionalKey(Schema.Literal("1d")),
29291 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29292 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29293 "group_by": Schema.optionalKey(Schema.Array(Schema.Literals(["project_id", "line_item", "api_key_id"]))),
29294 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29295 "page": Schema.optionalKey(Schema.String)
29296})
29297export type UsageCosts200 = UsageResponse
29298export const UsageCosts200 = UsageResponse
29299export type ListGroupsParams = {
29300 readonly "limit"?: number
29301 readonly "after"?: string
29302 readonly "order"?: "asc" | "desc"
29303}
29304export const ListGroupsParams = Schema.Struct({
29305 "limit": Schema.optionalKey(
29306 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29307 ),
29308 "after": Schema.optionalKey(Schema.String),
29309 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29310})
29311export type ListGroups200 = GroupListResource
29312export const ListGroups200 = GroupListResource
29313export type CreateGroupRequestJson = CreateGroupBody
29314export const CreateGroupRequestJson = CreateGroupBody
29315export type CreateGroup200 = GroupResponse
29316export const CreateGroup200 = GroupResponse
29317export type UpdateGroupRequestJson = UpdateGroupBody
29318export const UpdateGroupRequestJson = UpdateGroupBody
29319export type UpdateGroup200 = GroupResourceWithSuccess
29320export const UpdateGroup200 = GroupResourceWithSuccess
29321export type DeleteGroup200 = GroupDeletedResource
29322export const DeleteGroup200 = GroupDeletedResource
29323export type ListGroupRoleAssignmentsParams = {
29324 readonly "limit"?: number
29325 readonly "after"?: string
29326 readonly "order"?: "asc" | "desc"
29327}
29328export const ListGroupRoleAssignmentsParams = Schema.Struct({
29329 "limit": Schema.optionalKey(
29330 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29331 ),
29332 "after": Schema.optionalKey(Schema.String),
29333 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29334})
29335export type ListGroupRoleAssignments200 = RoleListResource
29336export const ListGroupRoleAssignments200 = RoleListResource
29337export type AssignGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29338export const AssignGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29339export type AssignGroupRole200 = GroupRoleAssignment
29340export const AssignGroupRole200 = GroupRoleAssignment
29341export type UnassignGroupRole200 = DeletedRoleAssignmentResource
29342export const UnassignGroupRole200 = DeletedRoleAssignmentResource
29343export type ListGroupUsersParams = {
29344 readonly "limit"?: number
29345 readonly "after"?: string
29346 readonly "order"?: "asc" | "desc"
29347}
29348export const ListGroupUsersParams = Schema.Struct({
29349 "limit": Schema.optionalKey(
29350 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29351 ),
29352 "after": Schema.optionalKey(Schema.String),
29353 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29354})
29355export type ListGroupUsers200 = UserListResource
29356export const ListGroupUsers200 = UserListResource
29357export type AddGroupUserRequestJson = CreateGroupUserBody
29358export const AddGroupUserRequestJson = CreateGroupUserBody
29359export type AddGroupUser200 = GroupUserAssignment
29360export const AddGroupUser200 = GroupUserAssignment
29361export type RemoveGroupUser200 = GroupUserDeletedResource
29362export const RemoveGroupUser200 = GroupUserDeletedResource
29363export type ListInvitesParams = { readonly "limit"?: number; readonly "after"?: string }
29364export const ListInvitesParams = Schema.Struct({
29365 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29366 "after": Schema.optionalKey(Schema.String)
29367})
29368export type ListInvites200 = InviteListResponse
29369export const ListInvites200 = InviteListResponse
29370export type InviteUserRequestJson = InviteRequest
29371export const InviteUserRequestJson = InviteRequest
29372export type InviteUser200 = Invite
29373export const InviteUser200 = Invite
29374export type RetrieveInvite200 = Invite
29375export const RetrieveInvite200 = Invite
29376export type DeleteInvite200 = InviteDeleteResponse
29377export const DeleteInvite200 = InviteDeleteResponse
29378export type ListProjectsParams = {
29379 readonly "limit"?: number
29380 readonly "after"?: string
29381 readonly "include_archived"?: boolean
29382}
29383export const ListProjectsParams = Schema.Struct({
29384 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29385 "after": Schema.optionalKey(Schema.String),
29386 "include_archived": Schema.optionalKey(Schema.Boolean)
29387})
29388export type ListProjects200 = ProjectListResponse
29389export const ListProjects200 = ProjectListResponse
29390export type CreateProjectRequestJson = ProjectCreateRequest
29391export const CreateProjectRequestJson = ProjectCreateRequest
29392export type CreateProject200 = Project
29393export const CreateProject200 = Project
29394export type RetrieveProject200 = Project
29395export const RetrieveProject200 = Project
29396export type ModifyProjectRequestJson = ProjectUpdateRequest
29397export const ModifyProjectRequestJson = ProjectUpdateRequest
29398export type ModifyProject200 = Project
29399export const ModifyProject200 = Project
29400export type ModifyProject400 = ErrorResponse
29401export const ModifyProject400 = ErrorResponse
29402export type ListProjectApiKeysParams = { readonly "limit"?: number; readonly "after"?: string }
29403export const ListProjectApiKeysParams = Schema.Struct({
29404 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29405 "after": Schema.optionalKey(Schema.String)
29406})
29407export type ListProjectApiKeys200 = ProjectApiKeyListResponse
29408export const ListProjectApiKeys200 = ProjectApiKeyListResponse
29409export type RetrieveProjectApiKey200 = ProjectApiKey
29410export const RetrieveProjectApiKey200 = ProjectApiKey
29411export type DeleteProjectApiKey200 = ProjectApiKeyDeleteResponse
29412export const DeleteProjectApiKey200 = ProjectApiKeyDeleteResponse
29413export type DeleteProjectApiKey400 = ErrorResponse
29414export const DeleteProjectApiKey400 = ErrorResponse
29415export type ArchiveProject200 = Project
29416export const ArchiveProject200 = Project
29417export type ListProjectCertificatesParams = {
29418 readonly "limit"?: number
29419 readonly "after"?: string
29420 readonly "order"?: "asc" | "desc"
29421}
29422export const ListProjectCertificatesParams = Schema.Struct({
29423 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29424 "after": Schema.optionalKey(Schema.String),
29425 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29426})
29427export type ListProjectCertificates200 = ListProjectCertificatesResponse
29428export const ListProjectCertificates200 = ListProjectCertificatesResponse
29429export type ActivateProjectCertificatesRequestJson = ToggleCertificatesRequest
29430export const ActivateProjectCertificatesRequestJson = ToggleCertificatesRequest
29431export type ActivateProjectCertificates200 = OrganizationProjectCertificateActivationResponse
29432export const ActivateProjectCertificates200 = OrganizationProjectCertificateActivationResponse
29433export type DeactivateProjectCertificatesRequestJson = ToggleCertificatesRequest
29434export const DeactivateProjectCertificatesRequestJson = ToggleCertificatesRequest
29435export type DeactivateProjectCertificates200 = OrganizationProjectCertificateDeactivationResponse
29436export const DeactivateProjectCertificates200 = OrganizationProjectCertificateDeactivationResponse
29437export type ListProjectGroupsParams = {
29438 readonly "limit"?: number
29439 readonly "after"?: string
29440 readonly "order"?: "asc" | "desc"
29441}
29442export const ListProjectGroupsParams = Schema.Struct({
29443 "limit": Schema.optionalKey(
29444 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
29445 ),
29446 "after": Schema.optionalKey(Schema.String),
29447 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29448})
29449export type ListProjectGroups200 = ProjectGroupListResource
29450export const ListProjectGroups200 = ProjectGroupListResource
29451export type AddProjectGroupRequestJson = InviteProjectGroupBody
29452export const AddProjectGroupRequestJson = InviteProjectGroupBody
29453export type AddProjectGroup200 = ProjectGroup
29454export const AddProjectGroup200 = ProjectGroup
29455export type RemoveProjectGroup200 = ProjectGroupDeletedResource
29456export const RemoveProjectGroup200 = ProjectGroupDeletedResource
29457export type RetrieveProjectHostedToolPermissions200 = ProjectHostedToolPermissions
29458export const RetrieveProjectHostedToolPermissions200 = ProjectHostedToolPermissions
29459export type UpdateProjectHostedToolPermissionsRequestJson = ProjectHostedToolPermissionsUpdateRequest
29460export const UpdateProjectHostedToolPermissionsRequestJson = ProjectHostedToolPermissionsUpdateRequest
29461export type UpdateProjectHostedToolPermissions200 = ProjectHostedToolPermissions
29462export const UpdateProjectHostedToolPermissions200 = ProjectHostedToolPermissions
29463export type RetrieveProjectModelPermissions200 = ProjectModelPermissions
29464export const RetrieveProjectModelPermissions200 = ProjectModelPermissions
29465export type UpdateProjectModelPermissionsRequestJson = ProjectModelPermissionsUpdateRequest
29466export const UpdateProjectModelPermissionsRequestJson = ProjectModelPermissionsUpdateRequest
29467export type UpdateProjectModelPermissions200 = ProjectModelPermissions
29468export const UpdateProjectModelPermissions200 = ProjectModelPermissions
29469export type DeleteProjectModelPermissions200 = ProjectModelPermissionsDeleteResponse
29470export const DeleteProjectModelPermissions200 = ProjectModelPermissionsDeleteResponse
29471export type ListProjectRateLimitsParams = {
29472 readonly "limit"?: number
29473 readonly "after"?: string
29474 readonly "before"?: string
29475}
29476export const ListProjectRateLimitsParams = Schema.Struct({
29477 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29478 "after": Schema.optionalKey(Schema.String),
29479 "before": Schema.optionalKey(Schema.String)
29480})
29481export type ListProjectRateLimits200 = ProjectRateLimitListResponse
29482export const ListProjectRateLimits200 = ProjectRateLimitListResponse
29483export type UpdateProjectRateLimitsRequestJson = ProjectRateLimitUpdateRequest
29484export const UpdateProjectRateLimitsRequestJson = ProjectRateLimitUpdateRequest
29485export type UpdateProjectRateLimits200 = ProjectRateLimit
29486export const UpdateProjectRateLimits200 = ProjectRateLimit
29487export type UpdateProjectRateLimits400 = ErrorResponse
29488export const UpdateProjectRateLimits400 = ErrorResponse
29489export type ListProjectServiceAccountsParams = { readonly "limit"?: number; readonly "after"?: string }
29490export const ListProjectServiceAccountsParams = Schema.Struct({
29491 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29492 "after": Schema.optionalKey(Schema.String)
29493})
29494export type ListProjectServiceAccounts200 = ProjectServiceAccountListResponse
29495export const ListProjectServiceAccounts200 = ProjectServiceAccountListResponse
29496export type ListProjectServiceAccounts400 = ErrorResponse
29497export const ListProjectServiceAccounts400 = ErrorResponse
29498export type CreateProjectServiceAccountRequestJson = ProjectServiceAccountCreateRequest
29499export const CreateProjectServiceAccountRequestJson = ProjectServiceAccountCreateRequest
29500export type CreateProjectServiceAccount200 = ProjectServiceAccountCreateResponse
29501export const CreateProjectServiceAccount200 = ProjectServiceAccountCreateResponse
29502export type CreateProjectServiceAccount400 = ErrorResponse
29503export const CreateProjectServiceAccount400 = ErrorResponse
29504export type RetrieveProjectServiceAccount200 = ProjectServiceAccount
29505export const RetrieveProjectServiceAccount200 = ProjectServiceAccount
29506export type DeleteProjectServiceAccount200 = ProjectServiceAccountDeleteResponse
29507export const DeleteProjectServiceAccount200 = ProjectServiceAccountDeleteResponse
29508export type ListProjectUsersParams = { readonly "limit"?: number; readonly "after"?: string }
29509export const ListProjectUsersParams = Schema.Struct({
29510 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29511 "after": Schema.optionalKey(Schema.String)
29512})
29513export type ListProjectUsers200 = ProjectUserListResponse
29514export const ListProjectUsers200 = ProjectUserListResponse
29515export type ListProjectUsers400 = ErrorResponse
29516export const ListProjectUsers400 = ErrorResponse
29517export type CreateProjectUserRequestJson = ProjectUserCreateRequest
29518export const CreateProjectUserRequestJson = ProjectUserCreateRequest
29519export type CreateProjectUser200 = ProjectUser
29520export const CreateProjectUser200 = ProjectUser
29521export type CreateProjectUser400 = ErrorResponse
29522export const CreateProjectUser400 = ErrorResponse
29523export type RetrieveProjectUser200 = ProjectUser
29524export const RetrieveProjectUser200 = ProjectUser
29525export type ModifyProjectUserRequestJson = ProjectUserUpdateRequest
29526export const ModifyProjectUserRequestJson = ProjectUserUpdateRequest
29527export type ModifyProjectUser200 = ProjectUser
29528export const ModifyProjectUser200 = ProjectUser
29529export type ModifyProjectUser400 = ErrorResponse
29530export const ModifyProjectUser400 = ErrorResponse
29531export type DeleteProjectUser200 = ProjectUserDeleteResponse
29532export const DeleteProjectUser200 = ProjectUserDeleteResponse
29533export type DeleteProjectUser400 = ErrorResponse
29534export const DeleteProjectUser400 = ErrorResponse
29535export type ListRolesParams = {
29536 readonly "limit"?: number
29537 readonly "after"?: string
29538 readonly "order"?: "asc" | "desc"
29539}
29540export const ListRolesParams = Schema.Struct({
29541 "limit": Schema.optionalKey(
29542 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29543 ),
29544 "after": Schema.optionalKey(Schema.String),
29545 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29546})
29547export type ListRoles200 = PublicRoleListResource
29548export const ListRoles200 = PublicRoleListResource
29549export type CreateRoleRequestJson = PublicCreateOrganizationRoleBody
29550export const CreateRoleRequestJson = PublicCreateOrganizationRoleBody
29551export type CreateRole200 = Role
29552export const CreateRole200 = Role
29553export type UpdateRoleRequestJson = PublicUpdateOrganizationRoleBody
29554export const UpdateRoleRequestJson = PublicUpdateOrganizationRoleBody
29555export type UpdateRole200 = Role
29556export const UpdateRole200 = Role
29557export type DeleteRole200 = RoleDeletedResource
29558export const DeleteRole200 = RoleDeletedResource
29559export type UsageAudioSpeechesParams = {
29560 readonly "start_time": number
29561 readonly "end_time"?: number
29562 readonly "bucket_width"?: "1m" | "1h" | "1d"
29563 readonly "project_ids"?: ReadonlyArray<string>
29564 readonly "user_ids"?: ReadonlyArray<string>
29565 readonly "api_key_ids"?: ReadonlyArray<string>
29566 readonly "models"?: ReadonlyArray<string>
29567 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model">
29568 readonly "limit"?: number
29569 readonly "page"?: string
29570}
29571export const UsageAudioSpeechesParams = Schema.Struct({
29572 "start_time": Schema.Number.check(Schema.isInt()),
29573 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29574 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29575 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29576 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29577 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29578 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29579 "group_by": Schema.optionalKey(Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model"]))),
29580 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29581 "page": Schema.optionalKey(Schema.String)
29582})
29583export type UsageAudioSpeeches200 = UsageResponse
29584export const UsageAudioSpeeches200 = UsageResponse
29585export type UsageAudioTranscriptionsParams = {
29586 readonly "start_time": number
29587 readonly "end_time"?: number
29588 readonly "bucket_width"?: "1m" | "1h" | "1d"
29589 readonly "project_ids"?: ReadonlyArray<string>
29590 readonly "user_ids"?: ReadonlyArray<string>
29591 readonly "api_key_ids"?: ReadonlyArray<string>
29592 readonly "models"?: ReadonlyArray<string>
29593 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model">
29594 readonly "limit"?: number
29595 readonly "page"?: string
29596}
29597export const UsageAudioTranscriptionsParams = Schema.Struct({
29598 "start_time": Schema.Number.check(Schema.isInt()),
29599 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29600 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29601 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29602 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29603 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29604 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29605 "group_by": Schema.optionalKey(Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model"]))),
29606 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29607 "page": Schema.optionalKey(Schema.String)
29608})
29609export type UsageAudioTranscriptions200 = UsageResponse
29610export const UsageAudioTranscriptions200 = UsageResponse
29611export type UsageCodeInterpreterSessionsParams = {
29612 readonly "start_time": number
29613 readonly "end_time"?: number
29614 readonly "bucket_width"?: "1m" | "1h" | "1d"
29615 readonly "project_ids"?: ReadonlyArray<string>
29616 readonly "group_by"?: ReadonlyArray<"project_id">
29617 readonly "limit"?: number
29618 readonly "page"?: string
29619}
29620export const UsageCodeInterpreterSessionsParams = Schema.Struct({
29621 "start_time": Schema.Number.check(Schema.isInt()),
29622 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29623 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29624 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29625 "group_by": Schema.optionalKey(Schema.Array(Schema.Literal("project_id"))),
29626 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29627 "page": Schema.optionalKey(Schema.String)
29628})
29629export type UsageCodeInterpreterSessions200 = UsageResponse
29630export const UsageCodeInterpreterSessions200 = UsageResponse
29631export type UsageCompletionsParams = {
29632 readonly "start_time": number
29633 readonly "end_time"?: number
29634 readonly "bucket_width"?: "1m" | "1h" | "1d"
29635 readonly "project_ids"?: ReadonlyArray<string>
29636 readonly "user_ids"?: ReadonlyArray<string>
29637 readonly "api_key_ids"?: ReadonlyArray<string>
29638 readonly "models"?: ReadonlyArray<string>
29639 readonly "batch"?: boolean
29640 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model" | "batch" | "service_tier">
29641 readonly "limit"?: number
29642 readonly "page"?: string
29643}
29644export const UsageCompletionsParams = Schema.Struct({
29645 "start_time": Schema.Number.check(Schema.isInt()),
29646 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29647 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29648 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29649 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29650 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29651 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29652 "batch": Schema.optionalKey(Schema.Boolean),
29653 "group_by": Schema.optionalKey(
29654 Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model", "batch", "service_tier"]))
29655 ),
29656 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29657 "page": Schema.optionalKey(Schema.String)
29658})
29659export type UsageCompletions200 = UsageResponse
29660export const UsageCompletions200 = UsageResponse
29661export type UsageEmbeddingsParams = {
29662 readonly "start_time": number
29663 readonly "end_time"?: number
29664 readonly "bucket_width"?: "1m" | "1h" | "1d"
29665 readonly "project_ids"?: ReadonlyArray<string>
29666 readonly "user_ids"?: ReadonlyArray<string>
29667 readonly "api_key_ids"?: ReadonlyArray<string>
29668 readonly "models"?: ReadonlyArray<string>
29669 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model">
29670 readonly "limit"?: number
29671 readonly "page"?: string
29672}
29673export const UsageEmbeddingsParams = Schema.Struct({
29674 "start_time": Schema.Number.check(Schema.isInt()),
29675 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29676 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29677 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29678 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29679 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29680 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29681 "group_by": Schema.optionalKey(Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model"]))),
29682 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29683 "page": Schema.optionalKey(Schema.String)
29684})
29685export type UsageEmbeddings200 = UsageResponse
29686export const UsageEmbeddings200 = UsageResponse
29687export type UsageFileSearchCallsParams = {
29688 readonly "start_time": number
29689 readonly "end_time"?: number
29690 readonly "bucket_width"?: "1m" | "1h" | "1d"
29691 readonly "project_ids"?: ReadonlyArray<string>
29692 readonly "user_ids"?: ReadonlyArray<string>
29693 readonly "api_key_ids"?: ReadonlyArray<string>
29694 readonly "vector_store_ids"?: ReadonlyArray<string>
29695 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "vector_store_id">
29696 readonly "limit"?: number
29697 readonly "page"?: string
29698}
29699export const UsageFileSearchCallsParams = Schema.Struct({
29700 "start_time": Schema.Number.check(Schema.isInt()),
29701 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29702 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29703 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29704 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29705 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29706 "vector_store_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29707 "group_by": Schema.optionalKey(
29708 Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "vector_store_id"]))
29709 ),
29710 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29711 "page": Schema.optionalKey(Schema.String)
29712})
29713export type UsageFileSearchCalls200 = UsageResponse
29714export const UsageFileSearchCalls200 = UsageResponse
29715export type UsageImagesParams = {
29716 readonly "start_time": number
29717 readonly "end_time"?: number
29718 readonly "bucket_width"?: "1m" | "1h" | "1d"
29719 readonly "sources"?: ReadonlyArray<"image.generation" | "image.edit" | "image.variation">
29720 readonly "sizes"?: ReadonlyArray<"256x256" | "512x512" | "1024x1024" | "1792x1792" | "1024x1792">
29721 readonly "project_ids"?: ReadonlyArray<string>
29722 readonly "user_ids"?: ReadonlyArray<string>
29723 readonly "api_key_ids"?: ReadonlyArray<string>
29724 readonly "models"?: ReadonlyArray<string>
29725 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model" | "size" | "source">
29726 readonly "limit"?: number
29727 readonly "page"?: string
29728}
29729export const UsageImagesParams = Schema.Struct({
29730 "start_time": Schema.Number.check(Schema.isInt()),
29731 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29732 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29733 "sources": Schema.optionalKey(Schema.Array(Schema.Literals(["image.generation", "image.edit", "image.variation"]))),
29734 "sizes": Schema.optionalKey(
29735 Schema.Array(Schema.Literals(["256x256", "512x512", "1024x1024", "1792x1792", "1024x1792"]))
29736 ),
29737 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29738 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29739 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29740 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29741 "group_by": Schema.optionalKey(
29742 Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model", "size", "source"]))
29743 ),
29744 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29745 "page": Schema.optionalKey(Schema.String)
29746})
29747export type UsageImages200 = UsageResponse
29748export const UsageImages200 = UsageResponse
29749export type UsageModerationsParams = {
29750 readonly "start_time": number
29751 readonly "end_time"?: number
29752 readonly "bucket_width"?: "1m" | "1h" | "1d"
29753 readonly "project_ids"?: ReadonlyArray<string>
29754 readonly "user_ids"?: ReadonlyArray<string>
29755 readonly "api_key_ids"?: ReadonlyArray<string>
29756 readonly "models"?: ReadonlyArray<string>
29757 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model">
29758 readonly "limit"?: number
29759 readonly "page"?: string
29760}
29761export const UsageModerationsParams = Schema.Struct({
29762 "start_time": Schema.Number.check(Schema.isInt()),
29763 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29764 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29765 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29766 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29767 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29768 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29769 "group_by": Schema.optionalKey(Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model"]))),
29770 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29771 "page": Schema.optionalKey(Schema.String)
29772})
29773export type UsageModerations200 = UsageResponse
29774export const UsageModerations200 = UsageResponse
29775export type UsageVectorStoresParams = {
29776 readonly "start_time": number
29777 readonly "end_time"?: number
29778 readonly "bucket_width"?: "1m" | "1h" | "1d"
29779 readonly "project_ids"?: ReadonlyArray<string>
29780 readonly "group_by"?: ReadonlyArray<"project_id">
29781 readonly "limit"?: number
29782 readonly "page"?: string
29783}
29784export const UsageVectorStoresParams = Schema.Struct({
29785 "start_time": Schema.Number.check(Schema.isInt()),
29786 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29787 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29788 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29789 "group_by": Schema.optionalKey(Schema.Array(Schema.Literal("project_id"))),
29790 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29791 "page": Schema.optionalKey(Schema.String)
29792})
29793export type UsageVectorStores200 = UsageResponse
29794export const UsageVectorStores200 = UsageResponse
29795export type UsageWebSearchCallsParams = {
29796 readonly "start_time": number
29797 readonly "end_time"?: number
29798 readonly "bucket_width"?: "1m" | "1h" | "1d"
29799 readonly "project_ids"?: ReadonlyArray<string>
29800 readonly "user_ids"?: ReadonlyArray<string>
29801 readonly "api_key_ids"?: ReadonlyArray<string>
29802 readonly "models"?: ReadonlyArray<string>
29803 readonly "context_levels"?: ReadonlyArray<"low" | "medium" | "high">
29804 readonly "group_by"?: ReadonlyArray<"project_id" | "user_id" | "api_key_id" | "model" | "context_level">
29805 readonly "limit"?: number
29806 readonly "page"?: string
29807}
29808export const UsageWebSearchCallsParams = Schema.Struct({
29809 "start_time": Schema.Number.check(Schema.isInt()),
29810 "end_time": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29811 "bucket_width": Schema.optionalKey(Schema.Literals(["1m", "1h", "1d"])),
29812 "project_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29813 "user_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29814 "api_key_ids": Schema.optionalKey(Schema.Array(Schema.String)),
29815 "models": Schema.optionalKey(Schema.Array(Schema.String)),
29816 "context_levels": Schema.optionalKey(Schema.Array(Schema.Literals(["low", "medium", "high"]))),
29817 "group_by": Schema.optionalKey(
29818 Schema.Array(Schema.Literals(["project_id", "user_id", "api_key_id", "model", "context_level"]))
29819 ),
29820 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29821 "page": Schema.optionalKey(Schema.String)
29822})
29823export type UsageWebSearchCalls200 = UsageResponse
29824export const UsageWebSearchCalls200 = UsageResponse
29825export type ListUsersParams = {
29826 readonly "limit"?: number
29827 readonly "after"?: string
29828 readonly "emails"?: ReadonlyArray<string>
29829}
29830export const ListUsersParams = Schema.Struct({
29831 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29832 "after": Schema.optionalKey(Schema.String),
29833 "emails": Schema.optionalKey(Schema.Array(Schema.String))
29834})
29835export type ListUsers200 = UserListResponse
29836export const ListUsers200 = UserListResponse
29837export type RetrieveUser200 = User
29838export const RetrieveUser200 = User
29839export type ModifyUserRequestJson = UserRoleUpdateRequest
29840export const ModifyUserRequestJson = UserRoleUpdateRequest
29841export type ModifyUser200 = User
29842export const ModifyUser200 = User
29843export type DeleteUser200 = UserDeleteResponse
29844export const DeleteUser200 = UserDeleteResponse
29845export type ListUserRoleAssignmentsParams = {
29846 readonly "limit"?: number
29847 readonly "after"?: string
29848 readonly "order"?: "asc" | "desc"
29849}
29850export const ListUserRoleAssignmentsParams = Schema.Struct({
29851 "limit": Schema.optionalKey(
29852 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29853 ),
29854 "after": Schema.optionalKey(Schema.String),
29855 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29856})
29857export type ListUserRoleAssignments200 = RoleListResource
29858export const ListUserRoleAssignments200 = RoleListResource
29859export type AssignUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29860export const AssignUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29861export type AssignUserRole200 = UserRoleAssignment
29862export const AssignUserRole200 = UserRoleAssignment
29863export type UnassignUserRole200 = DeletedRoleAssignmentResource
29864export const UnassignUserRole200 = DeletedRoleAssignmentResource
29865export type ListProjectGroupRoleAssignmentsParams = {
29866 readonly "limit"?: number
29867 readonly "after"?: string
29868 readonly "order"?: "asc" | "desc"
29869}
29870export const ListProjectGroupRoleAssignmentsParams = Schema.Struct({
29871 "limit": Schema.optionalKey(
29872 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29873 ),
29874 "after": Schema.optionalKey(Schema.String),
29875 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29876})
29877export type ListProjectGroupRoleAssignments200 = RoleListResource
29878export const ListProjectGroupRoleAssignments200 = RoleListResource
29879export type AssignProjectGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29880export const AssignProjectGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29881export type AssignProjectGroupRole200 = GroupRoleAssignment
29882export const AssignProjectGroupRole200 = GroupRoleAssignment
29883export type UnassignProjectGroupRole200 = DeletedRoleAssignmentResource
29884export const UnassignProjectGroupRole200 = DeletedRoleAssignmentResource
29885export type ListProjectRolesParams = {
29886 readonly "limit"?: number
29887 readonly "after"?: string
29888 readonly "order"?: "asc" | "desc"
29889}
29890export const ListProjectRolesParams = Schema.Struct({
29891 "limit": Schema.optionalKey(
29892 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29893 ),
29894 "after": Schema.optionalKey(Schema.String),
29895 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29896})
29897export type ListProjectRoles200 = PublicRoleListResource
29898export const ListProjectRoles200 = PublicRoleListResource
29899export type CreateProjectRoleRequestJson = PublicCreateOrganizationRoleBody
29900export const CreateProjectRoleRequestJson = PublicCreateOrganizationRoleBody
29901export type CreateProjectRole200 = Role
29902export const CreateProjectRole200 = Role
29903export type UpdateProjectRoleRequestJson = PublicUpdateOrganizationRoleBody
29904export const UpdateProjectRoleRequestJson = PublicUpdateOrganizationRoleBody
29905export type UpdateProjectRole200 = Role
29906export const UpdateProjectRole200 = Role
29907export type DeleteProjectRole200 = RoleDeletedResource
29908export const DeleteProjectRole200 = RoleDeletedResource
29909export type ListProjectUserRoleAssignmentsParams = {
29910 readonly "limit"?: number
29911 readonly "after"?: string
29912 readonly "order"?: "asc" | "desc"
29913}
29914export const ListProjectUserRoleAssignmentsParams = Schema.Struct({
29915 "limit": Schema.optionalKey(
29916 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1000))
29917 ),
29918 "after": Schema.optionalKey(Schema.String),
29919 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"]))
29920})
29921export type ListProjectUserRoleAssignments200 = RoleListResource
29922export const ListProjectUserRoleAssignments200 = RoleListResource
29923export type AssignProjectUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29924export const AssignProjectUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody
29925export type AssignProjectUserRole200 = UserRoleAssignment
29926export const AssignProjectUserRole200 = UserRoleAssignment
29927export type UnassignProjectUserRole200 = DeletedRoleAssignmentResource
29928export const UnassignProjectUserRole200 = DeletedRoleAssignmentResource
29929export type CreateRealtimeCallRequestFormData = RealtimeCallCreateRequest
29930export const CreateRealtimeCallRequestFormData = RealtimeCallCreateRequest
29931export type AcceptRealtimeCallRequestJson = RealtimeSessionCreateRequestGA
29932export const AcceptRealtimeCallRequestJson = RealtimeSessionCreateRequestGA
29933export type ReferRealtimeCallRequestJson = RealtimeCallReferRequest
29934export const ReferRealtimeCallRequestJson = RealtimeCallReferRequest
29935export type RejectRealtimeCallRequestJson = RealtimeCallRejectRequest
29936export const RejectRealtimeCallRequestJson = RealtimeCallRejectRequest
29937export type CreateRealtimeClientSecretRequestJson = RealtimeCreateClientSecretRequest
29938export const CreateRealtimeClientSecretRequestJson = RealtimeCreateClientSecretRequest
29939export type CreateRealtimeClientSecret200 = RealtimeCreateClientSecretResponse
29940export const CreateRealtimeClientSecret200 = RealtimeCreateClientSecretResponse
29941export type CreateRealtimeSessionRequestJson = RealtimeSessionCreateRequest
29942export const CreateRealtimeSessionRequestJson = RealtimeSessionCreateRequest
29943export type CreateRealtimeSession200 = RealtimeSessionCreateResponse
29944export const CreateRealtimeSession200 = RealtimeSessionCreateResponse
29945export type CreateRealtimeTranscriptionSessionRequestJson = RealtimeTranscriptionSessionCreateRequest
29946export const CreateRealtimeTranscriptionSessionRequestJson = RealtimeTranscriptionSessionCreateRequest
29947export type CreateRealtimeTranscriptionSession200 = RealtimeTranscriptionSessionCreateResponse
29948export const CreateRealtimeTranscriptionSession200 = RealtimeTranscriptionSessionCreateResponse
29949export type CreateRealtimeTranslationClientSecretRequestJson = RealtimeTranslationClientSecretCreateRequest
29950export const CreateRealtimeTranslationClientSecretRequestJson = RealtimeTranslationClientSecretCreateRequest
29951export type CreateRealtimeTranslationClientSecret200 = RealtimeTranslationClientSecretCreateResponse
29952export const CreateRealtimeTranslationClientSecret200 = RealtimeTranslationClientSecretCreateResponse
29953export type CreateResponseRequestJson = CreateResponse
29954export const CreateResponseRequestJson = CreateResponse
29955export type CreateResponse200 = Response
29956export const CreateResponse200 = Response
29957export type CreateResponse200Sse = ResponseStreamEvent
29958export const CreateResponse200Sse = ResponseStreamEvent
29959export type GetResponseParams = {
29960 readonly "include"?: ReadonlyArray<IncludeEnum>
29961 readonly "stream"?: boolean
29962 readonly "starting_after"?: number
29963 readonly "include_obfuscation"?: boolean
29964}
29965export const GetResponseParams = Schema.Struct({
29966 "include": Schema.optionalKey(Schema.Array(IncludeEnum)),
29967 "stream": Schema.optionalKey(Schema.Boolean),
29968 "starting_after": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29969 "include_obfuscation": Schema.optionalKey(Schema.Boolean)
29970})
29971export type GetResponse200 = Response
29972export const GetResponse200 = Response
29973export type DeleteResponse404 = Error
29974export const DeleteResponse404 = Error
29975export type CancelResponse200 = Response
29976export const CancelResponse200 = Response
29977export type CancelResponse404 = Error
29978export const CancelResponse404 = Error
29979export type ListInputItemsParams = {
29980 readonly "limit"?: number
29981 readonly "order"?: "asc" | "desc"
29982 readonly "after"?: string
29983 readonly "include"?: ReadonlyArray<IncludeEnum>
29984}
29985export const ListInputItemsParams = Schema.Struct({
29986 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
29987 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
29988 "after": Schema.optionalKey(Schema.String),
29989 "include": Schema.optionalKey(Schema.Array(IncludeEnum))
29990})
29991export type ListInputItems200 = ResponseItemList
29992export const ListInputItems200 = ResponseItemList
29993export type CreateThreadRequestJson = CreateThreadRequest
29994export const CreateThreadRequestJson = CreateThreadRequest
29995export type CreateThread200 = ThreadObject
29996export const CreateThread200 = ThreadObject
29997export type CreateThreadAndRunRequestJson = CreateThreadAndRunRequest
29998export const CreateThreadAndRunRequestJson = CreateThreadAndRunRequest
29999export type CreateThreadAndRun200 = RunObject
30000export const CreateThreadAndRun200 = RunObject
30001export type GetThread200 = ThreadObject
30002export const GetThread200 = ThreadObject
30003export type ModifyThreadRequestJson = ModifyThreadRequest
30004export const ModifyThreadRequestJson = ModifyThreadRequest
30005export type ModifyThread200 = ThreadObject
30006export const ModifyThread200 = ThreadObject
30007export type DeleteThread200 = DeleteThreadResponse
30008export const DeleteThread200 = DeleteThreadResponse
30009export type ListMessagesParams = {
30010 readonly "limit"?: number
30011 readonly "order"?: "asc" | "desc"
30012 readonly "after"?: string
30013 readonly "before"?: string
30014 readonly "run_id"?: string
30015}
30016export const ListMessagesParams = Schema.Struct({
30017 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
30018 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
30019 "after": Schema.optionalKey(Schema.String),
30020 "before": Schema.optionalKey(Schema.String),
30021 "run_id": Schema.optionalKey(Schema.String)
30022})
30023export type ListMessages200 = ListMessagesResponse
30024export const ListMessages200 = ListMessagesResponse
30025export type CreateMessageRequestJson = CreateMessageRequest
30026export const CreateMessageRequestJson = CreateMessageRequest
30027export type CreateMessage200 = MessageObject
30028export const CreateMessage200 = MessageObject
30029export type GetMessage200 = MessageObject
30030export const GetMessage200 = MessageObject
30031export type ModifyMessageRequestJson = ModifyMessageRequest
30032export const ModifyMessageRequestJson = ModifyMessageRequest
30033export type ModifyMessage200 = MessageObject
30034export const ModifyMessage200 = MessageObject
30035export type DeleteMessage200 = DeleteMessageResponse
30036export const DeleteMessage200 = DeleteMessageResponse
30037export type ListRunsParams = {
30038 readonly "limit"?: number
30039 readonly "order"?: "asc" | "desc"
30040 readonly "after"?: string
30041 readonly "before"?: string
30042}
30043export const ListRunsParams = Schema.Struct({
30044 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
30045 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
30046 "after": Schema.optionalKey(Schema.String),
30047 "before": Schema.optionalKey(Schema.String)
30048})
30049export type ListRuns200 = ListRunsResponse
30050export const ListRuns200 = ListRunsResponse
30051export type CreateRunParams = {
30052 readonly "include[]"?: ReadonlyArray<"step_details.tool_calls[*].file_search.results[*].content">
30053}
30054export const CreateRunParams = Schema.Struct({
30055 "include[]": Schema.optionalKey(
30056 Schema.Array(Schema.Literal("step_details.tool_calls[*].file_search.results[*].content"))
30057 )
30058})
30059export type CreateRunRequestJson = CreateRunRequest
30060export const CreateRunRequestJson = CreateRunRequest
30061export type CreateRun200 = RunObject
30062export const CreateRun200 = RunObject
30063export type GetRun200 = RunObject
30064export const GetRun200 = RunObject
30065export type ModifyRunRequestJson = ModifyRunRequest
30066export const ModifyRunRequestJson = ModifyRunRequest
30067export type ModifyRun200 = RunObject
30068export const ModifyRun200 = RunObject
30069export type CancelRun200 = RunObject
30070export const CancelRun200 = RunObject
30071export type ListRunStepsParams = {
30072 readonly "limit"?: number
30073 readonly "order"?: "asc" | "desc"
30074 readonly "after"?: string
30075 readonly "before"?: string
30076 readonly "include[]"?: ReadonlyArray<"step_details.tool_calls[*].file_search.results[*].content">
30077}
30078export const ListRunStepsParams = Schema.Struct({
30079 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
30080 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
30081 "after": Schema.optionalKey(Schema.String),
30082 "before": Schema.optionalKey(Schema.String),
30083 "include[]": Schema.optionalKey(
30084 Schema.Array(Schema.Literal("step_details.tool_calls[*].file_search.results[*].content"))
30085 )
30086})
30087export type ListRunSteps200 = ListRunStepsResponse
30088export const ListRunSteps200 = ListRunStepsResponse
30089export type GetRunStepParams = {
30090 readonly "include[]"?: ReadonlyArray<"step_details.tool_calls[*].file_search.results[*].content">
30091}
30092export const GetRunStepParams = Schema.Struct({
30093 "include[]": Schema.optionalKey(
30094 Schema.Array(Schema.Literal("step_details.tool_calls[*].file_search.results[*].content"))
30095 )
30096})
30097export type GetRunStep200 = RunStepObject
30098export const GetRunStep200 = RunStepObject
30099export type SubmitToolOuputsToRunRequestJson = SubmitToolOutputsRunRequest
30100export const SubmitToolOuputsToRunRequestJson = SubmitToolOutputsRunRequest
30101export type SubmitToolOuputsToRun200 = RunObject
30102export const SubmitToolOuputsToRun200 = RunObject
30103export type CreateUploadRequestJson = CreateUploadRequest
30104export const CreateUploadRequestJson = CreateUploadRequest
30105export type CreateUpload200 = Upload
30106export const CreateUpload200 = Upload
30107export type CancelUpload200 = Upload
30108export const CancelUpload200 = Upload
30109export type CompleteUploadRequestJson = CompleteUploadRequest
30110export const CompleteUploadRequestJson = CompleteUploadRequest
30111export type CompleteUpload200 = Upload
30112export const CompleteUpload200 = Upload
30113export type AddUploadPartRequestFormData = AddUploadPartRequest
30114export const AddUploadPartRequestFormData = AddUploadPartRequest
30115export type AddUploadPart200 = UploadPart
30116export const AddUploadPart200 = UploadPart
30117export type ListVectorStoresParams = {
30118 readonly "limit"?: number
30119 readonly "order"?: "asc" | "desc"
30120 readonly "after"?: string
30121 readonly "before"?: string
30122}
30123export const ListVectorStoresParams = Schema.Struct({
30124 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
30125 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
30126 "after": Schema.optionalKey(Schema.String),
30127 "before": Schema.optionalKey(Schema.String)
30128})
30129export type ListVectorStores200 = ListVectorStoresResponse
30130export const ListVectorStores200 = ListVectorStoresResponse
30131export type CreateVectorStoreRequestJson = CreateVectorStoreRequest
30132export const CreateVectorStoreRequestJson = CreateVectorStoreRequest
30133export type CreateVectorStore200 = VectorStoreObject
30134export const CreateVectorStore200 = VectorStoreObject
30135export type GetVectorStore200 = VectorStoreObject
30136export const GetVectorStore200 = VectorStoreObject
30137export type ModifyVectorStoreRequestJson = UpdateVectorStoreRequest
30138export const ModifyVectorStoreRequestJson = UpdateVectorStoreRequest
30139export type ModifyVectorStore200 = VectorStoreObject
30140export const ModifyVectorStore200 = VectorStoreObject
30141export type DeleteVectorStore200 = DeleteVectorStoreResponse
30142export const DeleteVectorStore200 = DeleteVectorStoreResponse
30143export type CreateVectorStoreFileBatchRequestJson = CreateVectorStoreFileBatchRequest
30144export const CreateVectorStoreFileBatchRequestJson = CreateVectorStoreFileBatchRequest
30145export type CreateVectorStoreFileBatch200 = VectorStoreFileBatchObject
30146export const CreateVectorStoreFileBatch200 = VectorStoreFileBatchObject
30147export type GetVectorStoreFileBatch200 = VectorStoreFileBatchObject
30148export const GetVectorStoreFileBatch200 = VectorStoreFileBatchObject
30149export type CancelVectorStoreFileBatch200 = VectorStoreFileBatchObject
30150export const CancelVectorStoreFileBatch200 = VectorStoreFileBatchObject
30151export type ListFilesInVectorStoreBatchParams = {
30152 readonly "limit"?: number
30153 readonly "order"?: "asc" | "desc"
30154 readonly "after"?: string
30155 readonly "before"?: string
30156 readonly "filter"?: "in_progress" | "completed" | "failed" | "cancelled"
30157}
30158export const ListFilesInVectorStoreBatchParams = Schema.Struct({
30159 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
30160 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
30161 "after": Schema.optionalKey(Schema.String),
30162 "before": Schema.optionalKey(Schema.String),
30163 "filter": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "failed", "cancelled"]))
30164})
30165export type ListFilesInVectorStoreBatch200 = ListVectorStoreFilesResponse
30166export const ListFilesInVectorStoreBatch200 = ListVectorStoreFilesResponse
30167export type ListVectorStoreFilesParams = {
30168 readonly "limit"?: number
30169 readonly "order"?: "asc" | "desc"
30170 readonly "after"?: string
30171 readonly "before"?: string
30172 readonly "filter"?: "in_progress" | "completed" | "failed" | "cancelled"
30173}
30174export const ListVectorStoreFilesParams = Schema.Struct({
30175 "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())),
30176 "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])),
30177 "after": Schema.optionalKey(Schema.String),
30178 "before": Schema.optionalKey(Schema.String),
30179 "filter": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "failed", "cancelled"]))
30180})
30181export type ListVectorStoreFiles200 = ListVectorStoreFilesResponse
30182export const ListVectorStoreFiles200 = ListVectorStoreFilesResponse
30183export type CreateVectorStoreFileRequestJson = CreateVectorStoreFileRequest
30184export const CreateVectorStoreFileRequestJson = CreateVectorStoreFileRequest
30185export type CreateVectorStoreFile200 = VectorStoreFileObject
30186export const CreateVectorStoreFile200 = VectorStoreFileObject
30187export type GetVectorStoreFile200 = VectorStoreFileObject
30188export const GetVectorStoreFile200 = VectorStoreFileObject
30189export type UpdateVectorStoreFileAttributesRequestJson = UpdateVectorStoreFileAttributesRequest
30190export const UpdateVectorStoreFileAttributesRequestJson = UpdateVectorStoreFileAttributesRequest
30191export type UpdateVectorStoreFileAttributes200 = VectorStoreFileObject
30192export const UpdateVectorStoreFileAttributes200 = VectorStoreFileObject
30193export type DeleteVectorStoreFile200 = DeleteVectorStoreFileResponse
30194export const DeleteVectorStoreFile200 = DeleteVectorStoreFileResponse
30195export type RetrieveVectorStoreFileContent200 = VectorStoreFileContentResponse
30196export const RetrieveVectorStoreFileContent200 = VectorStoreFileContentResponse
30197export type SearchVectorStoreRequestJson = VectorStoreSearchRequest
30198export const SearchVectorStoreRequestJson = VectorStoreSearchRequest
30199export type SearchVectorStore200 = VectorStoreSearchResultsPage
30200export const SearchVectorStore200 = VectorStoreSearchResultsPage
30201export type CreateConversationRequestJson = CreateConversationBody
30202export const CreateConversationRequestJson = CreateConversationBody
30203export type CreateConversation200 = ConversationResource
30204export const CreateConversation200 = ConversationResource
30205export type GetConversation200 = ConversationResource
30206export const GetConversation200 = ConversationResource
30207export type UpdateConversationRequestJson = UpdateConversationBody
30208export const UpdateConversationRequestJson = UpdateConversationBody
30209export type UpdateConversation200 = ConversationResource
30210export const UpdateConversation200 = ConversationResource
30211export type DeleteConversation200 = DeletedConversationResource
30212export const DeleteConversation200 = DeletedConversationResource
30213export type ListVideosParams = { readonly "limit"?: number; readonly "order"?: OrderEnum; readonly "after"?: string }
30214export const ListVideosParams = Schema.Struct({
30215 "limit": Schema.optionalKey(
30216 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
30217 ),
30218 "order": Schema.optionalKey(OrderEnum),
30219 "after": Schema.optionalKey(
30220 Schema.String.annotate({ "description": "Identifier for the last item from the previous pagination request" })
30221 )
30222})
30223export type ListVideos200 = VideoListResource
30224export const ListVideos200 = VideoListResource
30225export type CreateVideoRequestJson = CreateVideoJsonBody
30226export const CreateVideoRequestJson = CreateVideoJsonBody
30227export type CreateVideoRequestFormData = CreateVideoMultipartBody
30228export const CreateVideoRequestFormData = CreateVideoMultipartBody
30229export type CreateVideo200 = VideoResource
30230export const CreateVideo200 = VideoResource
30231export type CreateVideoCharacterRequestFormData = CreateVideoCharacterBody
30232export const CreateVideoCharacterRequestFormData = CreateVideoCharacterBody
30233export type CreateVideoCharacter200 = VideoCharacterResource
30234export const CreateVideoCharacter200 = VideoCharacterResource
30235export type GetVideoCharacter200 = VideoCharacterResource
30236export const GetVideoCharacter200 = VideoCharacterResource
30237export type CreateVideoEditRequestJson = CreateVideoEditJsonBody
30238export const CreateVideoEditRequestJson = CreateVideoEditJsonBody
30239export type CreateVideoEditRequestFormData = CreateVideoEditMultipartBody
30240export const CreateVideoEditRequestFormData = CreateVideoEditMultipartBody
30241export type CreateVideoEdit200 = VideoResource
30242export const CreateVideoEdit200 = VideoResource
30243export type CreateVideoExtendRequestJson = CreateVideoExtendJsonBody
30244export const CreateVideoExtendRequestJson = CreateVideoExtendJsonBody
30245export type CreateVideoExtendRequestFormData = CreateVideoExtendMultipartBody
30246export const CreateVideoExtendRequestFormData = CreateVideoExtendMultipartBody
30247export type CreateVideoExtend200 = VideoResource
30248export const CreateVideoExtend200 = VideoResource
30249export type GetVideo200 = VideoResource
30250export const GetVideo200 = VideoResource
30251export type DeleteVideo200 = DeletedVideoResource
30252export const DeleteVideo200 = DeletedVideoResource
30253export type RetrieveVideoContentParams = { readonly "variant"?: VideoContentVariant }
30254export const RetrieveVideoContentParams = Schema.Struct({ "variant": Schema.optionalKey(VideoContentVariant) })
30255export type RetrieveVideoContent200 = string
30256export const RetrieveVideoContent200 = Schema.String
30257export type CreateVideoRemixRequestJson = CreateVideoRemixBody
30258export const CreateVideoRemixRequestJson = CreateVideoRemixBody
30259export type CreateVideoRemixRequestFormData = CreateVideoRemixBody
30260export const CreateVideoRemixRequestFormData = CreateVideoRemixBody
30261export type CreateVideoRemix200 = VideoResource
30262export const CreateVideoRemix200 = VideoResource
30263export type GetinputtokencountsRequestJson = TokenCountsBody
30264export const GetinputtokencountsRequestJson = TokenCountsBody
30265export type GetinputtokencountsRequestFormUrlEncoded = TokenCountsBody
30266export const GetinputtokencountsRequestFormUrlEncoded = TokenCountsBody
30267export type Getinputtokencounts200 = TokenCountsResource
30268export const Getinputtokencounts200 = TokenCountsResource
30269export type CompactconversationRequestJson = CompactResponseMethodPublicBody
30270export const CompactconversationRequestJson = CompactResponseMethodPublicBody
30271export type CompactconversationRequestFormUrlEncoded = CompactResponseMethodPublicBody
30272export const CompactconversationRequestFormUrlEncoded = CompactResponseMethodPublicBody
30273export type Compactconversation200 = CompactResource
30274export const Compactconversation200 = CompactResource
30275export type ListSkillsParams = { readonly "limit"?: number; readonly "order"?: OrderEnum; readonly "after"?: string }
30276export const ListSkillsParams = Schema.Struct({
30277 "limit": Schema.optionalKey(
30278 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
30279 ),
30280 "order": Schema.optionalKey(OrderEnum),
30281 "after": Schema.optionalKey(
30282 Schema.String.annotate({ "description": "Identifier for the last item from the previous pagination request" })
30283 )
30284})
30285export type ListSkills200 = SkillListResource
30286export const ListSkills200 = SkillListResource
30287export type CreateSkillRequestJson = CreateSkillBody
30288export const CreateSkillRequestJson = CreateSkillBody
30289export type CreateSkillRequestFormData = CreateSkillBody
30290export const CreateSkillRequestFormData = CreateSkillBody
30291export type CreateSkill200 = SkillResource
30292export const CreateSkill200 = SkillResource
30293export type GetSkill200 = SkillResource
30294export const GetSkill200 = SkillResource
30295export type UpdateSkillDefaultVersionRequestJson = SetDefaultSkillVersionBody
30296export const UpdateSkillDefaultVersionRequestJson = SetDefaultSkillVersionBody
30297export type UpdateSkillDefaultVersionRequestFormUrlEncoded = SetDefaultSkillVersionBody
30298export const UpdateSkillDefaultVersionRequestFormUrlEncoded = SetDefaultSkillVersionBody
30299export type UpdateSkillDefaultVersion200 = SkillResource
30300export const UpdateSkillDefaultVersion200 = SkillResource
30301export type DeleteSkill200 = DeletedSkillResource
30302export const DeleteSkill200 = DeletedSkillResource
30303export type GetSkillContent200 = string
30304export const GetSkillContent200 = Schema.String
30305export type ListSkillVersionsParams = {
30306 readonly "limit"?: number
30307 readonly "order"?: OrderEnum
30308 readonly "after"?: string
30309}
30310export const ListSkillVersionsParams = Schema.Struct({
30311 "limit": Schema.optionalKey(
30312 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
30313 ),
30314 "order": Schema.optionalKey(OrderEnum),
30315 "after": Schema.optionalKey(Schema.String)
30316})
30317export type ListSkillVersions200 = SkillVersionListResource
30318export const ListSkillVersions200 = SkillVersionListResource
30319export type CreateSkillVersionRequestJson = CreateSkillVersionBody
30320export const CreateSkillVersionRequestJson = CreateSkillVersionBody
30321export type CreateSkillVersionRequestFormData = CreateSkillVersionBody
30322export const CreateSkillVersionRequestFormData = CreateSkillVersionBody
30323export type CreateSkillVersion200 = SkillVersionResource
30324export const CreateSkillVersion200 = SkillVersionResource
30325export type GetSkillVersion200 = SkillVersionResource
30326export const GetSkillVersion200 = SkillVersionResource
30327export type DeleteSkillVersion200 = DeletedSkillVersionResource
30328export const DeleteSkillVersion200 = DeletedSkillVersionResource
30329export type GetSkillVersionContent200 = string
30330export const GetSkillVersionContent200 = Schema.String
30331export type CancelChatSessionMethod200 = ChatSessionResource
30332export const CancelChatSessionMethod200 = ChatSessionResource
30333export type CreateChatSessionMethodRequestJson = CreateChatSessionBody
30334export const CreateChatSessionMethodRequestJson = CreateChatSessionBody
30335export type CreateChatSessionMethod200 = ChatSessionResource
30336export const CreateChatSessionMethod200 = ChatSessionResource
30337export type ListThreadItemsMethodParams = {
30338 readonly "limit"?: number
30339 readonly "order"?: OrderEnum
30340 readonly "after"?: string
30341 readonly "before"?: string
30342}
30343export const ListThreadItemsMethodParams = Schema.Struct({
30344 "limit": Schema.optionalKey(
30345 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
30346 ),
30347 "order": Schema.optionalKey(OrderEnum),
30348 "after": Schema.optionalKey(
30349 Schema.String.annotate({
30350 "description": "List items created after this thread item ID. Defaults to null for the first page."
30351 })
30352 ),
30353 "before": Schema.optionalKey(
30354 Schema.String.annotate({
30355 "description": "List items created before this thread item ID. Defaults to null for the newest results."
30356 })
30357 )
30358})
30359export type ListThreadItemsMethod200 = ThreadItemListResource
30360export const ListThreadItemsMethod200 = ThreadItemListResource
30361export type GetThreadMethod200 = ThreadResource
30362export const GetThreadMethod200 = ThreadResource
30363export type DeleteThreadMethod200 = DeletedThreadResource
30364export const DeleteThreadMethod200 = DeletedThreadResource
30365export type ListThreadsMethodParams = {
30366 readonly "limit"?: number
30367 readonly "order"?: OrderEnum
30368 readonly "after"?: string
30369 readonly "before"?: string
30370 readonly "user"?: string
30371}
30372export const ListThreadsMethodParams = Schema.Struct({
30373 "limit": Schema.optionalKey(
30374 Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100))
30375 ),
30376 "order": Schema.optionalKey(OrderEnum),
30377 "after": Schema.optionalKey(
30378 Schema.String.annotate({
30379 "description": "List items created after this thread item ID. Defaults to null for the first page."
30380 })
30381 ),
30382 "before": Schema.optionalKey(
30383 Schema.String.annotate({
30384 "description": "List items created before this thread item ID. Defaults to null for the newest results."
30385 })
30386 ),
30387 "user": Schema.optionalKey(
30388 Schema.String.annotate({
30389 "description": "Filter threads that belong to this user identifier. Defaults to null to return all users."
30390 }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(512))
30391 )
30392})
30393export type ListThreadsMethod200 = ThreadListResource
30394export const ListThreadsMethod200 = ThreadListResource
30395
30396export interface OperationConfig {
30397 /**
30398 * Whether or not the response should be included in the value returned from
30399 * an operation.
30400 *
30401 * If set to `true`, a tuple of `[A, HttpClientResponse]` will be returned,
30402 * where `A` is the success type of the operation.
30403 *
30404 * If set to `false`, only the success type of the operation will be returned.
30405 */
30406 readonly includeResponse?: boolean | undefined
30407}
30408
30409/**
30410 * A utility type which optionally includes the response in the return result
30411 * of an operation based upon the value of the `includeResponse` configuration
30412 * option.
30413 */
30414export type WithOptionalResponse<A, Config extends OperationConfig> = Config extends {
30415 readonly includeResponse: true
30416} ? [A, HttpClientResponse.HttpClientResponse] :
30417 A
30418
30419export const make = (
30420 httpClient: HttpClient.HttpClient,
30421 options: {
30422 readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect<HttpClient.HttpClient>) | undefined
30423 } = {}
30424): OpenAiClient => {
30425 const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) =>
30426 Effect.flatMap(
30427 Effect.orElseSucceed(response.json, () => "Unexpected status code"),
30428 (description) =>
30429 Effect.fail(
30430 new HttpClientError.HttpClientError({
30431 reason: new HttpClientError.StatusCodeError({
30432 request: response.request,
30433 response,
30434 description: typeof description === "string" ? description : JSON.stringify(description)
30435 })
30436 })
30437 )
30438 )
30439 const withResponse = <Config extends OperationConfig>(config: Config | undefined) =>
30440 (
30441 f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<any, any>
30442 ): (request: HttpClientRequest.HttpClientRequest) => Effect.Effect<any, any> => {
30443 const withOptionalResponse = (
30444 config?.includeResponse
30445 ? (response: HttpClientResponse.HttpClientResponse) => Effect.map(f(response), (a) => [a, response])
30446 : (response: HttpClientResponse.HttpClientResponse) => f(response)
30447 ) as any
30448 return options?.transformClient
30449 ? (request) =>
30450 Effect.flatMap(
30451 Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)),
30452 withOptionalResponse
30453 )
30454 : (request) => Effect.flatMap(httpClient.execute(request), withOptionalResponse)
30455 }
30456 const sseRequest = <
30457 Type,
30458 DecodingServices
30459 >(
30460 schema: Schema.ConstraintDecoder<Type, DecodingServices>
30461 ) =>
30462 (
30463 request: HttpClientRequest.HttpClientRequest
30464 ): Stream.Stream<
30465 { readonly event: string; readonly id: string | undefined; readonly data: Type },
30466 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
30467 DecodingServices
30468 > =>
30469 HttpClient.filterStatusOk(httpClient).execute(request).pipe(
30470 Effect.map((response) => response.stream),
30471 Stream.unwrap,
30472 Stream.decodeText(),
30473 Stream.pipeThroughChannel(Sse.decodeDataSchema(schema))
30474 )
30475 const binaryRequest = (
30476 request: HttpClientRequest.HttpClientRequest
30477 ): Stream.Stream<Uint8Array, HttpClientError.HttpClientError> =>
30478 HttpClient.filterStatusOk(httpClient).execute(request).pipe(
30479 Effect.map((response) => response.stream),
30480 Stream.unwrap
30481 )
30482 const decodeSuccess =
30483 <Schema extends Schema.Constraint>(schema: Schema) => (response: HttpClientResponse.HttpClientResponse) =>
30484 HttpClientResponse.schemaBodyJson(schema)(response)
30485 const decodeError =
30486 <const Tag extends string, Schema extends Schema.Constraint>(tag: Tag, schema: Schema) =>
30487 (response: HttpClientResponse.HttpClientResponse) =>
30488 Effect.flatMap(
30489 HttpClientResponse.schemaBodyJson(schema)(response),
30490 (cause) => Effect.fail(OpenAiClientError(tag, cause, response))
30491 )
30492 return {
30493 httpClient,
30494 "listAssistants": (options) =>
30495 HttpClientRequest.get(`/assistants`).pipe(
30496 HttpClientRequest.setUrlParams({
30497 "limit": options?.params?.["limit"] as any,
30498 "order": options?.params?.["order"] as any,
30499 "after": options?.params?.["after"] as any,
30500 "before": options?.params?.["before"] as any
30501 }),
30502 withResponse(options?.config)(HttpClientResponse.matchStatus({
30503 "2xx": decodeSuccess(ListAssistants200),
30504 orElse: unexpectedStatus
30505 }))
30506 ),
30507 "createAssistant": (options) =>
30508 HttpClientRequest.post(`/assistants`).pipe(
30509 HttpClientRequest.bodyJsonUnsafe(options.payload),
30510 withResponse(options.config)(HttpClientResponse.matchStatus({
30511 "2xx": decodeSuccess(CreateAssistant200),
30512 orElse: unexpectedStatus
30513 }))
30514 ),
30515 "getAssistant": (assistantId, options) =>
30516 HttpClientRequest.get(`/assistants/${assistantId}`).pipe(
30517 withResponse(options?.config)(HttpClientResponse.matchStatus({
30518 "2xx": decodeSuccess(GetAssistant200),
30519 orElse: unexpectedStatus
30520 }))
30521 ),
30522 "modifyAssistant": (assistantId, options) =>
30523 HttpClientRequest.post(`/assistants/${assistantId}`).pipe(
30524 HttpClientRequest.bodyJsonUnsafe(options.payload),
30525 withResponse(options.config)(HttpClientResponse.matchStatus({
30526 "2xx": decodeSuccess(ModifyAssistant200),
30527 orElse: unexpectedStatus
30528 }))
30529 ),
30530 "deleteAssistant": (assistantId, options) =>
30531 HttpClientRequest.delete(`/assistants/${assistantId}`).pipe(
30532 withResponse(options?.config)(HttpClientResponse.matchStatus({
30533 "2xx": decodeSuccess(DeleteAssistant200),
30534 orElse: unexpectedStatus
30535 }))
30536 ),
30537 "createSpeech": (options) =>
30538 HttpClientRequest.post(`/audio/speech`).pipe(
30539 HttpClientRequest.bodyJsonUnsafe(options.payload),
30540 withResponse(options.config)(HttpClientResponse.matchStatus({
30541 orElse: unexpectedStatus
30542 }))
30543 ),
30544 "createSpeechSse": (options) =>
30545 HttpClientRequest.post(`/audio/speech`).pipe(
30546 HttpClientRequest.bodyJsonUnsafe(options.payload),
30547 sseRequest(CreateSpeech200Sse)
30548 ),
30549 "createSpeechStream": (options) =>
30550 HttpClientRequest.post(`/audio/speech`).pipe(
30551 HttpClientRequest.bodyJsonUnsafe(options.payload),
30552 binaryRequest
30553 ),
30554 "createTranscription": (options) =>
30555 HttpClientRequest.post(`/audio/transcriptions`).pipe(
30556 HttpClientRequest.bodyFormData(options.payload as any),
30557 withResponse(options.config)(HttpClientResponse.matchStatus({
30558 "2xx": decodeSuccess(CreateTranscription200),
30559 orElse: unexpectedStatus
30560 }))
30561 ),
30562 "createTranscriptionSse": (options) =>
30563 HttpClientRequest.post(`/audio/transcriptions`).pipe(
30564 HttpClientRequest.bodyFormData(options.payload as any),
30565 sseRequest(CreateTranscription200Sse)
30566 ),
30567 "createTranslation": (options) =>
30568 HttpClientRequest.post(`/audio/translations`).pipe(
30569 HttpClientRequest.bodyFormData(options.payload as any),
30570 withResponse(options.config)(HttpClientResponse.matchStatus({
30571 "2xx": decodeSuccess(CreateTranslation200),
30572 orElse: unexpectedStatus
30573 }))
30574 ),
30575 "listVoiceConsents": (options) =>
30576 HttpClientRequest.get(`/audio/voice_consents`).pipe(
30577 HttpClientRequest.setUrlParams({
30578 "after": options?.params?.["after"] as any,
30579 "limit": options?.params?.["limit"] as any
30580 }),
30581 withResponse(options?.config)(HttpClientResponse.matchStatus({
30582 "2xx": decodeSuccess(ListVoiceConsents200),
30583 orElse: unexpectedStatus
30584 }))
30585 ),
30586 "createVoiceConsent": (options) =>
30587 HttpClientRequest.post(`/audio/voice_consents`).pipe(
30588 HttpClientRequest.bodyFormData(options.payload as any),
30589 withResponse(options.config)(HttpClientResponse.matchStatus({
30590 "2xx": decodeSuccess(CreateVoiceConsent200),
30591 orElse: unexpectedStatus
30592 }))
30593 ),
30594 "getVoiceConsent": (consentId, options) =>
30595 HttpClientRequest.get(`/audio/voice_consents/${consentId}`).pipe(
30596 withResponse(options?.config)(HttpClientResponse.matchStatus({
30597 "2xx": decodeSuccess(GetVoiceConsent200),
30598 orElse: unexpectedStatus
30599 }))
30600 ),
30601 "updateVoiceConsent": (consentId, options) =>
30602 HttpClientRequest.post(`/audio/voice_consents/${consentId}`).pipe(
30603 HttpClientRequest.bodyJsonUnsafe(options.payload),
30604 withResponse(options.config)(HttpClientResponse.matchStatus({
30605 "2xx": decodeSuccess(UpdateVoiceConsent200),
30606 orElse: unexpectedStatus
30607 }))
30608 ),
30609 "deleteVoiceConsent": (consentId, options) =>
30610 HttpClientRequest.delete(`/audio/voice_consents/${consentId}`).pipe(
30611 withResponse(options?.config)(HttpClientResponse.matchStatus({
30612 "2xx": decodeSuccess(DeleteVoiceConsent200),
30613 orElse: unexpectedStatus
30614 }))
30615 ),
30616 "createVoice": (options) =>
30617 HttpClientRequest.post(`/audio/voices`).pipe(
30618 HttpClientRequest.bodyFormData(options.payload as any),
30619 withResponse(options.config)(HttpClientResponse.matchStatus({
30620 "2xx": decodeSuccess(CreateVoice200),
30621 orElse: unexpectedStatus
30622 }))
30623 ),
30624 "listBatches": (options) =>
30625 HttpClientRequest.get(`/batches`).pipe(
30626 HttpClientRequest.setUrlParams({
30627 "after": options?.params?.["after"] as any,
30628 "limit": options?.params?.["limit"] as any
30629 }),
30630 withResponse(options?.config)(HttpClientResponse.matchStatus({
30631 "2xx": decodeSuccess(ListBatches200),
30632 orElse: unexpectedStatus
30633 }))
30634 ),
30635 "createBatch": (options) =>
30636 HttpClientRequest.post(`/batches`).pipe(
30637 HttpClientRequest.bodyJsonUnsafe(options.payload),
30638 withResponse(options.config)(HttpClientResponse.matchStatus({
30639 "2xx": decodeSuccess(CreateBatch200),
30640 orElse: unexpectedStatus
30641 }))
30642 ),
30643 "retrieveBatch": (batchId, options) =>
30644 HttpClientRequest.get(`/batches/${batchId}`).pipe(
30645 withResponse(options?.config)(HttpClientResponse.matchStatus({
30646 "2xx": decodeSuccess(RetrieveBatch200),
30647 orElse: unexpectedStatus
30648 }))
30649 ),
30650 "cancelBatch": (batchId, options) =>
30651 HttpClientRequest.post(`/batches/${batchId}/cancel`).pipe(
30652 withResponse(options?.config)(HttpClientResponse.matchStatus({
30653 "2xx": decodeSuccess(CancelBatch200),
30654 orElse: unexpectedStatus
30655 }))
30656 ),
30657 "listChatCompletions": (options) =>
30658 HttpClientRequest.get(`/chat/completions`).pipe(
30659 HttpClientRequest.setUrlParams({
30660 "model": options?.params?.["model"] as any,
30661 "metadata": options?.params?.["metadata"] as any,
30662 "after": options?.params?.["after"] as any,
30663 "limit": options?.params?.["limit"] as any,
30664 "order": options?.params?.["order"] as any
30665 }),
30666 withResponse(options?.config)(HttpClientResponse.matchStatus({
30667 "2xx": decodeSuccess(ListChatCompletions200),
30668 orElse: unexpectedStatus
30669 }))
30670 ),
30671 "createChatCompletion": (options) =>
30672 HttpClientRequest.post(`/chat/completions`).pipe(
30673 HttpClientRequest.bodyJsonUnsafe(options.payload),
30674 withResponse(options.config)(HttpClientResponse.matchStatus({
30675 "2xx": decodeSuccess(CreateChatCompletion200),
30676 orElse: unexpectedStatus
30677 }))
30678 ),
30679 "createChatCompletionSse": (options) =>
30680 HttpClientRequest.post(`/chat/completions`).pipe(
30681 HttpClientRequest.bodyJsonUnsafe(options.payload),
30682 sseRequest(CreateChatCompletion200Sse)
30683 ),
30684 "getChatCompletion": (completionId, options) =>
30685 HttpClientRequest.get(`/chat/completions/${completionId}`).pipe(
30686 withResponse(options?.config)(HttpClientResponse.matchStatus({
30687 "2xx": decodeSuccess(GetChatCompletion200),
30688 orElse: unexpectedStatus
30689 }))
30690 ),
30691 "updateChatCompletion": (completionId, options) =>
30692 HttpClientRequest.post(`/chat/completions/${completionId}`).pipe(
30693 HttpClientRequest.bodyJsonUnsafe(options.payload),
30694 withResponse(options.config)(HttpClientResponse.matchStatus({
30695 "2xx": decodeSuccess(UpdateChatCompletion200),
30696 orElse: unexpectedStatus
30697 }))
30698 ),
30699 "deleteChatCompletion": (completionId, options) =>
30700 HttpClientRequest.delete(`/chat/completions/${completionId}`).pipe(
30701 withResponse(options?.config)(HttpClientResponse.matchStatus({
30702 "2xx": decodeSuccess(DeleteChatCompletion200),
30703 orElse: unexpectedStatus
30704 }))
30705 ),
30706 "getChatCompletionMessages": (completionId, options) =>
30707 HttpClientRequest.get(`/chat/completions/${completionId}/messages`).pipe(
30708 HttpClientRequest.setUrlParams({
30709 "after": options?.params?.["after"] as any,
30710 "limit": options?.params?.["limit"] as any,
30711 "order": options?.params?.["order"] as any
30712 }),
30713 withResponse(options?.config)(HttpClientResponse.matchStatus({
30714 "2xx": decodeSuccess(GetChatCompletionMessages200),
30715 orElse: unexpectedStatus
30716 }))
30717 ),
30718 "createCompletion": (options) =>
30719 HttpClientRequest.post(`/completions`).pipe(
30720 HttpClientRequest.bodyJsonUnsafe(options.payload),
30721 withResponse(options.config)(HttpClientResponse.matchStatus({
30722 "2xx": decodeSuccess(CreateCompletion200),
30723 orElse: unexpectedStatus
30724 }))
30725 ),
30726 "ListContainers": (options) =>
30727 HttpClientRequest.get(`/containers`).pipe(
30728 HttpClientRequest.setUrlParams({
30729 "limit": options?.params?.["limit"] as any,
30730 "order": options?.params?.["order"] as any,
30731 "after": options?.params?.["after"] as any,
30732 "name": options?.params?.["name"] as any
30733 }),
30734 withResponse(options?.config)(HttpClientResponse.matchStatus({
30735 "2xx": decodeSuccess(ListContainers200),
30736 orElse: unexpectedStatus
30737 }))
30738 ),
30739 "CreateContainer": (options) =>
30740 HttpClientRequest.post(`/containers`).pipe(
30741 HttpClientRequest.bodyJsonUnsafe(options.payload),
30742 withResponse(options.config)(HttpClientResponse.matchStatus({
30743 "2xx": decodeSuccess(CreateContainer200),
30744 orElse: unexpectedStatus
30745 }))
30746 ),
30747 "RetrieveContainer": (containerId, options) =>
30748 HttpClientRequest.get(`/containers/${containerId}`).pipe(
30749 withResponse(options?.config)(HttpClientResponse.matchStatus({
30750 "2xx": decodeSuccess(RetrieveContainer200),
30751 orElse: unexpectedStatus
30752 }))
30753 ),
30754 "DeleteContainer": (containerId, options) =>
30755 HttpClientRequest.delete(`/containers/${containerId}`).pipe(
30756 withResponse(options?.config)(HttpClientResponse.matchStatus({
30757 "200": () => Effect.void,
30758 orElse: unexpectedStatus
30759 }))
30760 ),
30761 "ListContainerFiles": (containerId, options) =>
30762 HttpClientRequest.get(`/containers/${containerId}/files`).pipe(
30763 HttpClientRequest.setUrlParams({
30764 "limit": options?.params?.["limit"] as any,
30765 "order": options?.params?.["order"] as any,
30766 "after": options?.params?.["after"] as any
30767 }),
30768 withResponse(options?.config)(HttpClientResponse.matchStatus({
30769 "2xx": decodeSuccess(ListContainerFiles200),
30770 orElse: unexpectedStatus
30771 }))
30772 ),
30773 "CreateContainerFile": (containerId, options) =>
30774 HttpClientRequest.post(`/containers/${containerId}/files`).pipe(
30775 HttpClientRequest.bodyFormData(options.payload as any),
30776 withResponse(options.config)(HttpClientResponse.matchStatus({
30777 "2xx": decodeSuccess(CreateContainerFile200),
30778 orElse: unexpectedStatus
30779 }))
30780 ),
30781 "RetrieveContainerFile": (containerId, fileId, options) =>
30782 HttpClientRequest.get(`/containers/${containerId}/files/${fileId}`).pipe(
30783 withResponse(options?.config)(HttpClientResponse.matchStatus({
30784 "2xx": decodeSuccess(RetrieveContainerFile200),
30785 orElse: unexpectedStatus
30786 }))
30787 ),
30788 "DeleteContainerFile": (containerId, fileId, options) =>
30789 HttpClientRequest.delete(`/containers/${containerId}/files/${fileId}`).pipe(
30790 withResponse(options?.config)(HttpClientResponse.matchStatus({
30791 "200": () => Effect.void,
30792 orElse: unexpectedStatus
30793 }))
30794 ),
30795 "RetrieveContainerFileContent": (containerId, fileId, options) =>
30796 HttpClientRequest.get(`/containers/${containerId}/files/${fileId}/content`).pipe(
30797 withResponse(options?.config)(HttpClientResponse.matchStatus({
30798 "200": () => Effect.void,
30799 orElse: unexpectedStatus
30800 }))
30801 ),
30802 "listConversationItems": (conversationId, options) =>
30803 HttpClientRequest.get(`/conversations/${conversationId}/items`).pipe(
30804 HttpClientRequest.setUrlParams({
30805 "limit": options?.params?.["limit"] as any,
30806 "order": options?.params?.["order"] as any,
30807 "after": options?.params?.["after"] as any,
30808 "include": options?.params?.["include"] as any
30809 }),
30810 withResponse(options?.config)(HttpClientResponse.matchStatus({
30811 "2xx": decodeSuccess(ListConversationItems200),
30812 orElse: unexpectedStatus
30813 }))
30814 ),
30815 "createConversationItems": (conversationId, options) =>
30816 HttpClientRequest.post(`/conversations/${conversationId}/items`).pipe(
30817 HttpClientRequest.setUrlParams({ "include": options.params?.["include"] as any }),
30818 HttpClientRequest.bodyJsonUnsafe(options.payload),
30819 withResponse(options.config)(HttpClientResponse.matchStatus({
30820 "2xx": decodeSuccess(CreateConversationItems200),
30821 orElse: unexpectedStatus
30822 }))
30823 ),
30824 "getConversationItem": (conversationId, itemId, options) =>
30825 HttpClientRequest.get(`/conversations/${conversationId}/items/${itemId}`).pipe(
30826 HttpClientRequest.setUrlParams({ "include": options?.params?.["include"] as any }),
30827 withResponse(options?.config)(HttpClientResponse.matchStatus({
30828 "2xx": decodeSuccess(GetConversationItem200),
30829 orElse: unexpectedStatus
30830 }))
30831 ),
30832 "deleteConversationItem": (conversationId, itemId, options) =>
30833 HttpClientRequest.delete(`/conversations/${conversationId}/items/${itemId}`).pipe(
30834 withResponse(options?.config)(HttpClientResponse.matchStatus({
30835 "2xx": decodeSuccess(DeleteConversationItem200),
30836 orElse: unexpectedStatus
30837 }))
30838 ),
30839 "createEmbedding": (options) =>
30840 HttpClientRequest.post(`/embeddings`).pipe(
30841 HttpClientRequest.bodyJsonUnsafe(options.payload),
30842 withResponse(options.config)(HttpClientResponse.matchStatus({
30843 "2xx": decodeSuccess(CreateEmbedding200),
30844 orElse: unexpectedStatus
30845 }))
30846 ),
30847 "listEvals": (options) =>
30848 HttpClientRequest.get(`/evals`).pipe(
30849 HttpClientRequest.setUrlParams({
30850 "after": options?.params?.["after"] as any,
30851 "limit": options?.params?.["limit"] as any,
30852 "order": options?.params?.["order"] as any,
30853 "order_by": options?.params?.["order_by"] as any
30854 }),
30855 withResponse(options?.config)(HttpClientResponse.matchStatus({
30856 "2xx": decodeSuccess(ListEvals200),
30857 orElse: unexpectedStatus
30858 }))
30859 ),
30860 "createEval": (options) =>
30861 HttpClientRequest.post(`/evals`).pipe(
30862 HttpClientRequest.bodyJsonUnsafe(options.payload),
30863 withResponse(options.config)(HttpClientResponse.matchStatus({
30864 "2xx": decodeSuccess(CreateEval201),
30865 orElse: unexpectedStatus
30866 }))
30867 ),
30868 "getEval": (evalId, options) =>
30869 HttpClientRequest.get(`/evals/${evalId}`).pipe(
30870 withResponse(options?.config)(HttpClientResponse.matchStatus({
30871 "2xx": decodeSuccess(GetEval200),
30872 orElse: unexpectedStatus
30873 }))
30874 ),
30875 "updateEval": (evalId, options) =>
30876 HttpClientRequest.post(`/evals/${evalId}`).pipe(
30877 HttpClientRequest.bodyJsonUnsafe(options.payload),
30878 withResponse(options.config)(HttpClientResponse.matchStatus({
30879 "2xx": decodeSuccess(UpdateEval200),
30880 orElse: unexpectedStatus
30881 }))
30882 ),
30883 "deleteEval": (evalId, options) =>
30884 HttpClientRequest.delete(`/evals/${evalId}`).pipe(
30885 withResponse(options?.config)(HttpClientResponse.matchStatus({
30886 "2xx": decodeSuccess(DeleteEval200),
30887 "404": decodeError("DeleteEval404", DeleteEval404),
30888 orElse: unexpectedStatus
30889 }))
30890 ),
30891 "getEvalRuns": (evalId, options) =>
30892 HttpClientRequest.get(`/evals/${evalId}/runs`).pipe(
30893 HttpClientRequest.setUrlParams({
30894 "after": options?.params?.["after"] as any,
30895 "limit": options?.params?.["limit"] as any,
30896 "order": options?.params?.["order"] as any,
30897 "status": options?.params?.["status"] as any
30898 }),
30899 withResponse(options?.config)(HttpClientResponse.matchStatus({
30900 "2xx": decodeSuccess(GetEvalRuns200),
30901 orElse: unexpectedStatus
30902 }))
30903 ),
30904 "createEvalRun": (evalId, options) =>
30905 HttpClientRequest.post(`/evals/${evalId}/runs`).pipe(
30906 HttpClientRequest.bodyJsonUnsafe(options.payload),
30907 withResponse(options.config)(HttpClientResponse.matchStatus({
30908 "2xx": decodeSuccess(CreateEvalRun201),
30909 "400": decodeError("CreateEvalRun400", CreateEvalRun400),
30910 orElse: unexpectedStatus
30911 }))
30912 ),
30913 "getEvalRun": (evalId, runId, options) =>
30914 HttpClientRequest.get(`/evals/${evalId}/runs/${runId}`).pipe(
30915 withResponse(options?.config)(HttpClientResponse.matchStatus({
30916 "2xx": decodeSuccess(GetEvalRun200),
30917 orElse: unexpectedStatus
30918 }))
30919 ),
30920 "cancelEvalRun": (evalId, runId, options) =>
30921 HttpClientRequest.post(`/evals/${evalId}/runs/${runId}`).pipe(
30922 withResponse(options?.config)(HttpClientResponse.matchStatus({
30923 "2xx": decodeSuccess(CancelEvalRun200),
30924 orElse: unexpectedStatus
30925 }))
30926 ),
30927 "deleteEvalRun": (evalId, runId, options) =>
30928 HttpClientRequest.delete(`/evals/${evalId}/runs/${runId}`).pipe(
30929 withResponse(options?.config)(HttpClientResponse.matchStatus({
30930 "2xx": decodeSuccess(DeleteEvalRun200),
30931 "404": decodeError("DeleteEvalRun404", DeleteEvalRun404),
30932 orElse: unexpectedStatus
30933 }))
30934 ),
30935 "getEvalRunOutputItems": (evalId, runId, options) =>
30936 HttpClientRequest.get(`/evals/${evalId}/runs/${runId}/output_items`).pipe(
30937 HttpClientRequest.setUrlParams({
30938 "after": options?.params?.["after"] as any,
30939 "limit": options?.params?.["limit"] as any,
30940 "status": options?.params?.["status"] as any,
30941 "order": options?.params?.["order"] as any
30942 }),
30943 withResponse(options?.config)(HttpClientResponse.matchStatus({
30944 "2xx": decodeSuccess(GetEvalRunOutputItems200),
30945 orElse: unexpectedStatus
30946 }))
30947 ),
30948 "getEvalRunOutputItem": (evalId, runId, outputItemId, options) =>
30949 HttpClientRequest.get(`/evals/${evalId}/runs/${runId}/output_items/${outputItemId}`).pipe(
30950 withResponse(options?.config)(HttpClientResponse.matchStatus({
30951 "2xx": decodeSuccess(GetEvalRunOutputItem200),
30952 orElse: unexpectedStatus
30953 }))
30954 ),
30955 "listFiles": (options) =>
30956 HttpClientRequest.get(`/files`).pipe(
30957 HttpClientRequest.setUrlParams({
30958 "purpose": options?.params?.["purpose"] as any,
30959 "limit": options?.params?.["limit"] as any,
30960 "order": options?.params?.["order"] as any,
30961 "after": options?.params?.["after"] as any
30962 }),
30963 withResponse(options?.config)(HttpClientResponse.matchStatus({
30964 "2xx": decodeSuccess(ListFiles200),
30965 orElse: unexpectedStatus
30966 }))
30967 ),
30968 "createFile": (options) =>
30969 HttpClientRequest.post(`/files`).pipe(
30970 HttpClientRequest.bodyFormData(options.payload as any),
30971 withResponse(options.config)(HttpClientResponse.matchStatus({
30972 "2xx": decodeSuccess(CreateFile200),
30973 orElse: unexpectedStatus
30974 }))
30975 ),
30976 "retrieveFile": (fileId, options) =>
30977 HttpClientRequest.get(`/files/${fileId}`).pipe(
30978 withResponse(options?.config)(HttpClientResponse.matchStatus({
30979 "2xx": decodeSuccess(RetrieveFile200),
30980 orElse: unexpectedStatus
30981 }))
30982 ),
30983 "deleteFile": (fileId, options) =>
30984 HttpClientRequest.delete(`/files/${fileId}`).pipe(
30985 withResponse(options?.config)(HttpClientResponse.matchStatus({
30986 "2xx": decodeSuccess(DeleteFile200),
30987 orElse: unexpectedStatus
30988 }))
30989 ),
30990 "downloadFile": (fileId, options) =>
30991 HttpClientRequest.get(`/files/${fileId}/content`).pipe(
30992 withResponse(options?.config)(HttpClientResponse.matchStatus({
30993 "2xx": decodeSuccess(DownloadFile200),
30994 orElse: unexpectedStatus
30995 }))
30996 ),
30997 "runGrader": (options) =>
30998 HttpClientRequest.post(`/fine_tuning/alpha/graders/run`).pipe(
30999 HttpClientRequest.bodyJsonUnsafe(options.payload),
31000 withResponse(options.config)(HttpClientResponse.matchStatus({
31001 "2xx": decodeSuccess(RunGrader200),
31002 orElse: unexpectedStatus
31003 }))
31004 ),
31005 "validateGrader": (options) =>
31006 HttpClientRequest.post(`/fine_tuning/alpha/graders/validate`).pipe(
31007 HttpClientRequest.bodyJsonUnsafe(options.payload),
31008 withResponse(options.config)(HttpClientResponse.matchStatus({
31009 "2xx": decodeSuccess(ValidateGrader200),
31010 orElse: unexpectedStatus
31011 }))
31012 ),
31013 "listFineTuningCheckpointPermissions": (fineTunedModelCheckpoint, options) =>
31014 HttpClientRequest.get(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`).pipe(
31015 HttpClientRequest.setUrlParams({
31016 "project_id": options?.params?.["project_id"] as any,
31017 "after": options?.params?.["after"] as any,
31018 "limit": options?.params?.["limit"] as any,
31019 "order": options?.params?.["order"] as any
31020 }),
31021 withResponse(options?.config)(HttpClientResponse.matchStatus({
31022 "2xx": decodeSuccess(ListFineTuningCheckpointPermissions200),
31023 orElse: unexpectedStatus
31024 }))
31025 ),
31026 "createFineTuningCheckpointPermission": (fineTunedModelCheckpoint, options) =>
31027 HttpClientRequest.post(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`).pipe(
31028 HttpClientRequest.bodyJsonUnsafe(options.payload),
31029 withResponse(options.config)(HttpClientResponse.matchStatus({
31030 "2xx": decodeSuccess(CreateFineTuningCheckpointPermission200),
31031 orElse: unexpectedStatus
31032 }))
31033 ),
31034 "deleteFineTuningCheckpointPermission": (fineTunedModelCheckpoint, permissionId, options) =>
31035 HttpClientRequest.delete(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions/${permissionId}`).pipe(
31036 withResponse(options?.config)(HttpClientResponse.matchStatus({
31037 "2xx": decodeSuccess(DeleteFineTuningCheckpointPermission200),
31038 orElse: unexpectedStatus
31039 }))
31040 ),
31041 "listPaginatedFineTuningJobs": (options) =>
31042 HttpClientRequest.get(`/fine_tuning/jobs`).pipe(
31043 HttpClientRequest.setUrlParams({
31044 "after": options?.params?.["after"] as any,
31045 "limit": options?.params?.["limit"] as any,
31046 "metadata": options?.params?.["metadata"] as any
31047 }),
31048 withResponse(options?.config)(HttpClientResponse.matchStatus({
31049 "2xx": decodeSuccess(ListPaginatedFineTuningJobs200),
31050 orElse: unexpectedStatus
31051 }))
31052 ),
31053 "createFineTuningJob": (options) =>
31054 HttpClientRequest.post(`/fine_tuning/jobs`).pipe(
31055 HttpClientRequest.bodyJsonUnsafe(options.payload),
31056 withResponse(options.config)(HttpClientResponse.matchStatus({
31057 "2xx": decodeSuccess(CreateFineTuningJob200),
31058 orElse: unexpectedStatus
31059 }))
31060 ),
31061 "retrieveFineTuningJob": (fineTuningJobId, options) =>
31062 HttpClientRequest.get(`/fine_tuning/jobs/${fineTuningJobId}`).pipe(
31063 withResponse(options?.config)(HttpClientResponse.matchStatus({
31064 "2xx": decodeSuccess(RetrieveFineTuningJob200),
31065 orElse: unexpectedStatus
31066 }))
31067 ),
31068 "cancelFineTuningJob": (fineTuningJobId, options) =>
31069 HttpClientRequest.post(`/fine_tuning/jobs/${fineTuningJobId}/cancel`).pipe(
31070 withResponse(options?.config)(HttpClientResponse.matchStatus({
31071 "2xx": decodeSuccess(CancelFineTuningJob200),
31072 orElse: unexpectedStatus
31073 }))
31074 ),
31075 "listFineTuningJobCheckpoints": (fineTuningJobId, options) =>
31076 HttpClientRequest.get(`/fine_tuning/jobs/${fineTuningJobId}/checkpoints`).pipe(
31077 HttpClientRequest.setUrlParams({
31078 "after": options?.params?.["after"] as any,
31079 "limit": options?.params?.["limit"] as any
31080 }),
31081 withResponse(options?.config)(HttpClientResponse.matchStatus({
31082 "2xx": decodeSuccess(ListFineTuningJobCheckpoints200),
31083 orElse: unexpectedStatus
31084 }))
31085 ),
31086 "listFineTuningEvents": (fineTuningJobId, options) =>
31087 HttpClientRequest.get(`/fine_tuning/jobs/${fineTuningJobId}/events`).pipe(
31088 HttpClientRequest.setUrlParams({
31089 "after": options?.params?.["after"] as any,
31090 "limit": options?.params?.["limit"] as any
31091 }),
31092 withResponse(options?.config)(HttpClientResponse.matchStatus({
31093 "2xx": decodeSuccess(ListFineTuningEvents200),
31094 orElse: unexpectedStatus
31095 }))
31096 ),
31097 "pauseFineTuningJob": (fineTuningJobId, options) =>
31098 HttpClientRequest.post(`/fine_tuning/jobs/${fineTuningJobId}/pause`).pipe(
31099 withResponse(options?.config)(HttpClientResponse.matchStatus({
31100 "2xx": decodeSuccess(PauseFineTuningJob200),
31101 orElse: unexpectedStatus
31102 }))
31103 ),
31104 "resumeFineTuningJob": (fineTuningJobId, options) =>
31105 HttpClientRequest.post(`/fine_tuning/jobs/${fineTuningJobId}/resume`).pipe(
31106 withResponse(options?.config)(HttpClientResponse.matchStatus({
31107 "2xx": decodeSuccess(ResumeFineTuningJob200),
31108 orElse: unexpectedStatus
31109 }))
31110 ),
31111 "createImageEdit": (options) =>
31112 HttpClientRequest.post(`/images/edits`).pipe(
31113 HttpClientRequest.bodyFormData(options.payload as any),
31114 withResponse(options.config)(HttpClientResponse.matchStatus({
31115 "2xx": decodeSuccess(CreateImageEdit200),
31116 orElse: unexpectedStatus
31117 }))
31118 ),
31119 "createImageEditSse": (options) =>
31120 HttpClientRequest.post(`/images/edits`).pipe(
31121 HttpClientRequest.bodyFormData(options.payload as any),
31122 sseRequest(CreateImageEdit200Sse)
31123 ),
31124 "createImage": (options) =>
31125 HttpClientRequest.post(`/images/generations`).pipe(
31126 HttpClientRequest.bodyJsonUnsafe(options.payload),
31127 withResponse(options.config)(HttpClientResponse.matchStatus({
31128 "2xx": decodeSuccess(CreateImage200),
31129 orElse: unexpectedStatus
31130 }))
31131 ),
31132 "createImageSse": (options) =>
31133 HttpClientRequest.post(`/images/generations`).pipe(
31134 HttpClientRequest.bodyJsonUnsafe(options.payload),
31135 sseRequest(CreateImage200Sse)
31136 ),
31137 "createImageVariation": (options) =>
31138 HttpClientRequest.post(`/images/variations`).pipe(
31139 HttpClientRequest.bodyFormData(options.payload as any),
31140 withResponse(options.config)(HttpClientResponse.matchStatus({
31141 "2xx": decodeSuccess(CreateImageVariation200),
31142 orElse: unexpectedStatus
31143 }))
31144 ),
31145 "listModels": (options) =>
31146 HttpClientRequest.get(`/models`).pipe(
31147 withResponse(options?.config)(HttpClientResponse.matchStatus({
31148 "2xx": decodeSuccess(ListModels200),
31149 orElse: unexpectedStatus
31150 }))
31151 ),
31152 "retrieveModel": (model, options) =>
31153 HttpClientRequest.get(`/models/${model}`).pipe(
31154 withResponse(options?.config)(HttpClientResponse.matchStatus({
31155 "2xx": decodeSuccess(RetrieveModel200),
31156 orElse: unexpectedStatus
31157 }))
31158 ),
31159 "deleteModel": (model, options) =>
31160 HttpClientRequest.delete(`/models/${model}`).pipe(
31161 withResponse(options?.config)(HttpClientResponse.matchStatus({
31162 "2xx": decodeSuccess(DeleteModel200),
31163 orElse: unexpectedStatus
31164 }))
31165 ),
31166 "createModeration": (options) =>
31167 HttpClientRequest.post(`/moderations`).pipe(
31168 HttpClientRequest.bodyJsonUnsafe(options.payload),
31169 withResponse(options.config)(HttpClientResponse.matchStatus({
31170 "2xx": decodeSuccess(CreateModeration200),
31171 orElse: unexpectedStatus
31172 }))
31173 ),
31174 "adminApiKeysList": (options) =>
31175 HttpClientRequest.get(`/organization/admin_api_keys`).pipe(
31176 HttpClientRequest.setUrlParams({
31177 "after": options?.params?.["after"] as any,
31178 "order": options?.params?.["order"] as any,
31179 "limit": options?.params?.["limit"] as any
31180 }),
31181 withResponse(options?.config)(HttpClientResponse.matchStatus({
31182 "2xx": decodeSuccess(AdminApiKeysList200),
31183 orElse: unexpectedStatus
31184 }))
31185 ),
31186 "adminApiKeysCreate": (options) =>
31187 HttpClientRequest.post(`/organization/admin_api_keys`).pipe(
31188 HttpClientRequest.bodyJsonUnsafe(options.payload),
31189 withResponse(options.config)(HttpClientResponse.matchStatus({
31190 "2xx": decodeSuccess(AdminApiKeysCreate200),
31191 orElse: unexpectedStatus
31192 }))
31193 ),
31194 "adminApiKeysGet": (keyId, options) =>
31195 HttpClientRequest.get(`/organization/admin_api_keys/${keyId}`).pipe(
31196 withResponse(options?.config)(HttpClientResponse.matchStatus({
31197 "2xx": decodeSuccess(AdminApiKeysGet200),
31198 orElse: unexpectedStatus
31199 }))
31200 ),
31201 "adminApiKeysDelete": (keyId, options) =>
31202 HttpClientRequest.delete(`/organization/admin_api_keys/${keyId}`).pipe(
31203 withResponse(options?.config)(HttpClientResponse.matchStatus({
31204 "2xx": decodeSuccess(AdminApiKeysDelete200),
31205 orElse: unexpectedStatus
31206 }))
31207 ),
31208 "listAuditLogs": (options) =>
31209 HttpClientRequest.get(`/organization/audit_logs`).pipe(
31210 HttpClientRequest.setUrlParams({
31211 "effective_at[gt]": options?.params?.["effective_at[gt]"] as any,
31212 "effective_at[gte]": options?.params?.["effective_at[gte]"] as any,
31213 "effective_at[lt]": options?.params?.["effective_at[lt]"] as any,
31214 "effective_at[lte]": options?.params?.["effective_at[lte]"] as any,
31215 "project_ids[]": options?.params?.["project_ids[]"] as any,
31216 "event_types[]": options?.params?.["event_types[]"] as any,
31217 "actor_ids[]": options?.params?.["actor_ids[]"] as any,
31218 "actor_emails[]": options?.params?.["actor_emails[]"] as any,
31219 "resource_ids[]": options?.params?.["resource_ids[]"] as any,
31220 "limit": options?.params?.["limit"] as any,
31221 "after": options?.params?.["after"] as any,
31222 "before": options?.params?.["before"] as any
31223 }),
31224 withResponse(options?.config)(HttpClientResponse.matchStatus({
31225 "2xx": decodeSuccess(ListAuditLogs200),
31226 orElse: unexpectedStatus
31227 }))
31228 ),
31229 "listOrganizationCertificates": (options) =>
31230 HttpClientRequest.get(`/organization/certificates`).pipe(
31231 HttpClientRequest.setUrlParams({
31232 "limit": options?.params?.["limit"] as any,
31233 "after": options?.params?.["after"] as any,
31234 "order": options?.params?.["order"] as any
31235 }),
31236 withResponse(options?.config)(HttpClientResponse.matchStatus({
31237 "2xx": decodeSuccess(ListOrganizationCertificates200),
31238 orElse: unexpectedStatus
31239 }))
31240 ),
31241 "uploadCertificate": (options) =>
31242 HttpClientRequest.post(`/organization/certificates`).pipe(
31243 HttpClientRequest.bodyJsonUnsafe(options.payload),
31244 withResponse(options.config)(HttpClientResponse.matchStatus({
31245 "2xx": decodeSuccess(UploadCertificate200),
31246 orElse: unexpectedStatus
31247 }))
31248 ),
31249 "activateOrganizationCertificates": (options) =>
31250 HttpClientRequest.post(`/organization/certificates/activate`).pipe(
31251 HttpClientRequest.bodyJsonUnsafe(options.payload),
31252 withResponse(options.config)(HttpClientResponse.matchStatus({
31253 "2xx": decodeSuccess(ActivateOrganizationCertificates200),
31254 orElse: unexpectedStatus
31255 }))
31256 ),
31257 "deactivateOrganizationCertificates": (options) =>
31258 HttpClientRequest.post(`/organization/certificates/deactivate`).pipe(
31259 HttpClientRequest.bodyJsonUnsafe(options.payload),
31260 withResponse(options.config)(HttpClientResponse.matchStatus({
31261 "2xx": decodeSuccess(DeactivateOrganizationCertificates200),
31262 orElse: unexpectedStatus
31263 }))
31264 ),
31265 "getCertificate": (certificateId, options) =>
31266 HttpClientRequest.get(`/organization/certificates/${certificateId}`).pipe(
31267 HttpClientRequest.setUrlParams({ "include": options?.params?.["include"] as any }),
31268 withResponse(options?.config)(HttpClientResponse.matchStatus({
31269 "2xx": decodeSuccess(GetCertificate200),
31270 orElse: unexpectedStatus
31271 }))
31272 ),
31273 "modifyCertificate": (certificateId, options) =>
31274 HttpClientRequest.post(`/organization/certificates/${certificateId}`).pipe(
31275 HttpClientRequest.bodyJsonUnsafe(options.payload),
31276 withResponse(options.config)(HttpClientResponse.matchStatus({
31277 "2xx": decodeSuccess(ModifyCertificate200),
31278 orElse: unexpectedStatus
31279 }))
31280 ),
31281 "deleteCertificate": (certificateId, options) =>
31282 HttpClientRequest.delete(`/organization/certificates/${certificateId}`).pipe(
31283 withResponse(options?.config)(HttpClientResponse.matchStatus({
31284 "2xx": decodeSuccess(DeleteCertificate200),
31285 orElse: unexpectedStatus
31286 }))
31287 ),
31288 "usageCosts": (options) =>
31289 HttpClientRequest.get(`/organization/costs`).pipe(
31290 HttpClientRequest.setUrlParams({
31291 "start_time": options.params["start_time"] as any,
31292 "end_time": options.params["end_time"] as any,
31293 "bucket_width": options.params["bucket_width"] as any,
31294 "project_ids": options.params["project_ids"] as any,
31295 "api_key_ids": options.params["api_key_ids"] as any,
31296 "group_by": options.params["group_by"] as any,
31297 "limit": options.params["limit"] as any,
31298 "page": options.params["page"] as any
31299 }),
31300 withResponse(options.config)(HttpClientResponse.matchStatus({
31301 "2xx": decodeSuccess(UsageCosts200),
31302 orElse: unexpectedStatus
31303 }))
31304 ),
31305 "listGroups": (options) =>
31306 HttpClientRequest.get(`/organization/groups`).pipe(
31307 HttpClientRequest.setUrlParams({
31308 "limit": options?.params?.["limit"] as any,
31309 "after": options?.params?.["after"] as any,
31310 "order": options?.params?.["order"] as any
31311 }),
31312 withResponse(options?.config)(HttpClientResponse.matchStatus({
31313 "2xx": decodeSuccess(ListGroups200),
31314 orElse: unexpectedStatus
31315 }))
31316 ),
31317 "createGroup": (options) =>
31318 HttpClientRequest.post(`/organization/groups`).pipe(
31319 HttpClientRequest.bodyJsonUnsafe(options.payload),
31320 withResponse(options.config)(HttpClientResponse.matchStatus({
31321 "2xx": decodeSuccess(CreateGroup200),
31322 orElse: unexpectedStatus
31323 }))
31324 ),
31325 "updateGroup": (groupId, options) =>
31326 HttpClientRequest.post(`/organization/groups/${groupId}`).pipe(
31327 HttpClientRequest.bodyJsonUnsafe(options.payload),
31328 withResponse(options.config)(HttpClientResponse.matchStatus({
31329 "2xx": decodeSuccess(UpdateGroup200),
31330 orElse: unexpectedStatus
31331 }))
31332 ),
31333 "deleteGroup": (groupId, options) =>
31334 HttpClientRequest.delete(`/organization/groups/${groupId}`).pipe(
31335 withResponse(options?.config)(HttpClientResponse.matchStatus({
31336 "2xx": decodeSuccess(DeleteGroup200),
31337 orElse: unexpectedStatus
31338 }))
31339 ),
31340 "listGroupRoleAssignments": (groupId, options) =>
31341 HttpClientRequest.get(`/organization/groups/${groupId}/roles`).pipe(
31342 HttpClientRequest.setUrlParams({
31343 "limit": options?.params?.["limit"] as any,
31344 "after": options?.params?.["after"] as any,
31345 "order": options?.params?.["order"] as any
31346 }),
31347 withResponse(options?.config)(HttpClientResponse.matchStatus({
31348 "2xx": decodeSuccess(ListGroupRoleAssignments200),
31349 orElse: unexpectedStatus
31350 }))
31351 ),
31352 "assignGroupRole": (groupId, options) =>
31353 HttpClientRequest.post(`/organization/groups/${groupId}/roles`).pipe(
31354 HttpClientRequest.bodyJsonUnsafe(options.payload),
31355 withResponse(options.config)(HttpClientResponse.matchStatus({
31356 "2xx": decodeSuccess(AssignGroupRole200),
31357 orElse: unexpectedStatus
31358 }))
31359 ),
31360 "unassignGroupRole": (groupId, roleId, options) =>
31361 HttpClientRequest.delete(`/organization/groups/${groupId}/roles/${roleId}`).pipe(
31362 withResponse(options?.config)(HttpClientResponse.matchStatus({
31363 "2xx": decodeSuccess(UnassignGroupRole200),
31364 orElse: unexpectedStatus
31365 }))
31366 ),
31367 "listGroupUsers": (groupId, options) =>
31368 HttpClientRequest.get(`/organization/groups/${groupId}/users`).pipe(
31369 HttpClientRequest.setUrlParams({
31370 "limit": options?.params?.["limit"] as any,
31371 "after": options?.params?.["after"] as any,
31372 "order": options?.params?.["order"] as any
31373 }),
31374 withResponse(options?.config)(HttpClientResponse.matchStatus({
31375 "2xx": decodeSuccess(ListGroupUsers200),
31376 orElse: unexpectedStatus
31377 }))
31378 ),
31379 "addGroupUser": (groupId, options) =>
31380 HttpClientRequest.post(`/organization/groups/${groupId}/users`).pipe(
31381 HttpClientRequest.bodyJsonUnsafe(options.payload),
31382 withResponse(options.config)(HttpClientResponse.matchStatus({
31383 "2xx": decodeSuccess(AddGroupUser200),
31384 orElse: unexpectedStatus
31385 }))
31386 ),
31387 "removeGroupUser": (groupId, userId, options) =>
31388 HttpClientRequest.delete(`/organization/groups/${groupId}/users/${userId}`).pipe(
31389 withResponse(options?.config)(HttpClientResponse.matchStatus({
31390 "2xx": decodeSuccess(RemoveGroupUser200),
31391 orElse: unexpectedStatus
31392 }))
31393 ),
31394 "listInvites": (options) =>
31395 HttpClientRequest.get(`/organization/invites`).pipe(
31396 HttpClientRequest.setUrlParams({
31397 "limit": options?.params?.["limit"] as any,
31398 "after": options?.params?.["after"] as any
31399 }),
31400 withResponse(options?.config)(HttpClientResponse.matchStatus({
31401 "2xx": decodeSuccess(ListInvites200),
31402 orElse: unexpectedStatus
31403 }))
31404 ),
31405 "inviteUser": (options) =>
31406 HttpClientRequest.post(`/organization/invites`).pipe(
31407 HttpClientRequest.bodyJsonUnsafe(options.payload),
31408 withResponse(options.config)(HttpClientResponse.matchStatus({
31409 "2xx": decodeSuccess(InviteUser200),
31410 orElse: unexpectedStatus
31411 }))
31412 ),
31413 "retrieveInvite": (inviteId, options) =>
31414 HttpClientRequest.get(`/organization/invites/${inviteId}`).pipe(
31415 withResponse(options?.config)(HttpClientResponse.matchStatus({
31416 "2xx": decodeSuccess(RetrieveInvite200),
31417 orElse: unexpectedStatus
31418 }))
31419 ),
31420 "deleteInvite": (inviteId, options) =>
31421 HttpClientRequest.delete(`/organization/invites/${inviteId}`).pipe(
31422 withResponse(options?.config)(HttpClientResponse.matchStatus({
31423 "2xx": decodeSuccess(DeleteInvite200),
31424 orElse: unexpectedStatus
31425 }))
31426 ),
31427 "listProjects": (options) =>
31428 HttpClientRequest.get(`/organization/projects`).pipe(
31429 HttpClientRequest.setUrlParams({
31430 "limit": options?.params?.["limit"] as any,
31431 "after": options?.params?.["after"] as any,
31432 "include_archived": options?.params?.["include_archived"] as any
31433 }),
31434 withResponse(options?.config)(HttpClientResponse.matchStatus({
31435 "2xx": decodeSuccess(ListProjects200),
31436 orElse: unexpectedStatus
31437 }))
31438 ),
31439 "createProject": (options) =>
31440 HttpClientRequest.post(`/organization/projects`).pipe(
31441 HttpClientRequest.bodyJsonUnsafe(options.payload),
31442 withResponse(options.config)(HttpClientResponse.matchStatus({
31443 "2xx": decodeSuccess(CreateProject200),
31444 orElse: unexpectedStatus
31445 }))
31446 ),
31447 "retrieveProject": (projectId, options) =>
31448 HttpClientRequest.get(`/organization/projects/${projectId}`).pipe(
31449 withResponse(options?.config)(HttpClientResponse.matchStatus({
31450 "2xx": decodeSuccess(RetrieveProject200),
31451 orElse: unexpectedStatus
31452 }))
31453 ),
31454 "modifyProject": (projectId, options) =>
31455 HttpClientRequest.post(`/organization/projects/${projectId}`).pipe(
31456 HttpClientRequest.bodyJsonUnsafe(options.payload),
31457 withResponse(options.config)(HttpClientResponse.matchStatus({
31458 "2xx": decodeSuccess(ModifyProject200),
31459 "400": decodeError("ModifyProject400", ModifyProject400),
31460 orElse: unexpectedStatus
31461 }))
31462 ),
31463 "listProjectApiKeys": (projectId, options) =>
31464 HttpClientRequest.get(`/organization/projects/${projectId}/api_keys`).pipe(
31465 HttpClientRequest.setUrlParams({
31466 "limit": options?.params?.["limit"] as any,
31467 "after": options?.params?.["after"] as any
31468 }),
31469 withResponse(options?.config)(HttpClientResponse.matchStatus({
31470 "2xx": decodeSuccess(ListProjectApiKeys200),
31471 orElse: unexpectedStatus
31472 }))
31473 ),
31474 "retrieveProjectApiKey": (projectId, apiKeyId, options) =>
31475 HttpClientRequest.get(`/organization/projects/${projectId}/api_keys/${apiKeyId}`).pipe(
31476 withResponse(options?.config)(HttpClientResponse.matchStatus({
31477 "2xx": decodeSuccess(RetrieveProjectApiKey200),
31478 orElse: unexpectedStatus
31479 }))
31480 ),
31481 "deleteProjectApiKey": (projectId, apiKeyId, options) =>
31482 HttpClientRequest.delete(`/organization/projects/${projectId}/api_keys/${apiKeyId}`).pipe(
31483 withResponse(options?.config)(HttpClientResponse.matchStatus({
31484 "2xx": decodeSuccess(DeleteProjectApiKey200),
31485 "400": decodeError("DeleteProjectApiKey400", DeleteProjectApiKey400),
31486 orElse: unexpectedStatus
31487 }))
31488 ),
31489 "archiveProject": (projectId, options) =>
31490 HttpClientRequest.post(`/organization/projects/${projectId}/archive`).pipe(
31491 withResponse(options?.config)(HttpClientResponse.matchStatus({
31492 "2xx": decodeSuccess(ArchiveProject200),
31493 orElse: unexpectedStatus
31494 }))
31495 ),
31496 "listProjectCertificates": (projectId, options) =>
31497 HttpClientRequest.get(`/organization/projects/${projectId}/certificates`).pipe(
31498 HttpClientRequest.setUrlParams({
31499 "limit": options?.params?.["limit"] as any,
31500 "after": options?.params?.["after"] as any,
31501 "order": options?.params?.["order"] as any
31502 }),
31503 withResponse(options?.config)(HttpClientResponse.matchStatus({
31504 "2xx": decodeSuccess(ListProjectCertificates200),
31505 orElse: unexpectedStatus
31506 }))
31507 ),
31508 "activateProjectCertificates": (projectId, options) =>
31509 HttpClientRequest.post(`/organization/projects/${projectId}/certificates/activate`).pipe(
31510 HttpClientRequest.bodyJsonUnsafe(options.payload),
31511 withResponse(options.config)(HttpClientResponse.matchStatus({
31512 "2xx": decodeSuccess(ActivateProjectCertificates200),
31513 orElse: unexpectedStatus
31514 }))
31515 ),
31516 "deactivateProjectCertificates": (projectId, options) =>
31517 HttpClientRequest.post(`/organization/projects/${projectId}/certificates/deactivate`).pipe(
31518 HttpClientRequest.bodyJsonUnsafe(options.payload),
31519 withResponse(options.config)(HttpClientResponse.matchStatus({
31520 "2xx": decodeSuccess(DeactivateProjectCertificates200),
31521 orElse: unexpectedStatus
31522 }))
31523 ),
31524 "listProjectGroups": (projectId, options) =>
31525 HttpClientRequest.get(`/organization/projects/${projectId}/groups`).pipe(
31526 HttpClientRequest.setUrlParams({
31527 "limit": options?.params?.["limit"] as any,
31528 "after": options?.params?.["after"] as any,
31529 "order": options?.params?.["order"] as any
31530 }),
31531 withResponse(options?.config)(HttpClientResponse.matchStatus({
31532 "2xx": decodeSuccess(ListProjectGroups200),
31533 orElse: unexpectedStatus
31534 }))
31535 ),
31536 "addProjectGroup": (projectId, options) =>
31537 HttpClientRequest.post(`/organization/projects/${projectId}/groups`).pipe(
31538 HttpClientRequest.bodyJsonUnsafe(options.payload),
31539 withResponse(options.config)(HttpClientResponse.matchStatus({
31540 "2xx": decodeSuccess(AddProjectGroup200),
31541 orElse: unexpectedStatus
31542 }))
31543 ),
31544 "removeProjectGroup": (projectId, groupId, options) =>
31545 HttpClientRequest.delete(`/organization/projects/${projectId}/groups/${groupId}`).pipe(
31546 withResponse(options?.config)(HttpClientResponse.matchStatus({
31547 "2xx": decodeSuccess(RemoveProjectGroup200),
31548 orElse: unexpectedStatus
31549 }))
31550 ),
31551 "retrieveProjectHostedToolPermissions": (projectId, options) =>
31552 HttpClientRequest.get(`/organization/projects/${projectId}/hosted_tool_permissions`).pipe(
31553 withResponse(options?.config)(HttpClientResponse.matchStatus({
31554 "2xx": decodeSuccess(RetrieveProjectHostedToolPermissions200),
31555 orElse: unexpectedStatus
31556 }))
31557 ),
31558 "updateProjectHostedToolPermissions": (projectId, options) =>
31559 HttpClientRequest.post(`/organization/projects/${projectId}/hosted_tool_permissions`).pipe(
31560 HttpClientRequest.bodyJsonUnsafe(options.payload),
31561 withResponse(options.config)(HttpClientResponse.matchStatus({
31562 "2xx": decodeSuccess(UpdateProjectHostedToolPermissions200),
31563 orElse: unexpectedStatus
31564 }))
31565 ),
31566 "retrieveProjectModelPermissions": (projectId, options) =>
31567 HttpClientRequest.get(`/organization/projects/${projectId}/model_permissions`).pipe(
31568 withResponse(options?.config)(HttpClientResponse.matchStatus({
31569 "2xx": decodeSuccess(RetrieveProjectModelPermissions200),
31570 orElse: unexpectedStatus
31571 }))
31572 ),
31573 "updateProjectModelPermissions": (projectId, options) =>
31574 HttpClientRequest.post(`/organization/projects/${projectId}/model_permissions`).pipe(
31575 HttpClientRequest.bodyJsonUnsafe(options.payload),
31576 withResponse(options.config)(HttpClientResponse.matchStatus({
31577 "2xx": decodeSuccess(UpdateProjectModelPermissions200),
31578 orElse: unexpectedStatus
31579 }))
31580 ),
31581 "deleteProjectModelPermissions": (projectId, options) =>
31582 HttpClientRequest.delete(`/organization/projects/${projectId}/model_permissions`).pipe(
31583 withResponse(options?.config)(HttpClientResponse.matchStatus({
31584 "2xx": decodeSuccess(DeleteProjectModelPermissions200),
31585 orElse: unexpectedStatus
31586 }))
31587 ),
31588 "listProjectRateLimits": (projectId, options) =>
31589 HttpClientRequest.get(`/organization/projects/${projectId}/rate_limits`).pipe(
31590 HttpClientRequest.setUrlParams({
31591 "limit": options?.params?.["limit"] as any,
31592 "after": options?.params?.["after"] as any,
31593 "before": options?.params?.["before"] as any
31594 }),
31595 withResponse(options?.config)(HttpClientResponse.matchStatus({
31596 "2xx": decodeSuccess(ListProjectRateLimits200),
31597 orElse: unexpectedStatus
31598 }))
31599 ),
31600 "updateProjectRateLimits": (projectId, rateLimitId, options) =>
31601 HttpClientRequest.post(`/organization/projects/${projectId}/rate_limits/${rateLimitId}`).pipe(
31602 HttpClientRequest.bodyJsonUnsafe(options.payload),
31603 withResponse(options.config)(HttpClientResponse.matchStatus({
31604 "2xx": decodeSuccess(UpdateProjectRateLimits200),
31605 "400": decodeError("UpdateProjectRateLimits400", UpdateProjectRateLimits400),
31606 orElse: unexpectedStatus
31607 }))
31608 ),
31609 "listProjectServiceAccounts": (projectId, options) =>
31610 HttpClientRequest.get(`/organization/projects/${projectId}/service_accounts`).pipe(
31611 HttpClientRequest.setUrlParams({
31612 "limit": options?.params?.["limit"] as any,
31613 "after": options?.params?.["after"] as any
31614 }),
31615 withResponse(options?.config)(HttpClientResponse.matchStatus({
31616 "2xx": decodeSuccess(ListProjectServiceAccounts200),
31617 "400": decodeError("ListProjectServiceAccounts400", ListProjectServiceAccounts400),
31618 orElse: unexpectedStatus
31619 }))
31620 ),
31621 "createProjectServiceAccount": (projectId, options) =>
31622 HttpClientRequest.post(`/organization/projects/${projectId}/service_accounts`).pipe(
31623 HttpClientRequest.bodyJsonUnsafe(options.payload),
31624 withResponse(options.config)(HttpClientResponse.matchStatus({
31625 "2xx": decodeSuccess(CreateProjectServiceAccount200),
31626 "400": decodeError("CreateProjectServiceAccount400", CreateProjectServiceAccount400),
31627 orElse: unexpectedStatus
31628 }))
31629 ),
31630 "retrieveProjectServiceAccount": (projectId, serviceAccountId, options) =>
31631 HttpClientRequest.get(`/organization/projects/${projectId}/service_accounts/${serviceAccountId}`).pipe(
31632 withResponse(options?.config)(HttpClientResponse.matchStatus({
31633 "2xx": decodeSuccess(RetrieveProjectServiceAccount200),
31634 orElse: unexpectedStatus
31635 }))
31636 ),
31637 "deleteProjectServiceAccount": (projectId, serviceAccountId, options) =>
31638 HttpClientRequest.delete(`/organization/projects/${projectId}/service_accounts/${serviceAccountId}`).pipe(
31639 withResponse(options?.config)(HttpClientResponse.matchStatus({
31640 "2xx": decodeSuccess(DeleteProjectServiceAccount200),
31641 orElse: unexpectedStatus
31642 }))
31643 ),
31644 "listProjectUsers": (projectId, options) =>
31645 HttpClientRequest.get(`/organization/projects/${projectId}/users`).pipe(
31646 HttpClientRequest.setUrlParams({
31647 "limit": options?.params?.["limit"] as any,
31648 "after": options?.params?.["after"] as any
31649 }),
31650 withResponse(options?.config)(HttpClientResponse.matchStatus({
31651 "2xx": decodeSuccess(ListProjectUsers200),
31652 "400": decodeError("ListProjectUsers400", ListProjectUsers400),
31653 orElse: unexpectedStatus
31654 }))
31655 ),
31656 "createProjectUser": (projectId, options) =>
31657 HttpClientRequest.post(`/organization/projects/${projectId}/users`).pipe(
31658 HttpClientRequest.bodyJsonUnsafe(options.payload),
31659 withResponse(options.config)(HttpClientResponse.matchStatus({
31660 "2xx": decodeSuccess(CreateProjectUser200),
31661 "400": decodeError("CreateProjectUser400", CreateProjectUser400),
31662 orElse: unexpectedStatus
31663 }))
31664 ),
31665 "retrieveProjectUser": (projectId, userId, options) =>
31666 HttpClientRequest.get(`/organization/projects/${projectId}/users/${userId}`).pipe(
31667 withResponse(options?.config)(HttpClientResponse.matchStatus({
31668 "2xx": decodeSuccess(RetrieveProjectUser200),
31669 orElse: unexpectedStatus
31670 }))
31671 ),
31672 "modifyProjectUser": (projectId, userId, options) =>
31673 HttpClientRequest.post(`/organization/projects/${projectId}/users/${userId}`).pipe(
31674 HttpClientRequest.bodyJsonUnsafe(options.payload),
31675 withResponse(options.config)(HttpClientResponse.matchStatus({
31676 "2xx": decodeSuccess(ModifyProjectUser200),
31677 "400": decodeError("ModifyProjectUser400", ModifyProjectUser400),
31678 orElse: unexpectedStatus
31679 }))
31680 ),
31681 "deleteProjectUser": (projectId, userId, options) =>
31682 HttpClientRequest.delete(`/organization/projects/${projectId}/users/${userId}`).pipe(
31683 withResponse(options?.config)(HttpClientResponse.matchStatus({
31684 "2xx": decodeSuccess(DeleteProjectUser200),
31685 "400": decodeError("DeleteProjectUser400", DeleteProjectUser400),
31686 orElse: unexpectedStatus
31687 }))
31688 ),
31689 "listRoles": (options) =>
31690 HttpClientRequest.get(`/organization/roles`).pipe(
31691 HttpClientRequest.setUrlParams({
31692 "limit": options?.params?.["limit"] as any,
31693 "after": options?.params?.["after"] as any,
31694 "order": options?.params?.["order"] as any
31695 }),
31696 withResponse(options?.config)(HttpClientResponse.matchStatus({
31697 "2xx": decodeSuccess(ListRoles200),
31698 orElse: unexpectedStatus
31699 }))
31700 ),
31701 "createRole": (options) =>
31702 HttpClientRequest.post(`/organization/roles`).pipe(
31703 HttpClientRequest.bodyJsonUnsafe(options.payload),
31704 withResponse(options.config)(HttpClientResponse.matchStatus({
31705 "2xx": decodeSuccess(CreateRole200),
31706 orElse: unexpectedStatus
31707 }))
31708 ),
31709 "updateRole": (roleId, options) =>
31710 HttpClientRequest.post(`/organization/roles/${roleId}`).pipe(
31711 HttpClientRequest.bodyJsonUnsafe(options.payload),
31712 withResponse(options.config)(HttpClientResponse.matchStatus({
31713 "2xx": decodeSuccess(UpdateRole200),
31714 orElse: unexpectedStatus
31715 }))
31716 ),
31717 "deleteRole": (roleId, options) =>
31718 HttpClientRequest.delete(`/organization/roles/${roleId}`).pipe(
31719 withResponse(options?.config)(HttpClientResponse.matchStatus({
31720 "2xx": decodeSuccess(DeleteRole200),
31721 orElse: unexpectedStatus
31722 }))
31723 ),
31724 "usageAudioSpeeches": (options) =>
31725 HttpClientRequest.get(`/organization/usage/audio_speeches`).pipe(
31726 HttpClientRequest.setUrlParams({
31727 "start_time": options.params["start_time"] as any,
31728 "end_time": options.params["end_time"] as any,
31729 "bucket_width": options.params["bucket_width"] as any,
31730 "project_ids": options.params["project_ids"] as any,
31731 "user_ids": options.params["user_ids"] as any,
31732 "api_key_ids": options.params["api_key_ids"] as any,
31733 "models": options.params["models"] as any,
31734 "group_by": options.params["group_by"] as any,
31735 "limit": options.params["limit"] as any,
31736 "page": options.params["page"] as any
31737 }),
31738 withResponse(options.config)(HttpClientResponse.matchStatus({
31739 "2xx": decodeSuccess(UsageAudioSpeeches200),
31740 orElse: unexpectedStatus
31741 }))
31742 ),
31743 "usageAudioTranscriptions": (options) =>
31744 HttpClientRequest.get(`/organization/usage/audio_transcriptions`).pipe(
31745 HttpClientRequest.setUrlParams({
31746 "start_time": options.params["start_time"] as any,
31747 "end_time": options.params["end_time"] as any,
31748 "bucket_width": options.params["bucket_width"] as any,
31749 "project_ids": options.params["project_ids"] as any,
31750 "user_ids": options.params["user_ids"] as any,
31751 "api_key_ids": options.params["api_key_ids"] as any,
31752 "models": options.params["models"] as any,
31753 "group_by": options.params["group_by"] as any,
31754 "limit": options.params["limit"] as any,
31755 "page": options.params["page"] as any
31756 }),
31757 withResponse(options.config)(HttpClientResponse.matchStatus({
31758 "2xx": decodeSuccess(UsageAudioTranscriptions200),
31759 orElse: unexpectedStatus
31760 }))
31761 ),
31762 "usageCodeInterpreterSessions": (options) =>
31763 HttpClientRequest.get(`/organization/usage/code_interpreter_sessions`).pipe(
31764 HttpClientRequest.setUrlParams({
31765 "start_time": options.params["start_time"] as any,
31766 "end_time": options.params["end_time"] as any,
31767 "bucket_width": options.params["bucket_width"] as any,
31768 "project_ids": options.params["project_ids"] as any,
31769 "group_by": options.params["group_by"] as any,
31770 "limit": options.params["limit"] as any,
31771 "page": options.params["page"] as any
31772 }),
31773 withResponse(options.config)(HttpClientResponse.matchStatus({
31774 "2xx": decodeSuccess(UsageCodeInterpreterSessions200),
31775 orElse: unexpectedStatus
31776 }))
31777 ),
31778 "usageCompletions": (options) =>
31779 HttpClientRequest.get(`/organization/usage/completions`).pipe(
31780 HttpClientRequest.setUrlParams({
31781 "start_time": options.params["start_time"] as any,
31782 "end_time": options.params["end_time"] as any,
31783 "bucket_width": options.params["bucket_width"] as any,
31784 "project_ids": options.params["project_ids"] as any,
31785 "user_ids": options.params["user_ids"] as any,
31786 "api_key_ids": options.params["api_key_ids"] as any,
31787 "models": options.params["models"] as any,
31788 "batch": options.params["batch"] as any,
31789 "group_by": options.params["group_by"] as any,
31790 "limit": options.params["limit"] as any,
31791 "page": options.params["page"] as any
31792 }),
31793 withResponse(options.config)(HttpClientResponse.matchStatus({
31794 "2xx": decodeSuccess(UsageCompletions200),
31795 orElse: unexpectedStatus
31796 }))
31797 ),
31798 "usageEmbeddings": (options) =>
31799 HttpClientRequest.get(`/organization/usage/embeddings`).pipe(
31800 HttpClientRequest.setUrlParams({
31801 "start_time": options.params["start_time"] as any,
31802 "end_time": options.params["end_time"] as any,
31803 "bucket_width": options.params["bucket_width"] as any,
31804 "project_ids": options.params["project_ids"] as any,
31805 "user_ids": options.params["user_ids"] as any,
31806 "api_key_ids": options.params["api_key_ids"] as any,
31807 "models": options.params["models"] as any,
31808 "group_by": options.params["group_by"] as any,
31809 "limit": options.params["limit"] as any,
31810 "page": options.params["page"] as any
31811 }),
31812 withResponse(options.config)(HttpClientResponse.matchStatus({
31813 "2xx": decodeSuccess(UsageEmbeddings200),
31814 orElse: unexpectedStatus
31815 }))
31816 ),
31817 "usageFileSearchCalls": (options) =>
31818 HttpClientRequest.get(`/organization/usage/file_search_calls`).pipe(
31819 HttpClientRequest.setUrlParams({
31820 "start_time": options.params["start_time"] as any,
31821 "end_time": options.params["end_time"] as any,
31822 "bucket_width": options.params["bucket_width"] as any,
31823 "project_ids": options.params["project_ids"] as any,
31824 "user_ids": options.params["user_ids"] as any,
31825 "api_key_ids": options.params["api_key_ids"] as any,
31826 "vector_store_ids": options.params["vector_store_ids"] as any,
31827 "group_by": options.params["group_by"] as any,
31828 "limit": options.params["limit"] as any,
31829 "page": options.params["page"] as any
31830 }),
31831 withResponse(options.config)(HttpClientResponse.matchStatus({
31832 "2xx": decodeSuccess(UsageFileSearchCalls200),
31833 orElse: unexpectedStatus
31834 }))
31835 ),
31836 "usageImages": (options) =>
31837 HttpClientRequest.get(`/organization/usage/images`).pipe(
31838 HttpClientRequest.setUrlParams({
31839 "start_time": options.params["start_time"] as any,
31840 "end_time": options.params["end_time"] as any,
31841 "bucket_width": options.params["bucket_width"] as any,
31842 "sources": options.params["sources"] as any,
31843 "sizes": options.params["sizes"] as any,
31844 "project_ids": options.params["project_ids"] as any,
31845 "user_ids": options.params["user_ids"] as any,
31846 "api_key_ids": options.params["api_key_ids"] as any,
31847 "models": options.params["models"] as any,
31848 "group_by": options.params["group_by"] as any,
31849 "limit": options.params["limit"] as any,
31850 "page": options.params["page"] as any
31851 }),
31852 withResponse(options.config)(HttpClientResponse.matchStatus({
31853 "2xx": decodeSuccess(UsageImages200),
31854 orElse: unexpectedStatus
31855 }))
31856 ),
31857 "usageModerations": (options) =>
31858 HttpClientRequest.get(`/organization/usage/moderations`).pipe(
31859 HttpClientRequest.setUrlParams({
31860 "start_time": options.params["start_time"] as any,
31861 "end_time": options.params["end_time"] as any,
31862 "bucket_width": options.params["bucket_width"] as any,
31863 "project_ids": options.params["project_ids"] as any,
31864 "user_ids": options.params["user_ids"] as any,
31865 "api_key_ids": options.params["api_key_ids"] as any,
31866 "models": options.params["models"] as any,
31867 "group_by": options.params["group_by"] as any,
31868 "limit": options.params["limit"] as any,
31869 "page": options.params["page"] as any
31870 }),
31871 withResponse(options.config)(HttpClientResponse.matchStatus({
31872 "2xx": decodeSuccess(UsageModerations200),
31873 orElse: unexpectedStatus
31874 }))
31875 ),
31876 "usageVectorStores": (options) =>
31877 HttpClientRequest.get(`/organization/usage/vector_stores`).pipe(
31878 HttpClientRequest.setUrlParams({
31879 "start_time": options.params["start_time"] as any,
31880 "end_time": options.params["end_time"] as any,
31881 "bucket_width": options.params["bucket_width"] as any,
31882 "project_ids": options.params["project_ids"] as any,
31883 "group_by": options.params["group_by"] as any,
31884 "limit": options.params["limit"] as any,
31885 "page": options.params["page"] as any
31886 }),
31887 withResponse(options.config)(HttpClientResponse.matchStatus({
31888 "2xx": decodeSuccess(UsageVectorStores200),
31889 orElse: unexpectedStatus
31890 }))
31891 ),
31892 "usageWebSearchCalls": (options) =>
31893 HttpClientRequest.get(`/organization/usage/web_search_calls`).pipe(
31894 HttpClientRequest.setUrlParams({
31895 "start_time": options.params["start_time"] as any,
31896 "end_time": options.params["end_time"] as any,
31897 "bucket_width": options.params["bucket_width"] as any,
31898 "project_ids": options.params["project_ids"] as any,
31899 "user_ids": options.params["user_ids"] as any,
31900 "api_key_ids": options.params["api_key_ids"] as any,
31901 "models": options.params["models"] as any,
31902 "context_levels": options.params["context_levels"] as any,
31903 "group_by": options.params["group_by"] as any,
31904 "limit": options.params["limit"] as any,
31905 "page": options.params["page"] as any
31906 }),
31907 withResponse(options.config)(HttpClientResponse.matchStatus({
31908 "2xx": decodeSuccess(UsageWebSearchCalls200),
31909 orElse: unexpectedStatus
31910 }))
31911 ),
31912 "listUsers": (options) =>
31913 HttpClientRequest.get(`/organization/users`).pipe(
31914 HttpClientRequest.setUrlParams({
31915 "limit": options?.params?.["limit"] as any,
31916 "after": options?.params?.["after"] as any,
31917 "emails": options?.params?.["emails"] as any
31918 }),
31919 withResponse(options?.config)(HttpClientResponse.matchStatus({
31920 "2xx": decodeSuccess(ListUsers200),
31921 orElse: unexpectedStatus
31922 }))
31923 ),
31924 "retrieveUser": (userId, options) =>
31925 HttpClientRequest.get(`/organization/users/${userId}`).pipe(
31926 withResponse(options?.config)(HttpClientResponse.matchStatus({
31927 "2xx": decodeSuccess(RetrieveUser200),
31928 orElse: unexpectedStatus
31929 }))
31930 ),
31931 "modifyUser": (userId, options) =>
31932 HttpClientRequest.post(`/organization/users/${userId}`).pipe(
31933 HttpClientRequest.bodyJsonUnsafe(options.payload),
31934 withResponse(options.config)(HttpClientResponse.matchStatus({
31935 "2xx": decodeSuccess(ModifyUser200),
31936 orElse: unexpectedStatus
31937 }))
31938 ),
31939 "deleteUser": (userId, options) =>
31940 HttpClientRequest.delete(`/organization/users/${userId}`).pipe(
31941 withResponse(options?.config)(HttpClientResponse.matchStatus({
31942 "2xx": decodeSuccess(DeleteUser200),
31943 orElse: unexpectedStatus
31944 }))
31945 ),
31946 "listUserRoleAssignments": (userId, options) =>
31947 HttpClientRequest.get(`/organization/users/${userId}/roles`).pipe(
31948 HttpClientRequest.setUrlParams({
31949 "limit": options?.params?.["limit"] as any,
31950 "after": options?.params?.["after"] as any,
31951 "order": options?.params?.["order"] as any
31952 }),
31953 withResponse(options?.config)(HttpClientResponse.matchStatus({
31954 "2xx": decodeSuccess(ListUserRoleAssignments200),
31955 orElse: unexpectedStatus
31956 }))
31957 ),
31958 "assignUserRole": (userId, options) =>
31959 HttpClientRequest.post(`/organization/users/${userId}/roles`).pipe(
31960 HttpClientRequest.bodyJsonUnsafe(options.payload),
31961 withResponse(options.config)(HttpClientResponse.matchStatus({
31962 "2xx": decodeSuccess(AssignUserRole200),
31963 orElse: unexpectedStatus
31964 }))
31965 ),
31966 "unassignUserRole": (userId, roleId, options) =>
31967 HttpClientRequest.delete(`/organization/users/${userId}/roles/${roleId}`).pipe(
31968 withResponse(options?.config)(HttpClientResponse.matchStatus({
31969 "2xx": decodeSuccess(UnassignUserRole200),
31970 orElse: unexpectedStatus
31971 }))
31972 ),
31973 "listProjectGroupRoleAssignments": (projectId, groupId, options) =>
31974 HttpClientRequest.get(`/projects/${projectId}/groups/${groupId}/roles`).pipe(
31975 HttpClientRequest.setUrlParams({
31976 "limit": options?.params?.["limit"] as any,
31977 "after": options?.params?.["after"] as any,
31978 "order": options?.params?.["order"] as any
31979 }),
31980 withResponse(options?.config)(HttpClientResponse.matchStatus({
31981 "2xx": decodeSuccess(ListProjectGroupRoleAssignments200),
31982 orElse: unexpectedStatus
31983 }))
31984 ),
31985 "assignProjectGroupRole": (projectId, groupId, options) =>
31986 HttpClientRequest.post(`/projects/${projectId}/groups/${groupId}/roles`).pipe(
31987 HttpClientRequest.bodyJsonUnsafe(options.payload),
31988 withResponse(options.config)(HttpClientResponse.matchStatus({
31989 "2xx": decodeSuccess(AssignProjectGroupRole200),
31990 orElse: unexpectedStatus
31991 }))
31992 ),
31993 "unassignProjectGroupRole": (projectId, groupId, roleId, options) =>
31994 HttpClientRequest.delete(`/projects/${projectId}/groups/${groupId}/roles/${roleId}`).pipe(
31995 withResponse(options?.config)(HttpClientResponse.matchStatus({
31996 "2xx": decodeSuccess(UnassignProjectGroupRole200),
31997 orElse: unexpectedStatus
31998 }))
31999 ),
32000 "listProjectRoles": (projectId, options) =>
32001 HttpClientRequest.get(`/projects/${projectId}/roles`).pipe(
32002 HttpClientRequest.setUrlParams({
32003 "limit": options?.params?.["limit"] as any,
32004 "after": options?.params?.["after"] as any,
32005 "order": options?.params?.["order"] as any
32006 }),
32007 withResponse(options?.config)(HttpClientResponse.matchStatus({
32008 "2xx": decodeSuccess(ListProjectRoles200),
32009 orElse: unexpectedStatus
32010 }))
32011 ),
32012 "createProjectRole": (projectId, options) =>
32013 HttpClientRequest.post(`/projects/${projectId}/roles`).pipe(
32014 HttpClientRequest.bodyJsonUnsafe(options.payload),
32015 withResponse(options.config)(HttpClientResponse.matchStatus({
32016 "2xx": decodeSuccess(CreateProjectRole200),
32017 orElse: unexpectedStatus
32018 }))
32019 ),
32020 "updateProjectRole": (projectId, roleId, options) =>
32021 HttpClientRequest.post(`/projects/${projectId}/roles/${roleId}`).pipe(
32022 HttpClientRequest.bodyJsonUnsafe(options.payload),
32023 withResponse(options.config)(HttpClientResponse.matchStatus({
32024 "2xx": decodeSuccess(UpdateProjectRole200),
32025 orElse: unexpectedStatus
32026 }))
32027 ),
32028 "deleteProjectRole": (projectId, roleId, options) =>
32029 HttpClientRequest.delete(`/projects/${projectId}/roles/${roleId}`).pipe(
32030 withResponse(options?.config)(HttpClientResponse.matchStatus({
32031 "2xx": decodeSuccess(DeleteProjectRole200),
32032 orElse: unexpectedStatus
32033 }))
32034 ),
32035 "listProjectUserRoleAssignments": (projectId, userId, options) =>
32036 HttpClientRequest.get(`/projects/${projectId}/users/${userId}/roles`).pipe(
32037 HttpClientRequest.setUrlParams({
32038 "limit": options?.params?.["limit"] as any,
32039 "after": options?.params?.["after"] as any,
32040 "order": options?.params?.["order"] as any
32041 }),
32042 withResponse(options?.config)(HttpClientResponse.matchStatus({
32043 "2xx": decodeSuccess(ListProjectUserRoleAssignments200),
32044 orElse: unexpectedStatus
32045 }))
32046 ),
32047 "assignProjectUserRole": (projectId, userId, options) =>
32048 HttpClientRequest.post(`/projects/${projectId}/users/${userId}/roles`).pipe(
32049 HttpClientRequest.bodyJsonUnsafe(options.payload),
32050 withResponse(options.config)(HttpClientResponse.matchStatus({
32051 "2xx": decodeSuccess(AssignProjectUserRole200),
32052 orElse: unexpectedStatus
32053 }))
32054 ),
32055 "unassignProjectUserRole": (projectId, userId, roleId, options) =>
32056 HttpClientRequest.delete(`/projects/${projectId}/users/${userId}/roles/${roleId}`).pipe(
32057 withResponse(options?.config)(HttpClientResponse.matchStatus({
32058 "2xx": decodeSuccess(UnassignProjectUserRole200),
32059 orElse: unexpectedStatus
32060 }))
32061 ),
32062 "createRealtimeCall": (options) =>
32063 HttpClientRequest.post(`/realtime/calls`).pipe(
32064 HttpClientRequest.bodyFormData(options.payload as any),
32065 withResponse(options.config)(HttpClientResponse.matchStatus({
32066 orElse: unexpectedStatus
32067 }))
32068 ),
32069 "acceptRealtimeCall": (callId, options) =>
32070 HttpClientRequest.post(`/realtime/calls/${callId}/accept`).pipe(
32071 HttpClientRequest.bodyJsonUnsafe(options.payload),
32072 withResponse(options.config)(HttpClientResponse.matchStatus({
32073 "200": () => Effect.void,
32074 orElse: unexpectedStatus
32075 }))
32076 ),
32077 "hangupRealtimeCall": (callId, options) =>
32078 HttpClientRequest.post(`/realtime/calls/${callId}/hangup`).pipe(
32079 withResponse(options?.config)(HttpClientResponse.matchStatus({
32080 "200": () => Effect.void,
32081 orElse: unexpectedStatus
32082 }))
32083 ),
32084 "referRealtimeCall": (callId, options) =>
32085 HttpClientRequest.post(`/realtime/calls/${callId}/refer`).pipe(
32086 HttpClientRequest.bodyJsonUnsafe(options.payload),
32087 withResponse(options.config)(HttpClientResponse.matchStatus({
32088 "200": () => Effect.void,
32089 orElse: unexpectedStatus
32090 }))
32091 ),
32092 "rejectRealtimeCall": (callId, options) =>
32093 HttpClientRequest.post(`/realtime/calls/${callId}/reject`).pipe(
32094 HttpClientRequest.bodyJsonUnsafe(options.payload),
32095 withResponse(options.config)(HttpClientResponse.matchStatus({
32096 "200": () => Effect.void,
32097 orElse: unexpectedStatus
32098 }))
32099 ),
32100 "createRealtimeClientSecret": (options) =>
32101 HttpClientRequest.post(`/realtime/client_secrets`).pipe(
32102 HttpClientRequest.bodyJsonUnsafe(options.payload),
32103 withResponse(options.config)(HttpClientResponse.matchStatus({
32104 "2xx": decodeSuccess(CreateRealtimeClientSecret200),
32105 orElse: unexpectedStatus
32106 }))
32107 ),
32108 "createRealtimeSession": (options) =>
32109 HttpClientRequest.post(`/realtime/sessions`).pipe(
32110 HttpClientRequest.bodyJsonUnsafe(options.payload),
32111 withResponse(options.config)(HttpClientResponse.matchStatus({
32112 "2xx": decodeSuccess(CreateRealtimeSession200),
32113 orElse: unexpectedStatus
32114 }))
32115 ),
32116 "createRealtimeTranscriptionSession": (options) =>
32117 HttpClientRequest.post(`/realtime/transcription_sessions`).pipe(
32118 HttpClientRequest.bodyJsonUnsafe(options.payload),
32119 withResponse(options.config)(HttpClientResponse.matchStatus({
32120 "2xx": decodeSuccess(CreateRealtimeTranscriptionSession200),
32121 orElse: unexpectedStatus
32122 }))
32123 ),
32124 "createRealtimeTranslationClientSecret": (options) =>
32125 HttpClientRequest.post(`/realtime/translations/client_secrets`).pipe(
32126 HttpClientRequest.bodyJsonUnsafe(options.payload),
32127 withResponse(options.config)(HttpClientResponse.matchStatus({
32128 "2xx": decodeSuccess(CreateRealtimeTranslationClientSecret200),
32129 orElse: unexpectedStatus
32130 }))
32131 ),
32132 "createResponse": (options) =>
32133 HttpClientRequest.post(`/responses`).pipe(
32134 HttpClientRequest.bodyJsonUnsafe(options.payload),
32135 withResponse(options.config)(HttpClientResponse.matchStatus({
32136 "2xx": decodeSuccess(CreateResponse200),
32137 orElse: unexpectedStatus
32138 }))
32139 ),
32140 "createResponseSse": (options) =>
32141 HttpClientRequest.post(`/responses`).pipe(
32142 HttpClientRequest.bodyJsonUnsafe(options.payload),
32143 sseRequest(CreateResponse200Sse)
32144 ),
32145 "getResponse": (responseId, options) =>
32146 HttpClientRequest.get(`/responses/${responseId}`).pipe(
32147 HttpClientRequest.setUrlParams({
32148 "include": options?.params?.["include"] as any,
32149 "stream": options?.params?.["stream"] as any,
32150 "starting_after": options?.params?.["starting_after"] as any,
32151 "include_obfuscation": options?.params?.["include_obfuscation"] as any
32152 }),
32153 withResponse(options?.config)(HttpClientResponse.matchStatus({
32154 "2xx": decodeSuccess(GetResponse200),
32155 orElse: unexpectedStatus
32156 }))
32157 ),
32158 "deleteResponse": (responseId, options) =>
32159 HttpClientRequest.delete(`/responses/${responseId}`).pipe(
32160 withResponse(options?.config)(HttpClientResponse.matchStatus({
32161 "404": decodeError("DeleteResponse404", DeleteResponse404),
32162 "200": () => Effect.void,
32163 orElse: unexpectedStatus
32164 }))
32165 ),
32166 "cancelResponse": (responseId, options) =>
32167 HttpClientRequest.post(`/responses/${responseId}/cancel`).pipe(
32168 withResponse(options?.config)(HttpClientResponse.matchStatus({
32169 "2xx": decodeSuccess(CancelResponse200),
32170 "404": decodeError("CancelResponse404", CancelResponse404),
32171 orElse: unexpectedStatus
32172 }))
32173 ),
32174 "listInputItems": (responseId, options) =>
32175 HttpClientRequest.get(`/responses/${responseId}/input_items`).pipe(
32176 HttpClientRequest.setUrlParams({
32177 "limit": options?.params?.["limit"] as any,
32178 "order": options?.params?.["order"] as any,
32179 "after": options?.params?.["after"] as any,
32180 "include": options?.params?.["include"] as any
32181 }),
32182 withResponse(options?.config)(HttpClientResponse.matchStatus({
32183 "2xx": decodeSuccess(ListInputItems200),
32184 orElse: unexpectedStatus
32185 }))
32186 ),
32187 "createThread": (options) =>
32188 HttpClientRequest.post(`/threads`).pipe(
32189 HttpClientRequest.bodyJsonUnsafe(options.payload),
32190 withResponse(options.config)(HttpClientResponse.matchStatus({
32191 "2xx": decodeSuccess(CreateThread200),
32192 orElse: unexpectedStatus
32193 }))
32194 ),
32195 "createThreadAndRun": (options) =>
32196 HttpClientRequest.post(`/threads/runs`).pipe(
32197 HttpClientRequest.bodyJsonUnsafe(options.payload),
32198 withResponse(options.config)(HttpClientResponse.matchStatus({
32199 "2xx": decodeSuccess(CreateThreadAndRun200),
32200 orElse: unexpectedStatus
32201 }))
32202 ),
32203 "getThread": (threadId, options) =>
32204 HttpClientRequest.get(`/threads/${threadId}`).pipe(
32205 withResponse(options?.config)(HttpClientResponse.matchStatus({
32206 "2xx": decodeSuccess(GetThread200),
32207 orElse: unexpectedStatus
32208 }))
32209 ),
32210 "modifyThread": (threadId, options) =>
32211 HttpClientRequest.post(`/threads/${threadId}`).pipe(
32212 HttpClientRequest.bodyJsonUnsafe(options.payload),
32213 withResponse(options.config)(HttpClientResponse.matchStatus({
32214 "2xx": decodeSuccess(ModifyThread200),
32215 orElse: unexpectedStatus
32216 }))
32217 ),
32218 "deleteThread": (threadId, options) =>
32219 HttpClientRequest.delete(`/threads/${threadId}`).pipe(
32220 withResponse(options?.config)(HttpClientResponse.matchStatus({
32221 "2xx": decodeSuccess(DeleteThread200),
32222 orElse: unexpectedStatus
32223 }))
32224 ),
32225 "listMessages": (threadId, options) =>
32226 HttpClientRequest.get(`/threads/${threadId}/messages`).pipe(
32227 HttpClientRequest.setUrlParams({
32228 "limit": options?.params?.["limit"] as any,
32229 "order": options?.params?.["order"] as any,
32230 "after": options?.params?.["after"] as any,
32231 "before": options?.params?.["before"] as any,
32232 "run_id": options?.params?.["run_id"] as any
32233 }),
32234 withResponse(options?.config)(HttpClientResponse.matchStatus({
32235 "2xx": decodeSuccess(ListMessages200),
32236 orElse: unexpectedStatus
32237 }))
32238 ),
32239 "createMessage": (threadId, options) =>
32240 HttpClientRequest.post(`/threads/${threadId}/messages`).pipe(
32241 HttpClientRequest.bodyJsonUnsafe(options.payload),
32242 withResponse(options.config)(HttpClientResponse.matchStatus({
32243 "2xx": decodeSuccess(CreateMessage200),
32244 orElse: unexpectedStatus
32245 }))
32246 ),
32247 "getMessage": (threadId, messageId, options) =>
32248 HttpClientRequest.get(`/threads/${threadId}/messages/${messageId}`).pipe(
32249 withResponse(options?.config)(HttpClientResponse.matchStatus({
32250 "2xx": decodeSuccess(GetMessage200),
32251 orElse: unexpectedStatus
32252 }))
32253 ),
32254 "modifyMessage": (threadId, messageId, options) =>
32255 HttpClientRequest.post(`/threads/${threadId}/messages/${messageId}`).pipe(
32256 HttpClientRequest.bodyJsonUnsafe(options.payload),
32257 withResponse(options.config)(HttpClientResponse.matchStatus({
32258 "2xx": decodeSuccess(ModifyMessage200),
32259 orElse: unexpectedStatus
32260 }))
32261 ),
32262 "deleteMessage": (threadId, messageId, options) =>
32263 HttpClientRequest.delete(`/threads/${threadId}/messages/${messageId}`).pipe(
32264 withResponse(options?.config)(HttpClientResponse.matchStatus({
32265 "2xx": decodeSuccess(DeleteMessage200),
32266 orElse: unexpectedStatus
32267 }))
32268 ),
32269 "listRuns": (threadId, options) =>
32270 HttpClientRequest.get(`/threads/${threadId}/runs`).pipe(
32271 HttpClientRequest.setUrlParams({
32272 "limit": options?.params?.["limit"] as any,
32273 "order": options?.params?.["order"] as any,
32274 "after": options?.params?.["after"] as any,
32275 "before": options?.params?.["before"] as any
32276 }),
32277 withResponse(options?.config)(HttpClientResponse.matchStatus({
32278 "2xx": decodeSuccess(ListRuns200),
32279 orElse: unexpectedStatus
32280 }))
32281 ),
32282 "createRun": (threadId, options) =>
32283 HttpClientRequest.post(`/threads/${threadId}/runs`).pipe(
32284 HttpClientRequest.setUrlParams({ "include[]": options.params?.["include[]"] as any }),
32285 HttpClientRequest.bodyJsonUnsafe(options.payload),
32286 withResponse(options.config)(HttpClientResponse.matchStatus({
32287 "2xx": decodeSuccess(CreateRun200),
32288 orElse: unexpectedStatus
32289 }))
32290 ),
32291 "getRun": (threadId, runId, options) =>
32292 HttpClientRequest.get(`/threads/${threadId}/runs/${runId}`).pipe(
32293 withResponse(options?.config)(HttpClientResponse.matchStatus({
32294 "2xx": decodeSuccess(GetRun200),
32295 orElse: unexpectedStatus
32296 }))
32297 ),
32298 "modifyRun": (threadId, runId, options) =>
32299 HttpClientRequest.post(`/threads/${threadId}/runs/${runId}`).pipe(
32300 HttpClientRequest.bodyJsonUnsafe(options.payload),
32301 withResponse(options.config)(HttpClientResponse.matchStatus({
32302 "2xx": decodeSuccess(ModifyRun200),
32303 orElse: unexpectedStatus
32304 }))
32305 ),
32306 "cancelRun": (threadId, runId, options) =>
32307 HttpClientRequest.post(`/threads/${threadId}/runs/${runId}/cancel`).pipe(
32308 withResponse(options?.config)(HttpClientResponse.matchStatus({
32309 "2xx": decodeSuccess(CancelRun200),
32310 orElse: unexpectedStatus
32311 }))
32312 ),
32313 "listRunSteps": (threadId, runId, options) =>
32314 HttpClientRequest.get(`/threads/${threadId}/runs/${runId}/steps`).pipe(
32315 HttpClientRequest.setUrlParams({
32316 "limit": options?.params?.["limit"] as any,
32317 "order": options?.params?.["order"] as any,
32318 "after": options?.params?.["after"] as any,
32319 "before": options?.params?.["before"] as any,
32320 "include[]": options?.params?.["include[]"] as any
32321 }),
32322 withResponse(options?.config)(HttpClientResponse.matchStatus({
32323 "2xx": decodeSuccess(ListRunSteps200),
32324 orElse: unexpectedStatus
32325 }))
32326 ),
32327 "getRunStep": (threadId, runId, stepId, options) =>
32328 HttpClientRequest.get(`/threads/${threadId}/runs/${runId}/steps/${stepId}`).pipe(
32329 HttpClientRequest.setUrlParams({ "include[]": options?.params?.["include[]"] as any }),
32330 withResponse(options?.config)(HttpClientResponse.matchStatus({
32331 "2xx": decodeSuccess(GetRunStep200),
32332 orElse: unexpectedStatus
32333 }))
32334 ),
32335 "submitToolOuputsToRun": (threadId, runId, options) =>
32336 HttpClientRequest.post(`/threads/${threadId}/runs/${runId}/submit_tool_outputs`).pipe(
32337 HttpClientRequest.bodyJsonUnsafe(options.payload),
32338 withResponse(options.config)(HttpClientResponse.matchStatus({
32339 "2xx": decodeSuccess(SubmitToolOuputsToRun200),
32340 orElse: unexpectedStatus
32341 }))
32342 ),
32343 "createUpload": (options) =>
32344 HttpClientRequest.post(`/uploads`).pipe(
32345 HttpClientRequest.bodyJsonUnsafe(options.payload),
32346 withResponse(options.config)(HttpClientResponse.matchStatus({
32347 "2xx": decodeSuccess(CreateUpload200),
32348 orElse: unexpectedStatus
32349 }))
32350 ),
32351 "cancelUpload": (uploadId, options) =>
32352 HttpClientRequest.post(`/uploads/${uploadId}/cancel`).pipe(
32353 withResponse(options?.config)(HttpClientResponse.matchStatus({
32354 "2xx": decodeSuccess(CancelUpload200),
32355 orElse: unexpectedStatus
32356 }))
32357 ),
32358 "completeUpload": (uploadId, options) =>
32359 HttpClientRequest.post(`/uploads/${uploadId}/complete`).pipe(
32360 HttpClientRequest.bodyJsonUnsafe(options.payload),
32361 withResponse(options.config)(HttpClientResponse.matchStatus({
32362 "2xx": decodeSuccess(CompleteUpload200),
32363 orElse: unexpectedStatus
32364 }))
32365 ),
32366 "addUploadPart": (uploadId, options) =>
32367 HttpClientRequest.post(`/uploads/${uploadId}/parts`).pipe(
32368 HttpClientRequest.bodyFormData(options.payload as any),
32369 withResponse(options.config)(HttpClientResponse.matchStatus({
32370 "2xx": decodeSuccess(AddUploadPart200),
32371 orElse: unexpectedStatus
32372 }))
32373 ),
32374 "listVectorStores": (options) =>
32375 HttpClientRequest.get(`/vector_stores`).pipe(
32376 HttpClientRequest.setUrlParams({
32377 "limit": options?.params?.["limit"] as any,
32378 "order": options?.params?.["order"] as any,
32379 "after": options?.params?.["after"] as any,
32380 "before": options?.params?.["before"] as any
32381 }),
32382 withResponse(options?.config)(HttpClientResponse.matchStatus({
32383 "2xx": decodeSuccess(ListVectorStores200),
32384 orElse: unexpectedStatus
32385 }))
32386 ),
32387 "createVectorStore": (options) =>
32388 HttpClientRequest.post(`/vector_stores`).pipe(
32389 HttpClientRequest.bodyJsonUnsafe(options.payload),
32390 withResponse(options.config)(HttpClientResponse.matchStatus({
32391 "2xx": decodeSuccess(CreateVectorStore200),
32392 orElse: unexpectedStatus
32393 }))
32394 ),
32395 "getVectorStore": (vectorStoreId, options) =>
32396 HttpClientRequest.get(`/vector_stores/${vectorStoreId}`).pipe(
32397 withResponse(options?.config)(HttpClientResponse.matchStatus({
32398 "2xx": decodeSuccess(GetVectorStore200),
32399 orElse: unexpectedStatus
32400 }))
32401 ),
32402 "modifyVectorStore": (vectorStoreId, options) =>
32403 HttpClientRequest.post(`/vector_stores/${vectorStoreId}`).pipe(
32404 HttpClientRequest.bodyJsonUnsafe(options.payload),
32405 withResponse(options.config)(HttpClientResponse.matchStatus({
32406 "2xx": decodeSuccess(ModifyVectorStore200),
32407 orElse: unexpectedStatus
32408 }))
32409 ),
32410 "deleteVectorStore": (vectorStoreId, options) =>
32411 HttpClientRequest.delete(`/vector_stores/${vectorStoreId}`).pipe(
32412 withResponse(options?.config)(HttpClientResponse.matchStatus({
32413 "2xx": decodeSuccess(DeleteVectorStore200),
32414 orElse: unexpectedStatus
32415 }))
32416 ),
32417 "createVectorStoreFileBatch": (vectorStoreId, options) =>
32418 HttpClientRequest.post(`/vector_stores/${vectorStoreId}/file_batches`).pipe(
32419 HttpClientRequest.bodyJsonUnsafe(options.payload),
32420 withResponse(options.config)(HttpClientResponse.matchStatus({
32421 "2xx": decodeSuccess(CreateVectorStoreFileBatch200),
32422 orElse: unexpectedStatus
32423 }))
32424 ),
32425 "getVectorStoreFileBatch": (vectorStoreId, batchId, options) =>
32426 HttpClientRequest.get(`/vector_stores/${vectorStoreId}/file_batches/${batchId}`).pipe(
32427 withResponse(options?.config)(HttpClientResponse.matchStatus({
32428 "2xx": decodeSuccess(GetVectorStoreFileBatch200),
32429 orElse: unexpectedStatus
32430 }))
32431 ),
32432 "cancelVectorStoreFileBatch": (vectorStoreId, batchId, options) =>
32433 HttpClientRequest.post(`/vector_stores/${vectorStoreId}/file_batches/${batchId}/cancel`).pipe(
32434 withResponse(options?.config)(HttpClientResponse.matchStatus({
32435 "2xx": decodeSuccess(CancelVectorStoreFileBatch200),
32436 orElse: unexpectedStatus
32437 }))
32438 ),
32439 "listFilesInVectorStoreBatch": (vectorStoreId, batchId, options) =>
32440 HttpClientRequest.get(`/vector_stores/${vectorStoreId}/file_batches/${batchId}/files`).pipe(
32441 HttpClientRequest.setUrlParams({
32442 "limit": options?.params?.["limit"] as any,
32443 "order": options?.params?.["order"] as any,
32444 "after": options?.params?.["after"] as any,
32445 "before": options?.params?.["before"] as any,
32446 "filter": options?.params?.["filter"] as any
32447 }),
32448 withResponse(options?.config)(HttpClientResponse.matchStatus({
32449 "2xx": decodeSuccess(ListFilesInVectorStoreBatch200),
32450 orElse: unexpectedStatus
32451 }))
32452 ),
32453 "listVectorStoreFiles": (vectorStoreId, options) =>
32454 HttpClientRequest.get(`/vector_stores/${vectorStoreId}/files`).pipe(
32455 HttpClientRequest.setUrlParams({
32456 "limit": options?.params?.["limit"] as any,
32457 "order": options?.params?.["order"] as any,
32458 "after": options?.params?.["after"] as any,
32459 "before": options?.params?.["before"] as any,
32460 "filter": options?.params?.["filter"] as any
32461 }),
32462 withResponse(options?.config)(HttpClientResponse.matchStatus({
32463 "2xx": decodeSuccess(ListVectorStoreFiles200),
32464 orElse: unexpectedStatus
32465 }))
32466 ),
32467 "createVectorStoreFile": (vectorStoreId, options) =>
32468 HttpClientRequest.post(`/vector_stores/${vectorStoreId}/files`).pipe(
32469 HttpClientRequest.bodyJsonUnsafe(options.payload),
32470 withResponse(options.config)(HttpClientResponse.matchStatus({
32471 "2xx": decodeSuccess(CreateVectorStoreFile200),
32472 orElse: unexpectedStatus
32473 }))
32474 ),
32475 "getVectorStoreFile": (vectorStoreId, fileId, options) =>
32476 HttpClientRequest.get(`/vector_stores/${vectorStoreId}/files/${fileId}`).pipe(
32477 withResponse(options?.config)(HttpClientResponse.matchStatus({
32478 "2xx": decodeSuccess(GetVectorStoreFile200),
32479 orElse: unexpectedStatus
32480 }))
32481 ),
32482 "updateVectorStoreFileAttributes": (vectorStoreId, fileId, options) =>
32483 HttpClientRequest.post(`/vector_stores/${vectorStoreId}/files/${fileId}`).pipe(
32484 HttpClientRequest.bodyJsonUnsafe(options.payload),
32485 withResponse(options.config)(HttpClientResponse.matchStatus({
32486 "2xx": decodeSuccess(UpdateVectorStoreFileAttributes200),
32487 orElse: unexpectedStatus
32488 }))
32489 ),
32490 "deleteVectorStoreFile": (vectorStoreId, fileId, options) =>
32491 HttpClientRequest.delete(`/vector_stores/${vectorStoreId}/files/${fileId}`).pipe(
32492 withResponse(options?.config)(HttpClientResponse.matchStatus({
32493 "2xx": decodeSuccess(DeleteVectorStoreFile200),
32494 orElse: unexpectedStatus
32495 }))
32496 ),
32497 "retrieveVectorStoreFileContent": (vectorStoreId, fileId, options) =>
32498 HttpClientRequest.get(`/vector_stores/${vectorStoreId}/files/${fileId}/content`).pipe(
32499 withResponse(options?.config)(HttpClientResponse.matchStatus({
32500 "2xx": decodeSuccess(RetrieveVectorStoreFileContent200),
32501 orElse: unexpectedStatus
32502 }))
32503 ),
32504 "searchVectorStore": (vectorStoreId, options) =>
32505 HttpClientRequest.post(`/vector_stores/${vectorStoreId}/search`).pipe(
32506 HttpClientRequest.bodyJsonUnsafe(options.payload),
32507 withResponse(options.config)(HttpClientResponse.matchStatus({
32508 "2xx": decodeSuccess(SearchVectorStore200),
32509 orElse: unexpectedStatus
32510 }))
32511 ),
32512 "createConversation": (options) =>
32513 HttpClientRequest.post(`/conversations`).pipe(
32514 HttpClientRequest.bodyJsonUnsafe(options.payload),
32515 withResponse(options.config)(HttpClientResponse.matchStatus({
32516 "2xx": decodeSuccess(CreateConversation200),
32517 orElse: unexpectedStatus
32518 }))
32519 ),
32520 "getConversation": (conversationId, options) =>
32521 HttpClientRequest.get(`/conversations/${conversationId}`).pipe(
32522 withResponse(options?.config)(HttpClientResponse.matchStatus({
32523 "2xx": decodeSuccess(GetConversation200),
32524 orElse: unexpectedStatus
32525 }))
32526 ),
32527 "updateConversation": (conversationId, options) =>
32528 HttpClientRequest.post(`/conversations/${conversationId}`).pipe(
32529 HttpClientRequest.bodyJsonUnsafe(options.payload),
32530 withResponse(options.config)(HttpClientResponse.matchStatus({
32531 "2xx": decodeSuccess(UpdateConversation200),
32532 orElse: unexpectedStatus
32533 }))
32534 ),
32535 "deleteConversation": (conversationId, options) =>
32536 HttpClientRequest.delete(`/conversations/${conversationId}`).pipe(
32537 withResponse(options?.config)(HttpClientResponse.matchStatus({
32538 "2xx": decodeSuccess(DeleteConversation200),
32539 orElse: unexpectedStatus
32540 }))
32541 ),
32542 "ListVideos": (options) =>
32543 HttpClientRequest.get(`/videos`).pipe(
32544 HttpClientRequest.setUrlParams({
32545 "limit": options?.params?.["limit"] as any,
32546 "order": options?.params?.["order"] as any,
32547 "after": options?.params?.["after"] as any
32548 }),
32549 withResponse(options?.config)(HttpClientResponse.matchStatus({
32550 "2xx": decodeSuccess(ListVideos200),
32551 orElse: unexpectedStatus
32552 }))
32553 ),
32554 "createVideo": (options) =>
32555 HttpClientRequest.post(`/videos`).pipe(
32556 HttpClientRequest.bodyFormData(options.payload as any),
32557 withResponse(options.config)(HttpClientResponse.matchStatus({
32558 "2xx": decodeSuccess(CreateVideo200),
32559 orElse: unexpectedStatus
32560 }))
32561 ),
32562 "CreateVideoCharacter": (options) =>
32563 HttpClientRequest.post(`/videos/characters`).pipe(
32564 HttpClientRequest.bodyFormData(options.payload as any),
32565 withResponse(options.config)(HttpClientResponse.matchStatus({
32566 "2xx": decodeSuccess(CreateVideoCharacter200),
32567 orElse: unexpectedStatus
32568 }))
32569 ),
32570 "GetVideoCharacter": (characterId, options) =>
32571 HttpClientRequest.get(`/videos/characters/${characterId}`).pipe(
32572 withResponse(options?.config)(HttpClientResponse.matchStatus({
32573 "2xx": decodeSuccess(GetVideoCharacter200),
32574 orElse: unexpectedStatus
32575 }))
32576 ),
32577 "CreateVideoEdit": (options) =>
32578 HttpClientRequest.post(`/videos/edits`).pipe(
32579 HttpClientRequest.bodyFormData(options.payload as any),
32580 withResponse(options.config)(HttpClientResponse.matchStatus({
32581 "2xx": decodeSuccess(CreateVideoEdit200),
32582 orElse: unexpectedStatus
32583 }))
32584 ),
32585 "CreateVideoExtend": (options) =>
32586 HttpClientRequest.post(`/videos/extensions`).pipe(
32587 HttpClientRequest.bodyFormData(options.payload as any),
32588 withResponse(options.config)(HttpClientResponse.matchStatus({
32589 "2xx": decodeSuccess(CreateVideoExtend200),
32590 orElse: unexpectedStatus
32591 }))
32592 ),
32593 "GetVideo": (videoId, options) =>
32594 HttpClientRequest.get(`/videos/${videoId}`).pipe(
32595 withResponse(options?.config)(HttpClientResponse.matchStatus({
32596 "2xx": decodeSuccess(GetVideo200),
32597 orElse: unexpectedStatus
32598 }))
32599 ),
32600 "DeleteVideo": (videoId, options) =>
32601 HttpClientRequest.delete(`/videos/${videoId}`).pipe(
32602 withResponse(options?.config)(HttpClientResponse.matchStatus({
32603 "2xx": decodeSuccess(DeleteVideo200),
32604 orElse: unexpectedStatus
32605 }))
32606 ),
32607 "RetrieveVideoContent": (videoId, options) =>
32608 HttpClientRequest.get(`/videos/${videoId}/content`).pipe(
32609 HttpClientRequest.setUrlParams({ "variant": options?.params?.["variant"] as any }),
32610 withResponse(options?.config)(HttpClientResponse.matchStatus({
32611 "2xx": decodeSuccess(RetrieveVideoContent200),
32612 orElse: unexpectedStatus
32613 }))
32614 ),
32615 "CreateVideoRemix": (videoId, options) =>
32616 HttpClientRequest.post(`/videos/${videoId}/remix`).pipe(
32617 HttpClientRequest.bodyFormData(options.payload as any),
32618 withResponse(options.config)(HttpClientResponse.matchStatus({
32619 "2xx": decodeSuccess(CreateVideoRemix200),
32620 orElse: unexpectedStatus
32621 }))
32622 ),
32623 "Getinputtokencounts": (options) =>
32624 HttpClientRequest.post(`/responses/input_tokens`).pipe(
32625 HttpClientRequest.bodyUrlParams(options.payload as any),
32626 withResponse(options.config)(HttpClientResponse.matchStatus({
32627 "2xx": decodeSuccess(Getinputtokencounts200),
32628 orElse: unexpectedStatus
32629 }))
32630 ),
32631 "Compactconversation": (options) =>
32632 HttpClientRequest.post(`/responses/compact`).pipe(
32633 HttpClientRequest.bodyUrlParams(options.payload as any),
32634 withResponse(options.config)(HttpClientResponse.matchStatus({
32635 "2xx": decodeSuccess(Compactconversation200),
32636 orElse: unexpectedStatus
32637 }))
32638 ),
32639 "ListSkills": (options) =>
32640 HttpClientRequest.get(`/skills`).pipe(
32641 HttpClientRequest.setUrlParams({
32642 "limit": options?.params?.["limit"] as any,
32643 "order": options?.params?.["order"] as any,
32644 "after": options?.params?.["after"] as any
32645 }),
32646 withResponse(options?.config)(HttpClientResponse.matchStatus({
32647 "2xx": decodeSuccess(ListSkills200),
32648 orElse: unexpectedStatus
32649 }))
32650 ),
32651 "CreateSkill": (options) =>
32652 HttpClientRequest.post(`/skills`).pipe(
32653 HttpClientRequest.bodyFormData(options.payload as any),
32654 withResponse(options.config)(HttpClientResponse.matchStatus({
32655 "2xx": decodeSuccess(CreateSkill200),
32656 orElse: unexpectedStatus
32657 }))
32658 ),
32659 "GetSkill": (skillId, options) =>
32660 HttpClientRequest.get(`/skills/${skillId}`).pipe(
32661 withResponse(options?.config)(HttpClientResponse.matchStatus({
32662 "2xx": decodeSuccess(GetSkill200),
32663 orElse: unexpectedStatus
32664 }))
32665 ),
32666 "UpdateSkillDefaultVersion": (skillId, options) =>
32667 HttpClientRequest.post(`/skills/${skillId}`).pipe(
32668 HttpClientRequest.bodyUrlParams(options.payload as any),
32669 withResponse(options.config)(HttpClientResponse.matchStatus({
32670 "2xx": decodeSuccess(UpdateSkillDefaultVersion200),
32671 orElse: unexpectedStatus
32672 }))
32673 ),
32674 "DeleteSkill": (skillId, options) =>
32675 HttpClientRequest.delete(`/skills/${skillId}`).pipe(
32676 withResponse(options?.config)(HttpClientResponse.matchStatus({
32677 "2xx": decodeSuccess(DeleteSkill200),
32678 orElse: unexpectedStatus
32679 }))
32680 ),
32681 "GetSkillContent": (skillId, options) =>
32682 HttpClientRequest.get(`/skills/${skillId}/content`).pipe(
32683 withResponse(options?.config)(HttpClientResponse.matchStatus({
32684 "2xx": decodeSuccess(GetSkillContent200),
32685 orElse: unexpectedStatus
32686 }))
32687 ),
32688 "ListSkillVersions": (skillId, options) =>
32689 HttpClientRequest.get(`/skills/${skillId}/versions`).pipe(
32690 HttpClientRequest.setUrlParams({
32691 "limit": options?.params?.["limit"] as any,
32692 "order": options?.params?.["order"] as any,
32693 "after": options?.params?.["after"] as any
32694 }),
32695 withResponse(options?.config)(HttpClientResponse.matchStatus({
32696 "2xx": decodeSuccess(ListSkillVersions200),
32697 orElse: unexpectedStatus
32698 }))
32699 ),
32700 "CreateSkillVersion": (skillId, options) =>
32701 HttpClientRequest.post(`/skills/${skillId}/versions`).pipe(
32702 HttpClientRequest.bodyFormData(options.payload as any),
32703 withResponse(options.config)(HttpClientResponse.matchStatus({
32704 "2xx": decodeSuccess(CreateSkillVersion200),
32705 orElse: unexpectedStatus
32706 }))
32707 ),
32708 "GetSkillVersion": (skillId, version, options) =>
32709 HttpClientRequest.get(`/skills/${skillId}/versions/${version}`).pipe(
32710 withResponse(options?.config)(HttpClientResponse.matchStatus({
32711 "2xx": decodeSuccess(GetSkillVersion200),
32712 orElse: unexpectedStatus
32713 }))
32714 ),
32715 "DeleteSkillVersion": (skillId, version, options) =>
32716 HttpClientRequest.delete(`/skills/${skillId}/versions/${version}`).pipe(
32717 withResponse(options?.config)(HttpClientResponse.matchStatus({
32718 "2xx": decodeSuccess(DeleteSkillVersion200),
32719 orElse: unexpectedStatus
32720 }))
32721 ),
32722 "GetSkillVersionContent": (skillId, version, options) =>
32723 HttpClientRequest.get(`/skills/${skillId}/versions/${version}/content`).pipe(
32724 withResponse(options?.config)(HttpClientResponse.matchStatus({
32725 "2xx": decodeSuccess(GetSkillVersionContent200),
32726 orElse: unexpectedStatus
32727 }))
32728 ),
32729 "CancelChatSessionMethod": (sessionId, options) =>
32730 HttpClientRequest.post(`/chatkit/sessions/${sessionId}/cancel`).pipe(
32731 withResponse(options?.config)(HttpClientResponse.matchStatus({
32732 "2xx": decodeSuccess(CancelChatSessionMethod200),
32733 orElse: unexpectedStatus
32734 }))
32735 ),
32736 "CreateChatSessionMethod": (options) =>
32737 HttpClientRequest.post(`/chatkit/sessions`).pipe(
32738 HttpClientRequest.bodyJsonUnsafe(options.payload),
32739 withResponse(options.config)(HttpClientResponse.matchStatus({
32740 "2xx": decodeSuccess(CreateChatSessionMethod200),
32741 orElse: unexpectedStatus
32742 }))
32743 ),
32744 "ListThreadItemsMethod": (threadId, options) =>
32745 HttpClientRequest.get(`/chatkit/threads/${threadId}/items`).pipe(
32746 HttpClientRequest.setUrlParams({
32747 "limit": options?.params?.["limit"] as any,
32748 "order": options?.params?.["order"] as any,
32749 "after": options?.params?.["after"] as any,
32750 "before": options?.params?.["before"] as any
32751 }),
32752 withResponse(options?.config)(HttpClientResponse.matchStatus({
32753 "2xx": decodeSuccess(ListThreadItemsMethod200),
32754 orElse: unexpectedStatus
32755 }))
32756 ),
32757 "GetThreadMethod": (threadId, options) =>
32758 HttpClientRequest.get(`/chatkit/threads/${threadId}`).pipe(
32759 withResponse(options?.config)(HttpClientResponse.matchStatus({
32760 "2xx": decodeSuccess(GetThreadMethod200),
32761 orElse: unexpectedStatus
32762 }))
32763 ),
32764 "DeleteThreadMethod": (threadId, options) =>
32765 HttpClientRequest.delete(`/chatkit/threads/${threadId}`).pipe(
32766 withResponse(options?.config)(HttpClientResponse.matchStatus({
32767 "2xx": decodeSuccess(DeleteThreadMethod200),
32768 orElse: unexpectedStatus
32769 }))
32770 ),
32771 "ListThreadsMethod": (options) =>
32772 HttpClientRequest.get(`/chatkit/threads`).pipe(
32773 HttpClientRequest.setUrlParams({
32774 "limit": options?.params?.["limit"] as any,
32775 "order": options?.params?.["order"] as any,
32776 "after": options?.params?.["after"] as any,
32777 "before": options?.params?.["before"] as any,
32778 "user": options?.params?.["user"] as any
32779 }),
32780 withResponse(options?.config)(HttpClientResponse.matchStatus({
32781 "2xx": decodeSuccess(ListThreadsMethod200),
32782 orElse: unexpectedStatus
32783 }))
32784 )
32785 }
32786}
32787
32788export interface OpenAiClient {
32789 readonly httpClient: HttpClient.HttpClient
32790 /**
32791 * Returns a list of assistants.
32792 */
32793 readonly "listAssistants": <Config extends OperationConfig>(
32794 options:
32795 | { readonly params?: typeof ListAssistantsParams.Encoded | undefined; readonly config?: Config | undefined }
32796 | undefined
32797 ) => Effect.Effect<
32798 WithOptionalResponse<typeof ListAssistants200.Type, Config>,
32799 HttpClientError.HttpClientError | SchemaError
32800 >
32801 /**
32802 * Create an assistant with a model and instructions.
32803 */
32804 readonly "createAssistant": <Config extends OperationConfig>(
32805 options: { readonly payload: typeof CreateAssistantRequestJson.Encoded; readonly config?: Config | undefined }
32806 ) => Effect.Effect<
32807 WithOptionalResponse<typeof CreateAssistant200.Type, Config>,
32808 HttpClientError.HttpClientError | SchemaError
32809 >
32810 /**
32811 * Retrieves an assistant.
32812 */
32813 readonly "getAssistant": <Config extends OperationConfig>(
32814 assistantId: string,
32815 options: { readonly config?: Config | undefined } | undefined
32816 ) => Effect.Effect<
32817 WithOptionalResponse<typeof GetAssistant200.Type, Config>,
32818 HttpClientError.HttpClientError | SchemaError
32819 >
32820 /**
32821 * Modifies an assistant.
32822 */
32823 readonly "modifyAssistant": <Config extends OperationConfig>(
32824 assistantId: string,
32825 options: { readonly payload: typeof ModifyAssistantRequestJson.Encoded; readonly config?: Config | undefined }
32826 ) => Effect.Effect<
32827 WithOptionalResponse<typeof ModifyAssistant200.Type, Config>,
32828 HttpClientError.HttpClientError | SchemaError
32829 >
32830 /**
32831 * Delete an assistant.
32832 */
32833 readonly "deleteAssistant": <Config extends OperationConfig>(
32834 assistantId: string,
32835 options: { readonly config?: Config | undefined } | undefined
32836 ) => Effect.Effect<
32837 WithOptionalResponse<typeof DeleteAssistant200.Type, Config>,
32838 HttpClientError.HttpClientError | SchemaError
32839 >
32840 /**
32841 * Generates audio from the input text.
32842 *
32843 * Returns the audio file content, or a stream of audio events.
32844 */
32845 readonly "createSpeech": <Config extends OperationConfig>(
32846 options: { readonly payload: typeof CreateSpeechRequestJson.Encoded; readonly config?: Config | undefined }
32847 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
32848 /**
32849 * Generates audio from the input text.
32850 *
32851 * Returns the audio file content, or a stream of audio events.
32852 */
32853 readonly "createSpeechSse": (
32854 options: { readonly payload: typeof CreateSpeechRequestJson.Encoded }
32855 ) => Stream.Stream<
32856 { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateSpeech200Sse.Type },
32857 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
32858 typeof CreateSpeech200Sse.DecodingServices
32859 >
32860 /**
32861 * Generates audio from the input text.
32862 *
32863 * Returns the audio file content, or a stream of audio events.
32864 */
32865 readonly "createSpeechStream": (
32866 options: { readonly payload: typeof CreateSpeechRequestJson.Encoded }
32867 ) => Stream.Stream<Uint8Array, HttpClientError.HttpClientError>
32868 /**
32869 * Transcribes audio into the input language.
32870 *
32871 * Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
32872 * format, or a stream of transcript events.
32873 */
32874 readonly "createTranscription": <Config extends OperationConfig>(
32875 options: {
32876 readonly payload: typeof CreateTranscriptionRequestFormData.Encoded
32877 readonly config?: Config | undefined
32878 }
32879 ) => Effect.Effect<
32880 WithOptionalResponse<typeof CreateTranscription200.Type, Config>,
32881 HttpClientError.HttpClientError | SchemaError
32882 >
32883 /**
32884 * Transcribes audio into the input language.
32885 *
32886 * Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
32887 * format, or a stream of transcript events.
32888 */
32889 readonly "createTranscriptionSse": (
32890 options: { readonly payload: typeof CreateTranscriptionRequestFormData.Encoded }
32891 ) => Stream.Stream<
32892 { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateTranscription200Sse.Type },
32893 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
32894 typeof CreateTranscription200Sse.DecodingServices
32895 >
32896 /**
32897 * Translates audio into English.
32898 */
32899 readonly "createTranslation": <Config extends OperationConfig>(
32900 options: { readonly payload: typeof CreateTranslationRequestFormData.Encoded; readonly config?: Config | undefined }
32901 ) => Effect.Effect<
32902 WithOptionalResponse<typeof CreateTranslation200.Type, Config>,
32903 HttpClientError.HttpClientError | SchemaError
32904 >
32905 /**
32906 * List consent recordings available to your organization for creating custom voices.
32907 *
32908 * See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
32909 */
32910 readonly "listVoiceConsents": <Config extends OperationConfig>(
32911 options: {
32912 readonly params?: typeof ListVoiceConsentsParams.Encoded | undefined
32913 readonly config?: Config | undefined
32914 } | undefined
32915 ) => Effect.Effect<
32916 WithOptionalResponse<typeof ListVoiceConsents200.Type, Config>,
32917 HttpClientError.HttpClientError | SchemaError
32918 >
32919 /**
32920 * Upload a consent recording that authorizes creation of a custom voice.
32921 *
32922 * See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
32923 */
32924 readonly "createVoiceConsent": <Config extends OperationConfig>(
32925 options: {
32926 readonly payload: typeof CreateVoiceConsentRequestFormData.Encoded
32927 readonly config?: Config | undefined
32928 }
32929 ) => Effect.Effect<
32930 WithOptionalResponse<typeof CreateVoiceConsent200.Type, Config>,
32931 HttpClientError.HttpClientError | SchemaError
32932 >
32933 /**
32934 * Retrieve consent recording metadata used for creating custom voices.
32935 *
32936 * See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
32937 */
32938 readonly "getVoiceConsent": <Config extends OperationConfig>(
32939 consentId: string,
32940 options: { readonly config?: Config | undefined } | undefined
32941 ) => Effect.Effect<
32942 WithOptionalResponse<typeof GetVoiceConsent200.Type, Config>,
32943 HttpClientError.HttpClientError | SchemaError
32944 >
32945 /**
32946 * Update consent recording metadata used for creating custom voices. This endpoint updates metadata only and does not replace the underlying audio.
32947 *
32948 * See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
32949 */
32950 readonly "updateVoiceConsent": <Config extends OperationConfig>(
32951 consentId: string,
32952 options: { readonly payload: typeof UpdateVoiceConsentRequestJson.Encoded; readonly config?: Config | undefined }
32953 ) => Effect.Effect<
32954 WithOptionalResponse<typeof UpdateVoiceConsent200.Type, Config>,
32955 HttpClientError.HttpClientError | SchemaError
32956 >
32957 /**
32958 * Delete a consent recording that was uploaded for creating custom voices.
32959 *
32960 * See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
32961 */
32962 readonly "deleteVoiceConsent": <Config extends OperationConfig>(
32963 consentId: string,
32964 options: { readonly config?: Config | undefined } | undefined
32965 ) => Effect.Effect<
32966 WithOptionalResponse<typeof DeleteVoiceConsent200.Type, Config>,
32967 HttpClientError.HttpClientError | SchemaError
32968 >
32969 /**
32970 * Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.
32971 *
32972 * See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
32973 */
32974 readonly "createVoice": <Config extends OperationConfig>(
32975 options: { readonly payload: typeof CreateVoiceRequestFormData.Encoded; readonly config?: Config | undefined }
32976 ) => Effect.Effect<
32977 WithOptionalResponse<typeof CreateVoice200.Type, Config>,
32978 HttpClientError.HttpClientError | SchemaError
32979 >
32980 /**
32981 * List your organization's batches.
32982 */
32983 readonly "listBatches": <Config extends OperationConfig>(
32984 options:
32985 | { readonly params?: typeof ListBatchesParams.Encoded | undefined; readonly config?: Config | undefined }
32986 | undefined
32987 ) => Effect.Effect<
32988 WithOptionalResponse<typeof ListBatches200.Type, Config>,
32989 HttpClientError.HttpClientError | SchemaError
32990 >
32991 /**
32992 * Creates and executes a batch from an uploaded file of requests
32993 */
32994 readonly "createBatch": <Config extends OperationConfig>(
32995 options: { readonly payload: typeof CreateBatchRequestJson.Encoded; readonly config?: Config | undefined }
32996 ) => Effect.Effect<
32997 WithOptionalResponse<typeof CreateBatch200.Type, Config>,
32998 HttpClientError.HttpClientError | SchemaError
32999 >
33000 /**
33001 * Retrieves a batch.
33002 */
33003 readonly "retrieveBatch": <Config extends OperationConfig>(
33004 batchId: string,
33005 options: { readonly config?: Config | undefined } | undefined
33006 ) => Effect.Effect<
33007 WithOptionalResponse<typeof RetrieveBatch200.Type, Config>,
33008 HttpClientError.HttpClientError | SchemaError
33009 >
33010 /**
33011 * Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.
33012 */
33013 readonly "cancelBatch": <Config extends OperationConfig>(
33014 batchId: string,
33015 options: { readonly config?: Config | undefined } | undefined
33016 ) => Effect.Effect<
33017 WithOptionalResponse<typeof CancelBatch200.Type, Config>,
33018 HttpClientError.HttpClientError | SchemaError
33019 >
33020 /**
33021 * List stored Chat Completions. Only Chat Completions that have been stored
33022 * with the `store` parameter set to `true` will be returned.
33023 */
33024 readonly "listChatCompletions": <Config extends OperationConfig>(
33025 options: {
33026 readonly params?: typeof ListChatCompletionsParams.Encoded | undefined
33027 readonly config?: Config | undefined
33028 } | undefined
33029 ) => Effect.Effect<
33030 WithOptionalResponse<typeof ListChatCompletions200.Type, Config>,
33031 HttpClientError.HttpClientError | SchemaError
33032 >
33033 /**
33034 * **Starting a new project?** We recommend trying [Responses](/docs/api-reference/responses)
33035 * to take advantage of the latest OpenAI platform features. Compare
33036 * [Chat Completions with Responses](/docs/guides/responses-vs-chat-completions?api-mode=responses).
33037 *
33038 * ---
33039 *
33040 * Creates a model response for the given chat conversation. Learn more in the
33041 * [text generation](/docs/guides/text-generation), [vision](/docs/guides/vision),
33042 * and [audio](/docs/guides/audio) guides.
33043 *
33044 * Parameter support can differ depending on the model used to generate the
33045 * response, particularly for newer reasoning models. Parameters that are only
33046 * supported for reasoning models are noted below. For the current state of
33047 * unsupported parameters in reasoning models,
33048 * [refer to the reasoning guide](/docs/guides/reasoning).
33049 *
33050 * Returns a chat completion object, or a streamed sequence of chat completion
33051 * chunk objects if the request is streamed.
33052 */
33053 readonly "createChatCompletion": <Config extends OperationConfig>(
33054 options: { readonly payload: typeof CreateChatCompletionRequestJson.Encoded; readonly config?: Config | undefined }
33055 ) => Effect.Effect<
33056 WithOptionalResponse<typeof CreateChatCompletion200.Type, Config>,
33057 HttpClientError.HttpClientError | SchemaError
33058 >
33059 /**
33060 * **Starting a new project?** We recommend trying [Responses](/docs/api-reference/responses)
33061 * to take advantage of the latest OpenAI platform features. Compare
33062 * [Chat Completions with Responses](/docs/guides/responses-vs-chat-completions?api-mode=responses).
33063 *
33064 * ---
33065 *
33066 * Creates a model response for the given chat conversation. Learn more in the
33067 * [text generation](/docs/guides/text-generation), [vision](/docs/guides/vision),
33068 * and [audio](/docs/guides/audio) guides.
33069 *
33070 * Parameter support can differ depending on the model used to generate the
33071 * response, particularly for newer reasoning models. Parameters that are only
33072 * supported for reasoning models are noted below. For the current state of
33073 * unsupported parameters in reasoning models,
33074 * [refer to the reasoning guide](/docs/guides/reasoning).
33075 *
33076 * Returns a chat completion object, or a streamed sequence of chat completion
33077 * chunk objects if the request is streamed.
33078 */
33079 readonly "createChatCompletionSse": (
33080 options: { readonly payload: typeof CreateChatCompletionRequestJson.Encoded }
33081 ) => Stream.Stream<
33082 { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateChatCompletion200Sse.Type },
33083 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
33084 typeof CreateChatCompletion200Sse.DecodingServices
33085 >
33086 /**
33087 * Get a stored chat completion. Only Chat Completions that have been created
33088 * with the `store` parameter set to `true` will be returned.
33089 */
33090 readonly "getChatCompletion": <Config extends OperationConfig>(
33091 completionId: string,
33092 options: { readonly config?: Config | undefined } | undefined
33093 ) => Effect.Effect<
33094 WithOptionalResponse<typeof GetChatCompletion200.Type, Config>,
33095 HttpClientError.HttpClientError | SchemaError
33096 >
33097 /**
33098 * Modify a stored chat completion. Only Chat Completions that have been
33099 * created with the `store` parameter set to `true` can be modified. Currently,
33100 * the only supported modification is to update the `metadata` field.
33101 */
33102 readonly "updateChatCompletion": <Config extends OperationConfig>(
33103 completionId: string,
33104 options: { readonly payload: typeof UpdateChatCompletionRequestJson.Encoded; readonly config?: Config | undefined }
33105 ) => Effect.Effect<
33106 WithOptionalResponse<typeof UpdateChatCompletion200.Type, Config>,
33107 HttpClientError.HttpClientError | SchemaError
33108 >
33109 /**
33110 * Delete a stored chat completion. Only Chat Completions that have been
33111 * created with the `store` parameter set to `true` can be deleted.
33112 */
33113 readonly "deleteChatCompletion": <Config extends OperationConfig>(
33114 completionId: string,
33115 options: { readonly config?: Config | undefined } | undefined
33116 ) => Effect.Effect<
33117 WithOptionalResponse<typeof DeleteChatCompletion200.Type, Config>,
33118 HttpClientError.HttpClientError | SchemaError
33119 >
33120 /**
33121 * Get the messages in a stored chat completion. Only Chat Completions that
33122 * have been created with the `store` parameter set to `true` will be
33123 * returned.
33124 */
33125 readonly "getChatCompletionMessages": <Config extends OperationConfig>(
33126 completionId: string,
33127 options: {
33128 readonly params?: typeof GetChatCompletionMessagesParams.Encoded | undefined
33129 readonly config?: Config | undefined
33130 } | undefined
33131 ) => Effect.Effect<
33132 WithOptionalResponse<typeof GetChatCompletionMessages200.Type, Config>,
33133 HttpClientError.HttpClientError | SchemaError
33134 >
33135 /**
33136 * Creates a completion for the provided prompt and parameters.
33137 *
33138 * Returns a completion object, or a sequence of completion objects if the request is streamed.
33139 */
33140 readonly "createCompletion": <Config extends OperationConfig>(
33141 options: { readonly payload: typeof CreateCompletionRequestJson.Encoded; readonly config?: Config | undefined }
33142 ) => Effect.Effect<
33143 WithOptionalResponse<typeof CreateCompletion200.Type, Config>,
33144 HttpClientError.HttpClientError | SchemaError
33145 >
33146 /**
33147 * Lists containers.
33148 */
33149 readonly "ListContainers": <Config extends OperationConfig>(
33150 options:
33151 | { readonly params?: typeof ListContainersParams.Encoded | undefined; readonly config?: Config | undefined }
33152 | undefined
33153 ) => Effect.Effect<
33154 WithOptionalResponse<typeof ListContainers200.Type, Config>,
33155 HttpClientError.HttpClientError | SchemaError
33156 >
33157 /**
33158 * Creates a container.
33159 */
33160 readonly "CreateContainer": <Config extends OperationConfig>(
33161 options: { readonly payload: typeof CreateContainerRequestJson.Encoded; readonly config?: Config | undefined }
33162 ) => Effect.Effect<
33163 WithOptionalResponse<typeof CreateContainer200.Type, Config>,
33164 HttpClientError.HttpClientError | SchemaError
33165 >
33166 /**
33167 * Retrieves a container.
33168 */
33169 readonly "RetrieveContainer": <Config extends OperationConfig>(
33170 containerId: string,
33171 options: { readonly config?: Config | undefined } | undefined
33172 ) => Effect.Effect<
33173 WithOptionalResponse<typeof RetrieveContainer200.Type, Config>,
33174 HttpClientError.HttpClientError | SchemaError
33175 >
33176 /**
33177 * Delete a container.
33178 */
33179 readonly "DeleteContainer": <Config extends OperationConfig>(
33180 containerId: string,
33181 options: { readonly config?: Config | undefined } | undefined
33182 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
33183 /**
33184 * Lists container files.
33185 */
33186 readonly "ListContainerFiles": <Config extends OperationConfig>(
33187 containerId: string,
33188 options: {
33189 readonly params?: typeof ListContainerFilesParams.Encoded | undefined
33190 readonly config?: Config | undefined
33191 } | undefined
33192 ) => Effect.Effect<
33193 WithOptionalResponse<typeof ListContainerFiles200.Type, Config>,
33194 HttpClientError.HttpClientError | SchemaError
33195 >
33196 /**
33197 * Creates a container file.
33198 */
33199 readonly "CreateContainerFile": <Config extends OperationConfig>(
33200 containerId: string,
33201 options: {
33202 readonly payload: typeof CreateContainerFileRequestFormData.Encoded
33203 readonly config?: Config | undefined
33204 }
33205 ) => Effect.Effect<
33206 WithOptionalResponse<typeof CreateContainerFile200.Type, Config>,
33207 HttpClientError.HttpClientError | SchemaError
33208 >
33209 /**
33210 * Retrieves a container file.
33211 */
33212 readonly "RetrieveContainerFile": <Config extends OperationConfig>(
33213 containerId: string,
33214 fileId: string,
33215 options: { readonly config?: Config | undefined } | undefined
33216 ) => Effect.Effect<
33217 WithOptionalResponse<typeof RetrieveContainerFile200.Type, Config>,
33218 HttpClientError.HttpClientError | SchemaError
33219 >
33220 /**
33221 * Delete a container file.
33222 */
33223 readonly "DeleteContainerFile": <Config extends OperationConfig>(
33224 containerId: string,
33225 fileId: string,
33226 options: { readonly config?: Config | undefined } | undefined
33227 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
33228 /**
33229 * Retrieves a container file content.
33230 */
33231 readonly "RetrieveContainerFileContent": <Config extends OperationConfig>(
33232 containerId: string,
33233 fileId: string,
33234 options: { readonly config?: Config | undefined } | undefined
33235 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
33236 /**
33237 * List all items for a conversation with the given ID.
33238 */
33239 readonly "listConversationItems": <Config extends OperationConfig>(
33240 conversationId: string,
33241 options: {
33242 readonly params?: typeof ListConversationItemsParams.Encoded | undefined
33243 readonly config?: Config | undefined
33244 } | undefined
33245 ) => Effect.Effect<
33246 WithOptionalResponse<typeof ListConversationItems200.Type, Config>,
33247 HttpClientError.HttpClientError | SchemaError
33248 >
33249 /**
33250 * Create items in a conversation with the given ID.
33251 */
33252 readonly "createConversationItems": <Config extends OperationConfig>(
33253 conversationId: string,
33254 options: {
33255 readonly params?: typeof CreateConversationItemsParams.Encoded | undefined
33256 readonly payload: typeof CreateConversationItemsRequestJson.Encoded
33257 readonly config?: Config | undefined
33258 }
33259 ) => Effect.Effect<
33260 WithOptionalResponse<typeof CreateConversationItems200.Type, Config>,
33261 HttpClientError.HttpClientError | SchemaError
33262 >
33263 /**
33264 * Get a single item from a conversation with the given IDs.
33265 */
33266 readonly "getConversationItem": <Config extends OperationConfig>(
33267 conversationId: string,
33268 itemId: string,
33269 options: {
33270 readonly params?: typeof GetConversationItemParams.Encoded | undefined
33271 readonly config?: Config | undefined
33272 } | undefined
33273 ) => Effect.Effect<
33274 WithOptionalResponse<typeof GetConversationItem200.Type, Config>,
33275 HttpClientError.HttpClientError | SchemaError
33276 >
33277 /**
33278 * Delete an item from a conversation with the given IDs.
33279 */
33280 readonly "deleteConversationItem": <Config extends OperationConfig>(
33281 conversationId: string,
33282 itemId: string,
33283 options: { readonly config?: Config | undefined } | undefined
33284 ) => Effect.Effect<
33285 WithOptionalResponse<typeof DeleteConversationItem200.Type, Config>,
33286 HttpClientError.HttpClientError | SchemaError
33287 >
33288 /**
33289 * Creates an embedding vector representing the input text.
33290 */
33291 readonly "createEmbedding": <Config extends OperationConfig>(
33292 options: { readonly payload: typeof CreateEmbeddingRequestJson.Encoded; readonly config?: Config | undefined }
33293 ) => Effect.Effect<
33294 WithOptionalResponse<typeof CreateEmbedding200.Type, Config>,
33295 HttpClientError.HttpClientError | SchemaError
33296 >
33297 /**
33298 * List evaluations for a project.
33299 */
33300 readonly "listEvals": <Config extends OperationConfig>(
33301 options:
33302 | { readonly params?: typeof ListEvalsParams.Encoded | undefined; readonly config?: Config | undefined }
33303 | undefined
33304 ) => Effect.Effect<
33305 WithOptionalResponse<typeof ListEvals200.Type, Config>,
33306 HttpClientError.HttpClientError | SchemaError
33307 >
33308 /**
33309 * Create the structure of an evaluation that can be used to test a model's performance.
33310 * An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.
33311 * For more information, see the [Evals guide](/docs/guides/evals).
33312 */
33313 readonly "createEval": <Config extends OperationConfig>(
33314 options: { readonly payload: typeof CreateEvalRequestJson.Encoded; readonly config?: Config | undefined }
33315 ) => Effect.Effect<
33316 WithOptionalResponse<typeof CreateEval201.Type, Config>,
33317 HttpClientError.HttpClientError | SchemaError
33318 >
33319 /**
33320 * Get an evaluation by ID.
33321 */
33322 readonly "getEval": <Config extends OperationConfig>(
33323 evalId: string,
33324 options: { readonly config?: Config | undefined } | undefined
33325 ) => Effect.Effect<
33326 WithOptionalResponse<typeof GetEval200.Type, Config>,
33327 HttpClientError.HttpClientError | SchemaError
33328 >
33329 /**
33330 * Update certain properties of an evaluation.
33331 */
33332 readonly "updateEval": <Config extends OperationConfig>(
33333 evalId: string,
33334 options: { readonly payload: typeof UpdateEvalRequestJson.Encoded; readonly config?: Config | undefined }
33335 ) => Effect.Effect<
33336 WithOptionalResponse<typeof UpdateEval200.Type, Config>,
33337 HttpClientError.HttpClientError | SchemaError
33338 >
33339 /**
33340 * Delete an evaluation.
33341 */
33342 readonly "deleteEval": <Config extends OperationConfig>(
33343 evalId: string,
33344 options: { readonly config?: Config | undefined } | undefined
33345 ) => Effect.Effect<
33346 WithOptionalResponse<typeof DeleteEval200.Type, Config>,
33347 HttpClientError.HttpClientError | SchemaError | OpenAiClientError<"DeleteEval404", typeof DeleteEval404.Type>
33348 >
33349 /**
33350 * Get a list of runs for an evaluation.
33351 */
33352 readonly "getEvalRuns": <Config extends OperationConfig>(
33353 evalId: string,
33354 options:
33355 | { readonly params?: typeof GetEvalRunsParams.Encoded | undefined; readonly config?: Config | undefined }
33356 | undefined
33357 ) => Effect.Effect<
33358 WithOptionalResponse<typeof GetEvalRuns200.Type, Config>,
33359 HttpClientError.HttpClientError | SchemaError
33360 >
33361 /**
33362 * Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation.
33363 */
33364 readonly "createEvalRun": <Config extends OperationConfig>(
33365 evalId: string,
33366 options: { readonly payload: typeof CreateEvalRunRequestJson.Encoded; readonly config?: Config | undefined }
33367 ) => Effect.Effect<
33368 WithOptionalResponse<typeof CreateEvalRun201.Type, Config>,
33369 HttpClientError.HttpClientError | SchemaError | OpenAiClientError<"CreateEvalRun400", typeof CreateEvalRun400.Type>
33370 >
33371 /**
33372 * Get an evaluation run by ID.
33373 */
33374 readonly "getEvalRun": <Config extends OperationConfig>(
33375 evalId: string,
33376 runId: string,
33377 options: { readonly config?: Config | undefined } | undefined
33378 ) => Effect.Effect<
33379 WithOptionalResponse<typeof GetEvalRun200.Type, Config>,
33380 HttpClientError.HttpClientError | SchemaError
33381 >
33382 /**
33383 * Cancel an ongoing evaluation run.
33384 */
33385 readonly "cancelEvalRun": <Config extends OperationConfig>(
33386 evalId: string,
33387 runId: string,
33388 options: { readonly config?: Config | undefined } | undefined
33389 ) => Effect.Effect<
33390 WithOptionalResponse<typeof CancelEvalRun200.Type, Config>,
33391 HttpClientError.HttpClientError | SchemaError
33392 >
33393 /**
33394 * Delete an eval run.
33395 */
33396 readonly "deleteEvalRun": <Config extends OperationConfig>(
33397 evalId: string,
33398 runId: string,
33399 options: { readonly config?: Config | undefined } | undefined
33400 ) => Effect.Effect<
33401 WithOptionalResponse<typeof DeleteEvalRun200.Type, Config>,
33402 HttpClientError.HttpClientError | SchemaError | OpenAiClientError<"DeleteEvalRun404", typeof DeleteEvalRun404.Type>
33403 >
33404 /**
33405 * Get a list of output items for an evaluation run.
33406 */
33407 readonly "getEvalRunOutputItems": <Config extends OperationConfig>(
33408 evalId: string,
33409 runId: string,
33410 options: {
33411 readonly params?: typeof GetEvalRunOutputItemsParams.Encoded | undefined
33412 readonly config?: Config | undefined
33413 } | undefined
33414 ) => Effect.Effect<
33415 WithOptionalResponse<typeof GetEvalRunOutputItems200.Type, Config>,
33416 HttpClientError.HttpClientError | SchemaError
33417 >
33418 /**
33419 * Get an evaluation run output item by ID.
33420 */
33421 readonly "getEvalRunOutputItem": <Config extends OperationConfig>(
33422 evalId: string,
33423 runId: string,
33424 outputItemId: string,
33425 options: { readonly config?: Config | undefined } | undefined
33426 ) => Effect.Effect<
33427 WithOptionalResponse<typeof GetEvalRunOutputItem200.Type, Config>,
33428 HttpClientError.HttpClientError | SchemaError
33429 >
33430 /**
33431 * Returns a list of files.
33432 */
33433 readonly "listFiles": <Config extends OperationConfig>(
33434 options:
33435 | { readonly params?: typeof ListFilesParams.Encoded | undefined; readonly config?: Config | undefined }
33436 | undefined
33437 ) => Effect.Effect<
33438 WithOptionalResponse<typeof ListFiles200.Type, Config>,
33439 HttpClientError.HttpClientError | SchemaError
33440 >
33441 /**
33442 * Upload a file that can be used across various endpoints. Individual files
33443 * can be up to 512 MB, and each project can store up to 2.5 TB of files in
33444 * total. There is no organization-wide storage limit. Uploads to this
33445 * endpoint are rate-limited to 1,000 requests per minute per authenticated
33446 * user.
33447 *
33448 * - The Assistants API supports files up to 2 million tokens and of specific
33449 * file types. See the [Assistants Tools guide](/docs/assistants/tools) for
33450 * details.
33451 * - The Fine-tuning API only supports `.jsonl` files. The input also has
33452 * certain required formats for fine-tuning
33453 * [chat](/docs/api-reference/fine-tuning/chat-input) or
33454 * [completions](/docs/api-reference/fine-tuning/completions-input) models.
33455 * - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
33456 * also has a specific required
33457 * [format](/docs/api-reference/batch/request-input).
33458 * - For Retrieval or `file_search` ingestion, upload files here first. If
33459 * you need to attach multiple uploaded files to the same vector store, use
33460 * [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
33461 * instead of attaching them one by one. Vector store attachment has separate
33462 * limits from file upload, including 2,000 attached files per minute per
33463 * organization.
33464 *
33465 * Please [contact us](https://help.openai.com/) if you need to increase these
33466 * storage limits.
33467 */
33468 readonly "createFile": <Config extends OperationConfig>(
33469 options: { readonly payload: typeof CreateFileRequestFormData.Encoded; readonly config?: Config | undefined }
33470 ) => Effect.Effect<
33471 WithOptionalResponse<typeof CreateFile200.Type, Config>,
33472 HttpClientError.HttpClientError | SchemaError
33473 >
33474 /**
33475 * Returns information about a specific file.
33476 */
33477 readonly "retrieveFile": <Config extends OperationConfig>(
33478 fileId: string,
33479 options: { readonly config?: Config | undefined } | undefined
33480 ) => Effect.Effect<
33481 WithOptionalResponse<typeof RetrieveFile200.Type, Config>,
33482 HttpClientError.HttpClientError | SchemaError
33483 >
33484 /**
33485 * Delete a file and remove it from all vector stores.
33486 */
33487 readonly "deleteFile": <Config extends OperationConfig>(
33488 fileId: string,
33489 options: { readonly config?: Config | undefined } | undefined
33490 ) => Effect.Effect<
33491 WithOptionalResponse<typeof DeleteFile200.Type, Config>,
33492 HttpClientError.HttpClientError | SchemaError
33493 >
33494 /**
33495 * Returns the contents of the specified file.
33496 */
33497 readonly "downloadFile": <Config extends OperationConfig>(
33498 fileId: string,
33499 options: { readonly config?: Config | undefined } | undefined
33500 ) => Effect.Effect<
33501 WithOptionalResponse<typeof DownloadFile200.Type, Config>,
33502 HttpClientError.HttpClientError | SchemaError
33503 >
33504 /**
33505 * Run a grader.
33506 */
33507 readonly "runGrader": <Config extends OperationConfig>(
33508 options: { readonly payload: typeof RunGraderRequestJson.Encoded; readonly config?: Config | undefined }
33509 ) => Effect.Effect<
33510 WithOptionalResponse<typeof RunGrader200.Type, Config>,
33511 HttpClientError.HttpClientError | SchemaError
33512 >
33513 /**
33514 * Validate a grader.
33515 */
33516 readonly "validateGrader": <Config extends OperationConfig>(
33517 options: { readonly payload: typeof ValidateGraderRequestJson.Encoded; readonly config?: Config | undefined }
33518 ) => Effect.Effect<
33519 WithOptionalResponse<typeof ValidateGrader200.Type, Config>,
33520 HttpClientError.HttpClientError | SchemaError
33521 >
33522 /**
33523 * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
33524 *
33525 * Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.
33526 */
33527 readonly "listFineTuningCheckpointPermissions": <Config extends OperationConfig>(
33528 fineTunedModelCheckpoint: string,
33529 options: {
33530 readonly params?: typeof ListFineTuningCheckpointPermissionsParams.Encoded | undefined
33531 readonly config?: Config | undefined
33532 } | undefined
33533 ) => Effect.Effect<
33534 WithOptionalResponse<typeof ListFineTuningCheckpointPermissions200.Type, Config>,
33535 HttpClientError.HttpClientError | SchemaError
33536 >
33537 /**
33538 * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
33539 *
33540 * This enables organization owners to share fine-tuned models with other projects in their organization.
33541 */
33542 readonly "createFineTuningCheckpointPermission": <Config extends OperationConfig>(
33543 fineTunedModelCheckpoint: string,
33544 options: {
33545 readonly payload: typeof CreateFineTuningCheckpointPermissionRequestJson.Encoded
33546 readonly config?: Config | undefined
33547 }
33548 ) => Effect.Effect<
33549 WithOptionalResponse<typeof CreateFineTuningCheckpointPermission200.Type, Config>,
33550 HttpClientError.HttpClientError | SchemaError
33551 >
33552 /**
33553 * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
33554 *
33555 * Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.
33556 */
33557 readonly "deleteFineTuningCheckpointPermission": <Config extends OperationConfig>(
33558 fineTunedModelCheckpoint: string,
33559 permissionId: string,
33560 options: { readonly config?: Config | undefined } | undefined
33561 ) => Effect.Effect<
33562 WithOptionalResponse<typeof DeleteFineTuningCheckpointPermission200.Type, Config>,
33563 HttpClientError.HttpClientError | SchemaError
33564 >
33565 /**
33566 * List your organization's fine-tuning jobs
33567 */
33568 readonly "listPaginatedFineTuningJobs": <Config extends OperationConfig>(
33569 options: {
33570 readonly params?: typeof ListPaginatedFineTuningJobsParams.Encoded | undefined
33571 readonly config?: Config | undefined
33572 } | undefined
33573 ) => Effect.Effect<
33574 WithOptionalResponse<typeof ListPaginatedFineTuningJobs200.Type, Config>,
33575 HttpClientError.HttpClientError | SchemaError
33576 >
33577 /**
33578 * Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
33579 *
33580 * Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
33581 *
33582 * [Learn more about fine-tuning](/docs/guides/model-optimization)
33583 */
33584 readonly "createFineTuningJob": <Config extends OperationConfig>(
33585 options: { readonly payload: typeof CreateFineTuningJobRequestJson.Encoded; readonly config?: Config | undefined }
33586 ) => Effect.Effect<
33587 WithOptionalResponse<typeof CreateFineTuningJob200.Type, Config>,
33588 HttpClientError.HttpClientError | SchemaError
33589 >
33590 /**
33591 * Get info about a fine-tuning job.
33592 *
33593 * [Learn more about fine-tuning](/docs/guides/model-optimization)
33594 */
33595 readonly "retrieveFineTuningJob": <Config extends OperationConfig>(
33596 fineTuningJobId: string,
33597 options: { readonly config?: Config | undefined } | undefined
33598 ) => Effect.Effect<
33599 WithOptionalResponse<typeof RetrieveFineTuningJob200.Type, Config>,
33600 HttpClientError.HttpClientError | SchemaError
33601 >
33602 /**
33603 * Immediately cancel a fine-tune job.
33604 */
33605 readonly "cancelFineTuningJob": <Config extends OperationConfig>(
33606 fineTuningJobId: string,
33607 options: { readonly config?: Config | undefined } | undefined
33608 ) => Effect.Effect<
33609 WithOptionalResponse<typeof CancelFineTuningJob200.Type, Config>,
33610 HttpClientError.HttpClientError | SchemaError
33611 >
33612 /**
33613 * List checkpoints for a fine-tuning job.
33614 */
33615 readonly "listFineTuningJobCheckpoints": <Config extends OperationConfig>(
33616 fineTuningJobId: string,
33617 options: {
33618 readonly params?: typeof ListFineTuningJobCheckpointsParams.Encoded | undefined
33619 readonly config?: Config | undefined
33620 } | undefined
33621 ) => Effect.Effect<
33622 WithOptionalResponse<typeof ListFineTuningJobCheckpoints200.Type, Config>,
33623 HttpClientError.HttpClientError | SchemaError
33624 >
33625 /**
33626 * Get status updates for a fine-tuning job.
33627 */
33628 readonly "listFineTuningEvents": <Config extends OperationConfig>(
33629 fineTuningJobId: string,
33630 options: {
33631 readonly params?: typeof ListFineTuningEventsParams.Encoded | undefined
33632 readonly config?: Config | undefined
33633 } | undefined
33634 ) => Effect.Effect<
33635 WithOptionalResponse<typeof ListFineTuningEvents200.Type, Config>,
33636 HttpClientError.HttpClientError | SchemaError
33637 >
33638 /**
33639 * Pause a fine-tune job.
33640 */
33641 readonly "pauseFineTuningJob": <Config extends OperationConfig>(
33642 fineTuningJobId: string,
33643 options: { readonly config?: Config | undefined } | undefined
33644 ) => Effect.Effect<
33645 WithOptionalResponse<typeof PauseFineTuningJob200.Type, Config>,
33646 HttpClientError.HttpClientError | SchemaError
33647 >
33648 /**
33649 * Resume a fine-tune job.
33650 */
33651 readonly "resumeFineTuningJob": <Config extends OperationConfig>(
33652 fineTuningJobId: string,
33653 options: { readonly config?: Config | undefined } | undefined
33654 ) => Effect.Effect<
33655 WithOptionalResponse<typeof ResumeFineTuningJob200.Type, Config>,
33656 HttpClientError.HttpClientError | SchemaError
33657 >
33658 /**
33659 * You can call this endpoint with either:
33660 *
33661 * - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
33662 * - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
33663 *
33664 * Note that JSON requests use `images` (array) instead of the multipart `image` field.
33665 */
33666 readonly "createImageEdit": <Config extends OperationConfig>(
33667 options: { readonly payload: typeof CreateImageEditRequestFormData.Encoded; readonly config?: Config | undefined }
33668 ) => Effect.Effect<
33669 WithOptionalResponse<typeof CreateImageEdit200.Type, Config>,
33670 HttpClientError.HttpClientError | SchemaError
33671 >
33672 /**
33673 * You can call this endpoint with either:
33674 *
33675 * - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
33676 * - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
33677 *
33678 * Note that JSON requests use `images` (array) instead of the multipart `image` field.
33679 */
33680 readonly "createImageEditSse": (
33681 options: { readonly payload: typeof CreateImageEditRequestFormData.Encoded }
33682 ) => Stream.Stream<
33683 { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateImageEdit200Sse.Type },
33684 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
33685 typeof CreateImageEdit200Sse.DecodingServices
33686 >
33687 /**
33688 * Creates an image given a prompt. [Learn more](/docs/guides/images).
33689 */
33690 readonly "createImage": <Config extends OperationConfig>(
33691 options: { readonly payload: typeof CreateImageRequestJson.Encoded; readonly config?: Config | undefined }
33692 ) => Effect.Effect<
33693 WithOptionalResponse<typeof CreateImage200.Type, Config>,
33694 HttpClientError.HttpClientError | SchemaError
33695 >
33696 /**
33697 * Creates an image given a prompt. [Learn more](/docs/guides/images).
33698 */
33699 readonly "createImageSse": (
33700 options: { readonly payload: typeof CreateImageRequestJson.Encoded }
33701 ) => Stream.Stream<
33702 { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateImage200Sse.Type },
33703 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
33704 typeof CreateImage200Sse.DecodingServices
33705 >
33706 /**
33707 * Creates a variation of a given image. This endpoint only supports `dall-e-2`.
33708 */
33709 readonly "createImageVariation": <Config extends OperationConfig>(
33710 options: {
33711 readonly payload: typeof CreateImageVariationRequestFormData.Encoded
33712 readonly config?: Config | undefined
33713 }
33714 ) => Effect.Effect<
33715 WithOptionalResponse<typeof CreateImageVariation200.Type, Config>,
33716 HttpClientError.HttpClientError | SchemaError
33717 >
33718 /**
33719 * Lists the currently available models, and provides basic information about each one such as the owner and availability.
33720 */
33721 readonly "listModels": <Config extends OperationConfig>(
33722 options: { readonly config?: Config | undefined } | undefined
33723 ) => Effect.Effect<
33724 WithOptionalResponse<typeof ListModels200.Type, Config>,
33725 HttpClientError.HttpClientError | SchemaError
33726 >
33727 /**
33728 * Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
33729 */
33730 readonly "retrieveModel": <Config extends OperationConfig>(
33731 model: string,
33732 options: { readonly config?: Config | undefined } | undefined
33733 ) => Effect.Effect<
33734 WithOptionalResponse<typeof RetrieveModel200.Type, Config>,
33735 HttpClientError.HttpClientError | SchemaError
33736 >
33737 /**
33738 * Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
33739 */
33740 readonly "deleteModel": <Config extends OperationConfig>(
33741 model: string,
33742 options: { readonly config?: Config | undefined } | undefined
33743 ) => Effect.Effect<
33744 WithOptionalResponse<typeof DeleteModel200.Type, Config>,
33745 HttpClientError.HttpClientError | SchemaError
33746 >
33747 /**
33748 * Classifies if text and/or image inputs are potentially harmful. Learn
33749 * more in the [moderation guide](/docs/guides/moderation).
33750 */
33751 readonly "createModeration": <Config extends OperationConfig>(
33752 options: { readonly payload: typeof CreateModerationRequestJson.Encoded; readonly config?: Config | undefined }
33753 ) => Effect.Effect<
33754 WithOptionalResponse<typeof CreateModeration200.Type, Config>,
33755 HttpClientError.HttpClientError | SchemaError
33756 >
33757 /**
33758 * Retrieve a paginated list of organization admin API keys.
33759 */
33760 readonly "adminApiKeysList": <Config extends OperationConfig>(
33761 options: {
33762 readonly params?: typeof AdminApiKeysListParams.Encoded | undefined
33763 readonly config?: Config | undefined
33764 } | undefined
33765 ) => Effect.Effect<
33766 WithOptionalResponse<typeof AdminApiKeysList200.Type, Config>,
33767 HttpClientError.HttpClientError | SchemaError
33768 >
33769 /**
33770 * Create a new admin-level API key for the organization.
33771 */
33772 readonly "adminApiKeysCreate": <Config extends OperationConfig>(
33773 options: { readonly payload: typeof AdminApiKeysCreateRequestJson.Encoded; readonly config?: Config | undefined }
33774 ) => Effect.Effect<
33775 WithOptionalResponse<typeof AdminApiKeysCreate200.Type, Config>,
33776 HttpClientError.HttpClientError | SchemaError
33777 >
33778 /**
33779 * Get details for a specific organization API key by its ID.
33780 */
33781 readonly "adminApiKeysGet": <Config extends OperationConfig>(
33782 keyId: string,
33783 options: { readonly config?: Config | undefined } | undefined
33784 ) => Effect.Effect<
33785 WithOptionalResponse<typeof AdminApiKeysGet200.Type, Config>,
33786 HttpClientError.HttpClientError | SchemaError
33787 >
33788 /**
33789 * Delete the specified admin API key.
33790 */
33791 readonly "adminApiKeysDelete": <Config extends OperationConfig>(
33792 keyId: string,
33793 options: { readonly config?: Config | undefined } | undefined
33794 ) => Effect.Effect<
33795 WithOptionalResponse<typeof AdminApiKeysDelete200.Type, Config>,
33796 HttpClientError.HttpClientError | SchemaError
33797 >
33798 /**
33799 * List user actions and configuration changes within this organization.
33800 */
33801 readonly "listAuditLogs": <Config extends OperationConfig>(
33802 options:
33803 | { readonly params?: typeof ListAuditLogsParams.Encoded | undefined; readonly config?: Config | undefined }
33804 | undefined
33805 ) => Effect.Effect<
33806 WithOptionalResponse<typeof ListAuditLogs200.Type, Config>,
33807 HttpClientError.HttpClientError | SchemaError
33808 >
33809 /**
33810 * List uploaded certificates for this organization.
33811 */
33812 readonly "listOrganizationCertificates": <Config extends OperationConfig>(
33813 options: {
33814 readonly params?: typeof ListOrganizationCertificatesParams.Encoded | undefined
33815 readonly config?: Config | undefined
33816 } | undefined
33817 ) => Effect.Effect<
33818 WithOptionalResponse<typeof ListOrganizationCertificates200.Type, Config>,
33819 HttpClientError.HttpClientError | SchemaError
33820 >
33821 /**
33822 * Upload a certificate to the organization. This does **not** automatically activate the certificate.
33823 *
33824 * Organizations can upload up to 50 certificates.
33825 */
33826 readonly "uploadCertificate": <Config extends OperationConfig>(
33827 options: { readonly payload: typeof UploadCertificateRequestJson.Encoded; readonly config?: Config | undefined }
33828 ) => Effect.Effect<
33829 WithOptionalResponse<typeof UploadCertificate200.Type, Config>,
33830 HttpClientError.HttpClientError | SchemaError
33831 >
33832 /**
33833 * Activate certificates at the organization level.
33834 *
33835 * You can atomically and idempotently activate up to 10 certificates at a time.
33836 */
33837 readonly "activateOrganizationCertificates": <Config extends OperationConfig>(
33838 options: {
33839 readonly payload: typeof ActivateOrganizationCertificatesRequestJson.Encoded
33840 readonly config?: Config | undefined
33841 }
33842 ) => Effect.Effect<
33843 WithOptionalResponse<typeof ActivateOrganizationCertificates200.Type, Config>,
33844 HttpClientError.HttpClientError | SchemaError
33845 >
33846 /**
33847 * Deactivate certificates at the organization level.
33848 *
33849 * You can atomically and idempotently deactivate up to 10 certificates at a time.
33850 */
33851 readonly "deactivateOrganizationCertificates": <Config extends OperationConfig>(
33852 options: {
33853 readonly payload: typeof DeactivateOrganizationCertificatesRequestJson.Encoded
33854 readonly config?: Config | undefined
33855 }
33856 ) => Effect.Effect<
33857 WithOptionalResponse<typeof DeactivateOrganizationCertificates200.Type, Config>,
33858 HttpClientError.HttpClientError | SchemaError
33859 >
33860 /**
33861 * Get a certificate that has been uploaded to the organization.
33862 *
33863 * You can get a certificate regardless of whether it is active or not.
33864 */
33865 readonly "getCertificate": <Config extends OperationConfig>(
33866 certificateId: string,
33867 options:
33868 | { readonly params?: typeof GetCertificateParams.Encoded | undefined; readonly config?: Config | undefined }
33869 | undefined
33870 ) => Effect.Effect<
33871 WithOptionalResponse<typeof GetCertificate200.Type, Config>,
33872 HttpClientError.HttpClientError | SchemaError
33873 >
33874 /**
33875 * Modify a certificate. Note that only the name can be modified.
33876 */
33877 readonly "modifyCertificate": <Config extends OperationConfig>(
33878 certificateId: string,
33879 options: { readonly payload: typeof ModifyCertificateRequestJson.Encoded; readonly config?: Config | undefined }
33880 ) => Effect.Effect<
33881 WithOptionalResponse<typeof ModifyCertificate200.Type, Config>,
33882 HttpClientError.HttpClientError | SchemaError
33883 >
33884 /**
33885 * Delete a certificate from the organization.
33886 *
33887 * The certificate must be inactive for the organization and all projects.
33888 */
33889 readonly "deleteCertificate": <Config extends OperationConfig>(
33890 certificateId: string,
33891 options: { readonly config?: Config | undefined } | undefined
33892 ) => Effect.Effect<
33893 WithOptionalResponse<typeof DeleteCertificate200.Type, Config>,
33894 HttpClientError.HttpClientError | SchemaError
33895 >
33896 /**
33897 * Get costs details for the organization.
33898 */
33899 readonly "usageCosts": <Config extends OperationConfig>(
33900 options: { readonly params: typeof UsageCostsParams.Encoded; readonly config?: Config | undefined }
33901 ) => Effect.Effect<
33902 WithOptionalResponse<typeof UsageCosts200.Type, Config>,
33903 HttpClientError.HttpClientError | SchemaError
33904 >
33905 /**
33906 * Lists all groups in the organization.
33907 */
33908 readonly "listGroups": <Config extends OperationConfig>(
33909 options:
33910 | { readonly params?: typeof ListGroupsParams.Encoded | undefined; readonly config?: Config | undefined }
33911 | undefined
33912 ) => Effect.Effect<
33913 WithOptionalResponse<typeof ListGroups200.Type, Config>,
33914 HttpClientError.HttpClientError | SchemaError
33915 >
33916 /**
33917 * Creates a new group in the organization.
33918 */
33919 readonly "createGroup": <Config extends OperationConfig>(
33920 options: { readonly payload: typeof CreateGroupRequestJson.Encoded; readonly config?: Config | undefined }
33921 ) => Effect.Effect<
33922 WithOptionalResponse<typeof CreateGroup200.Type, Config>,
33923 HttpClientError.HttpClientError | SchemaError
33924 >
33925 /**
33926 * Updates a group's information.
33927 */
33928 readonly "updateGroup": <Config extends OperationConfig>(
33929 groupId: string,
33930 options: { readonly payload: typeof UpdateGroupRequestJson.Encoded; readonly config?: Config | undefined }
33931 ) => Effect.Effect<
33932 WithOptionalResponse<typeof UpdateGroup200.Type, Config>,
33933 HttpClientError.HttpClientError | SchemaError
33934 >
33935 /**
33936 * Deletes a group from the organization.
33937 */
33938 readonly "deleteGroup": <Config extends OperationConfig>(
33939 groupId: string,
33940 options: { readonly config?: Config | undefined } | undefined
33941 ) => Effect.Effect<
33942 WithOptionalResponse<typeof DeleteGroup200.Type, Config>,
33943 HttpClientError.HttpClientError | SchemaError
33944 >
33945 /**
33946 * Lists the organization roles assigned to a group within the organization.
33947 */
33948 readonly "listGroupRoleAssignments": <Config extends OperationConfig>(
33949 groupId: string,
33950 options: {
33951 readonly params?: typeof ListGroupRoleAssignmentsParams.Encoded | undefined
33952 readonly config?: Config | undefined
33953 } | undefined
33954 ) => Effect.Effect<
33955 WithOptionalResponse<typeof ListGroupRoleAssignments200.Type, Config>,
33956 HttpClientError.HttpClientError | SchemaError
33957 >
33958 /**
33959 * Assigns an organization role to a group within the organization.
33960 */
33961 readonly "assignGroupRole": <Config extends OperationConfig>(
33962 groupId: string,
33963 options: { readonly payload: typeof AssignGroupRoleRequestJson.Encoded; readonly config?: Config | undefined }
33964 ) => Effect.Effect<
33965 WithOptionalResponse<typeof AssignGroupRole200.Type, Config>,
33966 HttpClientError.HttpClientError | SchemaError
33967 >
33968 /**
33969 * Unassigns an organization role from a group within the organization.
33970 */
33971 readonly "unassignGroupRole": <Config extends OperationConfig>(
33972 groupId: string,
33973 roleId: string,
33974 options: { readonly config?: Config | undefined } | undefined
33975 ) => Effect.Effect<
33976 WithOptionalResponse<typeof UnassignGroupRole200.Type, Config>,
33977 HttpClientError.HttpClientError | SchemaError
33978 >
33979 /**
33980 * Lists the users assigned to a group.
33981 */
33982 readonly "listGroupUsers": <Config extends OperationConfig>(
33983 groupId: string,
33984 options:
33985 | { readonly params?: typeof ListGroupUsersParams.Encoded | undefined; readonly config?: Config | undefined }
33986 | undefined
33987 ) => Effect.Effect<
33988 WithOptionalResponse<typeof ListGroupUsers200.Type, Config>,
33989 HttpClientError.HttpClientError | SchemaError
33990 >
33991 /**
33992 * Adds a user to a group.
33993 */
33994 readonly "addGroupUser": <Config extends OperationConfig>(
33995 groupId: string,
33996 options: { readonly payload: typeof AddGroupUserRequestJson.Encoded; readonly config?: Config | undefined }
33997 ) => Effect.Effect<
33998 WithOptionalResponse<typeof AddGroupUser200.Type, Config>,
33999 HttpClientError.HttpClientError | SchemaError
34000 >
34001 /**
34002 * Removes a user from a group.
34003 */
34004 readonly "removeGroupUser": <Config extends OperationConfig>(
34005 groupId: string,
34006 userId: string,
34007 options: { readonly config?: Config | undefined } | undefined
34008 ) => Effect.Effect<
34009 WithOptionalResponse<typeof RemoveGroupUser200.Type, Config>,
34010 HttpClientError.HttpClientError | SchemaError
34011 >
34012 /**
34013 * Returns a list of invites in the organization.
34014 */
34015 readonly "listInvites": <Config extends OperationConfig>(
34016 options:
34017 | { readonly params?: typeof ListInvitesParams.Encoded | undefined; readonly config?: Config | undefined }
34018 | undefined
34019 ) => Effect.Effect<
34020 WithOptionalResponse<typeof ListInvites200.Type, Config>,
34021 HttpClientError.HttpClientError | SchemaError
34022 >
34023 /**
34024 * Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.
34025 */
34026 readonly "inviteUser": <Config extends OperationConfig>(
34027 options: { readonly payload: typeof InviteUserRequestJson.Encoded; readonly config?: Config | undefined }
34028 ) => Effect.Effect<
34029 WithOptionalResponse<typeof InviteUser200.Type, Config>,
34030 HttpClientError.HttpClientError | SchemaError
34031 >
34032 /**
34033 * Retrieves an invite.
34034 */
34035 readonly "retrieveInvite": <Config extends OperationConfig>(
34036 inviteId: string,
34037 options: { readonly config?: Config | undefined } | undefined
34038 ) => Effect.Effect<
34039 WithOptionalResponse<typeof RetrieveInvite200.Type, Config>,
34040 HttpClientError.HttpClientError | SchemaError
34041 >
34042 /**
34043 * Delete an invite. If the invite has already been accepted, it cannot be deleted.
34044 */
34045 readonly "deleteInvite": <Config extends OperationConfig>(
34046 inviteId: string,
34047 options: { readonly config?: Config | undefined } | undefined
34048 ) => Effect.Effect<
34049 WithOptionalResponse<typeof DeleteInvite200.Type, Config>,
34050 HttpClientError.HttpClientError | SchemaError
34051 >
34052 /**
34053 * Returns a list of projects.
34054 */
34055 readonly "listProjects": <Config extends OperationConfig>(
34056 options:
34057 | { readonly params?: typeof ListProjectsParams.Encoded | undefined; readonly config?: Config | undefined }
34058 | undefined
34059 ) => Effect.Effect<
34060 WithOptionalResponse<typeof ListProjects200.Type, Config>,
34061 HttpClientError.HttpClientError | SchemaError
34062 >
34063 /**
34064 * Create a new project in the organization. Projects can be created and archived, but cannot be deleted.
34065 */
34066 readonly "createProject": <Config extends OperationConfig>(
34067 options: { readonly payload: typeof CreateProjectRequestJson.Encoded; readonly config?: Config | undefined }
34068 ) => Effect.Effect<
34069 WithOptionalResponse<typeof CreateProject200.Type, Config>,
34070 HttpClientError.HttpClientError | SchemaError
34071 >
34072 /**
34073 * Retrieves a project.
34074 */
34075 readonly "retrieveProject": <Config extends OperationConfig>(
34076 projectId: string,
34077 options: { readonly config?: Config | undefined } | undefined
34078 ) => Effect.Effect<
34079 WithOptionalResponse<typeof RetrieveProject200.Type, Config>,
34080 HttpClientError.HttpClientError | SchemaError
34081 >
34082 /**
34083 * Modifies a project in the organization.
34084 */
34085 readonly "modifyProject": <Config extends OperationConfig>(
34086 projectId: string,
34087 options: { readonly payload: typeof ModifyProjectRequestJson.Encoded; readonly config?: Config | undefined }
34088 ) => Effect.Effect<
34089 WithOptionalResponse<typeof ModifyProject200.Type, Config>,
34090 HttpClientError.HttpClientError | SchemaError | OpenAiClientError<"ModifyProject400", typeof ModifyProject400.Type>
34091 >
34092 /**
34093 * Returns a list of API keys in the project.
34094 */
34095 readonly "listProjectApiKeys": <Config extends OperationConfig>(
34096 projectId: string,
34097 options: {
34098 readonly params?: typeof ListProjectApiKeysParams.Encoded | undefined
34099 readonly config?: Config | undefined
34100 } | undefined
34101 ) => Effect.Effect<
34102 WithOptionalResponse<typeof ListProjectApiKeys200.Type, Config>,
34103 HttpClientError.HttpClientError | SchemaError
34104 >
34105 /**
34106 * Retrieves an API key in the project.
34107 */
34108 readonly "retrieveProjectApiKey": <Config extends OperationConfig>(
34109 projectId: string,
34110 apiKeyId: string,
34111 options: { readonly config?: Config | undefined } | undefined
34112 ) => Effect.Effect<
34113 WithOptionalResponse<typeof RetrieveProjectApiKey200.Type, Config>,
34114 HttpClientError.HttpClientError | SchemaError
34115 >
34116 /**
34117 * Deletes an API key from the project.
34118 *
34119 * Returns confirmation of the key deletion, or an error if the key belonged to
34120 * a service account.
34121 */
34122 readonly "deleteProjectApiKey": <Config extends OperationConfig>(
34123 projectId: string,
34124 apiKeyId: string,
34125 options: { readonly config?: Config | undefined } | undefined
34126 ) => Effect.Effect<
34127 WithOptionalResponse<typeof DeleteProjectApiKey200.Type, Config>,
34128 | HttpClientError.HttpClientError
34129 | SchemaError
34130 | OpenAiClientError<"DeleteProjectApiKey400", typeof DeleteProjectApiKey400.Type>
34131 >
34132 /**
34133 * Archives a project in the organization. Archived projects cannot be used or updated.
34134 */
34135 readonly "archiveProject": <Config extends OperationConfig>(
34136 projectId: string,
34137 options: { readonly config?: Config | undefined } | undefined
34138 ) => Effect.Effect<
34139 WithOptionalResponse<typeof ArchiveProject200.Type, Config>,
34140 HttpClientError.HttpClientError | SchemaError
34141 >
34142 /**
34143 * List certificates for this project.
34144 */
34145 readonly "listProjectCertificates": <Config extends OperationConfig>(
34146 projectId: string,
34147 options: {
34148 readonly params?: typeof ListProjectCertificatesParams.Encoded | undefined
34149 readonly config?: Config | undefined
34150 } | undefined
34151 ) => Effect.Effect<
34152 WithOptionalResponse<typeof ListProjectCertificates200.Type, Config>,
34153 HttpClientError.HttpClientError | SchemaError
34154 >
34155 /**
34156 * Activate certificates at the project level.
34157 *
34158 * You can atomically and idempotently activate up to 10 certificates at a time.
34159 */
34160 readonly "activateProjectCertificates": <Config extends OperationConfig>(
34161 projectId: string,
34162 options: {
34163 readonly payload: typeof ActivateProjectCertificatesRequestJson.Encoded
34164 readonly config?: Config | undefined
34165 }
34166 ) => Effect.Effect<
34167 WithOptionalResponse<typeof ActivateProjectCertificates200.Type, Config>,
34168 HttpClientError.HttpClientError | SchemaError
34169 >
34170 /**
34171 * Deactivate certificates at the project level. You can atomically and
34172 * idempotently deactivate up to 10 certificates at a time.
34173 */
34174 readonly "deactivateProjectCertificates": <Config extends OperationConfig>(
34175 projectId: string,
34176 options: {
34177 readonly payload: typeof DeactivateProjectCertificatesRequestJson.Encoded
34178 readonly config?: Config | undefined
34179 }
34180 ) => Effect.Effect<
34181 WithOptionalResponse<typeof DeactivateProjectCertificates200.Type, Config>,
34182 HttpClientError.HttpClientError | SchemaError
34183 >
34184 /**
34185 * Lists the groups that have access to a project.
34186 */
34187 readonly "listProjectGroups": <Config extends OperationConfig>(
34188 projectId: string,
34189 options: {
34190 readonly params?: typeof ListProjectGroupsParams.Encoded | undefined
34191 readonly config?: Config | undefined
34192 } | undefined
34193 ) => Effect.Effect<
34194 WithOptionalResponse<typeof ListProjectGroups200.Type, Config>,
34195 HttpClientError.HttpClientError | SchemaError
34196 >
34197 /**
34198 * Grants a group access to a project.
34199 */
34200 readonly "addProjectGroup": <Config extends OperationConfig>(
34201 projectId: string,
34202 options: { readonly payload: typeof AddProjectGroupRequestJson.Encoded; readonly config?: Config | undefined }
34203 ) => Effect.Effect<
34204 WithOptionalResponse<typeof AddProjectGroup200.Type, Config>,
34205 HttpClientError.HttpClientError | SchemaError
34206 >
34207 /**
34208 * Revokes a group's access to a project.
34209 */
34210 readonly "removeProjectGroup": <Config extends OperationConfig>(
34211 projectId: string,
34212 groupId: string,
34213 options: { readonly config?: Config | undefined } | undefined
34214 ) => Effect.Effect<
34215 WithOptionalResponse<typeof RemoveProjectGroup200.Type, Config>,
34216 HttpClientError.HttpClientError | SchemaError
34217 >
34218 /**
34219 * Returns hosted tool permissions for a project.
34220 */
34221 readonly "retrieveProjectHostedToolPermissions": <Config extends OperationConfig>(
34222 projectId: string,
34223 options: { readonly config?: Config | undefined } | undefined
34224 ) => Effect.Effect<
34225 WithOptionalResponse<typeof RetrieveProjectHostedToolPermissions200.Type, Config>,
34226 HttpClientError.HttpClientError | SchemaError
34227 >
34228 /**
34229 * Updates hosted tool permissions for a project.
34230 */
34231 readonly "updateProjectHostedToolPermissions": <Config extends OperationConfig>(
34232 projectId: string,
34233 options: {
34234 readonly payload: typeof UpdateProjectHostedToolPermissionsRequestJson.Encoded
34235 readonly config?: Config | undefined
34236 }
34237 ) => Effect.Effect<
34238 WithOptionalResponse<typeof UpdateProjectHostedToolPermissions200.Type, Config>,
34239 HttpClientError.HttpClientError | SchemaError
34240 >
34241 /**
34242 * Returns model permissions for a project.
34243 */
34244 readonly "retrieveProjectModelPermissions": <Config extends OperationConfig>(
34245 projectId: string,
34246 options: { readonly config?: Config | undefined } | undefined
34247 ) => Effect.Effect<
34248 WithOptionalResponse<typeof RetrieveProjectModelPermissions200.Type, Config>,
34249 HttpClientError.HttpClientError | SchemaError
34250 >
34251 /**
34252 * Updates model permissions for a project.
34253 */
34254 readonly "updateProjectModelPermissions": <Config extends OperationConfig>(
34255 projectId: string,
34256 options: {
34257 readonly payload: typeof UpdateProjectModelPermissionsRequestJson.Encoded
34258 readonly config?: Config | undefined
34259 }
34260 ) => Effect.Effect<
34261 WithOptionalResponse<typeof UpdateProjectModelPermissions200.Type, Config>,
34262 HttpClientError.HttpClientError | SchemaError
34263 >
34264 /**
34265 * Deletes model permissions for a project.
34266 */
34267 readonly "deleteProjectModelPermissions": <Config extends OperationConfig>(
34268 projectId: string,
34269 options: { readonly config?: Config | undefined } | undefined
34270 ) => Effect.Effect<
34271 WithOptionalResponse<typeof DeleteProjectModelPermissions200.Type, Config>,
34272 HttpClientError.HttpClientError | SchemaError
34273 >
34274 /**
34275 * Returns the rate limits per model for a project.
34276 */
34277 readonly "listProjectRateLimits": <Config extends OperationConfig>(
34278 projectId: string,
34279 options: {
34280 readonly params?: typeof ListProjectRateLimitsParams.Encoded | undefined
34281 readonly config?: Config | undefined
34282 } | undefined
34283 ) => Effect.Effect<
34284 WithOptionalResponse<typeof ListProjectRateLimits200.Type, Config>,
34285 HttpClientError.HttpClientError | SchemaError
34286 >
34287 /**
34288 * Updates a project rate limit.
34289 */
34290 readonly "updateProjectRateLimits": <Config extends OperationConfig>(
34291 projectId: string,
34292 rateLimitId: string,
34293 options: {
34294 readonly payload: typeof UpdateProjectRateLimitsRequestJson.Encoded
34295 readonly config?: Config | undefined
34296 }
34297 ) => Effect.Effect<
34298 WithOptionalResponse<typeof UpdateProjectRateLimits200.Type, Config>,
34299 | HttpClientError.HttpClientError
34300 | SchemaError
34301 | OpenAiClientError<"UpdateProjectRateLimits400", typeof UpdateProjectRateLimits400.Type>
34302 >
34303 /**
34304 * Returns a list of service accounts in the project.
34305 */
34306 readonly "listProjectServiceAccounts": <Config extends OperationConfig>(
34307 projectId: string,
34308 options: {
34309 readonly params?: typeof ListProjectServiceAccountsParams.Encoded | undefined
34310 readonly config?: Config | undefined
34311 } | undefined
34312 ) => Effect.Effect<
34313 WithOptionalResponse<typeof ListProjectServiceAccounts200.Type, Config>,
34314 | HttpClientError.HttpClientError
34315 | SchemaError
34316 | OpenAiClientError<"ListProjectServiceAccounts400", typeof ListProjectServiceAccounts400.Type>
34317 >
34318 /**
34319 * Creates a new service account in the project. This also returns an unredacted API key for the service account.
34320 */
34321 readonly "createProjectServiceAccount": <Config extends OperationConfig>(
34322 projectId: string,
34323 options: {
34324 readonly payload: typeof CreateProjectServiceAccountRequestJson.Encoded
34325 readonly config?: Config | undefined
34326 }
34327 ) => Effect.Effect<
34328 WithOptionalResponse<typeof CreateProjectServiceAccount200.Type, Config>,
34329 | HttpClientError.HttpClientError
34330 | SchemaError
34331 | OpenAiClientError<"CreateProjectServiceAccount400", typeof CreateProjectServiceAccount400.Type>
34332 >
34333 /**
34334 * Retrieves a service account in the project.
34335 */
34336 readonly "retrieveProjectServiceAccount": <Config extends OperationConfig>(
34337 projectId: string,
34338 serviceAccountId: string,
34339 options: { readonly config?: Config | undefined } | undefined
34340 ) => Effect.Effect<
34341 WithOptionalResponse<typeof RetrieveProjectServiceAccount200.Type, Config>,
34342 HttpClientError.HttpClientError | SchemaError
34343 >
34344 /**
34345 * Deletes a service account from the project.
34346 *
34347 * Returns confirmation of service account deletion, or an error if the project
34348 * is archived (archived projects have no service accounts).
34349 */
34350 readonly "deleteProjectServiceAccount": <Config extends OperationConfig>(
34351 projectId: string,
34352 serviceAccountId: string,
34353 options: { readonly config?: Config | undefined } | undefined
34354 ) => Effect.Effect<
34355 WithOptionalResponse<typeof DeleteProjectServiceAccount200.Type, Config>,
34356 HttpClientError.HttpClientError | SchemaError
34357 >
34358 /**
34359 * Returns a list of users in the project.
34360 */
34361 readonly "listProjectUsers": <Config extends OperationConfig>(
34362 projectId: string,
34363 options: {
34364 readonly params?: typeof ListProjectUsersParams.Encoded | undefined
34365 readonly config?: Config | undefined
34366 } | undefined
34367 ) => Effect.Effect<
34368 WithOptionalResponse<typeof ListProjectUsers200.Type, Config>,
34369 | HttpClientError.HttpClientError
34370 | SchemaError
34371 | OpenAiClientError<"ListProjectUsers400", typeof ListProjectUsers400.Type>
34372 >
34373 /**
34374 * Adds a user to the project. Users must already be members of the organization to be added to a project.
34375 */
34376 readonly "createProjectUser": <Config extends OperationConfig>(
34377 projectId: string,
34378 options: { readonly payload: typeof CreateProjectUserRequestJson.Encoded; readonly config?: Config | undefined }
34379 ) => Effect.Effect<
34380 WithOptionalResponse<typeof CreateProjectUser200.Type, Config>,
34381 | HttpClientError.HttpClientError
34382 | SchemaError
34383 | OpenAiClientError<"CreateProjectUser400", typeof CreateProjectUser400.Type>
34384 >
34385 /**
34386 * Retrieves a user in the project.
34387 */
34388 readonly "retrieveProjectUser": <Config extends OperationConfig>(
34389 projectId: string,
34390 userId: string,
34391 options: { readonly config?: Config | undefined } | undefined
34392 ) => Effect.Effect<
34393 WithOptionalResponse<typeof RetrieveProjectUser200.Type, Config>,
34394 HttpClientError.HttpClientError | SchemaError
34395 >
34396 /**
34397 * Modifies a user's role in the project.
34398 */
34399 readonly "modifyProjectUser": <Config extends OperationConfig>(
34400 projectId: string,
34401 userId: string,
34402 options: { readonly payload: typeof ModifyProjectUserRequestJson.Encoded; readonly config?: Config | undefined }
34403 ) => Effect.Effect<
34404 WithOptionalResponse<typeof ModifyProjectUser200.Type, Config>,
34405 | HttpClientError.HttpClientError
34406 | SchemaError
34407 | OpenAiClientError<"ModifyProjectUser400", typeof ModifyProjectUser400.Type>
34408 >
34409 /**
34410 * Deletes a user from the project.
34411 *
34412 * Returns confirmation of project user deletion, or an error if the project is
34413 * archived (archived projects have no users).
34414 */
34415 readonly "deleteProjectUser": <Config extends OperationConfig>(
34416 projectId: string,
34417 userId: string,
34418 options: { readonly config?: Config | undefined } | undefined
34419 ) => Effect.Effect<
34420 WithOptionalResponse<typeof DeleteProjectUser200.Type, Config>,
34421 | HttpClientError.HttpClientError
34422 | SchemaError
34423 | OpenAiClientError<"DeleteProjectUser400", typeof DeleteProjectUser400.Type>
34424 >
34425 /**
34426 * Lists the roles configured for the organization.
34427 */
34428 readonly "listRoles": <Config extends OperationConfig>(
34429 options:
34430 | { readonly params?: typeof ListRolesParams.Encoded | undefined; readonly config?: Config | undefined }
34431 | undefined
34432 ) => Effect.Effect<
34433 WithOptionalResponse<typeof ListRoles200.Type, Config>,
34434 HttpClientError.HttpClientError | SchemaError
34435 >
34436 /**
34437 * Creates a custom role for the organization.
34438 */
34439 readonly "createRole": <Config extends OperationConfig>(
34440 options: { readonly payload: typeof CreateRoleRequestJson.Encoded; readonly config?: Config | undefined }
34441 ) => Effect.Effect<
34442 WithOptionalResponse<typeof CreateRole200.Type, Config>,
34443 HttpClientError.HttpClientError | SchemaError
34444 >
34445 /**
34446 * Updates an existing organization role.
34447 */
34448 readonly "updateRole": <Config extends OperationConfig>(
34449 roleId: string,
34450 options: { readonly payload: typeof UpdateRoleRequestJson.Encoded; readonly config?: Config | undefined }
34451 ) => Effect.Effect<
34452 WithOptionalResponse<typeof UpdateRole200.Type, Config>,
34453 HttpClientError.HttpClientError | SchemaError
34454 >
34455 /**
34456 * Deletes a custom role from the organization.
34457 */
34458 readonly "deleteRole": <Config extends OperationConfig>(
34459 roleId: string,
34460 options: { readonly config?: Config | undefined } | undefined
34461 ) => Effect.Effect<
34462 WithOptionalResponse<typeof DeleteRole200.Type, Config>,
34463 HttpClientError.HttpClientError | SchemaError
34464 >
34465 /**
34466 * Get audio speeches usage details for the organization.
34467 */
34468 readonly "usageAudioSpeeches": <Config extends OperationConfig>(
34469 options: { readonly params: typeof UsageAudioSpeechesParams.Encoded; readonly config?: Config | undefined }
34470 ) => Effect.Effect<
34471 WithOptionalResponse<typeof UsageAudioSpeeches200.Type, Config>,
34472 HttpClientError.HttpClientError | SchemaError
34473 >
34474 /**
34475 * Get audio transcriptions usage details for the organization.
34476 */
34477 readonly "usageAudioTranscriptions": <Config extends OperationConfig>(
34478 options: { readonly params: typeof UsageAudioTranscriptionsParams.Encoded; readonly config?: Config | undefined }
34479 ) => Effect.Effect<
34480 WithOptionalResponse<typeof UsageAudioTranscriptions200.Type, Config>,
34481 HttpClientError.HttpClientError | SchemaError
34482 >
34483 /**
34484 * Get code interpreter sessions usage details for the organization.
34485 */
34486 readonly "usageCodeInterpreterSessions": <Config extends OperationConfig>(
34487 options: {
34488 readonly params: typeof UsageCodeInterpreterSessionsParams.Encoded
34489 readonly config?: Config | undefined
34490 }
34491 ) => Effect.Effect<
34492 WithOptionalResponse<typeof UsageCodeInterpreterSessions200.Type, Config>,
34493 HttpClientError.HttpClientError | SchemaError
34494 >
34495 /**
34496 * Get completions usage details for the organization.
34497 */
34498 readonly "usageCompletions": <Config extends OperationConfig>(
34499 options: { readonly params: typeof UsageCompletionsParams.Encoded; readonly config?: Config | undefined }
34500 ) => Effect.Effect<
34501 WithOptionalResponse<typeof UsageCompletions200.Type, Config>,
34502 HttpClientError.HttpClientError | SchemaError
34503 >
34504 /**
34505 * Get embeddings usage details for the organization.
34506 */
34507 readonly "usageEmbeddings": <Config extends OperationConfig>(
34508 options: { readonly params: typeof UsageEmbeddingsParams.Encoded; readonly config?: Config | undefined }
34509 ) => Effect.Effect<
34510 WithOptionalResponse<typeof UsageEmbeddings200.Type, Config>,
34511 HttpClientError.HttpClientError | SchemaError
34512 >
34513 /**
34514 * Get file search calls usage details for the organization.
34515 */
34516 readonly "usageFileSearchCalls": <Config extends OperationConfig>(
34517 options: { readonly params: typeof UsageFileSearchCallsParams.Encoded; readonly config?: Config | undefined }
34518 ) => Effect.Effect<
34519 WithOptionalResponse<typeof UsageFileSearchCalls200.Type, Config>,
34520 HttpClientError.HttpClientError | SchemaError
34521 >
34522 /**
34523 * Get images usage details for the organization.
34524 */
34525 readonly "usageImages": <Config extends OperationConfig>(
34526 options: { readonly params: typeof UsageImagesParams.Encoded; readonly config?: Config | undefined }
34527 ) => Effect.Effect<
34528 WithOptionalResponse<typeof UsageImages200.Type, Config>,
34529 HttpClientError.HttpClientError | SchemaError
34530 >
34531 /**
34532 * Get moderations usage details for the organization.
34533 */
34534 readonly "usageModerations": <Config extends OperationConfig>(
34535 options: { readonly params: typeof UsageModerationsParams.Encoded; readonly config?: Config | undefined }
34536 ) => Effect.Effect<
34537 WithOptionalResponse<typeof UsageModerations200.Type, Config>,
34538 HttpClientError.HttpClientError | SchemaError
34539 >
34540 /**
34541 * Get vector stores usage details for the organization.
34542 */
34543 readonly "usageVectorStores": <Config extends OperationConfig>(
34544 options: { readonly params: typeof UsageVectorStoresParams.Encoded; readonly config?: Config | undefined }
34545 ) => Effect.Effect<
34546 WithOptionalResponse<typeof UsageVectorStores200.Type, Config>,
34547 HttpClientError.HttpClientError | SchemaError
34548 >
34549 /**
34550 * Get web search calls usage details for the organization.
34551 */
34552 readonly "usageWebSearchCalls": <Config extends OperationConfig>(
34553 options: { readonly params: typeof UsageWebSearchCallsParams.Encoded; readonly config?: Config | undefined }
34554 ) => Effect.Effect<
34555 WithOptionalResponse<typeof UsageWebSearchCalls200.Type, Config>,
34556 HttpClientError.HttpClientError | SchemaError
34557 >
34558 /**
34559 * Lists all of the users in the organization.
34560 */
34561 readonly "listUsers": <Config extends OperationConfig>(
34562 options:
34563 | { readonly params?: typeof ListUsersParams.Encoded | undefined; readonly config?: Config | undefined }
34564 | undefined
34565 ) => Effect.Effect<
34566 WithOptionalResponse<typeof ListUsers200.Type, Config>,
34567 HttpClientError.HttpClientError | SchemaError
34568 >
34569 /**
34570 * Retrieves a user by their identifier.
34571 */
34572 readonly "retrieveUser": <Config extends OperationConfig>(
34573 userId: string,
34574 options: { readonly config?: Config | undefined } | undefined
34575 ) => Effect.Effect<
34576 WithOptionalResponse<typeof RetrieveUser200.Type, Config>,
34577 HttpClientError.HttpClientError | SchemaError
34578 >
34579 /**
34580 * Modifies a user's role in the organization.
34581 */
34582 readonly "modifyUser": <Config extends OperationConfig>(
34583 userId: string,
34584 options: { readonly payload: typeof ModifyUserRequestJson.Encoded; readonly config?: Config | undefined }
34585 ) => Effect.Effect<
34586 WithOptionalResponse<typeof ModifyUser200.Type, Config>,
34587 HttpClientError.HttpClientError | SchemaError
34588 >
34589 /**
34590 * Deletes a user from the organization.
34591 */
34592 readonly "deleteUser": <Config extends OperationConfig>(
34593 userId: string,
34594 options: { readonly config?: Config | undefined } | undefined
34595 ) => Effect.Effect<
34596 WithOptionalResponse<typeof DeleteUser200.Type, Config>,
34597 HttpClientError.HttpClientError | SchemaError
34598 >
34599 /**
34600 * Lists the organization roles assigned to a user within the organization.
34601 */
34602 readonly "listUserRoleAssignments": <Config extends OperationConfig>(
34603 userId: string,
34604 options: {
34605 readonly params?: typeof ListUserRoleAssignmentsParams.Encoded | undefined
34606 readonly config?: Config | undefined
34607 } | undefined
34608 ) => Effect.Effect<
34609 WithOptionalResponse<typeof ListUserRoleAssignments200.Type, Config>,
34610 HttpClientError.HttpClientError | SchemaError
34611 >
34612 /**
34613 * Assigns an organization role to a user within the organization.
34614 */
34615 readonly "assignUserRole": <Config extends OperationConfig>(
34616 userId: string,
34617 options: { readonly payload: typeof AssignUserRoleRequestJson.Encoded; readonly config?: Config | undefined }
34618 ) => Effect.Effect<
34619 WithOptionalResponse<typeof AssignUserRole200.Type, Config>,
34620 HttpClientError.HttpClientError | SchemaError
34621 >
34622 /**
34623 * Unassigns an organization role from a user within the organization.
34624 */
34625 readonly "unassignUserRole": <Config extends OperationConfig>(
34626 userId: string,
34627 roleId: string,
34628 options: { readonly config?: Config | undefined } | undefined
34629 ) => Effect.Effect<
34630 WithOptionalResponse<typeof UnassignUserRole200.Type, Config>,
34631 HttpClientError.HttpClientError | SchemaError
34632 >
34633 /**
34634 * Lists the project roles assigned to a group within a project.
34635 */
34636 readonly "listProjectGroupRoleAssignments": <Config extends OperationConfig>(
34637 projectId: string,
34638 groupId: string,
34639 options: {
34640 readonly params?: typeof ListProjectGroupRoleAssignmentsParams.Encoded | undefined
34641 readonly config?: Config | undefined
34642 } | undefined
34643 ) => Effect.Effect<
34644 WithOptionalResponse<typeof ListProjectGroupRoleAssignments200.Type, Config>,
34645 HttpClientError.HttpClientError | SchemaError
34646 >
34647 /**
34648 * Assigns a project role to a group within a project.
34649 */
34650 readonly "assignProjectGroupRole": <Config extends OperationConfig>(
34651 projectId: string,
34652 groupId: string,
34653 options: {
34654 readonly payload: typeof AssignProjectGroupRoleRequestJson.Encoded
34655 readonly config?: Config | undefined
34656 }
34657 ) => Effect.Effect<
34658 WithOptionalResponse<typeof AssignProjectGroupRole200.Type, Config>,
34659 HttpClientError.HttpClientError | SchemaError
34660 >
34661 /**
34662 * Unassigns a project role from a group within a project.
34663 */
34664 readonly "unassignProjectGroupRole": <Config extends OperationConfig>(
34665 projectId: string,
34666 groupId: string,
34667 roleId: string,
34668 options: { readonly config?: Config | undefined } | undefined
34669 ) => Effect.Effect<
34670 WithOptionalResponse<typeof UnassignProjectGroupRole200.Type, Config>,
34671 HttpClientError.HttpClientError | SchemaError
34672 >
34673 /**
34674 * Lists the roles configured for a project.
34675 */
34676 readonly "listProjectRoles": <Config extends OperationConfig>(
34677 projectId: string,
34678 options: {
34679 readonly params?: typeof ListProjectRolesParams.Encoded | undefined
34680 readonly config?: Config | undefined
34681 } | undefined
34682 ) => Effect.Effect<
34683 WithOptionalResponse<typeof ListProjectRoles200.Type, Config>,
34684 HttpClientError.HttpClientError | SchemaError
34685 >
34686 /**
34687 * Creates a custom role for a project.
34688 */
34689 readonly "createProjectRole": <Config extends OperationConfig>(
34690 projectId: string,
34691 options: { readonly payload: typeof CreateProjectRoleRequestJson.Encoded; readonly config?: Config | undefined }
34692 ) => Effect.Effect<
34693 WithOptionalResponse<typeof CreateProjectRole200.Type, Config>,
34694 HttpClientError.HttpClientError | SchemaError
34695 >
34696 /**
34697 * Updates an existing project role.
34698 */
34699 readonly "updateProjectRole": <Config extends OperationConfig>(
34700 projectId: string,
34701 roleId: string,
34702 options: { readonly payload: typeof UpdateProjectRoleRequestJson.Encoded; readonly config?: Config | undefined }
34703 ) => Effect.Effect<
34704 WithOptionalResponse<typeof UpdateProjectRole200.Type, Config>,
34705 HttpClientError.HttpClientError | SchemaError
34706 >
34707 /**
34708 * Deletes a custom role from a project.
34709 */
34710 readonly "deleteProjectRole": <Config extends OperationConfig>(
34711 projectId: string,
34712 roleId: string,
34713 options: { readonly config?: Config | undefined } | undefined
34714 ) => Effect.Effect<
34715 WithOptionalResponse<typeof DeleteProjectRole200.Type, Config>,
34716 HttpClientError.HttpClientError | SchemaError
34717 >
34718 /**
34719 * Lists the project roles assigned to a user within a project.
34720 */
34721 readonly "listProjectUserRoleAssignments": <Config extends OperationConfig>(
34722 projectId: string,
34723 userId: string,
34724 options: {
34725 readonly params?: typeof ListProjectUserRoleAssignmentsParams.Encoded | undefined
34726 readonly config?: Config | undefined
34727 } | undefined
34728 ) => Effect.Effect<
34729 WithOptionalResponse<typeof ListProjectUserRoleAssignments200.Type, Config>,
34730 HttpClientError.HttpClientError | SchemaError
34731 >
34732 /**
34733 * Assigns a project role to a user within a project.
34734 */
34735 readonly "assignProjectUserRole": <Config extends OperationConfig>(
34736 projectId: string,
34737 userId: string,
34738 options: { readonly payload: typeof AssignProjectUserRoleRequestJson.Encoded; readonly config?: Config | undefined }
34739 ) => Effect.Effect<
34740 WithOptionalResponse<typeof AssignProjectUserRole200.Type, Config>,
34741 HttpClientError.HttpClientError | SchemaError
34742 >
34743 /**
34744 * Unassigns a project role from a user within a project.
34745 */
34746 readonly "unassignProjectUserRole": <Config extends OperationConfig>(
34747 projectId: string,
34748 userId: string,
34749 roleId: string,
34750 options: { readonly config?: Config | undefined } | undefined
34751 ) => Effect.Effect<
34752 WithOptionalResponse<typeof UnassignProjectUserRole200.Type, Config>,
34753 HttpClientError.HttpClientError | SchemaError
34754 >
34755 /**
34756 * Create a new Realtime API call over WebRTC and receive the SDP answer needed
34757 * to complete the peer connection.
34758 */
34759 readonly "createRealtimeCall": <Config extends OperationConfig>(
34760 options: {
34761 readonly payload: typeof CreateRealtimeCallRequestFormData.Encoded
34762 readonly config?: Config | undefined
34763 }
34764 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
34765 /**
34766 * Accept an incoming SIP call and configure the realtime session that will
34767 * handle it.
34768 */
34769 readonly "acceptRealtimeCall": <Config extends OperationConfig>(
34770 callId: string,
34771 options: { readonly payload: typeof AcceptRealtimeCallRequestJson.Encoded; readonly config?: Config | undefined }
34772 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
34773 /**
34774 * End an active Realtime API call, whether it was initiated over SIP or
34775 * WebRTC.
34776 */
34777 readonly "hangupRealtimeCall": <Config extends OperationConfig>(
34778 callId: string,
34779 options: { readonly config?: Config | undefined } | undefined
34780 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
34781 /**
34782 * Transfer an active SIP call to a new destination using the SIP REFER verb.
34783 */
34784 readonly "referRealtimeCall": <Config extends OperationConfig>(
34785 callId: string,
34786 options: { readonly payload: typeof ReferRealtimeCallRequestJson.Encoded; readonly config?: Config | undefined }
34787 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
34788 /**
34789 * Decline an incoming SIP call by returning a SIP status code to the caller.
34790 */
34791 readonly "rejectRealtimeCall": <Config extends OperationConfig>(
34792 callId: string,
34793 options: { readonly payload: typeof RejectRealtimeCallRequestJson.Encoded; readonly config?: Config | undefined }
34794 ) => Effect.Effect<WithOptionalResponse<void, Config>, HttpClientError.HttpClientError | SchemaError>
34795 /**
34796 * Create a Realtime client secret with an associated session configuration.
34797 *
34798 * Client secrets are short-lived tokens that can be passed to a client app,
34799 * such as a web frontend or mobile client, which grants access to the Realtime API without
34800 * leaking your main API key. You can configure a custom TTL for each client secret.
34801 *
34802 * You can also attach session configuration options to the client secret, which will be
34803 * applied to any sessions created using that client secret, but these can also be overridden
34804 * by the client connection.
34805 *
34806 * [Learn more about authentication with client secrets over WebRTC](/docs/guides/realtime-webrtc).
34807 *
34808 * Returns the created client secret and the effective session object. The client secret is a string that looks like `ek_1234`.
34809 */
34810 readonly "createRealtimeClientSecret": <Config extends OperationConfig>(
34811 options: {
34812 readonly payload: typeof CreateRealtimeClientSecretRequestJson.Encoded
34813 readonly config?: Config | undefined
34814 }
34815 ) => Effect.Effect<
34816 WithOptionalResponse<typeof CreateRealtimeClientSecret200.Type, Config>,
34817 HttpClientError.HttpClientError | SchemaError
34818 >
34819 /**
34820 * Create an ephemeral API token for use in client-side applications with the
34821 * Realtime API. Can be configured with the same session parameters as the
34822 * `session.update` client event.
34823 *
34824 * It responds with a session object, plus a `client_secret` key which contains
34825 * a usable ephemeral API token that can be used to authenticate browser clients
34826 * for the Realtime API.
34827 *
34828 * Returns the created Realtime session object, plus an ephemeral key.
34829 */
34830 readonly "createRealtimeSession": <Config extends OperationConfig>(
34831 options: { readonly payload: typeof CreateRealtimeSessionRequestJson.Encoded; readonly config?: Config | undefined }
34832 ) => Effect.Effect<
34833 WithOptionalResponse<typeof CreateRealtimeSession200.Type, Config>,
34834 HttpClientError.HttpClientError | SchemaError
34835 >
34836 /**
34837 * Create an ephemeral API token for use in client-side applications with the
34838 * Realtime API specifically for realtime transcriptions.
34839 * Can be configured with the same session parameters as the `transcription_session.update` client event.
34840 *
34841 * It responds with a session object, plus a `client_secret` key which contains
34842 * a usable ephemeral API token that can be used to authenticate browser clients
34843 * for the Realtime API.
34844 *
34845 * Returns the created Realtime transcription session object, plus an ephemeral key.
34846 */
34847 readonly "createRealtimeTranscriptionSession": <Config extends OperationConfig>(
34848 options: {
34849 readonly payload: typeof CreateRealtimeTranscriptionSessionRequestJson.Encoded
34850 readonly config?: Config | undefined
34851 }
34852 ) => Effect.Effect<
34853 WithOptionalResponse<typeof CreateRealtimeTranscriptionSession200.Type, Config>,
34854 HttpClientError.HttpClientError | SchemaError
34855 >
34856 /**
34857 * Create a Realtime translation client secret with an associated translation session configuration.
34858 *
34859 * Client secrets are short-lived tokens that can be passed to a client app,
34860 * such as a web frontend or mobile client, which grants access to the Realtime
34861 * Translation API without leaking your main API key. You can configure a custom
34862 * TTL for each client secret.
34863 *
34864 * Returns the created client secret and the effective translation session object.
34865 * The client secret is a string that looks like `ek_1234`.
34866 */
34867 readonly "createRealtimeTranslationClientSecret": <Config extends OperationConfig>(
34868 options: {
34869 readonly payload: typeof CreateRealtimeTranslationClientSecretRequestJson.Encoded
34870 readonly config?: Config | undefined
34871 }
34872 ) => Effect.Effect<
34873 WithOptionalResponse<typeof CreateRealtimeTranslationClientSecret200.Type, Config>,
34874 HttpClientError.HttpClientError | SchemaError
34875 >
34876 /**
34877 * Creates a model response. Provide [text](/docs/guides/text) or
34878 * [image](/docs/guides/images) inputs to generate [text](/docs/guides/text)
34879 * or [JSON](/docs/guides/structured-outputs) outputs. Have the model call
34880 * your own [custom code](/docs/guides/function-calling) or use built-in
34881 * [tools](/docs/guides/tools) like [web search](/docs/guides/tools-web-search)
34882 * or [file search](/docs/guides/tools-file-search) to use your own data
34883 * as input for the model's response.
34884 */
34885 readonly "createResponse": <Config extends OperationConfig>(
34886 options: { readonly payload: typeof CreateResponseRequestJson.Encoded; readonly config?: Config | undefined }
34887 ) => Effect.Effect<
34888 WithOptionalResponse<typeof CreateResponse200.Type, Config>,
34889 HttpClientError.HttpClientError | SchemaError
34890 >
34891 /**
34892 * Creates a model response. Provide [text](/docs/guides/text) or
34893 * [image](/docs/guides/images) inputs to generate [text](/docs/guides/text)
34894 * or [JSON](/docs/guides/structured-outputs) outputs. Have the model call
34895 * your own [custom code](/docs/guides/function-calling) or use built-in
34896 * [tools](/docs/guides/tools) like [web search](/docs/guides/tools-web-search)
34897 * or [file search](/docs/guides/tools-file-search) to use your own data
34898 * as input for the model's response.
34899 */
34900 readonly "createResponseSse": (
34901 options: { readonly payload: typeof CreateResponseRequestJson.Encoded }
34902 ) => Stream.Stream<
34903 { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateResponse200Sse.Type },
34904 HttpClientError.HttpClientError | SchemaError | Sse.Retry | Sse.SseError,
34905 typeof CreateResponse200Sse.DecodingServices
34906 >
34907 /**
34908 * Retrieves a model response with the given ID.
34909 */
34910 readonly "getResponse": <Config extends OperationConfig>(
34911 responseId: string,
34912 options:
34913 | { readonly params?: typeof GetResponseParams.Encoded | undefined; readonly config?: Config | undefined }
34914 | undefined
34915 ) => Effect.Effect<
34916 WithOptionalResponse<typeof GetResponse200.Type, Config>,
34917 HttpClientError.HttpClientError | SchemaError
34918 >
34919 /**
34920 * Deletes a model response with the given ID.
34921 */
34922 readonly "deleteResponse": <Config extends OperationConfig>(
34923 responseId: string,
34924 options: { readonly config?: Config | undefined } | undefined
34925 ) => Effect.Effect<
34926 WithOptionalResponse<void, Config>,
34927 | HttpClientError.HttpClientError
34928 | SchemaError
34929 | OpenAiClientError<"DeleteResponse404", typeof DeleteResponse404.Type>
34930 >
34931 /**
34932 * Cancels a model response with the given ID. Only responses created with
34933 * the `background` parameter set to `true` can be cancelled.
34934 * [Learn more](/docs/guides/background).
34935 */
34936 readonly "cancelResponse": <Config extends OperationConfig>(
34937 responseId: string,
34938 options: { readonly config?: Config | undefined } | undefined
34939 ) => Effect.Effect<
34940 WithOptionalResponse<typeof CancelResponse200.Type, Config>,
34941 | HttpClientError.HttpClientError
34942 | SchemaError
34943 | OpenAiClientError<"CancelResponse404", typeof CancelResponse404.Type>
34944 >
34945 /**
34946 * Returns a list of input items for a given response.
34947 */
34948 readonly "listInputItems": <Config extends OperationConfig>(
34949 responseId: string,
34950 options:
34951 | { readonly params?: typeof ListInputItemsParams.Encoded | undefined; readonly config?: Config | undefined }
34952 | undefined
34953 ) => Effect.Effect<
34954 WithOptionalResponse<typeof ListInputItems200.Type, Config>,
34955 HttpClientError.HttpClientError | SchemaError
34956 >
34957 /**
34958 * Create a thread.
34959 */
34960 readonly "createThread": <Config extends OperationConfig>(
34961 options: { readonly payload: typeof CreateThreadRequestJson.Encoded; readonly config?: Config | undefined }
34962 ) => Effect.Effect<
34963 WithOptionalResponse<typeof CreateThread200.Type, Config>,
34964 HttpClientError.HttpClientError | SchemaError
34965 >
34966 /**
34967 * Create a thread and run it in one request.
34968 */
34969 readonly "createThreadAndRun": <Config extends OperationConfig>(
34970 options: { readonly payload: typeof CreateThreadAndRunRequestJson.Encoded; readonly config?: Config | undefined }
34971 ) => Effect.Effect<
34972 WithOptionalResponse<typeof CreateThreadAndRun200.Type, Config>,
34973 HttpClientError.HttpClientError | SchemaError
34974 >
34975 /**
34976 * Retrieves a thread.
34977 */
34978 readonly "getThread": <Config extends OperationConfig>(
34979 threadId: string,
34980 options: { readonly config?: Config | undefined } | undefined
34981 ) => Effect.Effect<
34982 WithOptionalResponse<typeof GetThread200.Type, Config>,
34983 HttpClientError.HttpClientError | SchemaError
34984 >
34985 /**
34986 * Modifies a thread.
34987 */
34988 readonly "modifyThread": <Config extends OperationConfig>(
34989 threadId: string,
34990 options: { readonly payload: typeof ModifyThreadRequestJson.Encoded; readonly config?: Config | undefined }
34991 ) => Effect.Effect<
34992 WithOptionalResponse<typeof ModifyThread200.Type, Config>,
34993 HttpClientError.HttpClientError | SchemaError
34994 >
34995 /**
34996 * Delete a thread.
34997 */
34998 readonly "deleteThread": <Config extends OperationConfig>(
34999 threadId: string,
35000 options: { readonly config?: Config | undefined } | undefined
35001 ) => Effect.Effect<
35002 WithOptionalResponse<typeof DeleteThread200.Type, Config>,
35003 HttpClientError.HttpClientError | SchemaError
35004 >
35005 /**
35006 * Returns a list of messages for a given thread.
35007 */
35008 readonly "listMessages": <Config extends OperationConfig>(
35009 threadId: string,
35010 options:
35011 | { readonly params?: typeof ListMessagesParams.Encoded | undefined; readonly config?: Config | undefined }
35012 | undefined
35013 ) => Effect.Effect<
35014 WithOptionalResponse<typeof ListMessages200.Type, Config>,
35015 HttpClientError.HttpClientError | SchemaError
35016 >
35017 /**
35018 * Create a message.
35019 */
35020 readonly "createMessage": <Config extends OperationConfig>(
35021 threadId: string,
35022 options: { readonly payload: typeof CreateMessageRequestJson.Encoded; readonly config?: Config | undefined }
35023 ) => Effect.Effect<
35024 WithOptionalResponse<typeof CreateMessage200.Type, Config>,
35025 HttpClientError.HttpClientError | SchemaError
35026 >
35027 /**
35028 * Retrieve a message.
35029 */
35030 readonly "getMessage": <Config extends OperationConfig>(
35031 threadId: string,
35032 messageId: string,
35033 options: { readonly config?: Config | undefined } | undefined
35034 ) => Effect.Effect<
35035 WithOptionalResponse<typeof GetMessage200.Type, Config>,
35036 HttpClientError.HttpClientError | SchemaError
35037 >
35038 /**
35039 * Modifies a message.
35040 */
35041 readonly "modifyMessage": <Config extends OperationConfig>(
35042 threadId: string,
35043 messageId: string,
35044 options: { readonly payload: typeof ModifyMessageRequestJson.Encoded; readonly config?: Config | undefined }
35045 ) => Effect.Effect<
35046 WithOptionalResponse<typeof ModifyMessage200.Type, Config>,
35047 HttpClientError.HttpClientError | SchemaError
35048 >
35049 /**
35050 * Deletes a message.
35051 */
35052 readonly "deleteMessage": <Config extends OperationConfig>(
35053 threadId: string,
35054 messageId: string,
35055 options: { readonly config?: Config | undefined } | undefined
35056 ) => Effect.Effect<
35057 WithOptionalResponse<typeof DeleteMessage200.Type, Config>,
35058 HttpClientError.HttpClientError | SchemaError
35059 >
35060 /**
35061 * Returns a list of runs belonging to a thread.
35062 */
35063 readonly "listRuns": <Config extends OperationConfig>(
35064 threadId: string,
35065 options:
35066 | { readonly params?: typeof ListRunsParams.Encoded | undefined; readonly config?: Config | undefined }
35067 | undefined
35068 ) => Effect.Effect<
35069 WithOptionalResponse<typeof ListRuns200.Type, Config>,
35070 HttpClientError.HttpClientError | SchemaError
35071 >
35072 /**
35073 * Create a run.
35074 */
35075 readonly "createRun": <Config extends OperationConfig>(
35076 threadId: string,
35077 options: {
35078 readonly params?: typeof CreateRunParams.Encoded | undefined
35079 readonly payload: typeof CreateRunRequestJson.Encoded
35080 readonly config?: Config | undefined
35081 }
35082 ) => Effect.Effect<
35083 WithOptionalResponse<typeof CreateRun200.Type, Config>,
35084 HttpClientError.HttpClientError | SchemaError
35085 >
35086 /**
35087 * Retrieves a run.
35088 */
35089 readonly "getRun": <Config extends OperationConfig>(
35090 threadId: string,
35091 runId: string,
35092 options: { readonly config?: Config | undefined } | undefined
35093 ) => Effect.Effect<WithOptionalResponse<typeof GetRun200.Type, Config>, HttpClientError.HttpClientError | SchemaError>
35094 /**
35095 * Modifies a run.
35096 */
35097 readonly "modifyRun": <Config extends OperationConfig>(
35098 threadId: string,
35099 runId: string,
35100 options: { readonly payload: typeof ModifyRunRequestJson.Encoded; readonly config?: Config | undefined }
35101 ) => Effect.Effect<
35102 WithOptionalResponse<typeof ModifyRun200.Type, Config>,
35103 HttpClientError.HttpClientError | SchemaError
35104 >
35105 /**
35106 * Cancels a run that is `in_progress`.
35107 */
35108 readonly "cancelRun": <Config extends OperationConfig>(
35109 threadId: string,
35110 runId: string,
35111 options: { readonly config?: Config | undefined } | undefined
35112 ) => Effect.Effect<
35113 WithOptionalResponse<typeof CancelRun200.Type, Config>,
35114 HttpClientError.HttpClientError | SchemaError
35115 >
35116 /**
35117 * Returns a list of run steps belonging to a run.
35118 */
35119 readonly "listRunSteps": <Config extends OperationConfig>(
35120 threadId: string,
35121 runId: string,
35122 options:
35123 | { readonly params?: typeof ListRunStepsParams.Encoded | undefined; readonly config?: Config | undefined }
35124 | undefined
35125 ) => Effect.Effect<
35126 WithOptionalResponse<typeof ListRunSteps200.Type, Config>,
35127 HttpClientError.HttpClientError | SchemaError
35128 >
35129 /**
35130 * Retrieves a run step.
35131 */
35132 readonly "getRunStep": <Config extends OperationConfig>(
35133 threadId: string,
35134 runId: string,
35135 stepId: string,
35136 options:
35137 | { readonly params?: typeof GetRunStepParams.Encoded | undefined; readonly config?: Config | undefined }
35138 | undefined
35139 ) => Effect.Effect<
35140 WithOptionalResponse<typeof GetRunStep200.Type, Config>,
35141 HttpClientError.HttpClientError | SchemaError
35142 >
35143 /**
35144 * When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
35145 */
35146 readonly "submitToolOuputsToRun": <Config extends OperationConfig>(
35147 threadId: string,
35148 runId: string,
35149 options: { readonly payload: typeof SubmitToolOuputsToRunRequestJson.Encoded; readonly config?: Config | undefined }
35150 ) => Effect.Effect<
35151 WithOptionalResponse<typeof SubmitToolOuputsToRun200.Type, Config>,
35152 HttpClientError.HttpClientError | SchemaError
35153 >
35154 /**
35155 * Creates an intermediate [Upload](/docs/api-reference/uploads/object) object
35156 * that you can add [Parts](/docs/api-reference/uploads/part-object) to.
35157 * Currently, an Upload can accept at most 8 GB in total and expires after an
35158 * hour after you create it.
35159 *
35160 * Once you complete the Upload, we will create a
35161 * [File](/docs/api-reference/files/object) object that contains all the parts
35162 * you uploaded. This File is usable in the rest of our platform as a regular
35163 * File object.
35164 *
35165 * For certain `purpose` values, the correct `mime_type` must be specified.
35166 * Please refer to documentation for the
35167 * [supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files).
35168 *
35169 * For guidance on the proper filename extensions for each purpose, please
35170 * follow the documentation on [creating a
35171 * File](/docs/api-reference/files/create).
35172 *
35173 * Returns the Upload object with status `pending`.
35174 */
35175 readonly "createUpload": <Config extends OperationConfig>(
35176 options: { readonly payload: typeof CreateUploadRequestJson.Encoded; readonly config?: Config | undefined }
35177 ) => Effect.Effect<
35178 WithOptionalResponse<typeof CreateUpload200.Type, Config>,
35179 HttpClientError.HttpClientError | SchemaError
35180 >
35181 /**
35182 * Cancels the Upload. No Parts may be added after an Upload is cancelled.
35183 *
35184 * Returns the Upload object with status `cancelled`.
35185 */
35186 readonly "cancelUpload": <Config extends OperationConfig>(
35187 uploadId: string,
35188 options: { readonly config?: Config | undefined } | undefined
35189 ) => Effect.Effect<
35190 WithOptionalResponse<typeof CancelUpload200.Type, Config>,
35191 HttpClientError.HttpClientError | SchemaError
35192 >
35193 /**
35194 * Completes the [Upload](/docs/api-reference/uploads/object).
35195 *
35196 * Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.
35197 *
35198 * You can specify the order of the Parts by passing in an ordered list of the Part IDs.
35199 *
35200 * The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
35201 * Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object.
35202 */
35203 readonly "completeUpload": <Config extends OperationConfig>(
35204 uploadId: string,
35205 options: { readonly payload: typeof CompleteUploadRequestJson.Encoded; readonly config?: Config | undefined }
35206 ) => Effect.Effect<
35207 WithOptionalResponse<typeof CompleteUpload200.Type, Config>,
35208 HttpClientError.HttpClientError | SchemaError
35209 >
35210 /**
35211 * Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
35212 *
35213 * Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
35214 *
35215 * It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete).
35216 */
35217 readonly "addUploadPart": <Config extends OperationConfig>(
35218 uploadId: string,
35219 options: { readonly payload: typeof AddUploadPartRequestFormData.Encoded; readonly config?: Config | undefined }
35220 ) => Effect.Effect<
35221 WithOptionalResponse<typeof AddUploadPart200.Type, Config>,
35222 HttpClientError.HttpClientError | SchemaError
35223 >
35224 /**
35225 * Returns a list of vector stores.
35226 */
35227 readonly "listVectorStores": <Config extends OperationConfig>(
35228 options: {
35229 readonly params?: typeof ListVectorStoresParams.Encoded | undefined
35230 readonly config?: Config | undefined
35231 } | undefined
35232 ) => Effect.Effect<
35233 WithOptionalResponse<typeof ListVectorStores200.Type, Config>,
35234 HttpClientError.HttpClientError | SchemaError
35235 >
35236 /**
35237 * Create a vector store.
35238 */
35239 readonly "createVectorStore": <Config extends OperationConfig>(
35240 options: { readonly payload: typeof CreateVectorStoreRequestJson.Encoded; readonly config?: Config | undefined }
35241 ) => Effect.Effect<
35242 WithOptionalResponse<typeof CreateVectorStore200.Type, Config>,
35243 HttpClientError.HttpClientError | SchemaError
35244 >
35245 /**
35246 * Retrieves a vector store.
35247 */
35248 readonly "getVectorStore": <Config extends OperationConfig>(
35249 vectorStoreId: string,
35250 options: { readonly config?: Config | undefined } | undefined
35251 ) => Effect.Effect<
35252 WithOptionalResponse<typeof GetVectorStore200.Type, Config>,
35253 HttpClientError.HttpClientError | SchemaError
35254 >
35255 /**
35256 * Modifies a vector store.
35257 */
35258 readonly "modifyVectorStore": <Config extends OperationConfig>(
35259 vectorStoreId: string,
35260 options: { readonly payload: typeof ModifyVectorStoreRequestJson.Encoded; readonly config?: Config | undefined }
35261 ) => Effect.Effect<
35262 WithOptionalResponse<typeof ModifyVectorStore200.Type, Config>,
35263 HttpClientError.HttpClientError | SchemaError
35264 >
35265 /**
35266 * Delete a vector store.
35267 */
35268 readonly "deleteVectorStore": <Config extends OperationConfig>(
35269 vectorStoreId: string,
35270 options: { readonly config?: Config | undefined } | undefined
35271 ) => Effect.Effect<
35272 WithOptionalResponse<typeof DeleteVectorStore200.Type, Config>,
35273 HttpClientError.HttpClientError | SchemaError
35274 >
35275 /**
35276 * The maximum number of files in a single batch request is 2000.
35277 * Vector store file attach requests are rate limited per vector store (300 requests per minute across both this endpoint and `/vector_stores/{vector_store_id}/files`).
35278 * For ingesting multiple files into the same vector store, this batch endpoint is recommended.
35279 */
35280 readonly "createVectorStoreFileBatch": <Config extends OperationConfig>(
35281 vectorStoreId: string,
35282 options: {
35283 readonly payload: typeof CreateVectorStoreFileBatchRequestJson.Encoded
35284 readonly config?: Config | undefined
35285 }
35286 ) => Effect.Effect<
35287 WithOptionalResponse<typeof CreateVectorStoreFileBatch200.Type, Config>,
35288 HttpClientError.HttpClientError | SchemaError
35289 >
35290 /**
35291 * Retrieves a vector store file batch.
35292 */
35293 readonly "getVectorStoreFileBatch": <Config extends OperationConfig>(
35294 vectorStoreId: string,
35295 batchId: string,
35296 options: { readonly config?: Config | undefined } | undefined
35297 ) => Effect.Effect<
35298 WithOptionalResponse<typeof GetVectorStoreFileBatch200.Type, Config>,
35299 HttpClientError.HttpClientError | SchemaError
35300 >
35301 /**
35302 * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
35303 */
35304 readonly "cancelVectorStoreFileBatch": <Config extends OperationConfig>(
35305 vectorStoreId: string,
35306 batchId: string,
35307 options: { readonly config?: Config | undefined } | undefined
35308 ) => Effect.Effect<
35309 WithOptionalResponse<typeof CancelVectorStoreFileBatch200.Type, Config>,
35310 HttpClientError.HttpClientError | SchemaError
35311 >
35312 /**
35313 * Returns a list of vector store files in a batch.
35314 */
35315 readonly "listFilesInVectorStoreBatch": <Config extends OperationConfig>(
35316 vectorStoreId: string,
35317 batchId: string,
35318 options: {
35319 readonly params?: typeof ListFilesInVectorStoreBatchParams.Encoded | undefined
35320 readonly config?: Config | undefined
35321 } | undefined
35322 ) => Effect.Effect<
35323 WithOptionalResponse<typeof ListFilesInVectorStoreBatch200.Type, Config>,
35324 HttpClientError.HttpClientError | SchemaError
35325 >
35326 /**
35327 * Returns a list of vector store files.
35328 */
35329 readonly "listVectorStoreFiles": <Config extends OperationConfig>(
35330 vectorStoreId: string,
35331 options: {
35332 readonly params?: typeof ListVectorStoreFilesParams.Encoded | undefined
35333 readonly config?: Config | undefined
35334 } | undefined
35335 ) => Effect.Effect<
35336 WithOptionalResponse<typeof ListVectorStoreFiles200.Type, Config>,
35337 HttpClientError.HttpClientError | SchemaError
35338 >
35339 /**
35340 * This endpoint is subject to a per-vector-store write rate limit of 300 requests per minute, shared with `/vector_stores/{vector_store_id}/file_batches`.
35341 * For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume.
35342 */
35343 readonly "createVectorStoreFile": <Config extends OperationConfig>(
35344 vectorStoreId: string,
35345 options: { readonly payload: typeof CreateVectorStoreFileRequestJson.Encoded; readonly config?: Config | undefined }
35346 ) => Effect.Effect<
35347 WithOptionalResponse<typeof CreateVectorStoreFile200.Type, Config>,
35348 HttpClientError.HttpClientError | SchemaError
35349 >
35350 /**
35351 * Retrieves a vector store file.
35352 */
35353 readonly "getVectorStoreFile": <Config extends OperationConfig>(
35354 vectorStoreId: string,
35355 fileId: string,
35356 options: { readonly config?: Config | undefined } | undefined
35357 ) => Effect.Effect<
35358 WithOptionalResponse<typeof GetVectorStoreFile200.Type, Config>,
35359 HttpClientError.HttpClientError | SchemaError
35360 >
35361 /**
35362 * Update attributes on a vector store file.
35363 */
35364 readonly "updateVectorStoreFileAttributes": <Config extends OperationConfig>(
35365 vectorStoreId: string,
35366 fileId: string,
35367 options: {
35368 readonly payload: typeof UpdateVectorStoreFileAttributesRequestJson.Encoded
35369 readonly config?: Config | undefined
35370 }
35371 ) => Effect.Effect<
35372 WithOptionalResponse<typeof UpdateVectorStoreFileAttributes200.Type, Config>,
35373 HttpClientError.HttpClientError | SchemaError
35374 >
35375 /**
35376 * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint.
35377 */
35378 readonly "deleteVectorStoreFile": <Config extends OperationConfig>(
35379 vectorStoreId: string,
35380 fileId: string,
35381 options: { readonly config?: Config | undefined } | undefined
35382 ) => Effect.Effect<
35383 WithOptionalResponse<typeof DeleteVectorStoreFile200.Type, Config>,
35384 HttpClientError.HttpClientError | SchemaError
35385 >
35386 /**
35387 * Retrieve the parsed contents of a vector store file.
35388 */
35389 readonly "retrieveVectorStoreFileContent": <Config extends OperationConfig>(
35390 vectorStoreId: string,
35391 fileId: string,
35392 options: { readonly config?: Config | undefined } | undefined
35393 ) => Effect.Effect<
35394 WithOptionalResponse<typeof RetrieveVectorStoreFileContent200.Type, Config>,
35395 HttpClientError.HttpClientError | SchemaError
35396 >
35397 /**
35398 * Search a vector store for relevant chunks based on a query and file attributes filter.
35399 */
35400 readonly "searchVectorStore": <Config extends OperationConfig>(
35401 vectorStoreId: string,
35402 options: { readonly payload: typeof SearchVectorStoreRequestJson.Encoded; readonly config?: Config | undefined }
35403 ) => Effect.Effect<
35404 WithOptionalResponse<typeof SearchVectorStore200.Type, Config>,
35405 HttpClientError.HttpClientError | SchemaError
35406 >
35407 /**
35408 * Create a conversation.
35409 */
35410 readonly "createConversation": <Config extends OperationConfig>(
35411 options: { readonly payload: typeof CreateConversationRequestJson.Encoded; readonly config?: Config | undefined }
35412 ) => Effect.Effect<
35413 WithOptionalResponse<typeof CreateConversation200.Type, Config>,
35414 HttpClientError.HttpClientError | SchemaError
35415 >
35416 /**
35417 * Get a conversation
35418 */
35419 readonly "getConversation": <Config extends OperationConfig>(
35420 conversationId: string,
35421 options: { readonly config?: Config | undefined } | undefined
35422 ) => Effect.Effect<
35423 WithOptionalResponse<typeof GetConversation200.Type, Config>,
35424 HttpClientError.HttpClientError | SchemaError
35425 >
35426 /**
35427 * Update a conversation
35428 */
35429 readonly "updateConversation": <Config extends OperationConfig>(
35430 conversationId: string,
35431 options: { readonly payload: typeof UpdateConversationRequestJson.Encoded; readonly config?: Config | undefined }
35432 ) => Effect.Effect<
35433 WithOptionalResponse<typeof UpdateConversation200.Type, Config>,
35434 HttpClientError.HttpClientError | SchemaError
35435 >
35436 /**
35437 * Delete a conversation. Items in the conversation will not be deleted.
35438 */
35439 readonly "deleteConversation": <Config extends OperationConfig>(
35440 conversationId: string,
35441 options: { readonly config?: Config | undefined } | undefined
35442 ) => Effect.Effect<
35443 WithOptionalResponse<typeof DeleteConversation200.Type, Config>,
35444 HttpClientError.HttpClientError | SchemaError
35445 >
35446 /**
35447 * List recently generated videos for the current project.
35448 */
35449 readonly "ListVideos": <Config extends OperationConfig>(
35450 options:
35451 | { readonly params?: typeof ListVideosParams.Encoded | undefined; readonly config?: Config | undefined }
35452 | undefined
35453 ) => Effect.Effect<
35454 WithOptionalResponse<typeof ListVideos200.Type, Config>,
35455 HttpClientError.HttpClientError | SchemaError
35456 >
35457 /**
35458 * Create a new video generation job from a prompt and optional reference assets.
35459 */
35460 readonly "createVideo": <Config extends OperationConfig>(
35461 options: { readonly payload: typeof CreateVideoRequestFormData.Encoded; readonly config?: Config | undefined }
35462 ) => Effect.Effect<
35463 WithOptionalResponse<typeof CreateVideo200.Type, Config>,
35464 HttpClientError.HttpClientError | SchemaError
35465 >
35466 /**
35467 * Create a character from an uploaded video.
35468 */
35469 readonly "CreateVideoCharacter": <Config extends OperationConfig>(
35470 options: {
35471 readonly payload: typeof CreateVideoCharacterRequestFormData.Encoded
35472 readonly config?: Config | undefined
35473 }
35474 ) => Effect.Effect<
35475 WithOptionalResponse<typeof CreateVideoCharacter200.Type, Config>,
35476 HttpClientError.HttpClientError | SchemaError
35477 >
35478 /**
35479 * Fetch a character.
35480 */
35481 readonly "GetVideoCharacter": <Config extends OperationConfig>(
35482 characterId: string,
35483 options: { readonly config?: Config | undefined } | undefined
35484 ) => Effect.Effect<
35485 WithOptionalResponse<typeof GetVideoCharacter200.Type, Config>,
35486 HttpClientError.HttpClientError | SchemaError
35487 >
35488 /**
35489 * Create a new video generation job by editing a source video or existing generated video.
35490 */
35491 readonly "CreateVideoEdit": <Config extends OperationConfig>(
35492 options: { readonly payload: typeof CreateVideoEditRequestFormData.Encoded; readonly config?: Config | undefined }
35493 ) => Effect.Effect<
35494 WithOptionalResponse<typeof CreateVideoEdit200.Type, Config>,
35495 HttpClientError.HttpClientError | SchemaError
35496 >
35497 /**
35498 * Create an extension of a completed video.
35499 */
35500 readonly "CreateVideoExtend": <Config extends OperationConfig>(
35501 options: { readonly payload: typeof CreateVideoExtendRequestFormData.Encoded; readonly config?: Config | undefined }
35502 ) => Effect.Effect<
35503 WithOptionalResponse<typeof CreateVideoExtend200.Type, Config>,
35504 HttpClientError.HttpClientError | SchemaError
35505 >
35506 /**
35507 * Fetch the latest metadata for a generated video.
35508 */
35509 readonly "GetVideo": <Config extends OperationConfig>(
35510 videoId: string,
35511 options: { readonly config?: Config | undefined } | undefined
35512 ) => Effect.Effect<
35513 WithOptionalResponse<typeof GetVideo200.Type, Config>,
35514 HttpClientError.HttpClientError | SchemaError
35515 >
35516 /**
35517 * Permanently delete a completed or failed video and its stored assets.
35518 */
35519 readonly "DeleteVideo": <Config extends OperationConfig>(
35520 videoId: string,
35521 options: { readonly config?: Config | undefined } | undefined
35522 ) => Effect.Effect<
35523 WithOptionalResponse<typeof DeleteVideo200.Type, Config>,
35524 HttpClientError.HttpClientError | SchemaError
35525 >
35526 /**
35527 * Download the generated video bytes or a derived preview asset.
35528 *
35529 * Streams the rendered video content for the specified video job.
35530 */
35531 readonly "RetrieveVideoContent": <Config extends OperationConfig>(
35532 videoId: string,
35533 options: {
35534 readonly params?: typeof RetrieveVideoContentParams.Encoded | undefined
35535 readonly config?: Config | undefined
35536 } | undefined
35537 ) => Effect.Effect<
35538 WithOptionalResponse<typeof RetrieveVideoContent200.Type, Config>,
35539 HttpClientError.HttpClientError | SchemaError
35540 >
35541 /**
35542 * Create a remix of a completed video using a refreshed prompt.
35543 */
35544 readonly "CreateVideoRemix": <Config extends OperationConfig>(
35545 videoId: string,
35546 options: { readonly payload: typeof CreateVideoRemixRequestFormData.Encoded; readonly config?: Config | undefined }
35547 ) => Effect.Effect<
35548 WithOptionalResponse<typeof CreateVideoRemix200.Type, Config>,
35549 HttpClientError.HttpClientError | SchemaError
35550 >
35551 /**
35552 * Returns input token counts of the request.
35553 *
35554 * Returns an object with `object` set to `response.input_tokens` and an `input_tokens` count.
35555 */
35556 readonly "Getinputtokencounts": <Config extends OperationConfig>(
35557 options: {
35558 readonly payload: typeof GetinputtokencountsRequestFormUrlEncoded.Encoded
35559 readonly config?: Config | undefined
35560 }
35561 ) => Effect.Effect<
35562 WithOptionalResponse<typeof Getinputtokencounts200.Type, Config>,
35563 HttpClientError.HttpClientError | SchemaError
35564 >
35565 /**
35566 * Compact a conversation. Returns a compacted response object.
35567 *
35568 * Learn when and how to compact long-running conversations in the [conversation state guide](/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](/docs/guides/conversation-state#compaction-advanced).
35569 */
35570 readonly "Compactconversation": <Config extends OperationConfig>(
35571 options: {
35572 readonly payload: typeof CompactconversationRequestFormUrlEncoded.Encoded
35573 readonly config?: Config | undefined
35574 }
35575 ) => Effect.Effect<
35576 WithOptionalResponse<typeof Compactconversation200.Type, Config>,
35577 HttpClientError.HttpClientError | SchemaError
35578 >
35579 /**
35580 * List all skills for the current project.
35581 */
35582 readonly "ListSkills": <Config extends OperationConfig>(
35583 options:
35584 | { readonly params?: typeof ListSkillsParams.Encoded | undefined; readonly config?: Config | undefined }
35585 | undefined
35586 ) => Effect.Effect<
35587 WithOptionalResponse<typeof ListSkills200.Type, Config>,
35588 HttpClientError.HttpClientError | SchemaError
35589 >
35590 /**
35591 * Create a new skill.
35592 */
35593 readonly "CreateSkill": <Config extends OperationConfig>(
35594 options: { readonly payload: typeof CreateSkillRequestFormData.Encoded; readonly config?: Config | undefined }
35595 ) => Effect.Effect<
35596 WithOptionalResponse<typeof CreateSkill200.Type, Config>,
35597 HttpClientError.HttpClientError | SchemaError
35598 >
35599 /**
35600 * Get a skill by its ID.
35601 */
35602 readonly "GetSkill": <Config extends OperationConfig>(
35603 skillId: string,
35604 options: { readonly config?: Config | undefined } | undefined
35605 ) => Effect.Effect<
35606 WithOptionalResponse<typeof GetSkill200.Type, Config>,
35607 HttpClientError.HttpClientError | SchemaError
35608 >
35609 /**
35610 * Update the default version pointer for a skill.
35611 */
35612 readonly "UpdateSkillDefaultVersion": <Config extends OperationConfig>(
35613 skillId: string,
35614 options: {
35615 readonly payload: typeof UpdateSkillDefaultVersionRequestFormUrlEncoded.Encoded
35616 readonly config?: Config | undefined
35617 }
35618 ) => Effect.Effect<
35619 WithOptionalResponse<typeof UpdateSkillDefaultVersion200.Type, Config>,
35620 HttpClientError.HttpClientError | SchemaError
35621 >
35622 /**
35623 * Delete a skill by its ID.
35624 */
35625 readonly "DeleteSkill": <Config extends OperationConfig>(
35626 skillId: string,
35627 options: { readonly config?: Config | undefined } | undefined
35628 ) => Effect.Effect<
35629 WithOptionalResponse<typeof DeleteSkill200.Type, Config>,
35630 HttpClientError.HttpClientError | SchemaError
35631 >
35632 /**
35633 * Download a skill zip bundle by its ID.
35634 */
35635 readonly "GetSkillContent": <Config extends OperationConfig>(
35636 skillId: string,
35637 options: { readonly config?: Config | undefined } | undefined
35638 ) => Effect.Effect<
35639 WithOptionalResponse<typeof GetSkillContent200.Type, Config>,
35640 HttpClientError.HttpClientError | SchemaError
35641 >
35642 /**
35643 * List skill versions for a skill.
35644 */
35645 readonly "ListSkillVersions": <Config extends OperationConfig>(
35646 skillId: string,
35647 options: {
35648 readonly params?: typeof ListSkillVersionsParams.Encoded | undefined
35649 readonly config?: Config | undefined
35650 } | undefined
35651 ) => Effect.Effect<
35652 WithOptionalResponse<typeof ListSkillVersions200.Type, Config>,
35653 HttpClientError.HttpClientError | SchemaError
35654 >
35655 /**
35656 * Create a new immutable skill version.
35657 */
35658 readonly "CreateSkillVersion": <Config extends OperationConfig>(
35659 skillId: string,
35660 options: {
35661 readonly payload: typeof CreateSkillVersionRequestFormData.Encoded
35662 readonly config?: Config | undefined
35663 }
35664 ) => Effect.Effect<
35665 WithOptionalResponse<typeof CreateSkillVersion200.Type, Config>,
35666 HttpClientError.HttpClientError | SchemaError
35667 >
35668 /**
35669 * Get a specific skill version.
35670 */
35671 readonly "GetSkillVersion": <Config extends OperationConfig>(
35672 skillId: string,
35673 version: string,
35674 options: { readonly config?: Config | undefined } | undefined
35675 ) => Effect.Effect<
35676 WithOptionalResponse<typeof GetSkillVersion200.Type, Config>,
35677 HttpClientError.HttpClientError | SchemaError
35678 >
35679 /**
35680 * Delete a skill version.
35681 */
35682 readonly "DeleteSkillVersion": <Config extends OperationConfig>(
35683 skillId: string,
35684 version: string,
35685 options: { readonly config?: Config | undefined } | undefined
35686 ) => Effect.Effect<
35687 WithOptionalResponse<typeof DeleteSkillVersion200.Type, Config>,
35688 HttpClientError.HttpClientError | SchemaError
35689 >
35690 /**
35691 * Download a skill version zip bundle.
35692 */
35693 readonly "GetSkillVersionContent": <Config extends OperationConfig>(
35694 skillId: string,
35695 version: string,
35696 options: { readonly config?: Config | undefined } | undefined
35697 ) => Effect.Effect<
35698 WithOptionalResponse<typeof GetSkillVersionContent200.Type, Config>,
35699 HttpClientError.HttpClientError | SchemaError
35700 >
35701 /**
35702 * Cancel an active ChatKit session and return its most recent metadata.
35703 *
35704 * Cancelling prevents new requests from using the issued client secret.
35705 */
35706 readonly "CancelChatSessionMethod": <Config extends OperationConfig>(
35707 sessionId: string,
35708 options: { readonly config?: Config | undefined } | undefined
35709 ) => Effect.Effect<
35710 WithOptionalResponse<typeof CancelChatSessionMethod200.Type, Config>,
35711 HttpClientError.HttpClientError | SchemaError
35712 >
35713 /**
35714 * Create a ChatKit session.
35715 */
35716 readonly "CreateChatSessionMethod": <Config extends OperationConfig>(
35717 options: {
35718 readonly payload: typeof CreateChatSessionMethodRequestJson.Encoded
35719 readonly config?: Config | undefined
35720 }
35721 ) => Effect.Effect<
35722 WithOptionalResponse<typeof CreateChatSessionMethod200.Type, Config>,
35723 HttpClientError.HttpClientError | SchemaError
35724 >
35725 /**
35726 * List items that belong to a ChatKit thread.
35727 */
35728 readonly "ListThreadItemsMethod": <Config extends OperationConfig>(
35729 threadId: string,
35730 options: {
35731 readonly params?: typeof ListThreadItemsMethodParams.Encoded | undefined
35732 readonly config?: Config | undefined
35733 } | undefined
35734 ) => Effect.Effect<
35735 WithOptionalResponse<typeof ListThreadItemsMethod200.Type, Config>,
35736 HttpClientError.HttpClientError | SchemaError
35737 >
35738 /**
35739 * Retrieve a ChatKit thread by its identifier.
35740 */
35741 readonly "GetThreadMethod": <Config extends OperationConfig>(
35742 threadId: string,
35743 options: { readonly config?: Config | undefined } | undefined
35744 ) => Effect.Effect<
35745 WithOptionalResponse<typeof GetThreadMethod200.Type, Config>,
35746 HttpClientError.HttpClientError | SchemaError
35747 >
35748 /**
35749 * Delete a ChatKit thread along with its items and stored attachments.
35750 */
35751 readonly "DeleteThreadMethod": <Config extends OperationConfig>(
35752 threadId: string,
35753 options: { readonly config?: Config | undefined } | undefined
35754 ) => Effect.Effect<
35755 WithOptionalResponse<typeof DeleteThreadMethod200.Type, Config>,
35756 HttpClientError.HttpClientError | SchemaError
35757 >
35758 /**
35759 * List ChatKit threads with optional pagination and user filters.
35760 */
35761 readonly "ListThreadsMethod": <Config extends OperationConfig>(
35762 options: {
35763 readonly params?: typeof ListThreadsMethodParams.Encoded | undefined
35764 readonly config?: Config | undefined
35765 } | undefined
35766 ) => Effect.Effect<
35767 WithOptionalResponse<typeof ListThreadsMethod200.Type, Config>,
35768 HttpClientError.HttpClientError | SchemaError
35769 >
35770}
35771
35772export interface OpenAiClientError<Tag extends string, E> {
35773 readonly _tag: Tag
35774 readonly request: HttpClientRequest.HttpClientRequest
35775 readonly response: HttpClientResponse.HttpClientResponse
35776 readonly cause: E
35777}
35778
35779class OpenAiClientErrorImpl extends Data.Error<{
35780 _tag: string
35781 cause: any
35782 request: HttpClientRequest.HttpClientRequest
35783 response: HttpClientResponse.HttpClientResponse
35784}> {}
35785
35786export const OpenAiClientError = <Tag extends string, E>(
35787 tag: Tag,
35788 cause: E,
35789 response: HttpClientResponse.HttpClientResponse
35790): OpenAiClientError<Tag, E> =>
35791 new OpenAiClientErrorImpl({
35792 _tag: tag,
35793 cause,
35794 response,
35795 request: response.request
35796 }) as any