Skip to content

Commit 75e0808

Browse files
authored
IMPL
1 parent 5164870 commit 75e0808

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/xAI/GrokChatClient.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ async IAsyncEnumerable<ChatResponseUpdate> CompleteChatStreamingCore(IEnumerable
9494

9595
((List<AIContent>)update.Contents).AddRange(output.Delta.ToolCalls.AsContents(text, citations));
9696

97-
if (update.Contents.Any())
98-
yield return update;
97+
if (MapToUsage(chunk.Usage) is { } usage)
98+
update.Contents.Add(new UsageContent(usage) { RawRepresentation = chunk.Usage });
99+
100+
yield return update;
99101
}
100102
}
101103
}
@@ -277,6 +279,8 @@ codeResult.RawRepresentation is ToolCall codeToolCall &&
277279
{
278280
InputTokenCount = usage.PromptTokens,
279281
OutputTokenCount = usage.CompletionTokens,
282+
CachedInputTokenCount = usage.CachedPromptTextTokens,
283+
ReasoningTokenCount = usage.ReasoningTokens,
280284
TotalTokenCount = usage.TotalTokens
281285
};
282286

0 commit comments

Comments
 (0)