@@ -377,10 +377,13 @@ export interface ChatCompletionChunk {
377
377
/**
378
378
* An optional field that will only be present when you set
379
379
* `stream_options: {"include_usage": true}` in your request. When present, it
380
- * contains a null value except for the last chunk which contains the token usage
381
- * statistics for the entire request.
380
+ * contains a null value **except for the last chunk** which contains the token
381
+ * usage statistics for the entire request.
382
+ *
383
+ * **NOTE:** If the stream is interrupted or cancelled, you may not receive the
384
+ * final usage chunk which contains the total token usage for the request.
382
385
*/
383
- usage ?: CompletionsAPI . CompletionUsage | null ;
386
+ usage ?: CompletionsAPI . CompletionUsage ;
384
387
}
385
388
386
389
export namespace ChatCompletionChunk {
@@ -551,7 +554,7 @@ export namespace ChatCompletionContentPart {
551
554
/**
552
555
* The name of the file, used when passing the file to the model as a string.
553
556
*/
554
- file_name ?: string ;
557
+ filename ?: string ;
555
558
}
556
559
}
557
560
}
@@ -930,8 +933,11 @@ export interface ChatCompletionStreamOptions {
930
933
/**
931
934
* If set, an additional chunk will be streamed before the `data: [DONE]` message.
932
935
* The `usage` field on this chunk shows the token usage statistics for the entire
933
- * request, and the `choices` field will always be an empty array. All other chunks
934
- * will also include a `usage` field, but with a null value.
936
+ * request, and the `choices` field will always be an empty array.
937
+ *
938
+ * All other chunks will also include a `usage` field, but with a null value.
939
+ * **NOTE:** If the stream is interrupted, you may not receive the final usage
940
+ * chunk which contains the total token usage for the request.
935
941
*/
936
942
include_usage ?: boolean ;
937
943
}
0 commit comments