@effect/ai-openai 0.11.0 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/OpenAiEmbeddings/package.json +6 -0
  2. package/OpenAiTelemetry/package.json +6 -0
  3. package/dist/cjs/Generated.js +1910 -316
  4. package/dist/cjs/Generated.js.map +1 -1
  5. package/dist/cjs/OpenAiClient.js +88 -60
  6. package/dist/cjs/OpenAiClient.js.map +1 -1
  7. package/dist/cjs/OpenAiCompletions.js +82 -6
  8. package/dist/cjs/OpenAiCompletions.js.map +1 -1
  9. package/dist/cjs/OpenAiEmbeddings.js +95 -0
  10. package/dist/cjs/OpenAiEmbeddings.js.map +1 -0
  11. package/dist/cjs/OpenAiTelemetry.js +39 -0
  12. package/dist/cjs/OpenAiTelemetry.js.map +1 -0
  13. package/dist/cjs/index.js +5 -1
  14. package/dist/dts/Generated.d.ts +2789 -517
  15. package/dist/dts/Generated.d.ts.map +1 -1
  16. package/dist/dts/OpenAiClient.d.ts +15 -1
  17. package/dist/dts/OpenAiClient.d.ts.map +1 -1
  18. package/dist/dts/OpenAiCompletions.d.ts +8 -2
  19. package/dist/dts/OpenAiCompletions.d.ts.map +1 -1
  20. package/dist/dts/OpenAiConfig.d.ts +12 -1
  21. package/dist/dts/OpenAiConfig.d.ts.map +1 -1
  22. package/dist/dts/OpenAiEmbeddings.d.ts +51 -0
  23. package/dist/dts/OpenAiEmbeddings.d.ts.map +1 -0
  24. package/dist/dts/OpenAiTelemetry.d.ts +107 -0
  25. package/dist/dts/OpenAiTelemetry.d.ts.map +1 -0
  26. package/dist/dts/index.d.ts +8 -0
  27. package/dist/dts/index.d.ts.map +1 -1
  28. package/dist/esm/Generated.js +1612 -311
  29. package/dist/esm/Generated.js.map +1 -1
  30. package/dist/esm/OpenAiClient.js +88 -60
  31. package/dist/esm/OpenAiClient.js.map +1 -1
  32. package/dist/esm/OpenAiCompletions.js +82 -6
  33. package/dist/esm/OpenAiCompletions.js.map +1 -1
  34. package/dist/esm/OpenAiEmbeddings.js +83 -0
  35. package/dist/esm/OpenAiEmbeddings.js.map +1 -0
  36. package/dist/esm/OpenAiTelemetry.js +30 -0
  37. package/dist/esm/OpenAiTelemetry.js.map +1 -0
  38. package/dist/esm/index.js +8 -0
  39. package/dist/esm/index.js.map +1 -1
  40. package/package.json +22 -6
  41. package/src/Generated.ts +1892 -398
  42. package/src/OpenAiClient.ts +118 -67
  43. package/src/OpenAiCompletions.ts +108 -14
  44. package/src/OpenAiEmbeddings.ts +149 -0
  45. package/src/OpenAiTelemetry.ts +159 -0
  46. package/src/index.ts +10 -0
package/src/Generated.ts CHANGED
@@ -9,24 +9,34 @@ import * as Effect from "effect/Effect"
9
9
  import type { ParseError } from "effect/ParseResult"
10
10
  import * as S from "effect/Schema"
11
11
 
12
+ export class ListAssistantsParamsOrder extends S.Literal("asc", "desc") {}
13
+
12
14
  export class ListAssistantsParams extends S.Struct({
13
15
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
14
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
16
+ "order": S.optionalWith(ListAssistantsParamsOrder, { nullable: true, default: () => "desc" as const }),
15
17
  "after": S.optionalWith(S.String, { nullable: true }),
16
18
  "before": S.optionalWith(S.String, { nullable: true })
17
19
  }) {}
18
20
 
21
+ export class AssistantObjectObject extends S.Literal("assistant") {}
22
+
23
+ export class AssistantToolsCodeType extends S.Literal("code_interpreter") {}
24
+
19
25
  export class AssistantToolsCode extends S.Struct({
20
- "type": S.Literal("code_interpreter")
26
+ "type": AssistantToolsCodeType
21
27
  }) {}
22
28
 
29
+ export class AssistantToolsFileSearchType extends S.Literal("file_search") {}
30
+
31
+ export class FileSearchRankingOptionsRanker extends S.Literal("auto", "default_2024_08_21") {}
32
+
23
33
  export class FileSearchRankingOptions extends S.Struct({
24
- "ranker": S.optionalWith(S.Literal("auto", "default_2024_08_21"), { nullable: true }),
34
+ "ranker": S.optionalWith(FileSearchRankingOptionsRanker, { nullable: true }),
25
35
  "score_threshold": S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1))
26
36
  }) {}
27
37
 
28
38
  export class AssistantToolsFileSearch extends S.Struct({
29
- "type": S.Literal("file_search"),
39
+ "type": AssistantToolsFileSearchType,
30
40
  "file_search": S.optionalWith(
31
41
  S.Struct({
32
42
  "max_num_results": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50)), {
@@ -38,6 +48,8 @@ export class AssistantToolsFileSearch extends S.Struct({
38
48
  )
39
49
  }) {}
40
50
 
51
+ export class AssistantToolsFunctionType extends S.Literal("function") {}
52
+
41
53
  export class FunctionParameters extends S.Record({ key: S.String, value: S.Unknown }) {}
42
54
 
43
55
  export class FunctionObject extends S.Struct({
@@ -48,22 +60,28 @@ export class FunctionObject extends S.Struct({
48
60
  }) {}
49
61
 
50
62
  export class AssistantToolsFunction extends S.Struct({
51
- "type": S.Literal("function"),
63
+ "type": AssistantToolsFunctionType,
52
64
  "function": FunctionObject
53
65
  }) {}
54
66
 
67
+ export class ResponseFormatTextType extends S.Literal("text") {}
68
+
55
69
  export class ResponseFormatText extends S.Struct({
56
- "type": S.Literal("text")
70
+ "type": ResponseFormatTextType
57
71
  }) {}
58
72
 
73
+ export class ResponseFormatJsonObjectType extends S.Literal("json_object") {}
74
+
59
75
  export class ResponseFormatJsonObject extends S.Struct({
60
- "type": S.Literal("json_object")
76
+ "type": ResponseFormatJsonObjectType
61
77
  }) {}
62
78
 
79
+ export class ResponseFormatJsonSchemaType extends S.Literal("json_schema") {}
80
+
63
81
  export class ResponseFormatJsonSchemaSchema extends S.Record({ key: S.String, value: S.Unknown }) {}
64
82
 
65
83
  export class ResponseFormatJsonSchema extends S.Struct({
66
- "type": S.Literal("json_schema"),
84
+ "type": ResponseFormatJsonSchemaType,
67
85
  "json_schema": S.Struct({
68
86
  "description": S.optionalWith(S.String, { nullable: true }),
69
87
  "name": S.String,
@@ -78,7 +96,7 @@ export class AssistantsApiResponseFormatOption
78
96
 
79
97
  export class AssistantObject extends S.Struct({
80
98
  "id": S.String,
81
- "object": S.Literal("assistant"),
99
+ "object": AssistantObjectObject,
82
100
  "created_at": S.Int,
83
101
  "name": S.NullOr(S.String.pipe(S.maxLength(256))),
84
102
  "description": S.NullOr(S.String.pipe(S.maxLength(512))),
@@ -126,36 +144,39 @@ export class ListAssistantsResponse extends S.Class<ListAssistantsResponse>("Lis
126
144
  "has_more": S.Boolean
127
145
  }) {}
128
146
 
147
+ export class CreateAssistantRequestModel extends S.Literal(
148
+ "gpt-4o",
149
+ "gpt-4o-2024-11-20",
150
+ "gpt-4o-2024-08-06",
151
+ "gpt-4o-2024-05-13",
152
+ "gpt-4o-mini",
153
+ "gpt-4o-mini-2024-07-18",
154
+ "gpt-4-turbo",
155
+ "gpt-4-turbo-2024-04-09",
156
+ "gpt-4-0125-preview",
157
+ "gpt-4-turbo-preview",
158
+ "gpt-4-1106-preview",
159
+ "gpt-4-vision-preview",
160
+ "gpt-4",
161
+ "gpt-4-0314",
162
+ "gpt-4-0613",
163
+ "gpt-4-32k",
164
+ "gpt-4-32k-0314",
165
+ "gpt-4-32k-0613",
166
+ "gpt-3.5-turbo",
167
+ "gpt-3.5-turbo-16k",
168
+ "gpt-3.5-turbo-0613",
169
+ "gpt-3.5-turbo-1106",
170
+ "gpt-3.5-turbo-0125",
171
+ "gpt-3.5-turbo-16k-0613"
172
+ ) {}
173
+
174
+ export class CreateAssistantRequestToolResourcesFileSearchVectorStoresChunkingStrategyType
175
+ extends S.Literal("static")
176
+ {}
177
+
129
178
  export class CreateAssistantRequest extends S.Class<CreateAssistantRequest>("CreateAssistantRequest")({
130
- "model": S.Union(
131
- S.String,
132
- S.Literal(
133
- "gpt-4o",
134
- "gpt-4o-2024-08-06",
135
- "gpt-4o-2024-05-13",
136
- "gpt-4o-2024-08-06",
137
- "gpt-4o-mini",
138
- "gpt-4o-mini-2024-07-18",
139
- "gpt-4-turbo",
140
- "gpt-4-turbo-2024-04-09",
141
- "gpt-4-0125-preview",
142
- "gpt-4-turbo-preview",
143
- "gpt-4-1106-preview",
144
- "gpt-4-vision-preview",
145
- "gpt-4",
146
- "gpt-4-0314",
147
- "gpt-4-0613",
148
- "gpt-4-32k",
149
- "gpt-4-32k-0314",
150
- "gpt-4-32k-0613",
151
- "gpt-3.5-turbo",
152
- "gpt-3.5-turbo-16k",
153
- "gpt-3.5-turbo-0613",
154
- "gpt-3.5-turbo-1106",
155
- "gpt-3.5-turbo-0125",
156
- "gpt-3.5-turbo-16k-0613"
157
- )
158
- ),
179
+ "model": S.Union(S.String, CreateAssistantRequestModel),
159
180
  "name": S.optionalWith(S.String.pipe(S.maxLength(256)), { nullable: true }),
160
181
  "description": S.optionalWith(S.String.pipe(S.maxLength(512)), { nullable: true }),
161
182
  "instructions": S.optionalWith(S.String.pipe(S.maxLength(256000)), { nullable: true }),
@@ -250,17 +271,27 @@ export class ModifyAssistantRequest extends S.Class<ModifyAssistantRequest>("Mod
250
271
  "response_format": S.optionalWith(AssistantsApiResponseFormatOption, { nullable: true })
251
272
  }) {}
252
273
 
274
+ export class DeleteAssistantResponseObject extends S.Literal("assistant.deleted") {}
275
+
253
276
  export class DeleteAssistantResponse extends S.Class<DeleteAssistantResponse>("DeleteAssistantResponse")({
254
277
  "id": S.String,
255
278
  "deleted": S.Boolean,
256
- "object": S.Literal("assistant.deleted")
279
+ "object": DeleteAssistantResponseObject
257
280
  }) {}
258
281
 
282
+ export class CreateSpeechRequestModel extends S.Literal("tts-1", "tts-1-hd") {}
283
+
284
+ export class CreateSpeechRequestVoice
285
+ extends S.Literal("alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer")
286
+ {}
287
+
288
+ export class CreateSpeechRequestResponseFormat extends S.Literal("mp3", "opus", "aac", "flac", "wav", "pcm") {}
289
+
259
290
  export class CreateSpeechRequest extends S.Class<CreateSpeechRequest>("CreateSpeechRequest")({
260
- "model": S.Union(S.String, S.Literal("tts-1", "tts-1-hd")),
291
+ "model": S.Union(S.String, CreateSpeechRequestModel),
261
292
  "input": S.String.pipe(S.maxLength(4096)),
262
- "voice": S.Literal("alloy", "echo", "fable", "onyx", "nova", "shimmer"),
263
- "response_format": S.optionalWith(S.Literal("mp3", "opus", "aac", "flac", "wav", "pcm"), {
293
+ "voice": CreateSpeechRequestVoice,
294
+ "response_format": S.optionalWith(CreateSpeechRequestResponseFormat, {
264
295
  nullable: true,
265
296
  default: () => "mp3" as const
266
297
  }),
@@ -325,9 +356,22 @@ export class ListBatchesParams extends S.Struct({
325
356
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const })
326
357
  }) {}
327
358
 
359
+ export class BatchObject extends S.Literal("batch") {}
360
+
361
+ export class BatchStatus extends S.Literal(
362
+ "validating",
363
+ "failed",
364
+ "in_progress",
365
+ "finalizing",
366
+ "completed",
367
+ "expired",
368
+ "cancelling",
369
+ "cancelled"
370
+ ) {}
371
+
328
372
  export class Batch extends S.Struct({
329
373
  "id": S.String,
330
- "object": S.Literal("batch"),
374
+ "object": BatchObject,
331
375
  "endpoint": S.String,
332
376
  "errors": S.optionalWith(
333
377
  S.Struct({
@@ -346,16 +390,7 @@ export class Batch extends S.Struct({
346
390
  ),
347
391
  "input_file_id": S.String,
348
392
  "completion_window": S.String,
349
- "status": S.Literal(
350
- "validating",
351
- "failed",
352
- "in_progress",
353
- "finalizing",
354
- "completed",
355
- "expired",
356
- "cancelling",
357
- "cancelled"
358
- ),
393
+ "status": BatchStatus,
359
394
  "output_file_id": S.optionalWith(S.String, { nullable: true }),
360
395
  "error_file_id": S.optionalWith(S.String, { nullable: true }),
361
396
  "created_at": S.Int,
@@ -378,47 +413,78 @@ export class Batch extends S.Struct({
378
413
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
379
414
  }) {}
380
415
 
416
+ export class ListBatchesResponseObject extends S.Literal("list") {}
417
+
381
418
  export class ListBatchesResponse extends S.Class<ListBatchesResponse>("ListBatchesResponse")({
382
419
  "data": S.Array(Batch),
383
420
  "first_id": S.optionalWith(S.String, { nullable: true }),
384
421
  "last_id": S.optionalWith(S.String, { nullable: true }),
385
422
  "has_more": S.Boolean,
386
- "object": S.Literal("list")
423
+ "object": ListBatchesResponseObject
387
424
  }) {}
388
425
 
426
+ export class CreateBatchRequestEndpoint
427
+ extends S.Literal("/v1/chat/completions", "/v1/embeddings", "/v1/completions")
428
+ {}
429
+
430
+ export class CreateBatchRequestCompletionWindow extends S.Literal("24h") {}
431
+
389
432
  export class CreateBatchRequest extends S.Class<CreateBatchRequest>("CreateBatchRequest")({
390
433
  "input_file_id": S.String,
391
- "endpoint": S.Literal("/v1/chat/completions", "/v1/embeddings", "/v1/completions"),
392
- "completion_window": S.Literal("24h"),
434
+ "endpoint": CreateBatchRequestEndpoint,
435
+ "completion_window": CreateBatchRequestCompletionWindow,
393
436
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
394
437
  }) {}
395
438
 
439
+ export class ChatCompletionRequestMessageContentPartTextType extends S.Literal("text") {}
440
+
396
441
  export class ChatCompletionRequestMessageContentPartText extends S.Struct({
397
- "type": S.Literal("text"),
442
+ "type": ChatCompletionRequestMessageContentPartTextType,
398
443
  "text": S.String
399
444
  }) {}
400
445
 
446
+ export class ChatCompletionRequestDeveloperMessageRole extends S.Literal("developer") {}
447
+
448
+ export class ChatCompletionRequestDeveloperMessage extends S.Struct({
449
+ "content": S.Union(S.String, S.NonEmptyArray(ChatCompletionRequestMessageContentPartText)),
450
+ "role": ChatCompletionRequestDeveloperMessageRole,
451
+ "name": S.optionalWith(S.String, { nullable: true })
452
+ }) {}
453
+
401
454
  export class ChatCompletionRequestSystemMessageContentPart extends ChatCompletionRequestMessageContentPartText {}
402
455
 
456
+ export class ChatCompletionRequestSystemMessageRole extends S.Literal("system") {}
457
+
403
458
  export class ChatCompletionRequestSystemMessage extends S.Struct({
404
459
  "content": S.Union(S.String, S.NonEmptyArray(ChatCompletionRequestSystemMessageContentPart)),
405
- "role": S.Literal("system"),
460
+ "role": ChatCompletionRequestSystemMessageRole,
406
461
  "name": S.optionalWith(S.String, { nullable: true })
407
462
  }) {}
408
463
 
464
+ export class ChatCompletionRequestMessageContentPartImageType extends S.Literal("image_url") {}
465
+
466
+ export class ChatCompletionRequestMessageContentPartImageImageUrlDetail extends S.Literal("auto", "low", "high") {}
467
+
409
468
  export class ChatCompletionRequestMessageContentPartImage extends S.Struct({
410
- "type": S.Literal("image_url"),
469
+ "type": ChatCompletionRequestMessageContentPartImageType,
411
470
  "image_url": S.Struct({
412
471
  "url": S.String,
413
- "detail": S.optionalWith(S.Literal("auto", "low", "high"), { nullable: true, default: () => "auto" as const })
472
+ "detail": S.optionalWith(ChatCompletionRequestMessageContentPartImageImageUrlDetail, {
473
+ nullable: true,
474
+ default: () => "auto" as const
475
+ })
414
476
  })
415
477
  }) {}
416
478
 
479
+ export class ChatCompletionRequestMessageContentPartAudioType extends S.Literal("input_audio") {}
480
+
481
+ export class ChatCompletionRequestMessageContentPartAudioInputAudioFormat extends S.Literal("wav", "mp3") {}
482
+
417
483
  export class ChatCompletionRequestMessageContentPartAudio extends S.Struct({
418
- "type": S.Literal("input_audio"),
484
+ "type": ChatCompletionRequestMessageContentPartAudioType,
419
485
  "input_audio": S.Struct({
420
486
  "data": S.String,
421
- "format": S.Literal("wav", "mp3")
487
+ "format": ChatCompletionRequestMessageContentPartAudioInputAudioFormat
422
488
  })
423
489
  }) {}
424
490
 
@@ -428,14 +494,18 @@ export class ChatCompletionRequestUserMessageContentPart extends S.Union(
428
494
  ChatCompletionRequestMessageContentPartAudio
429
495
  ) {}
430
496
 
497
+ export class ChatCompletionRequestUserMessageRole extends S.Literal("user") {}
498
+
431
499
  export class ChatCompletionRequestUserMessage extends S.Struct({
432
500
  "content": S.Union(S.String, S.NonEmptyArray(ChatCompletionRequestUserMessageContentPart)),
433
- "role": S.Literal("user"),
501
+ "role": ChatCompletionRequestUserMessageRole,
434
502
  "name": S.optionalWith(S.String, { nullable: true })
435
503
  }) {}
436
504
 
505
+ export class ChatCompletionRequestMessageContentPartRefusalType extends S.Literal("refusal") {}
506
+
437
507
  export class ChatCompletionRequestMessageContentPartRefusal extends S.Struct({
438
- "type": S.Literal("refusal"),
508
+ "type": ChatCompletionRequestMessageContentPartRefusalType,
439
509
  "refusal": S.String
440
510
  }) {}
441
511
 
@@ -443,9 +513,13 @@ export class ChatCompletionRequestAssistantMessageContentPart
443
513
  extends S.Union(ChatCompletionRequestMessageContentPartText, ChatCompletionRequestMessageContentPartRefusal)
444
514
  {}
445
515
 
516
+ export class ChatCompletionRequestAssistantMessageRole extends S.Literal("assistant") {}
517
+
518
+ export class ChatCompletionMessageToolCallType extends S.Literal("function") {}
519
+
446
520
  export class ChatCompletionMessageToolCall extends S.Struct({
447
521
  "id": S.String,
448
- "type": S.Literal("function"),
522
+ "type": ChatCompletionMessageToolCallType,
449
523
  "function": S.Struct({
450
524
  "name": S.String,
451
525
  "arguments": S.String
@@ -459,7 +533,7 @@ export class ChatCompletionRequestAssistantMessage extends S.Struct({
459
533
  nullable: true
460
534
  }),
461
535
  "refusal": S.optionalWith(S.String, { nullable: true }),
462
- "role": S.Literal("assistant"),
536
+ "role": ChatCompletionRequestAssistantMessageRole,
463
537
  "name": S.optionalWith(S.String, { nullable: true }),
464
538
  "audio": S.optionalWith(
465
539
  S.Struct({
@@ -477,21 +551,26 @@ export class ChatCompletionRequestAssistantMessage extends S.Struct({
477
551
  )
478
552
  }) {}
479
553
 
554
+ export class ChatCompletionRequestToolMessageRole extends S.Literal("tool") {}
555
+
480
556
  export class ChatCompletionRequestToolMessageContentPart extends ChatCompletionRequestMessageContentPartText {}
481
557
 
482
558
  export class ChatCompletionRequestToolMessage extends S.Struct({
483
- "role": S.Literal("tool"),
559
+ "role": ChatCompletionRequestToolMessageRole,
484
560
  "content": S.Union(S.String, S.NonEmptyArray(ChatCompletionRequestToolMessageContentPart)),
485
561
  "tool_call_id": S.String
486
562
  }) {}
487
563
 
564
+ export class ChatCompletionRequestFunctionMessageRole extends S.Literal("function") {}
565
+
488
566
  export class ChatCompletionRequestFunctionMessage extends S.Struct({
489
- "role": S.Literal("function"),
567
+ "role": ChatCompletionRequestFunctionMessageRole,
490
568
  "content": S.NullOr(S.String),
491
569
  "name": S.String
492
570
  }) {}
493
571
 
494
572
  export class ChatCompletionRequestMessage extends S.Union(
573
+ ChatCompletionRequestDeveloperMessage,
495
574
  ChatCompletionRequestSystemMessage,
496
575
  ChatCompletionRequestUserMessage,
497
576
  ChatCompletionRequestAssistantMessage,
@@ -499,19 +578,80 @@ export class ChatCompletionRequestMessage extends S.Union(
499
578
  ChatCompletionRequestFunctionMessage
500
579
  ) {}
501
580
 
581
+ export class CreateChatCompletionRequestModel extends S.Literal(
582
+ "o1",
583
+ "o1-2024-12-17",
584
+ "o1-preview",
585
+ "o1-preview-2024-09-12",
586
+ "o1-mini",
587
+ "o1-mini-2024-09-12",
588
+ "gpt-4o",
589
+ "gpt-4o-2024-11-20",
590
+ "gpt-4o-2024-08-06",
591
+ "gpt-4o-2024-05-13",
592
+ "gpt-4o-audio-preview",
593
+ "gpt-4o-audio-preview-2024-10-01",
594
+ "gpt-4o-audio-preview-2024-12-17",
595
+ "gpt-4o-mini-audio-preview",
596
+ "gpt-4o-mini-audio-preview-2024-12-17",
597
+ "chatgpt-4o-latest",
598
+ "gpt-4o-mini",
599
+ "gpt-4o-mini-2024-07-18",
600
+ "gpt-4-turbo",
601
+ "gpt-4-turbo-2024-04-09",
602
+ "gpt-4-0125-preview",
603
+ "gpt-4-turbo-preview",
604
+ "gpt-4-1106-preview",
605
+ "gpt-4-vision-preview",
606
+ "gpt-4",
607
+ "gpt-4-0314",
608
+ "gpt-4-0613",
609
+ "gpt-4-32k",
610
+ "gpt-4-32k-0314",
611
+ "gpt-4-32k-0613",
612
+ "gpt-3.5-turbo",
613
+ "gpt-3.5-turbo-16k",
614
+ "gpt-3.5-turbo-0301",
615
+ "gpt-3.5-turbo-0613",
616
+ "gpt-3.5-turbo-1106",
617
+ "gpt-3.5-turbo-0125",
618
+ "gpt-3.5-turbo-16k-0613"
619
+ ) {}
620
+
621
+ export class CreateChatCompletionRequestReasoningEffort extends S.Literal("low", "medium", "high") {}
622
+
502
623
  export class ChatCompletionModalities extends S.Array(S.Literal("text", "audio")) {}
503
624
 
625
+ export class PredictionContentType extends S.Literal("content") {}
626
+
627
+ export class PredictionContent extends S.Struct({
628
+ "type": PredictionContentType,
629
+ "content": S.Union(S.String, S.NonEmptyArray(ChatCompletionRequestMessageContentPartText))
630
+ }) {}
631
+
632
+ export class CreateChatCompletionRequestAudioVoice
633
+ extends S.Literal("alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse")
634
+ {}
635
+
636
+ export class CreateChatCompletionRequestAudioFormat extends S.Literal("wav", "mp3", "flac", "opus", "pcm16") {}
637
+
638
+ export class CreateChatCompletionRequestServiceTier extends S.Literal("auto", "default") {}
639
+
504
640
  export class ChatCompletionStreamOptions extends S.Struct({
505
641
  "include_usage": S.optionalWith(S.Boolean, { nullable: true })
506
642
  }) {}
507
643
 
644
+ export class ChatCompletionToolType extends S.Literal("function") {}
645
+
508
646
  export class ChatCompletionTool extends S.Struct({
509
- "type": S.Literal("function"),
647
+ "type": ChatCompletionToolType,
510
648
  "function": FunctionObject
511
649
  }) {}
512
650
 
651
+ export class ChatCompletionNamedToolChoiceType extends S.Literal("function") {}
652
+
513
653
  export class ChatCompletionNamedToolChoice extends S.Struct({
514
- "type": S.Literal("function"),
654
+ "type": ChatCompletionNamedToolChoiceType,
515
655
  "function": S.Struct({
516
656
  "name": S.String
517
657
  })
@@ -523,6 +663,8 @@ export class ChatCompletionToolChoiceOption
523
663
 
524
664
  export class ParallelToolCalls extends S.Boolean {}
525
665
 
666
+ export class CreateChatCompletionRequestFunctionCall extends S.Literal("none", "auto") {}
667
+
526
668
  export class ChatCompletionFunctionCallOption extends S.Struct({
527
669
  "name": S.String
528
670
  }) {}
@@ -535,46 +677,12 @@ export class ChatCompletionFunctions extends S.Struct({
535
677
 
536
678
  export class CreateChatCompletionRequest extends S.Class<CreateChatCompletionRequest>("CreateChatCompletionRequest")({
537
679
  "messages": S.NonEmptyArray(ChatCompletionRequestMessage),
538
- "model": S.Union(
539
- S.String,
540
- S.Literal(
541
- "o1-preview",
542
- "o1-preview-2024-09-12",
543
- "o1-mini",
544
- "o1-mini-2024-09-12",
545
- "gpt-4o",
546
- "gpt-4o-2024-08-06",
547
- "gpt-4o-2024-05-13",
548
- "gpt-4o-2024-08-06",
549
- "gpt-4o-realtime-preview",
550
- "gpt-4o-realtime-preview-2024-10-01",
551
- "gpt-4o-audio-preview",
552
- "gpt-4o-audio-preview-2024-10-01",
553
- "chatgpt-4o-latest",
554
- "gpt-4o-mini",
555
- "gpt-4o-mini-2024-07-18",
556
- "gpt-4-turbo",
557
- "gpt-4-turbo-2024-04-09",
558
- "gpt-4-0125-preview",
559
- "gpt-4-turbo-preview",
560
- "gpt-4-1106-preview",
561
- "gpt-4-vision-preview",
562
- "gpt-4",
563
- "gpt-4-0314",
564
- "gpt-4-0613",
565
- "gpt-4-32k",
566
- "gpt-4-32k-0314",
567
- "gpt-4-32k-0613",
568
- "gpt-3.5-turbo",
569
- "gpt-3.5-turbo-16k",
570
- "gpt-3.5-turbo-0301",
571
- "gpt-3.5-turbo-0613",
572
- "gpt-3.5-turbo-1106",
573
- "gpt-3.5-turbo-0125",
574
- "gpt-3.5-turbo-16k-0613"
575
- )
576
- ),
680
+ "model": S.Union(S.String, CreateChatCompletionRequestModel),
577
681
  "store": S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
682
+ "reasoning_effort": S.optionalWith(CreateChatCompletionRequestReasoningEffort, {
683
+ nullable: true,
684
+ default: () => "medium" as const
685
+ }),
578
686
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true }),
579
687
  "frequency_penalty": S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(-2), S.lessThanOrEqualTo(2)), {
580
688
  nullable: true,
@@ -590,10 +698,11 @@ export class CreateChatCompletionRequest extends S.Class<CreateChatCompletionReq
590
698
  default: () => 1 as const
591
699
  }),
592
700
  "modalities": S.optionalWith(ChatCompletionModalities, { nullable: true }),
701
+ "prediction": S.optionalWith(PredictionContent, { nullable: true }),
593
702
  "audio": S.optionalWith(
594
703
  S.Struct({
595
- "voice": S.Literal("alloy", "echo", "fable", "onyx", "nova", "shimmer"),
596
- "format": S.Literal("wav", "mp3", "flac", "opus", "pcm16")
704
+ "voice": CreateChatCompletionRequestAudioVoice,
705
+ "format": CreateChatCompletionRequestAudioFormat
597
706
  }),
598
707
  { nullable: true }
599
708
  ),
@@ -604,11 +713,11 @@ export class CreateChatCompletionRequest extends S.Class<CreateChatCompletionReq
604
713
  "response_format": S.optionalWith(S.Union(ResponseFormatText, ResponseFormatJsonObject, ResponseFormatJsonSchema), {
605
714
  nullable: true
606
715
  }),
607
- "seed": S.optionalWith(
608
- S.Int.pipe(S.greaterThanOrEqualTo(-9223372036854776000), S.lessThanOrEqualTo(9223372036854776000)),
609
- { nullable: true }
610
- ),
611
- "service_tier": S.optionalWith(S.Literal("auto", "default"), { nullable: true, default: () => "auto" as const }),
716
+ "seed": S.optionalWith(S.Int, { nullable: true }),
717
+ "service_tier": S.optionalWith(CreateChatCompletionRequestServiceTier, {
718
+ nullable: true,
719
+ default: () => "auto" as const
720
+ }),
612
721
  "stop": S.optionalWith(S.Union(S.String, S.Array(S.String).pipe(S.minItems(1), S.maxItems(4))), { nullable: true }),
613
722
  "stream": S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
614
723
  "stream_options": S.optionalWith(ChatCompletionStreamOptions, { nullable: true }),
@@ -624,17 +733,23 @@ export class CreateChatCompletionRequest extends S.Class<CreateChatCompletionReq
624
733
  "tool_choice": S.optionalWith(ChatCompletionToolChoiceOption, { nullable: true }),
625
734
  "parallel_tool_calls": S.optionalWith(ParallelToolCalls, { nullable: true, default: () => true as const }),
626
735
  "user": S.optionalWith(S.String, { nullable: true }),
627
- "function_call": S.optionalWith(S.Union(S.Literal("none", "auto"), ChatCompletionFunctionCallOption), {
736
+ "function_call": S.optionalWith(S.Union(CreateChatCompletionRequestFunctionCall, ChatCompletionFunctionCallOption), {
628
737
  nullable: true
629
738
  }),
630
739
  "functions": S.optionalWith(S.Array(ChatCompletionFunctions).pipe(S.minItems(1), S.maxItems(128)), { nullable: true })
631
740
  }) {}
632
741
 
742
+ export class CreateChatCompletionResponseChoicesFinishReason
743
+ extends S.Literal("stop", "length", "tool_calls", "content_filter", "function_call")
744
+ {}
745
+
746
+ export class ChatCompletionResponseMessageRole extends S.Literal("assistant") {}
747
+
633
748
  export class ChatCompletionResponseMessage extends S.Struct({
634
749
  "content": S.NullOr(S.String),
635
750
  "refusal": S.NullOr(S.String),
636
751
  "tool_calls": S.optionalWith(ChatCompletionMessageToolCalls, { nullable: true }),
637
- "role": S.Literal("assistant"),
752
+ "role": ChatCompletionResponseMessageRole,
638
753
  "function_call": S.optionalWith(
639
754
  S.Struct({
640
755
  "arguments": S.String,
@@ -664,14 +779,20 @@ export class ChatCompletionTokenLogprob extends S.Struct({
664
779
  }))
665
780
  }) {}
666
781
 
782
+ export class CreateChatCompletionResponseServiceTier extends S.Literal("scale", "default") {}
783
+
784
+ export class CreateChatCompletionResponseObject extends S.Literal("chat.completion") {}
785
+
667
786
  export class CompletionUsage extends S.Struct({
668
787
  "completion_tokens": S.Int,
669
788
  "prompt_tokens": S.Int,
670
789
  "total_tokens": S.Int,
671
790
  "completion_tokens_details": S.optionalWith(
672
791
  S.Struct({
792
+ "accepted_prediction_tokens": S.optionalWith(S.Int, { nullable: true }),
673
793
  "audio_tokens": S.optionalWith(S.Int, { nullable: true }),
674
- "reasoning_tokens": S.optionalWith(S.Int, { nullable: true })
794
+ "reasoning_tokens": S.optionalWith(S.Int, { nullable: true }),
795
+ "rejected_prediction_tokens": S.optionalWith(S.Int, { nullable: true })
675
796
  }),
676
797
  { nullable: true }
677
798
  ),
@@ -688,7 +809,7 @@ export class CreateChatCompletionResponse
688
809
  extends S.Class<CreateChatCompletionResponse>("CreateChatCompletionResponse")({
689
810
  "id": S.String,
690
811
  "choices": S.Array(S.Struct({
691
- "finish_reason": S.Literal("stop", "length", "tool_calls", "content_filter", "function_call"),
812
+ "finish_reason": CreateChatCompletionResponseChoicesFinishReason,
692
813
  "index": S.Int,
693
814
  "message": ChatCompletionResponseMessage,
694
815
  "logprobs": S.NullOr(S.Struct({
@@ -698,15 +819,17 @@ export class CreateChatCompletionResponse
698
819
  })),
699
820
  "created": S.Int,
700
821
  "model": S.String,
701
- "service_tier": S.optionalWith(S.Literal("scale", "default"), { nullable: true }),
822
+ "service_tier": S.optionalWith(CreateChatCompletionResponseServiceTier, { nullable: true }),
702
823
  "system_fingerprint": S.optionalWith(S.String, { nullable: true }),
703
- "object": S.Literal("chat.completion"),
824
+ "object": CreateChatCompletionResponseObject,
704
825
  "usage": S.optionalWith(CompletionUsage, { nullable: true })
705
826
  })
706
827
  {}
707
828
 
829
+ export class CreateCompletionRequestModel extends S.Literal("gpt-3.5-turbo-instruct", "davinci-002", "babbage-002") {}
830
+
708
831
  export class CreateCompletionRequest extends S.Class<CreateCompletionRequest>("CreateCompletionRequest")({
709
- "model": S.Union(S.String, S.Literal("gpt-3.5-turbo-instruct", "davinci-002", "babbage-002")),
832
+ "model": S.Union(S.String, CreateCompletionRequestModel),
710
833
  "prompt": S.NullOr(
711
834
  S.Union(S.String, S.Array(S.String), S.NonEmptyArray(S.Int), S.NonEmptyArray(S.NonEmptyArray(S.Int)))
712
835
  ).pipe(S.propertySignature, S.withConstructorDefault(() => "<|endoftext|>" as const)),
@@ -730,10 +853,7 @@ export class CreateCompletionRequest extends S.Class<CreateCompletionRequest>("C
730
853
  nullable: true,
731
854
  default: () => 0 as const
732
855
  }),
733
- "seed": S.optionalWith(
734
- S.Int.pipe(S.greaterThanOrEqualTo(-9223372036854776000), S.lessThanOrEqualTo(9223372036854776000)),
735
- { nullable: true }
736
- ),
856
+ "seed": S.optionalWith(S.Int, { nullable: true }),
737
857
  "stop": S.optionalWith(S.Union(S.String, S.Array(S.String).pipe(S.minItems(1), S.maxItems(4))), { nullable: true }),
738
858
  "stream": S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
739
859
  "stream_options": S.optionalWith(ChatCompletionStreamOptions, { nullable: true }),
@@ -749,10 +869,14 @@ export class CreateCompletionRequest extends S.Class<CreateCompletionRequest>("C
749
869
  "user": S.optionalWith(S.String, { nullable: true })
750
870
  }) {}
751
871
 
872
+ export class CreateCompletionResponseChoicesFinishReason extends S.Literal("stop", "length", "content_filter") {}
873
+
874
+ export class CreateCompletionResponseObject extends S.Literal("text_completion") {}
875
+
752
876
  export class CreateCompletionResponse extends S.Class<CreateCompletionResponse>("CreateCompletionResponse")({
753
877
  "id": S.String,
754
878
  "choices": S.Array(S.Struct({
755
- "finish_reason": S.Literal("stop", "length", "content_filter"),
879
+ "finish_reason": CreateCompletionResponseChoicesFinishReason,
756
880
  "index": S.Int,
757
881
  "logprobs": S.NullOr(S.Struct({
758
882
  "text_offset": S.optionalWith(S.Array(S.Int), { nullable: true }),
@@ -765,10 +889,16 @@ export class CreateCompletionResponse extends S.Class<CreateCompletionResponse>(
765
889
  "created": S.Int,
766
890
  "model": S.String,
767
891
  "system_fingerprint": S.optionalWith(S.String, { nullable: true }),
768
- "object": S.Literal("text_completion"),
892
+ "object": CreateCompletionResponseObject,
769
893
  "usage": S.optionalWith(CompletionUsage, { nullable: true })
770
894
  }) {}
771
895
 
896
+ export class CreateEmbeddingRequestModel
897
+ extends S.Literal("text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large")
898
+ {}
899
+
900
+ export class CreateEmbeddingRequestEncodingFormat extends S.Literal("float", "base64") {}
901
+
772
902
  export class CreateEmbeddingRequest extends S.Class<CreateEmbeddingRequest>("CreateEmbeddingRequest")({
773
903
  "input": S.Union(
774
904
  S.String,
@@ -776,59 +906,82 @@ export class CreateEmbeddingRequest extends S.Class<CreateEmbeddingRequest>("Cre
776
906
  S.Array(S.Int).pipe(S.minItems(1), S.maxItems(2048)),
777
907
  S.Array(S.NonEmptyArray(S.Int)).pipe(S.minItems(1), S.maxItems(2048))
778
908
  ),
779
- "model": S.Union(S.String, S.Literal("text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large")),
780
- "encoding_format": S.optionalWith(S.Literal("float", "base64"), { nullable: true, default: () => "float" as const }),
909
+ "model": S.Union(S.String, CreateEmbeddingRequestModel),
910
+ "encoding_format": S.optionalWith(CreateEmbeddingRequestEncodingFormat, {
911
+ nullable: true,
912
+ default: () => "float" as const
913
+ }),
781
914
  "dimensions": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1)), { nullable: true }),
782
915
  "user": S.optionalWith(S.String, { nullable: true })
783
916
  }) {}
784
917
 
918
+ export class EmbeddingObject extends S.Literal("embedding") {}
919
+
785
920
  export class Embedding extends S.Struct({
786
921
  "index": S.Int,
787
922
  "embedding": S.Array(S.Number),
788
- "object": S.Literal("embedding")
923
+ "object": EmbeddingObject
789
924
  }) {}
790
925
 
926
+ export class CreateEmbeddingResponseObject extends S.Literal("list") {}
927
+
791
928
  export class CreateEmbeddingResponse extends S.Class<CreateEmbeddingResponse>("CreateEmbeddingResponse")({
792
929
  "data": S.Array(Embedding),
793
930
  "model": S.String,
794
- "object": S.Literal("list"),
931
+ "object": CreateEmbeddingResponseObject,
795
932
  "usage": S.Struct({
796
933
  "prompt_tokens": S.Int,
797
934
  "total_tokens": S.Int
798
935
  })
799
936
  }) {}
800
937
 
938
+ export class ListFilesParamsOrder extends S.Literal("asc", "desc") {}
939
+
801
940
  export class ListFilesParams extends S.Struct({
802
- "purpose": S.optionalWith(S.String, { nullable: true })
941
+ "purpose": S.optionalWith(S.String, { nullable: true }),
942
+ "limit": S.optionalWith(S.Int, { nullable: true, default: () => 10000 as const }),
943
+ "order": S.optionalWith(ListFilesParamsOrder, { nullable: true, default: () => "desc" as const }),
944
+ "after": S.optionalWith(S.String, { nullable: true })
803
945
  }) {}
804
946
 
947
+ export class OpenAIFileObject extends S.Literal("file") {}
948
+
949
+ export class OpenAIFilePurpose extends S.Literal(
950
+ "assistants",
951
+ "assistants_output",
952
+ "batch",
953
+ "batch_output",
954
+ "fine-tune",
955
+ "fine-tune-results",
956
+ "vision"
957
+ ) {}
958
+
959
+ export class OpenAIFileStatus extends S.Literal("uploaded", "processed", "error") {}
960
+
805
961
  export class OpenAIFile extends S.Struct({
806
962
  "id": S.String,
807
963
  "bytes": S.Int,
808
964
  "created_at": S.Int,
809
965
  "filename": S.String,
810
- "object": S.Literal("file"),
811
- "purpose": S.Literal(
812
- "assistants",
813
- "assistants_output",
814
- "batch",
815
- "batch_output",
816
- "fine-tune",
817
- "fine-tune-results",
818
- "vision"
819
- ),
820
- "status": S.Literal("uploaded", "processed", "error"),
966
+ "object": OpenAIFileObject,
967
+ "purpose": OpenAIFilePurpose,
968
+ "status": OpenAIFileStatus,
821
969
  "status_details": S.optionalWith(S.String, { nullable: true })
822
970
  }) {}
823
971
 
824
972
  export class ListFilesResponse extends S.Class<ListFilesResponse>("ListFilesResponse")({
973
+ "object": S.String,
825
974
  "data": S.Array(OpenAIFile),
826
- "object": S.Literal("list")
975
+ "first_id": S.String,
976
+ "last_id": S.String,
977
+ "has_more": S.Boolean
827
978
  }) {}
828
979
 
980
+ export class DeleteFileResponseObject extends S.Literal("file") {}
981
+
829
982
  export class DeleteFileResponse extends S.Class<DeleteFileResponse>("DeleteFileResponse")({
830
983
  "id": S.String,
831
- "object": S.Literal("file"),
984
+ "object": DeleteFileResponseObject,
832
985
  "deleted": S.Boolean
833
986
  }) {}
834
987
 
@@ -839,8 +992,22 @@ export class ListPaginatedFineTuningJobsParams extends S.Struct({
839
992
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const })
840
993
  }) {}
841
994
 
995
+ export class FineTuningJobHyperparametersBatchSize extends S.Literal("auto") {}
996
+
997
+ export class FineTuningJobHyperparametersLearningRateMultiplier extends S.Literal("auto") {}
998
+
999
+ export class FineTuningJobHyperparametersNEpochs extends S.Literal("auto") {}
1000
+
1001
+ export class FineTuningJobObject extends S.Literal("fine_tuning.job") {}
1002
+
1003
+ export class FineTuningJobStatus
1004
+ extends S.Literal("validating_files", "queued", "running", "succeeded", "failed", "cancelled")
1005
+ {}
1006
+
1007
+ export class FineTuningIntegrationType extends S.Literal("wandb") {}
1008
+
842
1009
  export class FineTuningIntegration extends S.Struct({
843
- "type": S.Literal("wandb"),
1010
+ "type": FineTuningIntegrationType,
844
1011
  "wandb": S.Struct({
845
1012
  "project": S.String,
846
1013
  "name": S.optionalWith(S.String, { nullable: true }),
@@ -849,6 +1016,93 @@ export class FineTuningIntegration extends S.Struct({
849
1016
  })
850
1017
  }) {}
851
1018
 
1019
+ export class FineTuneMethodType extends S.Literal("supervised", "dpo") {}
1020
+
1021
+ export class FineTuneSupervisedMethodHyperparametersBatchSize extends S.Literal("auto") {}
1022
+
1023
+ export class FineTuneSupervisedMethodHyperparametersLearningRateMultiplier extends S.Literal("auto") {}
1024
+
1025
+ export class FineTuneSupervisedMethodHyperparametersNEpochs extends S.Literal("auto") {}
1026
+
1027
+ export class FineTuneSupervisedMethod extends S.Struct({
1028
+ "hyperparameters": S.optionalWith(
1029
+ S.Struct({
1030
+ "batch_size": S.optionalWith(
1031
+ S.Union(
1032
+ FineTuneSupervisedMethodHyperparametersBatchSize,
1033
+ S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(256))
1034
+ ),
1035
+ { nullable: true, default: () => "auto" as const }
1036
+ ),
1037
+ "learning_rate_multiplier": S.optionalWith(
1038
+ S.Union(FineTuneSupervisedMethodHyperparametersLearningRateMultiplier, S.Number.pipe(S.greaterThan(0))),
1039
+ {
1040
+ nullable: true,
1041
+ default: () => "auto" as const
1042
+ }
1043
+ ),
1044
+ "n_epochs": S.optionalWith(
1045
+ S.Union(
1046
+ FineTuneSupervisedMethodHyperparametersNEpochs,
1047
+ S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50))
1048
+ ),
1049
+ { nullable: true, default: () => "auto" as const }
1050
+ )
1051
+ }),
1052
+ { nullable: true }
1053
+ )
1054
+ }) {}
1055
+
1056
+ export class FineTuneDPOMethodHyperparametersBeta extends S.Literal("auto") {}
1057
+
1058
+ export class FineTuneDPOMethodHyperparametersBatchSize extends S.Literal("auto") {}
1059
+
1060
+ export class FineTuneDPOMethodHyperparametersLearningRateMultiplier extends S.Literal("auto") {}
1061
+
1062
+ export class FineTuneDPOMethodHyperparametersNEpochs extends S.Literal("auto") {}
1063
+
1064
+ export class FineTuneDPOMethod extends S.Struct({
1065
+ "hyperparameters": S.optionalWith(
1066
+ S.Struct({
1067
+ "beta": S.optionalWith(
1068
+ S.Union(FineTuneDPOMethodHyperparametersBeta, S.Number.pipe(S.greaterThan(0), S.lessThanOrEqualTo(2))),
1069
+ {
1070
+ nullable: true,
1071
+ default: () => "auto" as const
1072
+ }
1073
+ ),
1074
+ "batch_size": S.optionalWith(
1075
+ S.Union(
1076
+ FineTuneDPOMethodHyperparametersBatchSize,
1077
+ S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(256))
1078
+ ),
1079
+ { nullable: true, default: () => "auto" as const }
1080
+ ),
1081
+ "learning_rate_multiplier": S.optionalWith(
1082
+ S.Union(FineTuneDPOMethodHyperparametersLearningRateMultiplier, S.Number.pipe(S.greaterThan(0))),
1083
+ {
1084
+ nullable: true,
1085
+ default: () => "auto" as const
1086
+ }
1087
+ ),
1088
+ "n_epochs": S.optionalWith(
1089
+ S.Union(
1090
+ FineTuneDPOMethodHyperparametersNEpochs,
1091
+ S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50))
1092
+ ),
1093
+ { nullable: true, default: () => "auto" as const }
1094
+ )
1095
+ }),
1096
+ { nullable: true }
1097
+ )
1098
+ }) {}
1099
+
1100
+ export class FineTuneMethod extends S.Struct({
1101
+ "type": S.optionalWith(FineTuneMethodType, { nullable: true }),
1102
+ "supervised": S.optionalWith(FineTuneSupervisedMethod, { nullable: true }),
1103
+ "dpo": S.optionalWith(FineTuneDPOMethod, { nullable: true })
1104
+ }) {}
1105
+
852
1106
  export class FineTuningJob extends S.Struct({
853
1107
  "id": S.String,
854
1108
  "created_at": S.Int,
@@ -860,54 +1114,89 @@ export class FineTuningJob extends S.Struct({
860
1114
  "fine_tuned_model": S.NullOr(S.String),
861
1115
  "finished_at": S.NullOr(S.Int),
862
1116
  "hyperparameters": S.Struct({
863
- "n_epochs": S.Union(S.Literal("auto"), S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50))).pipe(
864
- S.propertySignature,
865
- S.withConstructorDefault(() => "auto" as const)
1117
+ "batch_size": S.optionalWith(
1118
+ S.Union(FineTuningJobHyperparametersBatchSize, S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(256))),
1119
+ {
1120
+ nullable: true,
1121
+ default: () => "auto" as const
1122
+ }
1123
+ ),
1124
+ "learning_rate_multiplier": S.optionalWith(
1125
+ S.Union(FineTuningJobHyperparametersLearningRateMultiplier, S.Number.pipe(S.greaterThan(0))),
1126
+ {
1127
+ nullable: true,
1128
+ default: () => "auto" as const
1129
+ }
1130
+ ),
1131
+ "n_epochs": S.optionalWith(
1132
+ S.Union(FineTuningJobHyperparametersNEpochs, S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50))),
1133
+ {
1134
+ nullable: true,
1135
+ default: () => "auto" as const
1136
+ }
866
1137
  )
867
1138
  }),
868
1139
  "model": S.String,
869
- "object": S.Literal("fine_tuning.job"),
1140
+ "object": FineTuningJobObject,
870
1141
  "organization_id": S.String,
871
1142
  "result_files": S.Array(S.String),
872
- "status": S.Literal("validating_files", "queued", "running", "succeeded", "failed", "cancelled"),
1143
+ "status": FineTuningJobStatus,
873
1144
  "trained_tokens": S.NullOr(S.Int),
874
1145
  "training_file": S.String,
875
1146
  "validation_file": S.NullOr(S.String),
876
1147
  "integrations": S.optionalWith(S.Array(FineTuningIntegration).pipe(S.maxItems(5)), { nullable: true }),
877
1148
  "seed": S.Int,
878
- "estimated_finish": S.optionalWith(S.Int, { nullable: true })
1149
+ "estimated_finish": S.optionalWith(S.Int, { nullable: true }),
1150
+ "method": S.optionalWith(FineTuneMethod, { nullable: true })
879
1151
  }) {}
880
1152
 
1153
+ export class ListPaginatedFineTuningJobsResponseObject extends S.Literal("list") {}
1154
+
881
1155
  export class ListPaginatedFineTuningJobsResponse
882
1156
  extends S.Class<ListPaginatedFineTuningJobsResponse>("ListPaginatedFineTuningJobsResponse")({
883
1157
  "data": S.Array(FineTuningJob),
884
1158
  "has_more": S.Boolean,
885
- "object": S.Literal("list")
1159
+ "object": ListPaginatedFineTuningJobsResponseObject
886
1160
  })
887
1161
  {}
888
1162
 
1163
+ export class CreateFineTuningJobRequestModel
1164
+ extends S.Literal("babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini")
1165
+ {}
1166
+
1167
+ export class CreateFineTuningJobRequestHyperparametersBatchSize extends S.Literal("auto") {}
1168
+
1169
+ export class CreateFineTuningJobRequestHyperparametersLearningRateMultiplier extends S.Literal("auto") {}
1170
+
1171
+ export class CreateFineTuningJobRequestHyperparametersNEpochs extends S.Literal("auto") {}
1172
+
1173
+ export class CreateFineTuningJobRequestIntegrationsType extends S.Literal("wandb") {}
1174
+
889
1175
  export class CreateFineTuningJobRequest extends S.Class<CreateFineTuningJobRequest>("CreateFineTuningJobRequest")({
890
- "model": S.Union(S.String, S.Literal("babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini")),
1176
+ "model": S.Union(S.String, CreateFineTuningJobRequestModel),
891
1177
  "training_file": S.String,
892
1178
  "hyperparameters": S.optionalWith(
893
1179
  S.Struct({
894
1180
  "batch_size": S.optionalWith(
895
- S.Union(S.Literal("auto"), S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(256))),
1181
+ S.Union(
1182
+ CreateFineTuningJobRequestHyperparametersBatchSize,
1183
+ S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(256))
1184
+ ),
1185
+ { nullable: true, default: () => "auto" as const }
1186
+ ),
1187
+ "learning_rate_multiplier": S.optionalWith(
1188
+ S.Union(CreateFineTuningJobRequestHyperparametersLearningRateMultiplier, S.Number.pipe(S.greaterThan(0))),
896
1189
  {
897
1190
  nullable: true,
898
1191
  default: () => "auto" as const
899
1192
  }
900
1193
  ),
901
- "learning_rate_multiplier": S.optionalWith(S.Union(S.Literal("auto"), S.Number.pipe(S.greaterThan(0))), {
902
- nullable: true,
903
- default: () => "auto" as const
904
- }),
905
1194
  "n_epochs": S.optionalWith(
906
- S.Union(S.Literal("auto"), S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50))),
907
- {
908
- nullable: true,
909
- default: () => "auto" as const
910
- }
1195
+ S.Union(
1196
+ CreateFineTuningJobRequestHyperparametersNEpochs,
1197
+ S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50))
1198
+ ),
1199
+ { nullable: true, default: () => "auto" as const }
911
1200
  )
912
1201
  }),
913
1202
  { nullable: true }
@@ -916,7 +1205,7 @@ export class CreateFineTuningJobRequest extends S.Class<CreateFineTuningJobReque
916
1205
  "validation_file": S.optionalWith(S.String, { nullable: true }),
917
1206
  "integrations": S.optionalWith(
918
1207
  S.Array(S.Struct({
919
- "type": S.Literal("wandb"),
1208
+ "type": CreateFineTuningJobRequestIntegrationsType,
920
1209
  "wandb": S.Struct({
921
1210
  "project": S.String,
922
1211
  "name": S.optionalWith(S.String, { nullable: true }),
@@ -926,7 +1215,8 @@ export class CreateFineTuningJobRequest extends S.Class<CreateFineTuningJobReque
926
1215
  })),
927
1216
  { nullable: true }
928
1217
  ),
929
- "seed": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(2147483647)), { nullable: true })
1218
+ "seed": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(2147483647)), { nullable: true }),
1219
+ "method": S.optionalWith(FineTuneMethod, { nullable: true })
930
1220
  }) {}
931
1221
 
932
1222
  export class ListFineTuningJobCheckpointsParams extends S.Struct({
@@ -934,6 +1224,8 @@ export class ListFineTuningJobCheckpointsParams extends S.Struct({
934
1224
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 10 as const })
935
1225
  }) {}
936
1226
 
1227
+ export class FineTuningJobCheckpointObject extends S.Literal("fine_tuning.job.checkpoint") {}
1228
+
937
1229
  export class FineTuningJobCheckpoint extends S.Struct({
938
1230
  "id": S.String,
939
1231
  "created_at": S.Int,
@@ -949,13 +1241,15 @@ export class FineTuningJobCheckpoint extends S.Struct({
949
1241
  "full_valid_mean_token_accuracy": S.optionalWith(S.Number, { nullable: true })
950
1242
  }),
951
1243
  "fine_tuning_job_id": S.String,
952
- "object": S.Literal("fine_tuning.job.checkpoint")
1244
+ "object": FineTuningJobCheckpointObject
953
1245
  }) {}
954
1246
 
1247
+ export class ListFineTuningJobCheckpointsResponseObject extends S.Literal("list") {}
1248
+
955
1249
  export class ListFineTuningJobCheckpointsResponse
956
1250
  extends S.Class<ListFineTuningJobCheckpointsResponse>("ListFineTuningJobCheckpointsResponse")({
957
1251
  "data": S.Array(FineTuningJobCheckpoint),
958
- "object": S.Literal("list"),
1252
+ "object": ListFineTuningJobCheckpointsResponseObject,
959
1253
  "first_id": S.optionalWith(S.String, { nullable: true }),
960
1254
  "last_id": S.optionalWith(S.String, { nullable: true }),
961
1255
  "has_more": S.Boolean
@@ -967,18 +1261,28 @@ export class ListFineTuningEventsParams extends S.Struct({
967
1261
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const })
968
1262
  }) {}
969
1263
 
1264
+ export class FineTuningJobEventObject extends S.Literal("fine_tuning.job.event") {}
1265
+
1266
+ export class FineTuningJobEventLevel extends S.Literal("info", "warn", "error") {}
1267
+
1268
+ export class FineTuningJobEventType extends S.Literal("message", "metrics") {}
1269
+
970
1270
  export class FineTuningJobEvent extends S.Struct({
1271
+ "object": FineTuningJobEventObject,
971
1272
  "id": S.String,
972
1273
  "created_at": S.Int,
973
- "level": S.Literal("info", "warn", "error"),
1274
+ "level": FineTuningJobEventLevel,
974
1275
  "message": S.String,
975
- "object": S.Literal("fine_tuning.job.event")
1276
+ "type": S.optionalWith(FineTuningJobEventType, { nullable: true }),
1277
+ "data": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
976
1278
  }) {}
977
1279
 
1280
+ export class ListFineTuningJobEventsResponseObject extends S.Literal("list") {}
1281
+
978
1282
  export class ListFineTuningJobEventsResponse
979
1283
  extends S.Class<ListFineTuningJobEventsResponse>("ListFineTuningJobEventsResponse")({
980
1284
  "data": S.Array(FineTuningJobEvent),
981
- "object": S.Literal("list")
1285
+ "object": ListFineTuningJobEventsResponseObject
982
1286
  })
983
1287
  {}
984
1288
 
@@ -993,9 +1297,19 @@ export class ImagesResponse extends S.Class<ImagesResponse>("ImagesResponse")({
993
1297
  "data": S.Array(Image)
994
1298
  }) {}
995
1299
 
1300
+ export class CreateImageRequestModel extends S.Literal("dall-e-2", "dall-e-3") {}
1301
+
1302
+ export class CreateImageRequestQuality extends S.Literal("standard", "hd") {}
1303
+
1304
+ export class CreateImageRequestResponseFormat extends S.Literal("url", "b64_json") {}
1305
+
1306
+ export class CreateImageRequestSize extends S.Literal("256x256", "512x512", "1024x1024", "1792x1024", "1024x1792") {}
1307
+
1308
+ export class CreateImageRequestStyle extends S.Literal("vivid", "natural") {}
1309
+
996
1310
  export class CreateImageRequest extends S.Class<CreateImageRequest>("CreateImageRequest")({
997
1311
  "prompt": S.String,
998
- "model": S.optionalWith(S.Union(S.String, S.Literal("dall-e-2", "dall-e-3")), {
1312
+ "model": S.optionalWith(S.Union(S.String, CreateImageRequestModel), {
999
1313
  nullable: true,
1000
1314
  default: () => "dall-e-2" as const
1001
1315
  }),
@@ -1003,25 +1317,29 @@ export class CreateImageRequest extends S.Class<CreateImageRequest>("CreateImage
1003
1317
  nullable: true,
1004
1318
  default: () => 1 as const
1005
1319
  }),
1006
- "quality": S.optionalWith(S.Literal("standard", "hd"), { nullable: true, default: () => "standard" as const }),
1007
- "response_format": S.optionalWith(S.Literal("url", "b64_json"), { nullable: true, default: () => "url" as const }),
1008
- "size": S.optionalWith(S.Literal("256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"), {
1320
+ "quality": S.optionalWith(CreateImageRequestQuality, { nullable: true, default: () => "standard" as const }),
1321
+ "response_format": S.optionalWith(CreateImageRequestResponseFormat, {
1009
1322
  nullable: true,
1010
- default: () => "1024x1024" as const
1323
+ default: () => "url" as const
1011
1324
  }),
1012
- "style": S.optionalWith(S.Literal("vivid", "natural"), { nullable: true, default: () => "vivid" as const }),
1325
+ "size": S.optionalWith(CreateImageRequestSize, { nullable: true, default: () => "1024x1024" as const }),
1326
+ "style": S.optionalWith(CreateImageRequestStyle, { nullable: true, default: () => "vivid" as const }),
1013
1327
  "user": S.optionalWith(S.String, { nullable: true })
1014
1328
  }) {}
1015
1329
 
1330
+ export class ListModelsResponseObject extends S.Literal("list") {}
1331
+
1332
+ export class ModelObject extends S.Literal("model") {}
1333
+
1016
1334
  export class Model extends S.Struct({
1017
1335
  "id": S.String,
1018
1336
  "created": S.Int,
1019
- "object": S.Literal("model"),
1337
+ "object": ModelObject,
1020
1338
  "owned_by": S.String
1021
1339
  }) {}
1022
1340
 
1023
1341
  export class ListModelsResponse extends S.Class<ListModelsResponse>("ListModelsResponse")({
1024
- "object": S.Literal("list"),
1342
+ "object": ListModelsResponseObject,
1025
1343
  "data": S.Array(Model)
1026
1344
  }) {}
1027
1345
 
@@ -1031,37 +1349,70 @@ export class DeleteModelResponse extends S.Class<DeleteModelResponse>("DeleteMod
1031
1349
  "object": S.String
1032
1350
  }) {}
1033
1351
 
1352
+ export class CreateModerationRequestInputType extends S.Literal("text") {}
1353
+
1354
+ export class CreateModerationRequestModel extends S.Literal(
1355
+ "omni-moderation-latest",
1356
+ "omni-moderation-2024-09-26",
1357
+ "text-moderation-latest",
1358
+ "text-moderation-stable"
1359
+ ) {}
1360
+
1034
1361
  export class CreateModerationRequest extends S.Class<CreateModerationRequest>("CreateModerationRequest")({
1035
1362
  "input": S.Union(
1036
1363
  S.String,
1037
1364
  S.Array(S.String),
1038
1365
  S.Array(S.Union(
1039
1366
  S.Struct({
1040
- "type": S.Literal("image_url"),
1367
+ "type": CreateModerationRequestInputType,
1041
1368
  "image_url": S.Struct({
1042
1369
  "url": S.String
1043
1370
  })
1044
1371
  }),
1045
1372
  S.Struct({
1046
- "type": S.Literal("text"),
1373
+ "type": CreateModerationRequestInputType,
1047
1374
  "text": S.String
1048
1375
  })
1049
1376
  ))
1050
1377
  ),
1051
- "model": S.optionalWith(
1052
- S.Union(
1053
- S.String,
1054
- S.Literal(
1055
- "omni-moderation-latest",
1056
- "omni-moderation-2024-09-26",
1057
- "text-moderation-latest",
1058
- "text-moderation-stable"
1059
- )
1060
- ),
1061
- { nullable: true, default: () => "omni-moderation-latest" as const }
1062
- )
1378
+ "model": S.optionalWith(S.Union(S.String, CreateModerationRequestModel), {
1379
+ nullable: true,
1380
+ default: () => "omni-moderation-latest" as const
1381
+ })
1063
1382
  }) {}
1064
1383
 
1384
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesHate extends S.Literal("text") {}
1385
+
1386
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesHateThreatening extends S.Literal("text") {}
1387
+
1388
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesHarassment extends S.Literal("text") {}
1389
+
1390
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesHarassmentThreatening extends S.Literal("text") {}
1391
+
1392
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesIllicit extends S.Literal("text") {}
1393
+
1394
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesIllicitViolent extends S.Literal("text") {}
1395
+
1396
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesSelfHarm extends S.Literal("text", "image") {}
1397
+
1398
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesSelfHarmIntent
1399
+ extends S.Literal("text", "image")
1400
+ {}
1401
+
1402
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesSelfHarmInstructions
1403
+ extends S.Literal("text", "image")
1404
+ {}
1405
+
1406
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesSexual extends S.Literal("text", "image") {}
1407
+
1408
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesSexualMinors extends S.Literal("text") {}
1409
+
1410
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesViolence extends S.Literal("text", "image") {}
1411
+
1412
+ export class CreateModerationResponseResultsCategoryAppliedInputTypesViolenceGraphic
1413
+ extends S.Literal("text", "image")
1414
+ {}
1415
+
1065
1416
  export class CreateModerationResponse extends S.Class<CreateModerationResponse>("CreateModerationResponse")({
1066
1417
  "id": S.String,
1067
1418
  "model": S.String,
@@ -1098,23 +1449,68 @@ export class CreateModerationResponse extends S.Class<CreateModerationResponse>(
1098
1449
  "violence/graphic": S.Number
1099
1450
  }),
1100
1451
  "category_applied_input_types": S.Struct({
1101
- "hate": S.Array(S.Literal("text")),
1102
- "hate/threatening": S.Array(S.Literal("text")),
1103
- "harassment": S.Array(S.Literal("text")),
1104
- "harassment/threatening": S.Array(S.Literal("text")),
1105
- "illicit": S.Array(S.Literal("text")),
1106
- "illicit/violent": S.Array(S.Literal("text")),
1107
- "self-harm": S.Array(S.Literal("text", "image")),
1108
- "self-harm/intent": S.Array(S.Literal("text", "image")),
1109
- "self-harm/instructions": S.Array(S.Literal("text", "image")),
1110
- "sexual": S.Array(S.Literal("text", "image")),
1111
- "sexual/minors": S.Array(S.Literal("text")),
1112
- "violence": S.Array(S.Literal("text", "image")),
1113
- "violence/graphic": S.Array(S.Literal("text", "image"))
1452
+ "hate": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesHate),
1453
+ "hate/threatening": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesHateThreatening),
1454
+ "harassment": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesHarassment),
1455
+ "harassment/threatening": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesHarassmentThreatening),
1456
+ "illicit": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesIllicit),
1457
+ "illicit/violent": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesIllicitViolent),
1458
+ "self-harm": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesSelfHarm),
1459
+ "self-harm/intent": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesSelfHarmIntent),
1460
+ "self-harm/instructions": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesSelfHarmInstructions),
1461
+ "sexual": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesSexual),
1462
+ "sexual/minors": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesSexualMinors),
1463
+ "violence": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesViolence),
1464
+ "violence/graphic": S.Array(CreateModerationResponseResultsCategoryAppliedInputTypesViolenceGraphic)
1114
1465
  })
1115
1466
  }))
1116
1467
  }) {}
1117
1468
 
1469
+ export class AdminApiKeysListParamsOrder extends S.Literal("asc", "desc") {}
1470
+
1471
+ export class AdminApiKeysListParams extends S.Struct({
1472
+ "after": S.optionalWith(S.String, { nullable: true }),
1473
+ "order": S.optionalWith(AdminApiKeysListParamsOrder, { nullable: true, default: () => "asc" as const }),
1474
+ "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const })
1475
+ }) {}
1476
+
1477
+ export class AdminApiKey extends S.Struct({
1478
+ "object": S.optionalWith(S.String, { nullable: true }),
1479
+ "id": S.optionalWith(S.String, { nullable: true }),
1480
+ "name": S.optionalWith(S.String, { nullable: true }),
1481
+ "redacted_value": S.optionalWith(S.String, { nullable: true }),
1482
+ "value": S.optionalWith(S.String, { nullable: true }),
1483
+ "created_at": S.optionalWith(S.Int, { nullable: true }),
1484
+ "owner": S.optionalWith(
1485
+ S.Struct({
1486
+ "type": S.optionalWith(S.String, { nullable: true }),
1487
+ "id": S.optionalWith(S.String, { nullable: true }),
1488
+ "name": S.optionalWith(S.String, { nullable: true }),
1489
+ "created_at": S.optionalWith(S.Int, { nullable: true }),
1490
+ "role": S.optionalWith(S.String, { nullable: true })
1491
+ }),
1492
+ { nullable: true }
1493
+ )
1494
+ }) {}
1495
+
1496
+ export class ApiKeyList extends S.Class<ApiKeyList>("ApiKeyList")({
1497
+ "object": S.optionalWith(S.String, { nullable: true }),
1498
+ "data": S.optionalWith(S.Array(AdminApiKey), { nullable: true }),
1499
+ "has_more": S.optionalWith(S.Boolean, { nullable: true }),
1500
+ "first_id": S.optionalWith(S.String, { nullable: true }),
1501
+ "last_id": S.optionalWith(S.String, { nullable: true })
1502
+ }) {}
1503
+
1504
+ export class AdminApiKeysCreateRequest extends S.Class<AdminApiKeysCreateRequest>("AdminApiKeysCreateRequest")({
1505
+ "name": S.String
1506
+ }) {}
1507
+
1508
+ export class AdminApiKeysDelete200 extends S.Struct({
1509
+ "id": S.optionalWith(S.String, { nullable: true }),
1510
+ "object": S.optionalWith(S.String, { nullable: true }),
1511
+ "deleted": S.optionalWith(S.Boolean, { nullable: true })
1512
+ }) {}
1513
+
1118
1514
  export class AuditLogEventType extends S.Literal(
1119
1515
  "api_key.created",
1120
1516
  "api_key.updated",
@@ -1133,6 +1529,8 @@ export class AuditLogEventType extends S.Literal(
1133
1529
  "service_account.created",
1134
1530
  "service_account.updated",
1135
1531
  "service_account.deleted",
1532
+ "rate_limit.updated",
1533
+ "rate_limit.deleted",
1136
1534
  "user.added",
1137
1535
  "user.updated",
1138
1536
  "user.deleted"
@@ -1153,6 +1551,10 @@ export class ListAuditLogsParams extends S.Struct({
1153
1551
  "before": S.optionalWith(S.String, { nullable: true })
1154
1552
  }) {}
1155
1553
 
1554
+ export class ListAuditLogsResponseObject extends S.Literal("list") {}
1555
+
1556
+ export class AuditLogActorType extends S.Literal("session", "api_key") {}
1557
+
1156
1558
  export class AuditLogActorUser extends S.Struct({
1157
1559
  "id": S.optionalWith(S.String, { nullable: true }),
1158
1560
  "email": S.optionalWith(S.String, { nullable: true })
@@ -1163,21 +1565,23 @@ export class AuditLogActorSession extends S.Struct({
1163
1565
  "ip_address": S.optionalWith(S.String, { nullable: true })
1164
1566
  }) {}
1165
1567
 
1568
+ export class AuditLogActorApiKeyType extends S.Literal("user", "service_account") {}
1569
+
1166
1570
  export class AuditLogActorServiceAccount extends S.Struct({
1167
1571
  "id": S.optionalWith(S.String, { nullable: true })
1168
1572
  }) {}
1169
1573
 
1170
1574
  export class AuditLogActorApiKey extends S.Struct({
1171
1575
  "id": S.optionalWith(S.String, { nullable: true }),
1172
- "type": S.optionalWith(S.Literal("user", "service_account"), { nullable: true }),
1576
+ "type": S.optionalWith(AuditLogActorApiKeyType, { nullable: true }),
1173
1577
  "user": S.optionalWith(AuditLogActorUser, { nullable: true }),
1174
1578
  "service_account": S.optionalWith(AuditLogActorServiceAccount, { nullable: true })
1175
1579
  }) {}
1176
1580
 
1177
1581
  export class AuditLogActor extends S.Struct({
1178
- "type": S.optionalWith(S.Literal("session", "api_key"), { nullable: true }),
1179
- "session": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true }),
1180
- "api_key": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
1582
+ "type": S.optionalWith(AuditLogActorType, { nullable: true }),
1583
+ "session": S.optionalWith(AuditLogActorSession, { nullable: true }),
1584
+ "api_key": S.optionalWith(AuditLogActorApiKey, { nullable: true })
1181
1585
  }) {}
1182
1586
 
1183
1587
  export class AuditLog extends S.Struct({
@@ -1313,19 +1717,42 @@ export class AuditLog extends S.Struct({
1313
1717
  }),
1314
1718
  { nullable: true }
1315
1719
  ),
1316
- "service_account.created": S.optionalWith(
1720
+ "rate_limit.updated": S.optionalWith(
1317
1721
  S.Struct({
1318
1722
  "id": S.optionalWith(S.String, { nullable: true }),
1319
- "data": S.optionalWith(
1723
+ "changes_requested": S.optionalWith(
1320
1724
  S.Struct({
1321
- "role": S.optionalWith(S.String, { nullable: true })
1725
+ "max_requests_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
1726
+ "max_tokens_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
1727
+ "max_images_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
1728
+ "max_audio_megabytes_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
1729
+ "max_requests_per_1_day": S.optionalWith(S.Int, { nullable: true }),
1730
+ "batch_1_day_max_input_tokens": S.optionalWith(S.Int, { nullable: true })
1322
1731
  }),
1323
1732
  { nullable: true }
1324
1733
  )
1325
1734
  }),
1326
1735
  { nullable: true }
1327
1736
  ),
1328
- "service_account.updated": S.optionalWith(
1737
+ "rate_limit.deleted": S.optionalWith(
1738
+ S.Struct({
1739
+ "id": S.optionalWith(S.String, { nullable: true })
1740
+ }),
1741
+ { nullable: true }
1742
+ ),
1743
+ "service_account.created": S.optionalWith(
1744
+ S.Struct({
1745
+ "id": S.optionalWith(S.String, { nullable: true }),
1746
+ "data": S.optionalWith(
1747
+ S.Struct({
1748
+ "role": S.optionalWith(S.String, { nullable: true })
1749
+ }),
1750
+ { nullable: true }
1751
+ )
1752
+ }),
1753
+ { nullable: true }
1754
+ ),
1755
+ "service_account.updated": S.optionalWith(
1329
1756
  S.Struct({
1330
1757
  "id": S.optionalWith(S.String, { nullable: true }),
1331
1758
  "changes_requested": S.optionalWith(
@@ -1376,44 +1803,230 @@ export class AuditLog extends S.Struct({
1376
1803
  }) {}
1377
1804
 
1378
1805
  export class ListAuditLogsResponse extends S.Class<ListAuditLogsResponse>("ListAuditLogsResponse")({
1379
- "object": S.Literal("list"),
1806
+ "object": ListAuditLogsResponseObject,
1380
1807
  "data": S.Array(AuditLog),
1381
1808
  "first_id": S.String,
1382
1809
  "last_id": S.String,
1383
1810
  "has_more": S.Boolean
1384
1811
  }) {}
1385
1812
 
1813
+ export class UsageCostsParamsBucketWidth extends S.Literal("1d") {}
1814
+
1815
+ export class UsageCostsParamsGroupBy extends S.Literal("project_id", "line_item") {}
1816
+
1817
+ export class UsageCostsParams extends S.Struct({
1818
+ "start_time": S.Int,
1819
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
1820
+ "bucket_width": S.optionalWith(UsageCostsParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
1821
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
1822
+ "group_by": S.optionalWith(S.Array(UsageCostsParamsGroupBy), { nullable: true }),
1823
+ "limit": S.optionalWith(S.Int, { nullable: true, default: () => 7 as const }),
1824
+ "page": S.optionalWith(S.String, { nullable: true })
1825
+ }) {}
1826
+
1827
+ export class UsageResponseObject extends S.Literal("page") {}
1828
+
1829
+ export class UsageTimeBucketObject extends S.Literal("bucket") {}
1830
+
1831
+ export class UsageCompletionsResultObject extends S.Literal("organization.usage.completions.result") {}
1832
+
1833
+ export class UsageCompletionsResult extends S.Struct({
1834
+ "object": UsageCompletionsResultObject,
1835
+ "input_tokens": S.Int,
1836
+ "input_cached_tokens": S.optionalWith(S.Int, { nullable: true }),
1837
+ "output_tokens": S.Int,
1838
+ "input_audio_tokens": S.optionalWith(S.Int, { nullable: true }),
1839
+ "output_audio_tokens": S.optionalWith(S.Int, { nullable: true }),
1840
+ "num_model_requests": S.Int,
1841
+ "project_id": S.optionalWith(S.String, { nullable: true }),
1842
+ "user_id": S.optionalWith(S.String, { nullable: true }),
1843
+ "api_key_id": S.optionalWith(S.String, { nullable: true }),
1844
+ "model": S.optionalWith(S.String, { nullable: true }),
1845
+ "batch": S.optionalWith(S.Boolean, { nullable: true })
1846
+ }) {}
1847
+
1848
+ export class UsageEmbeddingsResultObject extends S.Literal("organization.usage.embeddings.result") {}
1849
+
1850
+ export class UsageEmbeddingsResult extends S.Struct({
1851
+ "object": UsageEmbeddingsResultObject,
1852
+ "input_tokens": S.Int,
1853
+ "num_model_requests": S.Int,
1854
+ "project_id": S.optionalWith(S.String, { nullable: true }),
1855
+ "user_id": S.optionalWith(S.String, { nullable: true }),
1856
+ "api_key_id": S.optionalWith(S.String, { nullable: true }),
1857
+ "model": S.optionalWith(S.String, { nullable: true })
1858
+ }) {}
1859
+
1860
+ export class UsageModerationsResultObject extends S.Literal("organization.usage.moderations.result") {}
1861
+
1862
+ export class UsageModerationsResult extends S.Struct({
1863
+ "object": UsageModerationsResultObject,
1864
+ "input_tokens": S.Int,
1865
+ "num_model_requests": S.Int,
1866
+ "project_id": S.optionalWith(S.String, { nullable: true }),
1867
+ "user_id": S.optionalWith(S.String, { nullable: true }),
1868
+ "api_key_id": S.optionalWith(S.String, { nullable: true }),
1869
+ "model": S.optionalWith(S.String, { nullable: true })
1870
+ }) {}
1871
+
1872
+ export class UsageImagesResultObject extends S.Literal("organization.usage.images.result") {}
1873
+
1874
+ export class UsageImagesResult extends S.Struct({
1875
+ "object": UsageImagesResultObject,
1876
+ "images": S.Int,
1877
+ "num_model_requests": S.Int,
1878
+ "source": S.optionalWith(S.String, { nullable: true }),
1879
+ "size": S.optionalWith(S.String, { nullable: true }),
1880
+ "project_id": S.optionalWith(S.String, { nullable: true }),
1881
+ "user_id": S.optionalWith(S.String, { nullable: true }),
1882
+ "api_key_id": S.optionalWith(S.String, { nullable: true }),
1883
+ "model": S.optionalWith(S.String, { nullable: true })
1884
+ }) {}
1885
+
1886
+ export class UsageAudioSpeechesResultObject extends S.Literal("organization.usage.audio_speeches.result") {}
1887
+
1888
+ export class UsageAudioSpeechesResult extends S.Struct({
1889
+ "object": UsageAudioSpeechesResultObject,
1890
+ "characters": S.Int,
1891
+ "num_model_requests": S.Int,
1892
+ "project_id": S.optionalWith(S.String, { nullable: true }),
1893
+ "user_id": S.optionalWith(S.String, { nullable: true }),
1894
+ "api_key_id": S.optionalWith(S.String, { nullable: true }),
1895
+ "model": S.optionalWith(S.String, { nullable: true })
1896
+ }) {}
1897
+
1898
+ export class UsageAudioTranscriptionsResultObject extends S.Literal("organization.usage.audio_transcriptions.result") {}
1899
+
1900
+ export class UsageAudioTranscriptionsResult extends S.Struct({
1901
+ "object": UsageAudioTranscriptionsResultObject,
1902
+ "seconds": S.Int,
1903
+ "num_model_requests": S.Int,
1904
+ "project_id": S.optionalWith(S.String, { nullable: true }),
1905
+ "user_id": S.optionalWith(S.String, { nullable: true }),
1906
+ "api_key_id": S.optionalWith(S.String, { nullable: true }),
1907
+ "model": S.optionalWith(S.String, { nullable: true })
1908
+ }) {}
1909
+
1910
+ export class UsageVectorStoresResultObject extends S.Literal("organization.usage.vector_stores.result") {}
1911
+
1912
+ export class UsageVectorStoresResult extends S.Struct({
1913
+ "object": UsageVectorStoresResultObject,
1914
+ "usage_bytes": S.Int,
1915
+ "project_id": S.optionalWith(S.String, { nullable: true })
1916
+ }) {}
1917
+
1918
+ export class UsageCodeInterpreterSessionsResultObject
1919
+ extends S.Literal("organization.usage.code_interpreter_sessions.result")
1920
+ {}
1921
+
1922
+ export class UsageCodeInterpreterSessionsResult extends S.Struct({
1923
+ "object": UsageCodeInterpreterSessionsResultObject,
1924
+ "sessions": S.Int,
1925
+ "project_id": S.optionalWith(S.String, { nullable: true })
1926
+ }) {}
1927
+
1928
+ export class CostsResultObject extends S.Literal("organization.costs.result") {}
1929
+
1930
+ export class CostsResult extends S.Struct({
1931
+ "object": CostsResultObject,
1932
+ "amount": S.optionalWith(
1933
+ S.Struct({
1934
+ "value": S.optionalWith(S.Number, { nullable: true }),
1935
+ "currency": S.optionalWith(S.String, { nullable: true })
1936
+ }),
1937
+ { nullable: true }
1938
+ ),
1939
+ "line_item": S.optionalWith(S.String, { nullable: true }),
1940
+ "project_id": S.optionalWith(S.String, { nullable: true })
1941
+ }) {}
1942
+
1943
+ export class UsageTimeBucket extends S.Struct({
1944
+ "object": UsageTimeBucketObject,
1945
+ "start_time": S.Int,
1946
+ "end_time": S.Int,
1947
+ "result": S.Array(
1948
+ S.Union(
1949
+ UsageCompletionsResult,
1950
+ UsageEmbeddingsResult,
1951
+ UsageModerationsResult,
1952
+ UsageImagesResult,
1953
+ UsageAudioSpeechesResult,
1954
+ UsageAudioTranscriptionsResult,
1955
+ UsageVectorStoresResult,
1956
+ UsageCodeInterpreterSessionsResult,
1957
+ CostsResult
1958
+ )
1959
+ )
1960
+ }) {}
1961
+
1962
+ export class UsageResponse extends S.Class<UsageResponse>("UsageResponse")({
1963
+ "object": UsageResponseObject,
1964
+ "data": S.Array(UsageTimeBucket),
1965
+ "has_more": S.Boolean,
1966
+ "next_page": S.String
1967
+ }) {}
1968
+
1386
1969
  export class ListInvitesParams extends S.Struct({
1387
1970
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
1388
1971
  "after": S.optionalWith(S.String, { nullable: true })
1389
1972
  }) {}
1390
1973
 
1974
+ export class InviteListResponseObject extends S.Literal("list") {}
1975
+
1976
+ export class InviteObject extends S.Literal("organization.invite") {}
1977
+
1978
+ export class InviteRole extends S.Literal("owner", "reader") {}
1979
+
1980
+ export class InviteStatus extends S.Literal("accepted", "expired", "pending") {}
1981
+
1982
+ export class InviteProjectsRole extends S.Literal("member", "owner") {}
1983
+
1391
1984
  export class Invite extends S.Struct({
1392
- "object": S.Literal("organization.invite"),
1985
+ "object": InviteObject,
1393
1986
  "id": S.String,
1394
1987
  "email": S.String,
1395
- "role": S.Literal("owner", "reader"),
1396
- "status": S.Literal("accepted", "expired", "pending"),
1988
+ "role": InviteRole,
1989
+ "status": InviteStatus,
1397
1990
  "invited_at": S.Int,
1398
1991
  "expires_at": S.Int,
1399
- "accepted_at": S.optionalWith(S.Int, { nullable: true })
1992
+ "accepted_at": S.optionalWith(S.Int, { nullable: true }),
1993
+ "projects": S.optionalWith(
1994
+ S.Array(S.Struct({
1995
+ "id": S.optionalWith(S.String, { nullable: true }),
1996
+ "role": S.optionalWith(InviteProjectsRole, { nullable: true })
1997
+ })),
1998
+ { nullable: true }
1999
+ )
1400
2000
  }) {}
1401
2001
 
1402
2002
  export class InviteListResponse extends S.Class<InviteListResponse>("InviteListResponse")({
1403
- "object": S.Literal("list"),
2003
+ "object": InviteListResponseObject,
1404
2004
  "data": S.Array(Invite),
1405
2005
  "first_id": S.optionalWith(S.String, { nullable: true }),
1406
2006
  "last_id": S.optionalWith(S.String, { nullable: true }),
1407
2007
  "has_more": S.optionalWith(S.Boolean, { nullable: true })
1408
2008
  }) {}
1409
2009
 
2010
+ export class InviteRequestRole extends S.Literal("reader", "owner") {}
2011
+
2012
+ export class InviteRequestProjectsRole extends S.Literal("member", "owner") {}
2013
+
1410
2014
  export class InviteRequest extends S.Class<InviteRequest>("InviteRequest")({
1411
2015
  "email": S.String,
1412
- "role": S.Literal("reader", "owner")
2016
+ "role": InviteRequestRole,
2017
+ "projects": S.optionalWith(
2018
+ S.Array(S.Struct({
2019
+ "id": S.String,
2020
+ "role": InviteRequestProjectsRole
2021
+ })),
2022
+ { nullable: true }
2023
+ )
1413
2024
  }) {}
1414
2025
 
2026
+ export class InviteDeleteResponseObject extends S.Literal("organization.invite.deleted") {}
2027
+
1415
2028
  export class InviteDeleteResponse extends S.Class<InviteDeleteResponse>("InviteDeleteResponse")({
1416
- "object": S.Literal("organization.invite.deleted"),
2029
+ "object": InviteDeleteResponseObject,
1417
2030
  "id": S.String,
1418
2031
  "deleted": S.Boolean
1419
2032
  }) {}
@@ -1424,17 +2037,23 @@ export class ListProjectsParams extends S.Struct({
1424
2037
  "include_archived": S.optionalWith(S.Boolean, { nullable: true, default: () => false as const })
1425
2038
  }) {}
1426
2039
 
2040
+ export class ProjectListResponseObject extends S.Literal("list") {}
2041
+
2042
+ export class ProjectObject extends S.Literal("organization.project") {}
2043
+
2044
+ export class ProjectStatus extends S.Literal("active", "archived") {}
2045
+
1427
2046
  export class Project extends S.Struct({
1428
2047
  "id": S.String,
1429
- "object": S.Literal("organization.project"),
2048
+ "object": ProjectObject,
1430
2049
  "name": S.String,
1431
2050
  "created_at": S.Int,
1432
2051
  "archived_at": S.optionalWith(S.Int, { nullable: true }),
1433
- "status": S.Literal("active", "archived")
2052
+ "status": ProjectStatus
1434
2053
  }) {}
1435
2054
 
1436
2055
  export class ProjectListResponse extends S.Class<ProjectListResponse>("ProjectListResponse")({
1437
- "object": S.Literal("list"),
2056
+ "object": ProjectListResponseObject,
1438
2057
  "data": S.Array(Project),
1439
2058
  "first_id": S.String,
1440
2059
  "last_id": S.String,
@@ -1465,58 +2084,119 @@ export class ListProjectApiKeysParams extends S.Struct({
1465
2084
  "after": S.optionalWith(S.String, { nullable: true })
1466
2085
  }) {}
1467
2086
 
2087
+ export class ProjectApiKeyListResponseObject extends S.Literal("list") {}
2088
+
2089
+ export class ProjectApiKeyObject extends S.Literal("organization.project.api_key") {}
2090
+
2091
+ export class ProjectApiKeyOwnerType extends S.Literal("user", "service_account") {}
2092
+
2093
+ export class ProjectUserObject extends S.Literal("organization.project.user") {}
2094
+
2095
+ export class ProjectUserRole extends S.Literal("owner", "member") {}
2096
+
1468
2097
  export class ProjectUser extends S.Struct({
1469
- "object": S.Literal("organization.project.user"),
2098
+ "object": ProjectUserObject,
1470
2099
  "id": S.String,
1471
2100
  "name": S.String,
1472
2101
  "email": S.String,
1473
- "role": S.Literal("owner", "member"),
2102
+ "role": ProjectUserRole,
1474
2103
  "added_at": S.Int
1475
2104
  }) {}
1476
2105
 
2106
+ export class ProjectServiceAccountObject extends S.Literal("organization.project.service_account") {}
2107
+
2108
+ export class ProjectServiceAccountRole extends S.Literal("owner", "member") {}
2109
+
1477
2110
  export class ProjectServiceAccount extends S.Struct({
1478
- "object": S.Literal("organization.project.service_account"),
2111
+ "object": ProjectServiceAccountObject,
1479
2112
  "id": S.String,
1480
2113
  "name": S.String,
1481
- "role": S.Literal("owner", "member"),
2114
+ "role": ProjectServiceAccountRole,
1482
2115
  "created_at": S.Int
1483
2116
  }) {}
1484
2117
 
1485
2118
  export class ProjectApiKey extends S.Struct({
1486
- "object": S.Literal("organization.project.api_key"),
2119
+ "object": ProjectApiKeyObject,
1487
2120
  "redacted_value": S.String,
1488
2121
  "name": S.String,
1489
2122
  "created_at": S.Int,
1490
2123
  "id": S.String,
1491
2124
  "owner": S.Struct({
1492
- "type": S.optionalWith(S.Literal("user", "service_account"), { nullable: true }),
2125
+ "type": S.optionalWith(ProjectApiKeyOwnerType, { nullable: true }),
1493
2126
  "user": S.optionalWith(ProjectUser, { nullable: true }),
1494
2127
  "service_account": S.optionalWith(ProjectServiceAccount, { nullable: true })
1495
2128
  })
1496
2129
  }) {}
1497
2130
 
1498
2131
  export class ProjectApiKeyListResponse extends S.Class<ProjectApiKeyListResponse>("ProjectApiKeyListResponse")({
1499
- "object": S.Literal("list"),
2132
+ "object": ProjectApiKeyListResponseObject,
1500
2133
  "data": S.Array(ProjectApiKey),
1501
2134
  "first_id": S.String,
1502
2135
  "last_id": S.String,
1503
2136
  "has_more": S.Boolean
1504
2137
  }) {}
1505
2138
 
2139
+ export class ProjectApiKeyDeleteResponseObject extends S.Literal("organization.project.api_key.deleted") {}
2140
+
1506
2141
  export class ProjectApiKeyDeleteResponse extends S.Class<ProjectApiKeyDeleteResponse>("ProjectApiKeyDeleteResponse")({
1507
- "object": S.Literal("organization.project.api_key.deleted"),
2142
+ "object": ProjectApiKeyDeleteResponseObject,
1508
2143
  "id": S.String,
1509
2144
  "deleted": S.Boolean
1510
2145
  }) {}
1511
2146
 
2147
+ export class ListProjectRateLimitsParams extends S.Struct({
2148
+ "limit": S.optionalWith(S.Int, { nullable: true, default: () => 100 as const }),
2149
+ "after": S.optionalWith(S.String, { nullable: true }),
2150
+ "before": S.optionalWith(S.String, { nullable: true })
2151
+ }) {}
2152
+
2153
+ export class ProjectRateLimitListResponseObject extends S.Literal("list") {}
2154
+
2155
+ export class ProjectRateLimitObject extends S.Literal("project.rate_limit") {}
2156
+
2157
+ export class ProjectRateLimit extends S.Struct({
2158
+ "object": ProjectRateLimitObject,
2159
+ "id": S.String,
2160
+ "model": S.String,
2161
+ "max_requests_per_1_minute": S.Int,
2162
+ "max_tokens_per_1_minute": S.Int,
2163
+ "max_images_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
2164
+ "max_audio_megabytes_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
2165
+ "max_requests_per_1_day": S.optionalWith(S.Int, { nullable: true }),
2166
+ "batch_1_day_max_input_tokens": S.optionalWith(S.Int, { nullable: true })
2167
+ }) {}
2168
+
2169
+ export class ProjectRateLimitListResponse
2170
+ extends S.Class<ProjectRateLimitListResponse>("ProjectRateLimitListResponse")({
2171
+ "object": ProjectRateLimitListResponseObject,
2172
+ "data": S.Array(ProjectRateLimit),
2173
+ "first_id": S.String,
2174
+ "last_id": S.String,
2175
+ "has_more": S.Boolean
2176
+ })
2177
+ {}
2178
+
2179
+ export class ProjectRateLimitUpdateRequest
2180
+ extends S.Class<ProjectRateLimitUpdateRequest>("ProjectRateLimitUpdateRequest")({
2181
+ "max_requests_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
2182
+ "max_tokens_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
2183
+ "max_images_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
2184
+ "max_audio_megabytes_per_1_minute": S.optionalWith(S.Int, { nullable: true }),
2185
+ "max_requests_per_1_day": S.optionalWith(S.Int, { nullable: true }),
2186
+ "batch_1_day_max_input_tokens": S.optionalWith(S.Int, { nullable: true })
2187
+ })
2188
+ {}
2189
+
1512
2190
  export class ListProjectServiceAccountsParams extends S.Struct({
1513
2191
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
1514
2192
  "after": S.optionalWith(S.String, { nullable: true })
1515
2193
  }) {}
1516
2194
 
2195
+ export class ProjectServiceAccountListResponseObject extends S.Literal("list") {}
2196
+
1517
2197
  export class ProjectServiceAccountListResponse
1518
2198
  extends S.Class<ProjectServiceAccountListResponse>("ProjectServiceAccountListResponse")({
1519
- "object": S.Literal("list"),
2199
+ "object": ProjectServiceAccountListResponseObject,
1520
2200
  "data": S.Array(ProjectServiceAccount),
1521
2201
  "first_id": S.String,
1522
2202
  "last_id": S.String,
@@ -1530,8 +2210,14 @@ export class ProjectServiceAccountCreateRequest
1530
2210
  })
1531
2211
  {}
1532
2212
 
2213
+ export class ProjectServiceAccountCreateResponseObject extends S.Literal("organization.project.service_account") {}
2214
+
2215
+ export class ProjectServiceAccountCreateResponseRole extends S.Literal("member") {}
2216
+
2217
+ export class ProjectServiceAccountApiKeyObject extends S.Literal("organization.project.service_account.api_key") {}
2218
+
1533
2219
  export class ProjectServiceAccountApiKey extends S.Struct({
1534
- "object": S.Literal("organization.project.service_account.api_key"),
2220
+ "object": ProjectServiceAccountApiKeyObject,
1535
2221
  "value": S.String,
1536
2222
  "name": S.String,
1537
2223
  "created_at": S.Int,
@@ -1540,18 +2226,22 @@ export class ProjectServiceAccountApiKey extends S.Struct({
1540
2226
 
1541
2227
  export class ProjectServiceAccountCreateResponse
1542
2228
  extends S.Class<ProjectServiceAccountCreateResponse>("ProjectServiceAccountCreateResponse")({
1543
- "object": S.Literal("organization.project.service_account"),
2229
+ "object": ProjectServiceAccountCreateResponseObject,
1544
2230
  "id": S.String,
1545
2231
  "name": S.String,
1546
- "role": S.Literal("member"),
2232
+ "role": ProjectServiceAccountCreateResponseRole,
1547
2233
  "created_at": S.Int,
1548
2234
  "api_key": ProjectServiceAccountApiKey
1549
2235
  })
1550
2236
  {}
1551
2237
 
2238
+ export class ProjectServiceAccountDeleteResponseObject
2239
+ extends S.Literal("organization.project.service_account.deleted")
2240
+ {}
2241
+
1552
2242
  export class ProjectServiceAccountDeleteResponse
1553
2243
  extends S.Class<ProjectServiceAccountDeleteResponse>("ProjectServiceAccountDeleteResponse")({
1554
- "object": S.Literal("organization.project.service_account.deleted"),
2244
+ "object": ProjectServiceAccountDeleteResponseObject,
1555
2245
  "id": S.String,
1556
2246
  "deleted": S.Boolean
1557
2247
  })
@@ -1570,80 +2260,374 @@ export class ProjectUserListResponse extends S.Class<ProjectUserListResponse>("P
1570
2260
  "has_more": S.Boolean
1571
2261
  }) {}
1572
2262
 
2263
+ export class ProjectUserCreateRequestRole extends S.Literal("owner", "member") {}
2264
+
1573
2265
  export class ProjectUserCreateRequest extends S.Class<ProjectUserCreateRequest>("ProjectUserCreateRequest")({
1574
2266
  "user_id": S.String,
1575
- "role": S.Literal("owner", "member")
2267
+ "role": ProjectUserCreateRequestRole
1576
2268
  }) {}
1577
2269
 
2270
+ export class ProjectUserUpdateRequestRole extends S.Literal("owner", "member") {}
2271
+
1578
2272
  export class ProjectUserUpdateRequest extends S.Class<ProjectUserUpdateRequest>("ProjectUserUpdateRequest")({
1579
- "role": S.Literal("owner", "member")
2273
+ "role": ProjectUserUpdateRequestRole
1580
2274
  }) {}
1581
2275
 
2276
+ export class ProjectUserDeleteResponseObject extends S.Literal("organization.project.user.deleted") {}
2277
+
1582
2278
  export class ProjectUserDeleteResponse extends S.Class<ProjectUserDeleteResponse>("ProjectUserDeleteResponse")({
1583
- "object": S.Literal("organization.project.user.deleted"),
2279
+ "object": ProjectUserDeleteResponseObject,
1584
2280
  "id": S.String,
1585
2281
  "deleted": S.Boolean
1586
2282
  }) {}
1587
2283
 
2284
+ export class UsageAudioSpeechesParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2285
+
2286
+ export class UsageAudioSpeechesParamsGroupBy extends S.Literal("project_id", "user_id", "api_key_id", "model") {}
2287
+
2288
+ export class UsageAudioSpeechesParams extends S.Struct({
2289
+ "start_time": S.Int,
2290
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2291
+ "bucket_width": S.optionalWith(UsageAudioSpeechesParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
2292
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2293
+ "user_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2294
+ "api_key_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2295
+ "models": S.optionalWith(S.Array(S.String), { nullable: true }),
2296
+ "group_by": S.optionalWith(S.Array(UsageAudioSpeechesParamsGroupBy), { nullable: true }),
2297
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2298
+ "page": S.optionalWith(S.String, { nullable: true })
2299
+ }) {}
2300
+
2301
+ export class UsageAudioTranscriptionsParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2302
+
2303
+ export class UsageAudioTranscriptionsParamsGroupBy extends S.Literal("project_id", "user_id", "api_key_id", "model") {}
2304
+
2305
+ export class UsageAudioTranscriptionsParams extends S.Struct({
2306
+ "start_time": S.Int,
2307
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2308
+ "bucket_width": S.optionalWith(UsageAudioTranscriptionsParamsBucketWidth, {
2309
+ nullable: true,
2310
+ default: () => "1d" as const
2311
+ }),
2312
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2313
+ "user_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2314
+ "api_key_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2315
+ "models": S.optionalWith(S.Array(S.String), { nullable: true }),
2316
+ "group_by": S.optionalWith(S.Array(UsageAudioTranscriptionsParamsGroupBy), { nullable: true }),
2317
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2318
+ "page": S.optionalWith(S.String, { nullable: true })
2319
+ }) {}
2320
+
2321
+ export class UsageCodeInterpreterSessionsParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2322
+
2323
+ export class UsageCodeInterpreterSessionsParamsGroupBy extends S.Literal("project_id") {}
2324
+
2325
+ export class UsageCodeInterpreterSessionsParams extends S.Struct({
2326
+ "start_time": S.Int,
2327
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2328
+ "bucket_width": S.optionalWith(UsageCodeInterpreterSessionsParamsBucketWidth, {
2329
+ nullable: true,
2330
+ default: () => "1d" as const
2331
+ }),
2332
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2333
+ "group_by": S.optionalWith(S.Array(UsageCodeInterpreterSessionsParamsGroupBy), { nullable: true }),
2334
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2335
+ "page": S.optionalWith(S.String, { nullable: true })
2336
+ }) {}
2337
+
2338
+ export class UsageCompletionsParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2339
+
2340
+ export class UsageCompletionsParamsGroupBy extends S.Literal("project_id", "user_id", "api_key_id", "model", "batch") {}
2341
+
2342
+ export class UsageCompletionsParams extends S.Struct({
2343
+ "start_time": S.Int,
2344
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2345
+ "bucket_width": S.optionalWith(UsageCompletionsParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
2346
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2347
+ "user_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2348
+ "api_key_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2349
+ "models": S.optionalWith(S.Array(S.String), { nullable: true }),
2350
+ "batch": S.optionalWith(S.Boolean, { nullable: true }),
2351
+ "group_by": S.optionalWith(S.Array(UsageCompletionsParamsGroupBy), { nullable: true }),
2352
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2353
+ "page": S.optionalWith(S.String, { nullable: true })
2354
+ }) {}
2355
+
2356
+ export class UsageEmbeddingsParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2357
+
2358
+ export class UsageEmbeddingsParamsGroupBy extends S.Literal("project_id", "user_id", "api_key_id", "model") {}
2359
+
2360
+ export class UsageEmbeddingsParams extends S.Struct({
2361
+ "start_time": S.Int,
2362
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2363
+ "bucket_width": S.optionalWith(UsageEmbeddingsParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
2364
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2365
+ "user_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2366
+ "api_key_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2367
+ "models": S.optionalWith(S.Array(S.String), { nullable: true }),
2368
+ "group_by": S.optionalWith(S.Array(UsageEmbeddingsParamsGroupBy), { nullable: true }),
2369
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2370
+ "page": S.optionalWith(S.String, { nullable: true })
2371
+ }) {}
2372
+
2373
+ export class UsageImagesParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2374
+
2375
+ export class UsageImagesParamsSources extends S.Literal("image.generation", "image.edit", "image.variation") {}
2376
+
2377
+ export class UsageImagesParamsSizes extends S.Literal("256x256", "512x512", "1024x1024", "1792x1792", "1024x1792") {}
2378
+
2379
+ export class UsageImagesParamsGroupBy
2380
+ extends S.Literal("project_id", "user_id", "api_key_id", "model", "size", "source")
2381
+ {}
2382
+
2383
+ export class UsageImagesParams extends S.Struct({
2384
+ "start_time": S.Int,
2385
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2386
+ "bucket_width": S.optionalWith(UsageImagesParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
2387
+ "sources": S.optionalWith(S.Array(UsageImagesParamsSources), { nullable: true }),
2388
+ "sizes": S.optionalWith(S.Array(UsageImagesParamsSizes), { nullable: true }),
2389
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2390
+ "user_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2391
+ "api_key_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2392
+ "models": S.optionalWith(S.Array(S.String), { nullable: true }),
2393
+ "group_by": S.optionalWith(S.Array(UsageImagesParamsGroupBy), { nullable: true }),
2394
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2395
+ "page": S.optionalWith(S.String, { nullable: true })
2396
+ }) {}
2397
+
2398
+ export class UsageModerationsParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2399
+
2400
+ export class UsageModerationsParamsGroupBy extends S.Literal("project_id", "user_id", "api_key_id", "model") {}
2401
+
2402
+ export class UsageModerationsParams extends S.Struct({
2403
+ "start_time": S.Int,
2404
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2405
+ "bucket_width": S.optionalWith(UsageModerationsParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
2406
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2407
+ "user_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2408
+ "api_key_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2409
+ "models": S.optionalWith(S.Array(S.String), { nullable: true }),
2410
+ "group_by": S.optionalWith(S.Array(UsageModerationsParamsGroupBy), { nullable: true }),
2411
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2412
+ "page": S.optionalWith(S.String, { nullable: true })
2413
+ }) {}
2414
+
2415
+ export class UsageVectorStoresParamsBucketWidth extends S.Literal("1m", "1h", "1d") {}
2416
+
2417
+ export class UsageVectorStoresParamsGroupBy extends S.Literal("project_id") {}
2418
+
2419
+ export class UsageVectorStoresParams extends S.Struct({
2420
+ "start_time": S.Int,
2421
+ "end_time": S.optionalWith(S.Int, { nullable: true }),
2422
+ "bucket_width": S.optionalWith(UsageVectorStoresParamsBucketWidth, { nullable: true, default: () => "1d" as const }),
2423
+ "project_ids": S.optionalWith(S.Array(S.String), { nullable: true }),
2424
+ "group_by": S.optionalWith(S.Array(UsageVectorStoresParamsGroupBy), { nullable: true }),
2425
+ "limit": S.optionalWith(S.Int, { nullable: true }),
2426
+ "page": S.optionalWith(S.String, { nullable: true })
2427
+ }) {}
2428
+
1588
2429
  export class ListUsersParams extends S.Struct({
1589
2430
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
1590
2431
  "after": S.optionalWith(S.String, { nullable: true })
1591
2432
  }) {}
1592
2433
 
2434
+ export class UserListResponseObject extends S.Literal("list") {}
2435
+
2436
+ export class UserObject extends S.Literal("organization.user") {}
2437
+
2438
+ export class UserRole extends S.Literal("owner", "reader") {}
2439
+
1593
2440
  export class User extends S.Struct({
1594
- "object": S.Literal("organization.user"),
2441
+ "object": UserObject,
1595
2442
  "id": S.String,
1596
2443
  "name": S.String,
1597
2444
  "email": S.String,
1598
- "role": S.Literal("owner", "reader"),
2445
+ "role": UserRole,
1599
2446
  "added_at": S.Int
1600
2447
  }) {}
1601
2448
 
1602
2449
  export class UserListResponse extends S.Class<UserListResponse>("UserListResponse")({
1603
- "object": S.Literal("list"),
2450
+ "object": UserListResponseObject,
1604
2451
  "data": S.Array(User),
1605
2452
  "first_id": S.String,
1606
2453
  "last_id": S.String,
1607
2454
  "has_more": S.Boolean
1608
2455
  }) {}
1609
2456
 
2457
+ export class UserRoleUpdateRequestRole extends S.Literal("owner", "reader") {}
2458
+
1610
2459
  export class UserRoleUpdateRequest extends S.Class<UserRoleUpdateRequest>("UserRoleUpdateRequest")({
1611
- "role": S.Literal("owner", "reader")
2460
+ "role": UserRoleUpdateRequestRole
1612
2461
  }) {}
1613
2462
 
2463
+ export class UserDeleteResponseObject extends S.Literal("organization.user.deleted") {}
2464
+
1614
2465
  export class UserDeleteResponse extends S.Class<UserDeleteResponse>("UserDeleteResponse")({
1615
- "object": S.Literal("organization.user.deleted"),
2466
+ "object": UserDeleteResponseObject,
1616
2467
  "id": S.String,
1617
2468
  "deleted": S.Boolean
1618
2469
  }) {}
1619
2470
 
2471
+ export class RealtimeSessionCreateRequestModel extends S.Literal(
2472
+ "gpt-4o-realtime-preview",
2473
+ "gpt-4o-realtime-preview-2024-10-01",
2474
+ "gpt-4o-realtime-preview-2024-12-17",
2475
+ "gpt-4o-mini-realtime-preview",
2476
+ "gpt-4o-mini-realtime-preview-2024-12-17"
2477
+ ) {}
2478
+
2479
+ export class RealtimeSessionCreateRequestVoice
2480
+ extends S.Literal("alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse")
2481
+ {}
2482
+
2483
+ export class RealtimeSessionCreateRequestInputAudioFormat extends S.Literal("pcm16", "g711_ulaw", "g711_alaw") {}
2484
+
2485
+ export class RealtimeSessionCreateRequestOutputAudioFormat extends S.Literal("pcm16", "g711_ulaw", "g711_alaw") {}
2486
+
2487
+ export class RealtimeSessionCreateRequestToolsType extends S.Literal("function") {}
2488
+
2489
+ export class RealtimeSessionCreateRequestMaxResponseOutputTokens extends S.Literal("inf") {}
2490
+
2491
+ export class RealtimeSessionCreateRequest
2492
+ extends S.Class<RealtimeSessionCreateRequest>("RealtimeSessionCreateRequest")({
2493
+ "model": S.optionalWith(RealtimeSessionCreateRequestModel, { nullable: true }),
2494
+ "instructions": S.optionalWith(S.String, { nullable: true }),
2495
+ "voice": S.optionalWith(RealtimeSessionCreateRequestVoice, { nullable: true }),
2496
+ "input_audio_format": S.optionalWith(RealtimeSessionCreateRequestInputAudioFormat, { nullable: true }),
2497
+ "output_audio_format": S.optionalWith(RealtimeSessionCreateRequestOutputAudioFormat, { nullable: true }),
2498
+ "input_audio_transcription": S.optionalWith(
2499
+ S.Struct({
2500
+ "model": S.optionalWith(S.String, { nullable: true })
2501
+ }),
2502
+ { nullable: true }
2503
+ ),
2504
+ "turn_detection": S.optionalWith(
2505
+ S.Struct({
2506
+ "type": S.optionalWith(S.String, { nullable: true }),
2507
+ "threshold": S.optionalWith(S.Number, { nullable: true }),
2508
+ "prefix_padding_ms": S.optionalWith(S.Int, { nullable: true }),
2509
+ "silence_duration_ms": S.optionalWith(S.Int, { nullable: true }),
2510
+ "create_response": S.optionalWith(S.Boolean, { nullable: true, default: () => true as const })
2511
+ }),
2512
+ { nullable: true }
2513
+ ),
2514
+ "tools": S.optionalWith(
2515
+ S.Array(S.Struct({
2516
+ "type": S.optionalWith(RealtimeSessionCreateRequestToolsType, { nullable: true }),
2517
+ "name": S.optionalWith(S.String, { nullable: true }),
2518
+ "description": S.optionalWith(S.String, { nullable: true }),
2519
+ "parameters": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
2520
+ })),
2521
+ { nullable: true }
2522
+ ),
2523
+ "tool_choice": S.optionalWith(S.String, { nullable: true }),
2524
+ "temperature": S.optionalWith(S.Number, { nullable: true }),
2525
+ "max_response_output_tokens": S.optionalWith(S.Union(S.Int, RealtimeSessionCreateRequestMaxResponseOutputTokens), {
2526
+ nullable: true
2527
+ })
2528
+ })
2529
+ {}
2530
+
2531
+ export class RealtimeSessionCreateResponseVoice
2532
+ extends S.Literal("alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse")
2533
+ {}
2534
+
2535
+ export class RealtimeSessionCreateResponseToolsType extends S.Literal("function") {}
2536
+
2537
+ export class RealtimeSessionCreateResponseMaxResponseOutputTokens extends S.Literal("inf") {}
2538
+
2539
+ export class RealtimeSessionCreateResponse
2540
+ extends S.Class<RealtimeSessionCreateResponse>("RealtimeSessionCreateResponse")({
2541
+ "client_secret": S.optionalWith(
2542
+ S.Struct({
2543
+ "value": S.optionalWith(S.String, { nullable: true }),
2544
+ "expires_at": S.optionalWith(S.Int, { nullable: true })
2545
+ }),
2546
+ { nullable: true }
2547
+ ),
2548
+ "instructions": S.optionalWith(S.String, { nullable: true }),
2549
+ "voice": S.optionalWith(RealtimeSessionCreateResponseVoice, { nullable: true }),
2550
+ "input_audio_format": S.optionalWith(S.String, { nullable: true }),
2551
+ "output_audio_format": S.optionalWith(S.String, { nullable: true }),
2552
+ "input_audio_transcription": S.optionalWith(
2553
+ S.Struct({
2554
+ "model": S.optionalWith(S.String, { nullable: true })
2555
+ }),
2556
+ { nullable: true }
2557
+ ),
2558
+ "turn_detection": S.optionalWith(
2559
+ S.Struct({
2560
+ "type": S.optionalWith(S.String, { nullable: true }),
2561
+ "threshold": S.optionalWith(S.Number, { nullable: true }),
2562
+ "prefix_padding_ms": S.optionalWith(S.Int, { nullable: true }),
2563
+ "silence_duration_ms": S.optionalWith(S.Int, { nullable: true })
2564
+ }),
2565
+ { nullable: true }
2566
+ ),
2567
+ "tools": S.optionalWith(
2568
+ S.Array(S.Struct({
2569
+ "type": S.optionalWith(RealtimeSessionCreateResponseToolsType, { nullable: true }),
2570
+ "name": S.optionalWith(S.String, { nullable: true }),
2571
+ "description": S.optionalWith(S.String, { nullable: true }),
2572
+ "parameters": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
2573
+ })),
2574
+ { nullable: true }
2575
+ ),
2576
+ "tool_choice": S.optionalWith(S.String, { nullable: true }),
2577
+ "temperature": S.optionalWith(S.Number, { nullable: true }),
2578
+ "max_response_output_tokens": S.optionalWith(S.Union(S.Int, RealtimeSessionCreateResponseMaxResponseOutputTokens), {
2579
+ nullable: true
2580
+ })
2581
+ })
2582
+ {}
2583
+
2584
+ export class CreateMessageRequestRole extends S.Literal("user", "assistant") {}
2585
+
2586
+ export class MessageContentImageFileObjectType extends S.Literal("image_file") {}
2587
+
2588
+ export class MessageContentImageFileObjectImageFileDetail extends S.Literal("auto", "low", "high") {}
2589
+
1620
2590
  export class MessageContentImageFileObject extends S.Struct({
1621
- "type": S.Literal("image_file"),
2591
+ "type": MessageContentImageFileObjectType,
1622
2592
  "image_file": S.Struct({
1623
2593
  "file_id": S.String,
1624
- "detail": S.optionalWith(S.Literal("auto", "low", "high"), { nullable: true, default: () => "auto" as const })
2594
+ "detail": S.optionalWith(MessageContentImageFileObjectImageFileDetail, {
2595
+ nullable: true,
2596
+ default: () => "auto" as const
2597
+ })
1625
2598
  })
1626
2599
  }) {}
1627
2600
 
2601
+ export class MessageContentImageUrlObjectType extends S.Literal("image_url") {}
2602
+
2603
+ export class MessageContentImageUrlObjectImageUrlDetail extends S.Literal("auto", "low", "high") {}
2604
+
1628
2605
  export class MessageContentImageUrlObject extends S.Struct({
1629
- "type": S.Literal("image_url"),
2606
+ "type": MessageContentImageUrlObjectType,
1630
2607
  "image_url": S.Struct({
1631
2608
  "url": S.String,
1632
- "detail": S.optionalWith(S.Literal("auto", "low", "high"), { nullable: true, default: () => "auto" as const })
2609
+ "detail": S.optionalWith(MessageContentImageUrlObjectImageUrlDetail, {
2610
+ nullable: true,
2611
+ default: () => "auto" as const
2612
+ })
1633
2613
  })
1634
2614
  }) {}
1635
2615
 
2616
+ export class MessageRequestContentTextObjectType extends S.Literal("text") {}
2617
+
1636
2618
  export class MessageRequestContentTextObject extends S.Struct({
1637
- "type": S.Literal("text"),
2619
+ "type": MessageRequestContentTextObjectType,
1638
2620
  "text": S.String
1639
2621
  }) {}
1640
2622
 
2623
+ export class AssistantToolsFileSearchTypeOnlyType extends S.Literal("file_search") {}
2624
+
1641
2625
  export class AssistantToolsFileSearchTypeOnly extends S.Struct({
1642
- "type": S.Literal("file_search")
2626
+ "type": AssistantToolsFileSearchTypeOnlyType
1643
2627
  }) {}
1644
2628
 
1645
2629
  export class CreateMessageRequest extends S.Struct({
1646
- "role": S.Literal("user", "assistant"),
2630
+ "role": CreateMessageRequestRole,
1647
2631
  "content": S.Union(
1648
2632
  S.String,
1649
2633
  S.NonEmptyArray(
@@ -1662,6 +2646,8 @@ export class CreateMessageRequest extends S.Struct({
1662
2646
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
1663
2647
  }) {}
1664
2648
 
2649
+ export class CreateThreadRequestToolResourcesFileSearchVectorStoresChunkingStrategyType extends S.Literal("static") {}
2650
+
1665
2651
  export class CreateThreadRequest extends S.Class<CreateThreadRequest>("CreateThreadRequest")({
1666
2652
  "messages": S.optionalWith(S.Array(CreateMessageRequest), { nullable: true }),
1667
2653
  "tool_resources": S.optionalWith(
@@ -1695,9 +2681,11 @@ export class CreateThreadRequest extends S.Class<CreateThreadRequest>("CreateThr
1695
2681
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
1696
2682
  }) {}
1697
2683
 
2684
+ export class ThreadObjectObject extends S.Literal("thread") {}
2685
+
1698
2686
  export class ThreadObject extends S.Class<ThreadObject>("ThreadObject")({
1699
2687
  "id": S.String,
1700
- "object": S.Literal("thread"),
2688
+ "object": ThreadObjectObject,
1701
2689
  "created_at": S.Int,
1702
2690
  "tool_resources": S.NullOr(S.Struct({
1703
2691
  "code_interpreter": S.optionalWith(
@@ -1719,13 +2707,44 @@ export class ThreadObject extends S.Class<ThreadObject>("ThreadObject")({
1719
2707
  "metadata": S.NullOr(S.Record({ key: S.String, value: S.Unknown }))
1720
2708
  }) {}
1721
2709
 
2710
+ export class CreateThreadAndRunRequestModel extends S.Literal(
2711
+ "gpt-4o",
2712
+ "gpt-4o-2024-11-20",
2713
+ "gpt-4o-2024-08-06",
2714
+ "gpt-4o-2024-05-13",
2715
+ "gpt-4o-mini",
2716
+ "gpt-4o-mini-2024-07-18",
2717
+ "gpt-4-turbo",
2718
+ "gpt-4-turbo-2024-04-09",
2719
+ "gpt-4-0125-preview",
2720
+ "gpt-4-turbo-preview",
2721
+ "gpt-4-1106-preview",
2722
+ "gpt-4-vision-preview",
2723
+ "gpt-4",
2724
+ "gpt-4-0314",
2725
+ "gpt-4-0613",
2726
+ "gpt-4-32k",
2727
+ "gpt-4-32k-0314",
2728
+ "gpt-4-32k-0613",
2729
+ "gpt-3.5-turbo",
2730
+ "gpt-3.5-turbo-16k",
2731
+ "gpt-3.5-turbo-0613",
2732
+ "gpt-3.5-turbo-1106",
2733
+ "gpt-3.5-turbo-0125",
2734
+ "gpt-3.5-turbo-16k-0613"
2735
+ ) {}
2736
+
2737
+ export class TruncationObjectType extends S.Literal("auto", "last_messages") {}
2738
+
1722
2739
  export class TruncationObject extends S.Struct({
1723
- "type": S.Literal("auto", "last_messages"),
2740
+ "type": TruncationObjectType,
1724
2741
  "last_messages": S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1)), { nullable: true })
1725
2742
  }) {}
1726
2743
 
2744
+ export class AssistantsNamedToolChoiceType extends S.Literal("function", "code_interpreter", "file_search") {}
2745
+
1727
2746
  export class AssistantsNamedToolChoice extends S.Struct({
1728
- "type": S.Literal("function", "code_interpreter", "file_search"),
2747
+ "type": AssistantsNamedToolChoiceType,
1729
2748
  "function": S.optionalWith(
1730
2749
  S.Struct({
1731
2750
  "name": S.String
@@ -1741,38 +2760,7 @@ export class AssistantsApiToolChoiceOption
1741
2760
  export class CreateThreadAndRunRequest extends S.Class<CreateThreadAndRunRequest>("CreateThreadAndRunRequest")({
1742
2761
  "assistant_id": S.String,
1743
2762
  "thread": S.optionalWith(CreateThreadRequest, { nullable: true }),
1744
- "model": S.optionalWith(
1745
- S.Union(
1746
- S.String,
1747
- S.Literal(
1748
- "gpt-4o",
1749
- "gpt-4o-2024-08-06",
1750
- "gpt-4o-2024-05-13",
1751
- "gpt-4o-2024-08-06",
1752
- "gpt-4o-mini",
1753
- "gpt-4o-mini-2024-07-18",
1754
- "gpt-4-turbo",
1755
- "gpt-4-turbo-2024-04-09",
1756
- "gpt-4-0125-preview",
1757
- "gpt-4-turbo-preview",
1758
- "gpt-4-1106-preview",
1759
- "gpt-4-vision-preview",
1760
- "gpt-4",
1761
- "gpt-4-0314",
1762
- "gpt-4-0613",
1763
- "gpt-4-32k",
1764
- "gpt-4-32k-0314",
1765
- "gpt-4-32k-0613",
1766
- "gpt-3.5-turbo",
1767
- "gpt-3.5-turbo-16k",
1768
- "gpt-3.5-turbo-0613",
1769
- "gpt-3.5-turbo-1106",
1770
- "gpt-3.5-turbo-0125",
1771
- "gpt-3.5-turbo-16k-0613"
1772
- )
1773
- ),
1774
- { nullable: true }
1775
- ),
2763
+ "model": S.optionalWith(S.Union(S.String, CreateThreadAndRunRequestModel), { nullable: true }),
1776
2764
  "instructions": S.optionalWith(S.String, { nullable: true }),
1777
2765
  "tools": S.optionalWith(
1778
2766
  S.Array(S.Union(AssistantToolsCode, AssistantToolsFileSearch, AssistantToolsFunction)).pipe(S.maxItems(20)),
@@ -1816,15 +2804,37 @@ export class CreateThreadAndRunRequest extends S.Class<CreateThreadAndRunRequest
1816
2804
  "response_format": S.optionalWith(AssistantsApiResponseFormatOption, { nullable: true })
1817
2805
  }) {}
1818
2806
 
2807
+ export class RunObjectObject extends S.Literal("thread.run") {}
2808
+
2809
+ export class RunObjectStatus extends S.Literal(
2810
+ "queued",
2811
+ "in_progress",
2812
+ "requires_action",
2813
+ "cancelling",
2814
+ "cancelled",
2815
+ "failed",
2816
+ "completed",
2817
+ "incomplete",
2818
+ "expired"
2819
+ ) {}
2820
+
2821
+ export class RunObjectRequiredActionType extends S.Literal("submit_tool_outputs") {}
2822
+
2823
+ export class RunToolCallObjectType extends S.Literal("function") {}
2824
+
1819
2825
  export class RunToolCallObject extends S.Struct({
1820
2826
  "id": S.String,
1821
- "type": S.Literal("function"),
2827
+ "type": RunToolCallObjectType,
1822
2828
  "function": S.Struct({
1823
2829
  "name": S.String,
1824
2830
  "arguments": S.String
1825
2831
  })
1826
2832
  }) {}
1827
2833
 
2834
+ export class RunObjectLastErrorCode extends S.Literal("server_error", "rate_limit_exceeded", "invalid_prompt") {}
2835
+
2836
+ export class RunObjectIncompleteDetailsReason extends S.Literal("max_completion_tokens", "max_prompt_tokens") {}
2837
+
1828
2838
  export class RunCompletionUsage extends S.Struct({
1829
2839
  "completion_tokens": S.Int,
1830
2840
  "prompt_tokens": S.Int,
@@ -1833,29 +2843,19 @@ export class RunCompletionUsage extends S.Struct({
1833
2843
 
1834
2844
  export class RunObject extends S.Class<RunObject>("RunObject")({
1835
2845
  "id": S.String,
1836
- "object": S.Literal("thread.run"),
2846
+ "object": RunObjectObject,
1837
2847
  "created_at": S.Int,
1838
2848
  "thread_id": S.String,
1839
2849
  "assistant_id": S.String,
1840
- "status": S.Literal(
1841
- "queued",
1842
- "in_progress",
1843
- "requires_action",
1844
- "cancelling",
1845
- "cancelled",
1846
- "failed",
1847
- "completed",
1848
- "incomplete",
1849
- "expired"
1850
- ),
2850
+ "status": RunObjectStatus,
1851
2851
  "required_action": S.NullOr(S.Struct({
1852
- "type": S.Literal("submit_tool_outputs"),
2852
+ "type": RunObjectRequiredActionType,
1853
2853
  "submit_tool_outputs": S.Struct({
1854
2854
  "tool_calls": S.Array(RunToolCallObject)
1855
2855
  })
1856
2856
  })),
1857
2857
  "last_error": S.NullOr(S.Struct({
1858
- "code": S.Literal("server_error", "rate_limit_exceeded", "invalid_prompt"),
2858
+ "code": RunObjectLastErrorCode,
1859
2859
  "message": S.String
1860
2860
  })),
1861
2861
  "expires_at": S.NullOr(S.Int),
@@ -1864,7 +2864,7 @@ export class RunObject extends S.Class<RunObject>("RunObject")({
1864
2864
  "failed_at": S.NullOr(S.Int),
1865
2865
  "completed_at": S.NullOr(S.Int),
1866
2866
  "incomplete_details": S.NullOr(S.Struct({
1867
- "reason": S.optionalWith(S.Literal("max_completion_tokens", "max_prompt_tokens"), { nullable: true })
2867
+ "reason": S.optionalWith(RunObjectIncompleteDetailsReason, { nullable: true })
1868
2868
  })),
1869
2869
  "model": S.String,
1870
2870
  "instructions": S.String,
@@ -1906,22 +2906,40 @@ export class ModifyThreadRequest extends S.Class<ModifyThreadRequest>("ModifyThr
1906
2906
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
1907
2907
  }) {}
1908
2908
 
2909
+ export class DeleteThreadResponseObject extends S.Literal("thread.deleted") {}
2910
+
1909
2911
  export class DeleteThreadResponse extends S.Class<DeleteThreadResponse>("DeleteThreadResponse")({
1910
2912
  "id": S.String,
1911
2913
  "deleted": S.Boolean,
1912
- "object": S.Literal("thread.deleted")
2914
+ "object": DeleteThreadResponseObject
1913
2915
  }) {}
1914
2916
 
2917
+ export class ListMessagesParamsOrder extends S.Literal("asc", "desc") {}
2918
+
1915
2919
  export class ListMessagesParams extends S.Struct({
1916
2920
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
1917
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
2921
+ "order": S.optionalWith(ListMessagesParamsOrder, { nullable: true, default: () => "desc" as const }),
1918
2922
  "after": S.optionalWith(S.String, { nullable: true }),
1919
2923
  "before": S.optionalWith(S.String, { nullable: true }),
1920
2924
  "run_id": S.optionalWith(S.String, { nullable: true })
1921
2925
  }) {}
1922
2926
 
2927
+ export class MessageObjectObject extends S.Literal("thread.message") {}
2928
+
2929
+ export class MessageObjectStatus extends S.Literal("in_progress", "incomplete", "completed") {}
2930
+
2931
+ export class MessageObjectIncompleteDetailsReason
2932
+ extends S.Literal("content_filter", "max_tokens", "run_cancelled", "run_expired", "run_failed")
2933
+ {}
2934
+
2935
+ export class MessageObjectRole extends S.Literal("user", "assistant") {}
2936
+
2937
+ export class MessageContentTextObjectType extends S.Literal("text") {}
2938
+
2939
+ export class MessageContentTextAnnotationsFileCitationObjectType extends S.Literal("file_citation") {}
2940
+
1923
2941
  export class MessageContentTextAnnotationsFileCitationObject extends S.Struct({
1924
- "type": S.Literal("file_citation"),
2942
+ "type": MessageContentTextAnnotationsFileCitationObjectType,
1925
2943
  "text": S.String,
1926
2944
  "file_citation": S.Struct({
1927
2945
  "file_id": S.String
@@ -1930,8 +2948,10 @@ export class MessageContentTextAnnotationsFileCitationObject extends S.Struct({
1930
2948
  "end_index": S.Int.pipe(S.greaterThanOrEqualTo(0))
1931
2949
  }) {}
1932
2950
 
2951
+ export class MessageContentTextAnnotationsFilePathObjectType extends S.Literal("file_path") {}
2952
+
1933
2953
  export class MessageContentTextAnnotationsFilePathObject extends S.Struct({
1934
- "type": S.Literal("file_path"),
2954
+ "type": MessageContentTextAnnotationsFilePathObjectType,
1935
2955
  "text": S.String,
1936
2956
  "file_path": S.Struct({
1937
2957
  "file_id": S.String
@@ -1941,7 +2961,7 @@ export class MessageContentTextAnnotationsFilePathObject extends S.Struct({
1941
2961
  }) {}
1942
2962
 
1943
2963
  export class MessageContentTextObject extends S.Struct({
1944
- "type": S.Literal("text"),
2964
+ "type": MessageContentTextObjectType,
1945
2965
  "text": S.Struct({
1946
2966
  "value": S.String,
1947
2967
  "annotations": S.Array(
@@ -1950,23 +2970,25 @@ export class MessageContentTextObject extends S.Struct({
1950
2970
  })
1951
2971
  }) {}
1952
2972
 
2973
+ export class MessageContentRefusalObjectType extends S.Literal("refusal") {}
2974
+
1953
2975
  export class MessageContentRefusalObject extends S.Struct({
1954
- "type": S.Literal("refusal"),
2976
+ "type": MessageContentRefusalObjectType,
1955
2977
  "refusal": S.String
1956
2978
  }) {}
1957
2979
 
1958
2980
  export class MessageObject extends S.Struct({
1959
2981
  "id": S.String,
1960
- "object": S.Literal("thread.message"),
2982
+ "object": MessageObjectObject,
1961
2983
  "created_at": S.Int,
1962
2984
  "thread_id": S.String,
1963
- "status": S.Literal("in_progress", "incomplete", "completed"),
2985
+ "status": MessageObjectStatus,
1964
2986
  "incomplete_details": S.NullOr(S.Struct({
1965
- "reason": S.Literal("content_filter", "max_tokens", "run_cancelled", "run_expired", "run_failed")
2987
+ "reason": MessageObjectIncompleteDetailsReason
1966
2988
  })),
1967
2989
  "completed_at": S.NullOr(S.Int),
1968
2990
  "incomplete_at": S.NullOr(S.Int),
1969
- "role": S.Literal("user", "assistant"),
2991
+ "role": MessageObjectRole,
1970
2992
  "content": S.Array(
1971
2993
  S.Union(
1972
2994
  MessageContentImageFileObject,
@@ -1996,15 +3018,19 @@ export class ModifyMessageRequest extends S.Class<ModifyMessageRequest>("ModifyM
1996
3018
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
1997
3019
  }) {}
1998
3020
 
3021
+ export class DeleteMessageResponseObject extends S.Literal("thread.message.deleted") {}
3022
+
1999
3023
  export class DeleteMessageResponse extends S.Class<DeleteMessageResponse>("DeleteMessageResponse")({
2000
3024
  "id": S.String,
2001
3025
  "deleted": S.Boolean,
2002
- "object": S.Literal("thread.message.deleted")
3026
+ "object": DeleteMessageResponseObject
2003
3027
  }) {}
2004
3028
 
3029
+ export class ListRunsParamsOrder extends S.Literal("asc", "desc") {}
3030
+
2005
3031
  export class ListRunsParams extends S.Struct({
2006
3032
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
2007
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
3033
+ "order": S.optionalWith(ListRunsParamsOrder, { nullable: true, default: () => "desc" as const }),
2008
3034
  "after": S.optionalWith(S.String, { nullable: true }),
2009
3035
  "before": S.optionalWith(S.String, { nullable: true })
2010
3036
  }) {}
@@ -2017,46 +3043,42 @@ export class ListRunsResponse extends S.Class<ListRunsResponse>("ListRunsRespons
2017
3043
  "has_more": S.Boolean
2018
3044
  }) {}
2019
3045
 
3046
+ export class CreateRunParamsInclude extends S.Literal("step_details.tool_calls[*].file_search.results[*].content") {}
3047
+
2020
3048
  export class CreateRunParams extends S.Struct({
2021
- "include[]": S.optionalWith(S.Array(S.Literal("step_details.tool_calls[*].file_search.results[*].content")), {
2022
- nullable: true
2023
- })
2024
- }) {}
3049
+ "include[]": S.optionalWith(S.Array(CreateRunParamsInclude), { nullable: true })
3050
+ }) {}
3051
+
3052
+ export class CreateRunRequestModel extends S.Literal(
3053
+ "gpt-4o",
3054
+ "gpt-4o-2024-11-20",
3055
+ "gpt-4o-2024-08-06",
3056
+ "gpt-4o-2024-05-13",
3057
+ "gpt-4o-mini",
3058
+ "gpt-4o-mini-2024-07-18",
3059
+ "gpt-4-turbo",
3060
+ "gpt-4-turbo-2024-04-09",
3061
+ "gpt-4-0125-preview",
3062
+ "gpt-4-turbo-preview",
3063
+ "gpt-4-1106-preview",
3064
+ "gpt-4-vision-preview",
3065
+ "gpt-4",
3066
+ "gpt-4-0314",
3067
+ "gpt-4-0613",
3068
+ "gpt-4-32k",
3069
+ "gpt-4-32k-0314",
3070
+ "gpt-4-32k-0613",
3071
+ "gpt-3.5-turbo",
3072
+ "gpt-3.5-turbo-16k",
3073
+ "gpt-3.5-turbo-0613",
3074
+ "gpt-3.5-turbo-1106",
3075
+ "gpt-3.5-turbo-0125",
3076
+ "gpt-3.5-turbo-16k-0613"
3077
+ ) {}
2025
3078
 
2026
3079
  export class CreateRunRequest extends S.Class<CreateRunRequest>("CreateRunRequest")({
2027
3080
  "assistant_id": S.String,
2028
- "model": S.optionalWith(
2029
- S.Union(
2030
- S.String,
2031
- S.Literal(
2032
- "gpt-4o",
2033
- "gpt-4o-2024-08-06",
2034
- "gpt-4o-2024-05-13",
2035
- "gpt-4o-2024-08-06",
2036
- "gpt-4o-mini",
2037
- "gpt-4o-mini-2024-07-18",
2038
- "gpt-4-turbo",
2039
- "gpt-4-turbo-2024-04-09",
2040
- "gpt-4-0125-preview",
2041
- "gpt-4-turbo-preview",
2042
- "gpt-4-1106-preview",
2043
- "gpt-4-vision-preview",
2044
- "gpt-4",
2045
- "gpt-4-0314",
2046
- "gpt-4-0613",
2047
- "gpt-4-32k",
2048
- "gpt-4-32k-0314",
2049
- "gpt-4-32k-0613",
2050
- "gpt-3.5-turbo",
2051
- "gpt-3.5-turbo-16k",
2052
- "gpt-3.5-turbo-0613",
2053
- "gpt-3.5-turbo-1106",
2054
- "gpt-3.5-turbo-0125",
2055
- "gpt-3.5-turbo-16k-0613"
2056
- )
2057
- ),
2058
- { nullable: true }
2059
- ),
3081
+ "model": S.optionalWith(S.Union(S.String, CreateRunRequestModel), { nullable: true }),
2060
3082
  "instructions": S.optionalWith(S.String, { nullable: true }),
2061
3083
  "additional_instructions": S.optionalWith(S.String, { nullable: true }),
2062
3084
  "additional_messages": S.optionalWith(S.Array(CreateMessageRequest), { nullable: true }),
@@ -2086,30 +3108,48 @@ export class ModifyRunRequest extends S.Class<ModifyRunRequest>("ModifyRunReques
2086
3108
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
2087
3109
  }) {}
2088
3110
 
3111
+ export class ListRunStepsParamsOrder extends S.Literal("asc", "desc") {}
3112
+
3113
+ export class ListRunStepsParamsInclude extends S.Literal("step_details.tool_calls[*].file_search.results[*].content") {}
3114
+
2089
3115
  export class ListRunStepsParams extends S.Struct({
2090
3116
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
2091
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
3117
+ "order": S.optionalWith(ListRunStepsParamsOrder, { nullable: true, default: () => "desc" as const }),
2092
3118
  "after": S.optionalWith(S.String, { nullable: true }),
2093
3119
  "before": S.optionalWith(S.String, { nullable: true }),
2094
- "include[]": S.optionalWith(S.Array(S.Literal("step_details.tool_calls[*].file_search.results[*].content")), {
2095
- nullable: true
2096
- })
3120
+ "include[]": S.optionalWith(S.Array(ListRunStepsParamsInclude), { nullable: true })
2097
3121
  }) {}
2098
3122
 
3123
+ export class RunStepObjectObject extends S.Literal("thread.run.step") {}
3124
+
3125
+ export class RunStepObjectType extends S.Literal("message_creation", "tool_calls") {}
3126
+
3127
+ export class RunStepObjectStatus extends S.Literal("in_progress", "cancelled", "failed", "completed", "expired") {}
3128
+
3129
+ export class RunStepDetailsMessageCreationObjectType extends S.Literal("message_creation") {}
3130
+
2099
3131
  export class RunStepDetailsMessageCreationObject extends S.Struct({
2100
- "type": S.Literal("message_creation"),
3132
+ "type": RunStepDetailsMessageCreationObjectType,
2101
3133
  "message_creation": S.Struct({
2102
3134
  "message_id": S.String
2103
3135
  })
2104
3136
  }) {}
2105
3137
 
3138
+ export class RunStepDetailsToolCallsObjectType extends S.Literal("tool_calls") {}
3139
+
3140
+ export class RunStepDetailsToolCallsCodeObjectType extends S.Literal("code_interpreter") {}
3141
+
3142
+ export class RunStepDetailsToolCallsCodeOutputLogsObjectType extends S.Literal("logs") {}
3143
+
2106
3144
  export class RunStepDetailsToolCallsCodeOutputLogsObject extends S.Struct({
2107
- "type": S.Literal("logs"),
3145
+ "type": RunStepDetailsToolCallsCodeOutputLogsObjectType,
2108
3146
  "logs": S.String
2109
3147
  }) {}
2110
3148
 
3149
+ export class RunStepDetailsToolCallsCodeOutputImageObjectType extends S.Literal("image") {}
3150
+
2111
3151
  export class RunStepDetailsToolCallsCodeOutputImageObject extends S.Struct({
2112
- "type": S.Literal("image"),
3152
+ "type": RunStepDetailsToolCallsCodeOutputImageObjectType,
2113
3153
  "image": S.Struct({
2114
3154
  "file_id": S.String
2115
3155
  })
@@ -2117,25 +3157,31 @@ export class RunStepDetailsToolCallsCodeOutputImageObject extends S.Struct({
2117
3157
 
2118
3158
  export class RunStepDetailsToolCallsCodeObject extends S.Struct({
2119
3159
  "id": S.String,
2120
- "type": S.Literal("code_interpreter"),
3160
+ "type": RunStepDetailsToolCallsCodeObjectType,
2121
3161
  "code_interpreter": S.Struct({
2122
3162
  "input": S.String,
2123
3163
  "outputs": S.Array(S.Record({ key: S.String, value: S.Unknown }))
2124
3164
  })
2125
3165
  }) {}
2126
3166
 
3167
+ export class RunStepDetailsToolCallsFileSearchObjectType extends S.Literal("file_search") {}
3168
+
3169
+ export class RunStepDetailsToolCallsFileSearchRankingOptionsObjectRanker extends S.Literal("default_2024_08_21") {}
3170
+
2127
3171
  export class RunStepDetailsToolCallsFileSearchRankingOptionsObject extends S.Struct({
2128
- "ranker": S.Literal("default_2024_08_21"),
3172
+ "ranker": RunStepDetailsToolCallsFileSearchRankingOptionsObjectRanker,
2129
3173
  "score_threshold": S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1))
2130
3174
  }) {}
2131
3175
 
3176
+ export class RunStepDetailsToolCallsFileSearchResultObjectContentType extends S.Literal("text") {}
3177
+
2132
3178
  export class RunStepDetailsToolCallsFileSearchResultObject extends S.Struct({
2133
3179
  "file_id": S.String,
2134
3180
  "file_name": S.String,
2135
3181
  "score": S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)),
2136
3182
  "content": S.optionalWith(
2137
3183
  S.Array(S.Struct({
2138
- "type": S.optionalWith(S.Literal("text"), { nullable: true }),
3184
+ "type": S.optionalWith(RunStepDetailsToolCallsFileSearchResultObjectContentType, { nullable: true }),
2139
3185
  "text": S.optionalWith(S.String, { nullable: true })
2140
3186
  })),
2141
3187
  { nullable: true }
@@ -2144,16 +3190,18 @@ export class RunStepDetailsToolCallsFileSearchResultObject extends S.Struct({
2144
3190
 
2145
3191
  export class RunStepDetailsToolCallsFileSearchObject extends S.Struct({
2146
3192
  "id": S.String,
2147
- "type": S.Literal("file_search"),
3193
+ "type": RunStepDetailsToolCallsFileSearchObjectType,
2148
3194
  "file_search": S.Struct({
2149
3195
  "ranking_options": S.optionalWith(RunStepDetailsToolCallsFileSearchRankingOptionsObject, { nullable: true }),
2150
3196
  "results": S.optionalWith(S.Array(RunStepDetailsToolCallsFileSearchResultObject), { nullable: true })
2151
3197
  })
2152
3198
  }) {}
2153
3199
 
3200
+ export class RunStepDetailsToolCallsFunctionObjectType extends S.Literal("function") {}
3201
+
2154
3202
  export class RunStepDetailsToolCallsFunctionObject extends S.Struct({
2155
3203
  "id": S.String,
2156
- "type": S.Literal("function"),
3204
+ "type": RunStepDetailsToolCallsFunctionObjectType,
2157
3205
  "function": S.Struct({
2158
3206
  "name": S.String,
2159
3207
  "arguments": S.String,
@@ -2162,7 +3210,7 @@ export class RunStepDetailsToolCallsFunctionObject extends S.Struct({
2162
3210
  }) {}
2163
3211
 
2164
3212
  export class RunStepDetailsToolCallsObject extends S.Struct({
2165
- "type": S.Literal("tool_calls"),
3213
+ "type": RunStepDetailsToolCallsObjectType,
2166
3214
  "tool_calls": S.Array(
2167
3215
  S.Union(
2168
3216
  RunStepDetailsToolCallsCodeObject,
@@ -2172,6 +3220,8 @@ export class RunStepDetailsToolCallsObject extends S.Struct({
2172
3220
  )
2173
3221
  }) {}
2174
3222
 
3223
+ export class RunStepObjectLastErrorCode extends S.Literal("server_error", "rate_limit_exceeded") {}
3224
+
2175
3225
  export class RunStepCompletionUsage extends S.Struct({
2176
3226
  "completion_tokens": S.Int,
2177
3227
  "prompt_tokens": S.Int,
@@ -2180,16 +3230,16 @@ export class RunStepCompletionUsage extends S.Struct({
2180
3230
 
2181
3231
  export class RunStepObject extends S.Struct({
2182
3232
  "id": S.String,
2183
- "object": S.Literal("thread.run.step"),
3233
+ "object": RunStepObjectObject,
2184
3234
  "created_at": S.Int,
2185
3235
  "assistant_id": S.String,
2186
3236
  "thread_id": S.String,
2187
3237
  "run_id": S.String,
2188
- "type": S.Literal("message_creation", "tool_calls"),
2189
- "status": S.Literal("in_progress", "cancelled", "failed", "completed", "expired"),
3238
+ "type": RunStepObjectType,
3239
+ "status": RunStepObjectStatus,
2190
3240
  "step_details": S.Record({ key: S.String, value: S.Unknown }),
2191
3241
  "last_error": S.NullOr(S.Struct({
2192
- "code": S.Literal("server_error", "rate_limit_exceeded"),
3242
+ "code": RunStepObjectLastErrorCode,
2193
3243
  "message": S.String
2194
3244
  })),
2195
3245
  "expired_at": S.NullOr(S.Int),
@@ -2208,10 +3258,10 @@ export class ListRunStepsResponse extends S.Class<ListRunStepsResponse>("ListRun
2208
3258
  "has_more": S.Boolean
2209
3259
  }) {}
2210
3260
 
3261
+ export class GetRunStepParamsInclude extends S.Literal("step_details.tool_calls[*].file_search.results[*].content") {}
3262
+
2211
3263
  export class GetRunStepParams extends S.Struct({
2212
- "include[]": S.optionalWith(S.Array(S.Literal("step_details.tool_calls[*].file_search.results[*].content")), {
2213
- nullable: true
2214
- })
3264
+ "include[]": S.optionalWith(S.Array(GetRunStepParamsInclude), { nullable: true })
2215
3265
  }) {}
2216
3266
 
2217
3267
  export class SubmitToolOutputsRunRequest extends S.Class<SubmitToolOutputsRunRequest>("SubmitToolOutputsRunRequest")({
@@ -2222,22 +3272,28 @@ export class SubmitToolOutputsRunRequest extends S.Class<SubmitToolOutputsRunReq
2222
3272
  "stream": S.optionalWith(S.Boolean, { nullable: true })
2223
3273
  }) {}
2224
3274
 
3275
+ export class CreateUploadRequestPurpose extends S.Literal("assistants", "batch", "fine-tune", "vision") {}
3276
+
2225
3277
  export class CreateUploadRequest extends S.Class<CreateUploadRequest>("CreateUploadRequest")({
2226
3278
  "filename": S.String,
2227
- "purpose": S.Literal("assistants", "batch", "fine-tune", "vision"),
3279
+ "purpose": CreateUploadRequestPurpose,
2228
3280
  "bytes": S.Int,
2229
3281
  "mime_type": S.String
2230
3282
  }) {}
2231
3283
 
3284
+ export class UploadStatus extends S.Literal("pending", "completed", "cancelled", "expired") {}
3285
+
3286
+ export class UploadObject extends S.Literal("upload") {}
3287
+
2232
3288
  export class Upload extends S.Class<Upload>("Upload")({
2233
3289
  "id": S.String,
2234
3290
  "created_at": S.Int,
2235
3291
  "filename": S.String,
2236
3292
  "bytes": S.Int,
2237
3293
  "purpose": S.String,
2238
- "status": S.Literal("pending", "completed", "cancelled", "expired"),
3294
+ "status": UploadStatus,
2239
3295
  "expires_at": S.Int,
2240
- "object": S.optionalWith(S.Literal("upload"), { nullable: true }),
3296
+ "object": S.optionalWith(UploadObject, { nullable: true }),
2241
3297
  "file": S.optionalWith(OpenAIFile, { nullable: true })
2242
3298
  }) {}
2243
3299
 
@@ -2246,28 +3302,38 @@ export class CompleteUploadRequest extends S.Class<CompleteUploadRequest>("Compl
2246
3302
  "md5": S.optionalWith(S.String, { nullable: true })
2247
3303
  }) {}
2248
3304
 
3305
+ export class UploadPartObject extends S.Literal("upload.part") {}
3306
+
2249
3307
  export class UploadPart extends S.Class<UploadPart>("UploadPart")({
2250
3308
  "id": S.String,
2251
3309
  "created_at": S.Int,
2252
3310
  "upload_id": S.String,
2253
- "object": S.Literal("upload.part")
3311
+ "object": UploadPartObject
2254
3312
  }) {}
2255
3313
 
3314
+ export class ListVectorStoresParamsOrder extends S.Literal("asc", "desc") {}
3315
+
2256
3316
  export class ListVectorStoresParams extends S.Struct({
2257
3317
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
2258
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
3318
+ "order": S.optionalWith(ListVectorStoresParamsOrder, { nullable: true, default: () => "desc" as const }),
2259
3319
  "after": S.optionalWith(S.String, { nullable: true }),
2260
3320
  "before": S.optionalWith(S.String, { nullable: true })
2261
3321
  }) {}
2262
3322
 
3323
+ export class VectorStoreObjectObject extends S.Literal("vector_store") {}
3324
+
3325
+ export class VectorStoreObjectStatus extends S.Literal("expired", "in_progress", "completed") {}
3326
+
3327
+ export class VectorStoreExpirationAfterAnchor extends S.Literal("last_active_at") {}
3328
+
2263
3329
  export class VectorStoreExpirationAfter extends S.Struct({
2264
- "anchor": S.Literal("last_active_at"),
3330
+ "anchor": VectorStoreExpirationAfterAnchor,
2265
3331
  "days": S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(365))
2266
3332
  }) {}
2267
3333
 
2268
3334
  export class VectorStoreObject extends S.Struct({
2269
3335
  "id": S.String,
2270
- "object": S.Literal("vector_store"),
3336
+ "object": VectorStoreObjectObject,
2271
3337
  "created_at": S.Int,
2272
3338
  "name": S.String,
2273
3339
  "usage_bytes": S.Int,
@@ -2278,7 +3344,7 @@ export class VectorStoreObject extends S.Struct({
2278
3344
  "cancelled": S.Int,
2279
3345
  "total": S.Int
2280
3346
  }),
2281
- "status": S.Literal("expired", "in_progress", "completed"),
3347
+ "status": VectorStoreObjectStatus,
2282
3348
  "expires_after": S.optionalWith(VectorStoreExpirationAfter, { nullable: true }),
2283
3349
  "expires_at": S.optionalWith(S.Int, { nullable: true }),
2284
3350
  "last_active_at": S.NullOr(S.Int),
@@ -2293,17 +3359,21 @@ export class ListVectorStoresResponse extends S.Class<ListVectorStoresResponse>(
2293
3359
  "has_more": S.Boolean
2294
3360
  }) {}
2295
3361
 
3362
+ export class AutoChunkingStrategyRequestParamType extends S.Literal("auto") {}
3363
+
2296
3364
  export class AutoChunkingStrategyRequestParam extends S.Struct({
2297
- "type": S.Literal("auto")
3365
+ "type": AutoChunkingStrategyRequestParamType
2298
3366
  }) {}
2299
3367
 
3368
+ export class StaticChunkingStrategyRequestParamType extends S.Literal("static") {}
3369
+
2300
3370
  export class StaticChunkingStrategy extends S.Struct({
2301
3371
  "max_chunk_size_tokens": S.Int.pipe(S.greaterThanOrEqualTo(100), S.lessThanOrEqualTo(4096)),
2302
3372
  "chunk_overlap_tokens": S.Int
2303
3373
  }) {}
2304
3374
 
2305
3375
  export class StaticChunkingStrategyRequestParam extends S.Struct({
2306
- "type": S.Literal("static"),
3376
+ "type": StaticChunkingStrategyRequestParamType,
2307
3377
  "static": StaticChunkingStrategy
2308
3378
  }) {}
2309
3379
 
@@ -2321,10 +3391,12 @@ export class UpdateVectorStoreRequest extends S.Class<UpdateVectorStoreRequest>(
2321
3391
  "metadata": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
2322
3392
  }) {}
2323
3393
 
3394
+ export class DeleteVectorStoreResponseObject extends S.Literal("vector_store.deleted") {}
3395
+
2324
3396
  export class DeleteVectorStoreResponse extends S.Class<DeleteVectorStoreResponse>("DeleteVectorStoreResponse")({
2325
3397
  "id": S.String,
2326
3398
  "deleted": S.Boolean,
2327
- "object": S.Literal("vector_store.deleted")
3399
+ "object": DeleteVectorStoreResponseObject
2328
3400
  }) {}
2329
3401
 
2330
3402
  export class ChunkingStrategyRequestParam extends S.Record({ key: S.String, value: S.Unknown }) {}
@@ -2336,12 +3408,16 @@ export class CreateVectorStoreFileBatchRequest
2336
3408
  })
2337
3409
  {}
2338
3410
 
3411
+ export class VectorStoreFileBatchObjectObject extends S.Literal("vector_store.files_batch") {}
3412
+
3413
+ export class VectorStoreFileBatchObjectStatus extends S.Literal("in_progress", "completed", "cancelled", "failed") {}
3414
+
2339
3415
  export class VectorStoreFileBatchObject extends S.Class<VectorStoreFileBatchObject>("VectorStoreFileBatchObject")({
2340
3416
  "id": S.String,
2341
- "object": S.Literal("vector_store.files_batch"),
3417
+ "object": VectorStoreFileBatchObjectObject,
2342
3418
  "created_at": S.Int,
2343
3419
  "vector_store_id": S.String,
2344
- "status": S.Literal("in_progress", "completed", "cancelled", "failed"),
3420
+ "status": VectorStoreFileBatchObjectStatus,
2345
3421
  "file_counts": S.Struct({
2346
3422
  "in_progress": S.Int,
2347
3423
  "completed": S.Int,
@@ -2351,32 +3427,48 @@ export class VectorStoreFileBatchObject extends S.Class<VectorStoreFileBatchObje
2351
3427
  })
2352
3428
  }) {}
2353
3429
 
3430
+ export class ListFilesInVectorStoreBatchParamsOrder extends S.Literal("asc", "desc") {}
3431
+
3432
+ export class ListFilesInVectorStoreBatchParamsFilter
3433
+ extends S.Literal("in_progress", "completed", "failed", "cancelled")
3434
+ {}
3435
+
2354
3436
  export class ListFilesInVectorStoreBatchParams extends S.Struct({
2355
3437
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
2356
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
3438
+ "order": S.optionalWith(ListFilesInVectorStoreBatchParamsOrder, { nullable: true, default: () => "desc" as const }),
2357
3439
  "after": S.optionalWith(S.String, { nullable: true }),
2358
3440
  "before": S.optionalWith(S.String, { nullable: true }),
2359
- "filter": S.optionalWith(S.Literal("in_progress", "completed", "failed", "cancelled"), { nullable: true })
3441
+ "filter": S.optionalWith(ListFilesInVectorStoreBatchParamsFilter, { nullable: true })
2360
3442
  }) {}
2361
3443
 
3444
+ export class VectorStoreFileObjectObject extends S.Literal("vector_store.file") {}
3445
+
3446
+ export class VectorStoreFileObjectStatus extends S.Literal("in_progress", "completed", "cancelled", "failed") {}
3447
+
3448
+ export class VectorStoreFileObjectLastErrorCode extends S.Literal("server_error", "unsupported_file", "invalid_file") {}
3449
+
3450
+ export class StaticChunkingStrategyResponseParamType extends S.Literal("static") {}
3451
+
2362
3452
  export class StaticChunkingStrategyResponseParam extends S.Struct({
2363
- "type": S.Literal("static"),
3453
+ "type": StaticChunkingStrategyResponseParamType,
2364
3454
  "static": StaticChunkingStrategy
2365
3455
  }) {}
2366
3456
 
3457
+ export class OtherChunkingStrategyResponseParamType extends S.Literal("other") {}
3458
+
2367
3459
  export class OtherChunkingStrategyResponseParam extends S.Struct({
2368
- "type": S.Literal("other")
3460
+ "type": OtherChunkingStrategyResponseParamType
2369
3461
  }) {}
2370
3462
 
2371
3463
  export class VectorStoreFileObject extends S.Struct({
2372
3464
  "id": S.String,
2373
- "object": S.Literal("vector_store.file"),
3465
+ "object": VectorStoreFileObjectObject,
2374
3466
  "usage_bytes": S.Int,
2375
3467
  "created_at": S.Int,
2376
3468
  "vector_store_id": S.String,
2377
- "status": S.Literal("in_progress", "completed", "cancelled", "failed"),
3469
+ "status": VectorStoreFileObjectStatus,
2378
3470
  "last_error": S.NullOr(S.Struct({
2379
- "code": S.Literal("server_error", "unsupported_file", "invalid_file"),
3471
+ "code": VectorStoreFileObjectLastErrorCode,
2380
3472
  "message": S.String
2381
3473
  })),
2382
3474
  "chunking_strategy": S.optionalWith(S.Record({ key: S.String, value: S.Unknown }), { nullable: true })
@@ -2392,12 +3484,16 @@ export class ListVectorStoreFilesResponse
2392
3484
  })
2393
3485
  {}
2394
3486
 
3487
+ export class ListVectorStoreFilesParamsOrder extends S.Literal("asc", "desc") {}
3488
+
3489
+ export class ListVectorStoreFilesParamsFilter extends S.Literal("in_progress", "completed", "failed", "cancelled") {}
3490
+
2395
3491
  export class ListVectorStoreFilesParams extends S.Struct({
2396
3492
  "limit": S.optionalWith(S.Int, { nullable: true, default: () => 20 as const }),
2397
- "order": S.optionalWith(S.Literal("asc", "desc"), { nullable: true, default: () => "desc" as const }),
3493
+ "order": S.optionalWith(ListVectorStoreFilesParamsOrder, { nullable: true, default: () => "desc" as const }),
2398
3494
  "after": S.optionalWith(S.String, { nullable: true }),
2399
3495
  "before": S.optionalWith(S.String, { nullable: true }),
2400
- "filter": S.optionalWith(S.Literal("in_progress", "completed", "failed", "cancelled"), { nullable: true })
3496
+ "filter": S.optionalWith(ListVectorStoreFilesParamsFilter, { nullable: true })
2401
3497
  }) {}
2402
3498
 
2403
3499
  export class CreateVectorStoreFileRequest
@@ -2407,11 +3503,13 @@ export class CreateVectorStoreFileRequest
2407
3503
  })
2408
3504
  {}
2409
3505
 
3506
+ export class DeleteVectorStoreFileResponseObject extends S.Literal("vector_store.file.deleted") {}
3507
+
2410
3508
  export class DeleteVectorStoreFileResponse
2411
3509
  extends S.Class<DeleteVectorStoreFileResponse>("DeleteVectorStoreFileResponse")({
2412
3510
  "id": S.String,
2413
3511
  "deleted": S.Boolean,
2414
- "object": S.Literal("vector_store.file.deleted")
3512
+ "object": DeleteVectorStoreFileResponseObject
2415
3513
  })
2416
3514
  {}
2417
3515
 
@@ -2655,7 +3753,12 @@ export const make = (httpClient: HttpClient.HttpClient): Client => {
2655
3753
  ),
2656
3754
  "listFiles": (options) =>
2657
3755
  HttpClientRequest.make("GET")(`/files`).pipe(
2658
- HttpClientRequest.setUrlParams({ "purpose": options["purpose"] }),
3756
+ HttpClientRequest.setUrlParams({
3757
+ "purpose": options["purpose"],
3758
+ "limit": options["limit"],
3759
+ "order": options["order"],
3760
+ "after": options["after"]
3761
+ }),
2659
3762
  Effect.succeed,
2660
3763
  Effect.flatMap((request) =>
2661
3764
  Effect.flatMap(
@@ -2912,6 +4015,67 @@ export const make = (httpClient: HttpClient.HttpClient): Client => {
2912
4015
  ),
2913
4016
  Effect.scoped
2914
4017
  ),
4018
+ "adminApiKeysList": (options) =>
4019
+ HttpClientRequest.make("GET")(`/organization/admin_api_keys`).pipe(
4020
+ HttpClientRequest.setUrlParams({
4021
+ "after": options["after"],
4022
+ "order": options["order"],
4023
+ "limit": options["limit"]
4024
+ }),
4025
+ Effect.succeed,
4026
+ Effect.flatMap((request) =>
4027
+ Effect.flatMap(
4028
+ httpClient.execute(request),
4029
+ HttpClientResponse.matchStatus({
4030
+ "200": (r) => HttpClientResponse.schemaBodyJson(ApiKeyList)(r),
4031
+ orElse: (response) => unexpectedStatus(request, response)
4032
+ })
4033
+ )
4034
+ ),
4035
+ Effect.scoped
4036
+ ),
4037
+ "adminApiKeysCreate": (options) =>
4038
+ HttpClientRequest.make("POST")(`/organization/admin_api_keys`).pipe(
4039
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
4040
+ Effect.flatMap((request) =>
4041
+ Effect.flatMap(
4042
+ httpClient.execute(request),
4043
+ HttpClientResponse.matchStatus({
4044
+ "200": (r) => HttpClientResponse.schemaBodyJson(AdminApiKey)(r),
4045
+ orElse: (response) => unexpectedStatus(request, response)
4046
+ })
4047
+ )
4048
+ ),
4049
+ Effect.scoped
4050
+ ),
4051
+ "adminApiKeysGet": (keyId) =>
4052
+ HttpClientRequest.make("GET")(`/organization/admin_api_keys/${keyId}`).pipe(
4053
+ Effect.succeed,
4054
+ Effect.flatMap((request) =>
4055
+ Effect.flatMap(
4056
+ httpClient.execute(request),
4057
+ HttpClientResponse.matchStatus({
4058
+ "200": (r) => HttpClientResponse.schemaBodyJson(AdminApiKey)(r),
4059
+ orElse: (response) => unexpectedStatus(request, response)
4060
+ })
4061
+ )
4062
+ ),
4063
+ Effect.scoped
4064
+ ),
4065
+ "adminApiKeysDelete": (keyId) =>
4066
+ HttpClientRequest.make("DELETE")(`/organization/admin_api_keys/${keyId}`).pipe(
4067
+ Effect.succeed,
4068
+ Effect.flatMap((request) =>
4069
+ Effect.flatMap(
4070
+ httpClient.execute(request),
4071
+ HttpClientResponse.matchStatus({
4072
+ "200": (r) => HttpClientResponse.schemaBodyJson(AdminApiKeysDelete200)(r),
4073
+ orElse: (response) => unexpectedStatus(request, response)
4074
+ })
4075
+ )
4076
+ ),
4077
+ Effect.scoped
4078
+ ),
2915
4079
  "listAuditLogs": (options) =>
2916
4080
  HttpClientRequest.make("GET")(`/organization/audit_logs`).pipe(
2917
4081
  HttpClientRequest.setUrlParams({
@@ -2940,6 +4104,29 @@ export const make = (httpClient: HttpClient.HttpClient): Client => {
2940
4104
  ),
2941
4105
  Effect.scoped
2942
4106
  ),
4107
+ "usageCosts": (options) =>
4108
+ HttpClientRequest.make("GET")(`/organization/costs`).pipe(
4109
+ HttpClientRequest.setUrlParams({
4110
+ "start_time": options["start_time"],
4111
+ "end_time": options["end_time"],
4112
+ "bucket_width": options["bucket_width"],
4113
+ "project_ids": options["project_ids"],
4114
+ "group_by": options["group_by"],
4115
+ "limit": options["limit"],
4116
+ "page": options["page"]
4117
+ }),
4118
+ Effect.succeed,
4119
+ Effect.flatMap((request) =>
4120
+ Effect.flatMap(
4121
+ httpClient.execute(request),
4122
+ HttpClientResponse.matchStatus({
4123
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4124
+ orElse: (response) => unexpectedStatus(request, response)
4125
+ })
4126
+ )
4127
+ ),
4128
+ Effect.scoped
4129
+ ),
2943
4130
  "listInvites": (options) =>
2944
4131
  HttpClientRequest.make("GET")(`/organization/invites`).pipe(
2945
4132
  HttpClientRequest.setUrlParams({ "limit": options["limit"], "after": options["after"] }),
@@ -3117,6 +4304,40 @@ export const make = (httpClient: HttpClient.HttpClient): Client => {
3117
4304
  ),
3118
4305
  Effect.scoped
3119
4306
  ),
4307
+ "listProjectRateLimits": (projectId, options) =>
4308
+ HttpClientRequest.make("GET")(`/organization/projects/${projectId}/rate_limits`).pipe(
4309
+ HttpClientRequest.setUrlParams({
4310
+ "limit": options["limit"],
4311
+ "after": options["after"],
4312
+ "before": options["before"]
4313
+ }),
4314
+ Effect.succeed,
4315
+ Effect.flatMap((request) =>
4316
+ Effect.flatMap(
4317
+ httpClient.execute(request),
4318
+ HttpClientResponse.matchStatus({
4319
+ "200": (r) => HttpClientResponse.schemaBodyJson(ProjectRateLimitListResponse)(r),
4320
+ orElse: (response) => unexpectedStatus(request, response)
4321
+ })
4322
+ )
4323
+ ),
4324
+ Effect.scoped
4325
+ ),
4326
+ "updateProjectRateLimits": (projectId, rateLimitId, options) =>
4327
+ HttpClientRequest.make("POST")(`/organization/projects/${projectId}/rate_limits/${rateLimitId}`).pipe(
4328
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
4329
+ Effect.flatMap((request) =>
4330
+ Effect.flatMap(
4331
+ httpClient.execute(request),
4332
+ HttpClientResponse.matchStatus({
4333
+ "200": (r) => HttpClientResponse.schemaBodyJson(ProjectRateLimit)(r),
4334
+ "400": (r) => decodeError(r, ErrorResponse),
4335
+ orElse: (response) => unexpectedStatus(request, response)
4336
+ })
4337
+ )
4338
+ ),
4339
+ Effect.scoped
4340
+ ),
3120
4341
  "listProjectServiceAccounts": (projectId, options) =>
3121
4342
  HttpClientRequest.make("GET")(`/organization/projects/${projectId}/service_accounts`).pipe(
3122
4343
  HttpClientRequest.setUrlParams({ "limit": options["limit"], "after": options["after"] }),
@@ -3251,6 +4472,211 @@ export const make = (httpClient: HttpClient.HttpClient): Client => {
3251
4472
  ),
3252
4473
  Effect.scoped
3253
4474
  ),
4475
+ "usageAudioSpeeches": (options) =>
4476
+ HttpClientRequest.make("GET")(`/organization/usage/audio_speeches`).pipe(
4477
+ HttpClientRequest.setUrlParams({
4478
+ "start_time": options["start_time"],
4479
+ "end_time": options["end_time"],
4480
+ "bucket_width": options["bucket_width"],
4481
+ "project_ids": options["project_ids"],
4482
+ "user_ids": options["user_ids"],
4483
+ "api_key_ids": options["api_key_ids"],
4484
+ "models": options["models"],
4485
+ "group_by": options["group_by"],
4486
+ "limit": options["limit"],
4487
+ "page": options["page"]
4488
+ }),
4489
+ Effect.succeed,
4490
+ Effect.flatMap((request) =>
4491
+ Effect.flatMap(
4492
+ httpClient.execute(request),
4493
+ HttpClientResponse.matchStatus({
4494
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4495
+ orElse: (response) => unexpectedStatus(request, response)
4496
+ })
4497
+ )
4498
+ ),
4499
+ Effect.scoped
4500
+ ),
4501
+ "usageAudioTranscriptions": (options) =>
4502
+ HttpClientRequest.make("GET")(`/organization/usage/audio_transcriptions`).pipe(
4503
+ HttpClientRequest.setUrlParams({
4504
+ "start_time": options["start_time"],
4505
+ "end_time": options["end_time"],
4506
+ "bucket_width": options["bucket_width"],
4507
+ "project_ids": options["project_ids"],
4508
+ "user_ids": options["user_ids"],
4509
+ "api_key_ids": options["api_key_ids"],
4510
+ "models": options["models"],
4511
+ "group_by": options["group_by"],
4512
+ "limit": options["limit"],
4513
+ "page": options["page"]
4514
+ }),
4515
+ Effect.succeed,
4516
+ Effect.flatMap((request) =>
4517
+ Effect.flatMap(
4518
+ httpClient.execute(request),
4519
+ HttpClientResponse.matchStatus({
4520
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4521
+ orElse: (response) => unexpectedStatus(request, response)
4522
+ })
4523
+ )
4524
+ ),
4525
+ Effect.scoped
4526
+ ),
4527
+ "usageCodeInterpreterSessions": (options) =>
4528
+ HttpClientRequest.make("GET")(`/organization/usage/code_interpreter_sessions`).pipe(
4529
+ HttpClientRequest.setUrlParams({
4530
+ "start_time": options["start_time"],
4531
+ "end_time": options["end_time"],
4532
+ "bucket_width": options["bucket_width"],
4533
+ "project_ids": options["project_ids"],
4534
+ "group_by": options["group_by"],
4535
+ "limit": options["limit"],
4536
+ "page": options["page"]
4537
+ }),
4538
+ Effect.succeed,
4539
+ Effect.flatMap((request) =>
4540
+ Effect.flatMap(
4541
+ httpClient.execute(request),
4542
+ HttpClientResponse.matchStatus({
4543
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4544
+ orElse: (response) => unexpectedStatus(request, response)
4545
+ })
4546
+ )
4547
+ ),
4548
+ Effect.scoped
4549
+ ),
4550
+ "usageCompletions": (options) =>
4551
+ HttpClientRequest.make("GET")(`/organization/usage/completions`).pipe(
4552
+ HttpClientRequest.setUrlParams({
4553
+ "start_time": options["start_time"],
4554
+ "end_time": options["end_time"],
4555
+ "bucket_width": options["bucket_width"],
4556
+ "project_ids": options["project_ids"],
4557
+ "user_ids": options["user_ids"],
4558
+ "api_key_ids": options["api_key_ids"],
4559
+ "models": options["models"],
4560
+ "batch": options["batch"],
4561
+ "group_by": options["group_by"],
4562
+ "limit": options["limit"],
4563
+ "page": options["page"]
4564
+ }),
4565
+ Effect.succeed,
4566
+ Effect.flatMap((request) =>
4567
+ Effect.flatMap(
4568
+ httpClient.execute(request),
4569
+ HttpClientResponse.matchStatus({
4570
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4571
+ orElse: (response) => unexpectedStatus(request, response)
4572
+ })
4573
+ )
4574
+ ),
4575
+ Effect.scoped
4576
+ ),
4577
+ "usageEmbeddings": (options) =>
4578
+ HttpClientRequest.make("GET")(`/organization/usage/embeddings`).pipe(
4579
+ HttpClientRequest.setUrlParams({
4580
+ "start_time": options["start_time"],
4581
+ "end_time": options["end_time"],
4582
+ "bucket_width": options["bucket_width"],
4583
+ "project_ids": options["project_ids"],
4584
+ "user_ids": options["user_ids"],
4585
+ "api_key_ids": options["api_key_ids"],
4586
+ "models": options["models"],
4587
+ "group_by": options["group_by"],
4588
+ "limit": options["limit"],
4589
+ "page": options["page"]
4590
+ }),
4591
+ Effect.succeed,
4592
+ Effect.flatMap((request) =>
4593
+ Effect.flatMap(
4594
+ httpClient.execute(request),
4595
+ HttpClientResponse.matchStatus({
4596
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4597
+ orElse: (response) => unexpectedStatus(request, response)
4598
+ })
4599
+ )
4600
+ ),
4601
+ Effect.scoped
4602
+ ),
4603
+ "usageImages": (options) =>
4604
+ HttpClientRequest.make("GET")(`/organization/usage/images`).pipe(
4605
+ HttpClientRequest.setUrlParams({
4606
+ "start_time": options["start_time"],
4607
+ "end_time": options["end_time"],
4608
+ "bucket_width": options["bucket_width"],
4609
+ "sources": options["sources"],
4610
+ "sizes": options["sizes"],
4611
+ "project_ids": options["project_ids"],
4612
+ "user_ids": options["user_ids"],
4613
+ "api_key_ids": options["api_key_ids"],
4614
+ "models": options["models"],
4615
+ "group_by": options["group_by"],
4616
+ "limit": options["limit"],
4617
+ "page": options["page"]
4618
+ }),
4619
+ Effect.succeed,
4620
+ Effect.flatMap((request) =>
4621
+ Effect.flatMap(
4622
+ httpClient.execute(request),
4623
+ HttpClientResponse.matchStatus({
4624
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4625
+ orElse: (response) => unexpectedStatus(request, response)
4626
+ })
4627
+ )
4628
+ ),
4629
+ Effect.scoped
4630
+ ),
4631
+ "usageModerations": (options) =>
4632
+ HttpClientRequest.make("GET")(`/organization/usage/moderations`).pipe(
4633
+ HttpClientRequest.setUrlParams({
4634
+ "start_time": options["start_time"],
4635
+ "end_time": options["end_time"],
4636
+ "bucket_width": options["bucket_width"],
4637
+ "project_ids": options["project_ids"],
4638
+ "user_ids": options["user_ids"],
4639
+ "api_key_ids": options["api_key_ids"],
4640
+ "models": options["models"],
4641
+ "group_by": options["group_by"],
4642
+ "limit": options["limit"],
4643
+ "page": options["page"]
4644
+ }),
4645
+ Effect.succeed,
4646
+ Effect.flatMap((request) =>
4647
+ Effect.flatMap(
4648
+ httpClient.execute(request),
4649
+ HttpClientResponse.matchStatus({
4650
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4651
+ orElse: (response) => unexpectedStatus(request, response)
4652
+ })
4653
+ )
4654
+ ),
4655
+ Effect.scoped
4656
+ ),
4657
+ "usageVectorStores": (options) =>
4658
+ HttpClientRequest.make("GET")(`/organization/usage/vector_stores`).pipe(
4659
+ HttpClientRequest.setUrlParams({
4660
+ "start_time": options["start_time"],
4661
+ "end_time": options["end_time"],
4662
+ "bucket_width": options["bucket_width"],
4663
+ "project_ids": options["project_ids"],
4664
+ "group_by": options["group_by"],
4665
+ "limit": options["limit"],
4666
+ "page": options["page"]
4667
+ }),
4668
+ Effect.succeed,
4669
+ Effect.flatMap((request) =>
4670
+ Effect.flatMap(
4671
+ httpClient.execute(request),
4672
+ HttpClientResponse.matchStatus({
4673
+ "200": (r) => HttpClientResponse.schemaBodyJson(UsageResponse)(r),
4674
+ orElse: (response) => unexpectedStatus(request, response)
4675
+ })
4676
+ )
4677
+ ),
4678
+ Effect.scoped
4679
+ ),
3254
4680
  "listUsers": (options) =>
3255
4681
  HttpClientRequest.make("GET")(`/organization/users`).pipe(
3256
4682
  HttpClientRequest.setUrlParams({ "limit": options["limit"], "after": options["after"] }),
@@ -3308,6 +4734,20 @@ export const make = (httpClient: HttpClient.HttpClient): Client => {
3308
4734
  ),
3309
4735
  Effect.scoped
3310
4736
  ),
4737
+ "createRealtimeSession": (options) =>
4738
+ HttpClientRequest.make("POST")(`/realtime/sessions`).pipe(
4739
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
4740
+ Effect.flatMap((request) =>
4741
+ Effect.flatMap(
4742
+ httpClient.execute(request),
4743
+ HttpClientResponse.matchStatus({
4744
+ "200": (r) => HttpClientResponse.schemaBodyJson(RealtimeSessionCreateResponse)(r),
4745
+ orElse: (response) => unexpectedStatus(request, response)
4746
+ })
4747
+ )
4748
+ ),
4749
+ Effect.scoped
4750
+ ),
3311
4751
  "createThread": (options) =>
3312
4752
  HttpClientRequest.make("POST")(`/threads`).pipe(
3313
4753
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
@@ -3948,9 +5388,24 @@ export interface Client {
3948
5388
  readonly "createModeration": (
3949
5389
  options: typeof CreateModerationRequest.Encoded
3950
5390
  ) => Effect.Effect<typeof CreateModerationResponse.Type, HttpClientError.HttpClientError | ParseError>
5391
+ readonly "adminApiKeysList": (
5392
+ options: typeof AdminApiKeysListParams.Encoded
5393
+ ) => Effect.Effect<typeof ApiKeyList.Type, HttpClientError.HttpClientError | ParseError>
5394
+ readonly "adminApiKeysCreate": (
5395
+ options: typeof AdminApiKeysCreateRequest.Encoded
5396
+ ) => Effect.Effect<typeof AdminApiKey.Type, HttpClientError.HttpClientError | ParseError>
5397
+ readonly "adminApiKeysGet": (
5398
+ keyId: string
5399
+ ) => Effect.Effect<typeof AdminApiKey.Type, HttpClientError.HttpClientError | ParseError>
5400
+ readonly "adminApiKeysDelete": (
5401
+ keyId: string
5402
+ ) => Effect.Effect<typeof AdminApiKeysDelete200.Type, HttpClientError.HttpClientError | ParseError>
3951
5403
  readonly "listAuditLogs": (
3952
5404
  options: typeof ListAuditLogsParams.Encoded
3953
5405
  ) => Effect.Effect<typeof ListAuditLogsResponse.Type, HttpClientError.HttpClientError | ParseError>
5406
+ readonly "usageCosts": (
5407
+ options: typeof UsageCostsParams.Encoded
5408
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
3954
5409
  readonly "listInvites": (
3955
5410
  options: typeof ListInvitesParams.Encoded
3956
5411
  ) => Effect.Effect<typeof InviteListResponse.Type, HttpClientError.HttpClientError | ParseError>
@@ -3994,6 +5449,18 @@ export interface Client {
3994
5449
  readonly "archiveProject": (
3995
5450
  projectId: string
3996
5451
  ) => Effect.Effect<typeof Project.Type, HttpClientError.HttpClientError | ParseError>
5452
+ readonly "listProjectRateLimits": (
5453
+ projectId: string,
5454
+ options: typeof ListProjectRateLimitsParams.Encoded
5455
+ ) => Effect.Effect<typeof ProjectRateLimitListResponse.Type, HttpClientError.HttpClientError | ParseError>
5456
+ readonly "updateProjectRateLimits": (
5457
+ projectId: string,
5458
+ rateLimitId: string,
5459
+ options: typeof ProjectRateLimitUpdateRequest.Encoded
5460
+ ) => Effect.Effect<
5461
+ typeof ProjectRateLimit.Type,
5462
+ HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
5463
+ >
3997
5464
  readonly "listProjectServiceAccounts": (
3998
5465
  projectId: string,
3999
5466
  options: typeof ListProjectServiceAccountsParams.Encoded
@@ -4043,6 +5510,30 @@ export interface Client {
4043
5510
  typeof ProjectUserDeleteResponse.Type,
4044
5511
  HttpClientError.HttpClientError | ParseError | typeof ErrorResponse.Type
4045
5512
  >
5513
+ readonly "usageAudioSpeeches": (
5514
+ options: typeof UsageAudioSpeechesParams.Encoded
5515
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5516
+ readonly "usageAudioTranscriptions": (
5517
+ options: typeof UsageAudioTranscriptionsParams.Encoded
5518
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5519
+ readonly "usageCodeInterpreterSessions": (
5520
+ options: typeof UsageCodeInterpreterSessionsParams.Encoded
5521
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5522
+ readonly "usageCompletions": (
5523
+ options: typeof UsageCompletionsParams.Encoded
5524
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5525
+ readonly "usageEmbeddings": (
5526
+ options: typeof UsageEmbeddingsParams.Encoded
5527
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5528
+ readonly "usageImages": (
5529
+ options: typeof UsageImagesParams.Encoded
5530
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5531
+ readonly "usageModerations": (
5532
+ options: typeof UsageModerationsParams.Encoded
5533
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
5534
+ readonly "usageVectorStores": (
5535
+ options: typeof UsageVectorStoresParams.Encoded
5536
+ ) => Effect.Effect<typeof UsageResponse.Type, HttpClientError.HttpClientError | ParseError>
4046
5537
  readonly "listUsers": (
4047
5538
  options: typeof ListUsersParams.Encoded
4048
5539
  ) => Effect.Effect<typeof UserListResponse.Type, HttpClientError.HttpClientError | ParseError>
@@ -4056,6 +5547,9 @@ export interface Client {
4056
5547
  readonly "deleteUser": (
4057
5548
  userId: string
4058
5549
  ) => Effect.Effect<typeof UserDeleteResponse.Type, HttpClientError.HttpClientError | ParseError>
5550
+ readonly "createRealtimeSession": (
5551
+ options: typeof RealtimeSessionCreateRequest.Encoded
5552
+ ) => Effect.Effect<typeof RealtimeSessionCreateResponse.Type, HttpClientError.HttpClientError | ParseError>
4059
5553
  readonly "createThread": (
4060
5554
  options: typeof CreateThreadRequest.Encoded
4061
5555
  ) => Effect.Effect<typeof ThreadObject.Type, HttpClientError.HttpClientError | ParseError>