openai 6.41.0 → 6.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -295,6 +295,12 @@ export interface ChatCompletion {
295
295
  */
296
296
  object: 'chat.completion';
297
297
 
298
+ /**
299
+ * Moderation results for the request input and generated output, if moderated
300
+ * completions were requested.
301
+ */
302
+ moderation?: ChatCompletion.Moderation | null;
303
+
298
304
  /**
299
305
  * Specifies the processing type used for serving the request.
300
306
  *
@@ -338,7 +344,8 @@ export namespace ChatCompletion {
338
344
  * number of tokens specified in the request was reached, `content_filter` if
339
345
  * content was omitted due to a flag from our content filters, `tool_calls` if the
340
346
  * model called a tool, or `function_call` (deprecated) if the model called a
341
- * function.
347
+ * function. Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html)
348
+ * for more.
342
349
  */
343
350
  finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
344
351
 
@@ -374,6 +381,182 @@ export namespace ChatCompletion {
374
381
  refusal: Array<ChatCompletionsAPI.ChatCompletionTokenLogprob> | null;
375
382
  }
376
383
  }
384
+
385
+ /**
386
+ * Moderation results for the request input and generated output, if moderated
387
+ * completions were requested.
388
+ */
389
+ export interface Moderation {
390
+ /**
391
+ * Moderation for the request input.
392
+ */
393
+ input: Moderation.ModerationResults | Moderation.Error;
394
+
395
+ /**
396
+ * Moderation for the generated output.
397
+ */
398
+ output: Moderation.ModerationResults | Moderation.Error;
399
+ }
400
+
401
+ export namespace Moderation {
402
+ /**
403
+ * Successful moderation results for the request input or generated output.
404
+ */
405
+ export interface ModerationResults {
406
+ /**
407
+ * The moderation model used to generate the results.
408
+ */
409
+ model: string;
410
+
411
+ /**
412
+ * A list of moderation results.
413
+ */
414
+ results: Array<ModerationResults.Result>;
415
+
416
+ /**
417
+ * The object type, which is always `moderation_results`.
418
+ */
419
+ type: 'moderation_results';
420
+ }
421
+
422
+ export namespace ModerationResults {
423
+ /**
424
+ * A moderation result produced for the response input or output.
425
+ */
426
+ export interface Result {
427
+ /**
428
+ * A dictionary of moderation categories to booleans, True if the input is flagged
429
+ * under this category.
430
+ */
431
+ categories: { [key: string]: boolean };
432
+
433
+ /**
434
+ * Which modalities of input are reflected by the score for each category.
435
+ */
436
+ category_applied_input_types: { [key: string]: Array<'text' | 'image'> };
437
+
438
+ /**
439
+ * A dictionary of moderation categories to scores.
440
+ */
441
+ category_scores: { [key: string]: number };
442
+
443
+ /**
444
+ * A boolean indicating whether the content was flagged by any category.
445
+ */
446
+ flagged: boolean;
447
+
448
+ /**
449
+ * The moderation model that produced this result.
450
+ */
451
+ model: string;
452
+
453
+ /**
454
+ * The object type, which was always `moderation_result` for successful moderation
455
+ * results.
456
+ */
457
+ type: 'moderation_result';
458
+ }
459
+ }
460
+
461
+ /**
462
+ * An error produced while attempting moderation.
463
+ */
464
+ export interface Error {
465
+ /**
466
+ * The error code.
467
+ */
468
+ code: string;
469
+
470
+ /**
471
+ * The error message.
472
+ */
473
+ message: string;
474
+
475
+ /**
476
+ * The object type, which is always `error`.
477
+ */
478
+ type: 'error';
479
+ }
480
+
481
+ /**
482
+ * Successful moderation results for the request input or generated output.
483
+ */
484
+ export interface ModerationResults {
485
+ /**
486
+ * The moderation model used to generate the results.
487
+ */
488
+ model: string;
489
+
490
+ /**
491
+ * A list of moderation results.
492
+ */
493
+ results: Array<ModerationResults.Result>;
494
+
495
+ /**
496
+ * The object type, which is always `moderation_results`.
497
+ */
498
+ type: 'moderation_results';
499
+ }
500
+
501
+ export namespace ModerationResults {
502
+ /**
503
+ * A moderation result produced for the response input or output.
504
+ */
505
+ export interface Result {
506
+ /**
507
+ * A dictionary of moderation categories to booleans, True if the input is flagged
508
+ * under this category.
509
+ */
510
+ categories: { [key: string]: boolean };
511
+
512
+ /**
513
+ * Which modalities of input are reflected by the score for each category.
514
+ */
515
+ category_applied_input_types: { [key: string]: Array<'text' | 'image'> };
516
+
517
+ /**
518
+ * A dictionary of moderation categories to scores.
519
+ */
520
+ category_scores: { [key: string]: number };
521
+
522
+ /**
523
+ * A boolean indicating whether the content was flagged by any category.
524
+ */
525
+ flagged: boolean;
526
+
527
+ /**
528
+ * The moderation model that produced this result.
529
+ */
530
+ model: string;
531
+
532
+ /**
533
+ * The object type, which was always `moderation_result` for successful moderation
534
+ * results.
535
+ */
536
+ type: 'moderation_result';
537
+ }
538
+ }
539
+
540
+ /**
541
+ * An error produced while attempting moderation.
542
+ */
543
+ export interface Error {
544
+ /**
545
+ * The error code.
546
+ */
547
+ code: string;
548
+
549
+ /**
550
+ * The error message.
551
+ */
552
+ message: string;
553
+
554
+ /**
555
+ * The object type, which is always `error`.
556
+ */
557
+ type: 'error';
558
+ }
559
+ }
377
560
  }
378
561
 
379
562
  /**
@@ -575,6 +758,12 @@ export interface ChatCompletionChunk {
575
758
  */
576
759
  object: 'chat.completion.chunk';
577
760
 
761
+ /**
762
+ * Moderation results for the request input and generated output. Present on the
763
+ * moderation chunk when moderated completions are requested.
764
+ */
765
+ moderation?: ChatCompletionChunk.Moderation | null;
766
+
578
767
  /**
579
768
  * Specifies the processing type used for serving the request.
580
769
  *
@@ -740,6 +929,182 @@ export namespace ChatCompletionChunk {
740
929
  refusal: Array<ChatCompletionsAPI.ChatCompletionTokenLogprob> | null;
741
930
  }
742
931
  }
932
+
933
+ /**
934
+ * Moderation results for the request input and generated output. Present on the
935
+ * moderation chunk when moderated completions are requested.
936
+ */
937
+ export interface Moderation {
938
+ /**
939
+ * Moderation for the request input.
940
+ */
941
+ input: Moderation.ModerationResults | Moderation.Error;
942
+
943
+ /**
944
+ * Moderation for the generated output.
945
+ */
946
+ output: Moderation.ModerationResults | Moderation.Error;
947
+ }
948
+
949
+ export namespace Moderation {
950
+ /**
951
+ * Successful moderation results for the request input or generated output.
952
+ */
953
+ export interface ModerationResults {
954
+ /**
955
+ * The moderation model used to generate the results.
956
+ */
957
+ model: string;
958
+
959
+ /**
960
+ * A list of moderation results.
961
+ */
962
+ results: Array<ModerationResults.Result>;
963
+
964
+ /**
965
+ * The object type, which is always `moderation_results`.
966
+ */
967
+ type: 'moderation_results';
968
+ }
969
+
970
+ export namespace ModerationResults {
971
+ /**
972
+ * A moderation result produced for the response input or output.
973
+ */
974
+ export interface Result {
975
+ /**
976
+ * A dictionary of moderation categories to booleans, True if the input is flagged
977
+ * under this category.
978
+ */
979
+ categories: { [key: string]: boolean };
980
+
981
+ /**
982
+ * Which modalities of input are reflected by the score for each category.
983
+ */
984
+ category_applied_input_types: { [key: string]: Array<'text' | 'image'> };
985
+
986
+ /**
987
+ * A dictionary of moderation categories to scores.
988
+ */
989
+ category_scores: { [key: string]: number };
990
+
991
+ /**
992
+ * A boolean indicating whether the content was flagged by any category.
993
+ */
994
+ flagged: boolean;
995
+
996
+ /**
997
+ * The moderation model that produced this result.
998
+ */
999
+ model: string;
1000
+
1001
+ /**
1002
+ * The object type, which was always `moderation_result` for successful moderation
1003
+ * results.
1004
+ */
1005
+ type: 'moderation_result';
1006
+ }
1007
+ }
1008
+
1009
+ /**
1010
+ * An error produced while attempting moderation.
1011
+ */
1012
+ export interface Error {
1013
+ /**
1014
+ * The error code.
1015
+ */
1016
+ code: string;
1017
+
1018
+ /**
1019
+ * The error message.
1020
+ */
1021
+ message: string;
1022
+
1023
+ /**
1024
+ * The object type, which is always `error`.
1025
+ */
1026
+ type: 'error';
1027
+ }
1028
+
1029
+ /**
1030
+ * Successful moderation results for the request input or generated output.
1031
+ */
1032
+ export interface ModerationResults {
1033
+ /**
1034
+ * The moderation model used to generate the results.
1035
+ */
1036
+ model: string;
1037
+
1038
+ /**
1039
+ * A list of moderation results.
1040
+ */
1041
+ results: Array<ModerationResults.Result>;
1042
+
1043
+ /**
1044
+ * The object type, which is always `moderation_results`.
1045
+ */
1046
+ type: 'moderation_results';
1047
+ }
1048
+
1049
+ export namespace ModerationResults {
1050
+ /**
1051
+ * A moderation result produced for the response input or output.
1052
+ */
1053
+ export interface Result {
1054
+ /**
1055
+ * A dictionary of moderation categories to booleans, True if the input is flagged
1056
+ * under this category.
1057
+ */
1058
+ categories: { [key: string]: boolean };
1059
+
1060
+ /**
1061
+ * Which modalities of input are reflected by the score for each category.
1062
+ */
1063
+ category_applied_input_types: { [key: string]: Array<'text' | 'image'> };
1064
+
1065
+ /**
1066
+ * A dictionary of moderation categories to scores.
1067
+ */
1068
+ category_scores: { [key: string]: number };
1069
+
1070
+ /**
1071
+ * A boolean indicating whether the content was flagged by any category.
1072
+ */
1073
+ flagged: boolean;
1074
+
1075
+ /**
1076
+ * The moderation model that produced this result.
1077
+ */
1078
+ model: string;
1079
+
1080
+ /**
1081
+ * The object type, which was always `moderation_result` for successful moderation
1082
+ * results.
1083
+ */
1084
+ type: 'moderation_result';
1085
+ }
1086
+ }
1087
+
1088
+ /**
1089
+ * An error produced while attempting moderation.
1090
+ */
1091
+ export interface Error {
1092
+ /**
1093
+ * The error code.
1094
+ */
1095
+ code: string;
1096
+
1097
+ /**
1098
+ * The error message.
1099
+ */
1100
+ message: string;
1101
+
1102
+ /**
1103
+ * The object type, which is always `error`.
1104
+ */
1105
+ type: 'error';
1106
+ }
1107
+ }
743
1108
  }
744
1109
 
745
1110
  /**
@@ -1641,6 +2006,11 @@ export interface ChatCompletionCreateParamsBase {
1641
2006
  */
1642
2007
  modalities?: Array<'text' | 'audio'> | null;
1643
2008
 
2009
+ /**
2010
+ * Configuration for running moderation on the request input and generated output.
2011
+ */
2012
+ moderation?: ChatCompletionCreateParams.Moderation | null;
2013
+
1644
2014
  /**
1645
2015
  * How many chat completion choices to generate for each input message. Note that
1646
2016
  * you will be charged based on the number of generated tokens across all of the
@@ -1897,6 +2267,17 @@ export namespace ChatCompletionCreateParams {
1897
2267
  parameters?: Shared.FunctionParameters;
1898
2268
  }
1899
2269
 
2270
+ /**
2271
+ * Configuration for running moderation on the request input and generated output.
2272
+ */
2273
+ export interface Moderation {
2274
+ /**
2275
+ * The moderation model to use for moderated completions, e.g.
2276
+ * 'omni-moderation-latest'.
2277
+ */
2278
+ model: string;
2279
+ }
2280
+
1900
2281
  /**
1901
2282
  * This tool searches the web for relevant results to use in a response. Learn more
1902
2283
  * about the
@@ -1102,6 +1102,12 @@ export interface Response {
1102
1102
  */
1103
1103
  max_output_tokens?: number | null;
1104
1104
 
1105
+ /**
1106
+ * Moderation results for the response input and output, if moderated completions
1107
+ * were requested.
1108
+ */
1109
+ moderation?: Response.Moderation | null;
1110
+
1105
1111
  /**
1106
1112
  * The unique ID of the previous response to the model. Use this to create
1107
1113
  * multi-turn conversations. Learn more about
@@ -1247,6 +1253,138 @@ export namespace Response {
1247
1253
  */
1248
1254
  id: string;
1249
1255
  }
1256
+
1257
+ /**
1258
+ * Moderation results for the response input and output, if moderated completions
1259
+ * were requested.
1260
+ */
1261
+ export interface Moderation {
1262
+ /**
1263
+ * Moderation for the response input.
1264
+ */
1265
+ input: Moderation.ModerationResult | Moderation.Error;
1266
+
1267
+ /**
1268
+ * Moderation for the response output.
1269
+ */
1270
+ output: Moderation.ModerationResult | Moderation.Error;
1271
+ }
1272
+
1273
+ export namespace Moderation {
1274
+ /**
1275
+ * A moderation result produced for the response input or output.
1276
+ */
1277
+ export interface ModerationResult {
1278
+ /**
1279
+ * A dictionary of moderation categories to booleans, True if the input is flagged
1280
+ * under this category.
1281
+ */
1282
+ categories: { [key: string]: boolean };
1283
+
1284
+ /**
1285
+ * Which modalities of input are reflected by the score for each category.
1286
+ */
1287
+ category_applied_input_types: { [key: string]: Array<'text' | 'image'> };
1288
+
1289
+ /**
1290
+ * A dictionary of moderation categories to scores.
1291
+ */
1292
+ category_scores: { [key: string]: number };
1293
+
1294
+ /**
1295
+ * A boolean indicating whether the content was flagged by any category.
1296
+ */
1297
+ flagged: boolean;
1298
+
1299
+ /**
1300
+ * The moderation model that produced this result.
1301
+ */
1302
+ model: string;
1303
+
1304
+ /**
1305
+ * The object type, which was always `moderation_result` for successful moderation
1306
+ * results.
1307
+ */
1308
+ type: 'moderation_result';
1309
+ }
1310
+
1311
+ /**
1312
+ * An error produced while attempting moderation for the response input or output.
1313
+ */
1314
+ export interface Error {
1315
+ /**
1316
+ * The error code.
1317
+ */
1318
+ code: string;
1319
+
1320
+ /**
1321
+ * The error message.
1322
+ */
1323
+ message: string;
1324
+
1325
+ /**
1326
+ * The object type, which was always `error` for moderation failures.
1327
+ */
1328
+ type: 'error';
1329
+ }
1330
+
1331
+ /**
1332
+ * A moderation result produced for the response input or output.
1333
+ */
1334
+ export interface ModerationResult {
1335
+ /**
1336
+ * A dictionary of moderation categories to booleans, True if the input is flagged
1337
+ * under this category.
1338
+ */
1339
+ categories: { [key: string]: boolean };
1340
+
1341
+ /**
1342
+ * Which modalities of input are reflected by the score for each category.
1343
+ */
1344
+ category_applied_input_types: { [key: string]: Array<'text' | 'image'> };
1345
+
1346
+ /**
1347
+ * A dictionary of moderation categories to scores.
1348
+ */
1349
+ category_scores: { [key: string]: number };
1350
+
1351
+ /**
1352
+ * A boolean indicating whether the content was flagged by any category.
1353
+ */
1354
+ flagged: boolean;
1355
+
1356
+ /**
1357
+ * The moderation model that produced this result.
1358
+ */
1359
+ model: string;
1360
+
1361
+ /**
1362
+ * The object type, which was always `moderation_result` for successful moderation
1363
+ * results.
1364
+ */
1365
+ type: 'moderation_result';
1366
+ }
1367
+
1368
+ /**
1369
+ * An error produced while attempting moderation for the response input or output.
1370
+ */
1371
+ export interface Error {
1372
+ /**
1373
+ * The error code.
1374
+ */
1375
+ code: string;
1376
+
1377
+ /**
1378
+ * The error message.
1379
+ */
1380
+ message: string;
1381
+
1382
+ /**
1383
+ * The object type, which was always `error` for moderation failures.
1384
+ */
1385
+ type: 'error';
1386
+ }
1387
+ }
1250
1388
  }
1251
1389
 
1252
1390
  /**
@@ -6639,6 +6777,11 @@ export interface ResponsesClientEvent {
6639
6777
  */
6640
6778
  model?: Shared.ResponsesModel;
6641
6779
 
6780
+ /**
6781
+ * Configuration for running moderation on the input and output of this response.
6782
+ */
6783
+ moderation?: ResponsesClientEvent.Moderation | null;
6784
+
6642
6785
  /**
6643
6786
  * Whether to allow the model to run tool calls in parallel.
6644
6787
  */
@@ -6845,6 +6988,17 @@ export namespace ResponsesClientEvent {
6845
6988
  compact_threshold?: number | null;
6846
6989
  }
6847
6990
 
6991
+ /**
6992
+ * Configuration for running moderation on the input and output of this response.
6993
+ */
6994
+ export interface Moderation {
6995
+ /**
6996
+ * The moderation model to use for moderated completions, e.g.
6997
+ * 'omni-moderation-latest'.
6998
+ */
6999
+ model: string;
7000
+ }
7001
+
6848
7002
  /**
6849
7003
  * Options for streaming responses. Only set this when you set `stream: true`.
6850
7004
  */
@@ -7694,6 +7848,11 @@ export interface ResponseCreateParamsBase {
7694
7848
  */
7695
7849
  model?: Shared.ResponsesModel;
7696
7850
 
7851
+ /**
7852
+ * Configuration for running moderation on the input and output of this response.
7853
+ */
7854
+ moderation?: ResponseCreateParams.Moderation | null;
7855
+
7697
7856
  /**
7698
7857
  * Whether to allow the model to run tool calls in parallel.
7699
7858
  */
@@ -7899,6 +8058,17 @@ export namespace ResponseCreateParams {
7899
8058
  compact_threshold?: number | null;
7900
8059
  }
7901
8060
 
8061
+ /**
8062
+ * Configuration for running moderation on the input and output of this response.
8063
+ */
8064
+ export interface Moderation {
8065
+ /**
8066
+ * The moderation model to use for moderated completions, e.g.
8067
+ * 'omni-moderation-latest'.
8068
+ */
8069
+ model: string;
8070
+ }
8071
+
7902
8072
  /**
7903
8073
  * Options for streaming responses. Only set this when you set `stream: true`.
7904
8074
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.41.0'; // x-release-please-version
1
+ export const VERSION = '6.42.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "6.41.0";
1
+ export declare const VERSION = "6.42.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "6.41.0";
1
+ export declare const VERSION = "6.42.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '6.41.0'; // x-release-please-version
4
+ exports.VERSION = '6.42.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '6.41.0'; // x-release-please-version
1
+ export const VERSION = '6.42.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map