@@ -377,10 +377,13 @@ export interface ChatCompletionChunk {
377377 /**
378378 * An optional field that will only be present when you set
379379 * `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.
382385 */
383- usage ?: CompletionsAPI . CompletionUsage | null ;
386+ usage ?: CompletionsAPI . CompletionUsage ;
384387}
385388
386389export namespace ChatCompletionChunk {
@@ -551,7 +554,7 @@ export namespace ChatCompletionContentPart {
551554 /**
552555 * The name of the file, used when passing the file to the model as a string.
553556 */
554- file_name ?: string ;
557+ filename ?: string ;
555558 }
556559 }
557560}
@@ -930,8 +933,11 @@ export interface ChatCompletionStreamOptions {
930933 /**
931934 * If set, an additional chunk will be streamed before the `data: [DONE]` message.
932935 * 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.
935941 */
936942 include_usage ?: boolean ;
937943}
0 commit comments