LangChain · Type Alias
UsageMetadata
UsageMetadata is a standard record for token usage on a message. It includes input, output, and total token counts, plus optional token-type details.
Last updated
- Since
- 0.3.9 for input_token_details and output_token_details
Syntax
class UsageMetadata(TypedDict):
input_tokens: int
output_tokens: int
total_tokens: int
input_token_details: NotRequired[InputTokenDetails]
output_token_details: NotRequired[OutputTokenDetails]In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
InputTokenDetailsOutputTokenDetailsAIMessage