@@ -41,8 +41,10 @@ private constructor(
41
41
private val finalizingAt: JsonField <Long >,
42
42
private val inProgressAt: JsonField <Long >,
43
43
private val metadata: JsonField <Metadata >,
44
+ private val model: JsonField <String >,
44
45
private val outputFileId: JsonField <String >,
45
46
private val requestCounts: JsonField <BatchRequestCounts >,
47
+ private val usage: JsonField <BatchUsage >,
46
48
private val additionalProperties: MutableMap <String , JsonValue >,
47
49
) {
48
50
@@ -82,12 +84,14 @@ private constructor(
82
84
@ExcludeMissing
83
85
inProgressAt: JsonField <Long > = JsonMissing .of(),
84
86
@JsonProperty(" metadata" ) @ExcludeMissing metadata: JsonField <Metadata > = JsonMissing .of(),
87
+ @JsonProperty(" model" ) @ExcludeMissing model: JsonField <String > = JsonMissing .of(),
85
88
@JsonProperty(" output_file_id" )
86
89
@ExcludeMissing
87
90
outputFileId: JsonField <String > = JsonMissing .of(),
88
91
@JsonProperty(" request_counts" )
89
92
@ExcludeMissing
90
93
requestCounts: JsonField <BatchRequestCounts > = JsonMissing .of(),
94
+ @JsonProperty(" usage" ) @ExcludeMissing usage: JsonField <BatchUsage > = JsonMissing .of(),
91
95
) : this (
92
96
id,
93
97
completionWindow,
@@ -107,8 +111,10 @@ private constructor(
107
111
finalizingAt,
108
112
inProgressAt,
109
113
metadata,
114
+ model,
110
115
outputFileId,
111
116
requestCounts,
117
+ usage,
112
118
mutableMapOf (),
113
119
)
114
120
@@ -262,6 +268,17 @@ private constructor(
262
268
*/
263
269
fun metadata (): Optional <Metadata > = metadata.getOptional(" metadata" )
264
270
271
+ /* *
272
+ * Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI offers a wide range of
273
+ * models with different capabilities, performance characteristics, and price points. Refer to
274
+ * the [model guide](https://platform.openai.com/docs/models) to browse and compare available
275
+ * models.
276
+ *
277
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
278
+ * server responded with an unexpected value).
279
+ */
280
+ fun model (): Optional <String > = model.getOptional(" model" )
281
+
265
282
/* *
266
283
* The ID of the file containing the outputs of successfully executed requests.
267
284
*
@@ -278,6 +295,15 @@ private constructor(
278
295
*/
279
296
fun requestCounts (): Optional <BatchRequestCounts > = requestCounts.getOptional(" request_counts" )
280
297
298
+ /* *
299
+ * Represents token usage details including input tokens, output tokens, a breakdown of output
300
+ * tokens, and the total tokens used. Only populated on batches created after September 7, 2025.
301
+ *
302
+ * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
303
+ * server responded with an unexpected value).
304
+ */
305
+ fun usage (): Optional <BatchUsage > = usage.getOptional(" usage" )
306
+
281
307
/* *
282
308
* Returns the raw JSON value of [id].
283
309
*
@@ -410,6 +436,13 @@ private constructor(
410
436
*/
411
437
@JsonProperty(" metadata" ) @ExcludeMissing fun _metadata (): JsonField <Metadata > = metadata
412
438
439
+ /* *
440
+ * Returns the raw JSON value of [model].
441
+ *
442
+ * Unlike [model], this method doesn't throw if the JSON field has an unexpected type.
443
+ */
444
+ @JsonProperty(" model" ) @ExcludeMissing fun _model (): JsonField <String > = model
445
+
413
446
/* *
414
447
* Returns the raw JSON value of [outputFileId].
415
448
*
@@ -428,6 +461,13 @@ private constructor(
428
461
@ExcludeMissing
429
462
fun _requestCounts (): JsonField <BatchRequestCounts > = requestCounts
430
463
464
+ /* *
465
+ * Returns the raw JSON value of [usage].
466
+ *
467
+ * Unlike [usage], this method doesn't throw if the JSON field has an unexpected type.
468
+ */
469
+ @JsonProperty(" usage" ) @ExcludeMissing fun _usage (): JsonField <BatchUsage > = usage
470
+
431
471
@JsonAnySetter
432
472
private fun putAdditionalProperty (key : String , value : JsonValue ) {
433
473
additionalProperties.put(key, value)
@@ -479,8 +519,10 @@ private constructor(
479
519
private var finalizingAt: JsonField <Long > = JsonMissing .of()
480
520
private var inProgressAt: JsonField <Long > = JsonMissing .of()
481
521
private var metadata: JsonField <Metadata > = JsonMissing .of()
522
+ private var model: JsonField <String > = JsonMissing .of()
482
523
private var outputFileId: JsonField <String > = JsonMissing .of()
483
524
private var requestCounts: JsonField <BatchRequestCounts > = JsonMissing .of()
525
+ private var usage: JsonField <BatchUsage > = JsonMissing .of()
484
526
private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
485
527
486
528
@JvmSynthetic
@@ -503,8 +545,10 @@ private constructor(
503
545
finalizingAt = batch.finalizingAt
504
546
inProgressAt = batch.inProgressAt
505
547
metadata = batch.metadata
548
+ model = batch.model
506
549
outputFileId = batch.outputFileId
507
550
requestCounts = batch.requestCounts
551
+ usage = batch.usage
508
552
additionalProperties = batch.additionalProperties.toMutableMap()
509
553
}
510
554
@@ -729,6 +773,22 @@ private constructor(
729
773
*/
730
774
fun metadata (metadata : JsonField <Metadata >) = apply { this .metadata = metadata }
731
775
776
+ /* *
777
+ * Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI offers a wide range
778
+ * of models with different capabilities, performance characteristics, and price points.
779
+ * Refer to the [model guide](https://platform.openai.com/docs/models) to browse and compare
780
+ * available models.
781
+ */
782
+ fun model (model : String ) = model(JsonField .of(model))
783
+
784
+ /* *
785
+ * Sets [Builder.model] to an arbitrary JSON value.
786
+ *
787
+ * You should usually call [Builder.model] with a well-typed [String] value instead. This
788
+ * method is primarily for setting the field to an undocumented or not yet supported value.
789
+ */
790
+ fun model (model : JsonField <String >) = apply { this .model = model }
791
+
732
792
/* * The ID of the file containing the outputs of successfully executed requests. */
733
793
fun outputFileId (outputFileId : String ) = outputFileId(JsonField .of(outputFileId))
734
794
@@ -758,6 +818,22 @@ private constructor(
758
818
this .requestCounts = requestCounts
759
819
}
760
820
821
+ /* *
822
+ * Represents token usage details including input tokens, output tokens, a breakdown of
823
+ * output tokens, and the total tokens used. Only populated on batches created after
824
+ * September 7, 2025.
825
+ */
826
+ fun usage (usage : BatchUsage ) = usage(JsonField .of(usage))
827
+
828
+ /* *
829
+ * Sets [Builder.usage] to an arbitrary JSON value.
830
+ *
831
+ * You should usually call [Builder.usage] with a well-typed [BatchUsage] value instead.
832
+ * This method is primarily for setting the field to an undocumented or not yet supported
833
+ * value.
834
+ */
835
+ fun usage (usage : JsonField <BatchUsage >) = apply { this .usage = usage }
836
+
761
837
fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
762
838
this .additionalProperties.clear()
763
839
putAllAdditionalProperties(additionalProperties)
@@ -814,8 +890,10 @@ private constructor(
814
890
finalizingAt,
815
891
inProgressAt,
816
892
metadata,
893
+ model,
817
894
outputFileId,
818
895
requestCounts,
896
+ usage,
819
897
additionalProperties.toMutableMap(),
820
898
)
821
899
}
@@ -849,8 +927,10 @@ private constructor(
849
927
finalizingAt()
850
928
inProgressAt()
851
929
metadata().ifPresent { it.validate() }
930
+ model()
852
931
outputFileId()
853
932
requestCounts().ifPresent { it.validate() }
933
+ usage().ifPresent { it.validate() }
854
934
validated = true
855
935
}
856
936
@@ -887,8 +967,10 @@ private constructor(
887
967
(if (finalizingAt.asKnown().isPresent) 1 else 0 ) +
888
968
(if (inProgressAt.asKnown().isPresent) 1 else 0 ) +
889
969
(metadata.asKnown().getOrNull()?.validity() ? : 0 ) +
970
+ (if (model.asKnown().isPresent) 1 else 0 ) +
890
971
(if (outputFileId.asKnown().isPresent) 1 else 0 ) +
891
- (requestCounts.asKnown().getOrNull()?.validity() ? : 0 )
972
+ (requestCounts.asKnown().getOrNull()?.validity() ? : 0 ) +
973
+ (usage.asKnown().getOrNull()?.validity() ? : 0 )
892
974
893
975
/* * The current status of the batch. */
894
976
class Status @JsonCreator private constructor(private val value : JsonField <String >) : Enum {
@@ -1378,8 +1460,10 @@ private constructor(
1378
1460
finalizingAt == other.finalizingAt &&
1379
1461
inProgressAt == other.inProgressAt &&
1380
1462
metadata == other.metadata &&
1463
+ model == other.model &&
1381
1464
outputFileId == other.outputFileId &&
1382
1465
requestCounts == other.requestCounts &&
1466
+ usage == other.usage &&
1383
1467
additionalProperties == other.additionalProperties
1384
1468
}
1385
1469
@@ -1403,14 +1487,16 @@ private constructor(
1403
1487
finalizingAt,
1404
1488
inProgressAt,
1405
1489
metadata,
1490
+ model,
1406
1491
outputFileId,
1407
1492
requestCounts,
1493
+ usage,
1408
1494
additionalProperties,
1409
1495
)
1410
1496
}
1411
1497
1412
1498
override fun hashCode (): Int = hashCode
1413
1499
1414
1500
override fun toString () =
1415
- " Batch{id=$id , completionWindow=$completionWindow , createdAt=$createdAt , endpoint=$endpoint , inputFileId=$inputFileId , object_=$object_ , status=$status , cancelledAt=$cancelledAt , cancellingAt=$cancellingAt , completedAt=$completedAt , errorFileId=$errorFileId , errors=$errors , expiredAt=$expiredAt , expiresAt=$expiresAt , failedAt=$failedAt , finalizingAt=$finalizingAt , inProgressAt=$inProgressAt , metadata=$metadata , outputFileId=$outputFileId , requestCounts=$requestCounts , additionalProperties=$additionalProperties }"
1501
+ " Batch{id=$id , completionWindow=$completionWindow , createdAt=$createdAt , endpoint=$endpoint , inputFileId=$inputFileId , object_=$object_ , status=$status , cancelledAt=$cancelledAt , cancellingAt=$cancellingAt , completedAt=$completedAt , errorFileId=$errorFileId , errors=$errors , expiredAt=$expiredAt , expiresAt=$expiresAt , failedAt=$failedAt , finalizingAt=$finalizingAt , inProgressAt=$inProgressAt , metadata=$metadata , model= $model , outputFileId=$outputFileId , requestCounts=$requestCounts , usage= $usage , additionalProperties=$additionalProperties }"
1416
1502
}
0 commit comments