UsageMetadata#
- class langsmith.schemas.UsageMetadata[source]#
Usage metadata for a message, such as token counts.
This is a standard representation of token usage that is consistent across models.
- input_tokens: int#
Count of input (or prompt) tokens. Sum of all input token types.
- output_tokens: int#
Count of output (or completion) tokens. Sum of all output token types.
- total_tokens: int#
Total token count. Sum of input_tokens + output_tokens.
- input_token_details: NotRequired[InputTokenDetails]#
Breakdown of input token counts.
Does not need to sum to full input token count. Does not need to have all keys.
- output_token_details: NotRequired[OutputTokenDetails]#
Breakdown of output token counts.
Does not need to sum to full output token count. Does not need to have all keys.
- input_cost: NotRequired[float]#
The cost of the input tokens.
- output_cost: NotRequired[float]#
The cost of the output tokens.
- total_cost: NotRequired[float]#
The total cost of the tokens.
- input_cost_details: NotRequired[InputCostDetails]#
The cost details of the input tokens.
- output_cost_details: NotRequired[OutputCostDetails]#
The cost details of the output tokens.