feat: Add support for usage in the OpenAI frontend vLLM backend#8264
Conversation
usage in the OpenAI frontend vLLM backendusage in the OpenAI frontend vLLM backend
Co-authored-by: richardhuo-nv <rihuo@nvidia.com>
|
NVIDIA/TensorRT-LLM#5445 |
|
Does the change include reporting each streaming chunk's usage? If not, have we verified with the requestor that if per chunk usage is needed? |
For streaming, it reports the https://platform.openai.com/docs/api-reference/chat/create#chat-create-stream_options |
richardhuo-nv
left a comment
There was a problem hiding this comment.
Great Job! Thanks!

What does the PR do?
usagesupport by default for non-streaming requestsstreaming optionsandusagein streaming requestsChecklist
<commit_type>: <Title>Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
Where should the reviewer start?
Test plan:
Caveats:
Background
By default, the OpenAI API supports
usagefor non-streaming requests. For streaming requests, we need to enablestream_options: {"include_usage": true}.https://platform.openai.com/docs/api-reference/chat/create
https://platform.openai.com/docs/api-reference/chat-streaming
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)