LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
Language
Theme
PythonlangsmithschemasExtractedUsageMetadata
Class●Since v0.3

ExtractedUsageMetadata

Usage metadata dictionary extracted from a run.

Should be the same as UsageMetadata, but does not require all keys to be present.

Copy
ExtractedUsageMetadata()

Bases

TypedDict

Constructors

constructor
__init__
NameType
input_tokensint
output_tokensint
total_tokensint
input_token_detailsInputTokenDetails
output_token_detailsOutputTokenDetails
input_costfloat
output_costfloat
total_costfloat
input_cost_detailsInputCostDetails
output_cost_detailsOutputCostDetails

Attributes

attribute
input_tokens: int

The number of tokens used for the prompt.

attribute
output_tokens: int

The number of tokens generated as output.

attribute
total_tokens: int

The total number of tokens used.

attribute
input_token_details: InputTokenDetails

The details of the input tokens.

attribute
output_token_details: OutputTokenDetails

The details of the output tokens.

attribute
input_cost: float

The cost of the input tokens.

attribute
output_cost: float

The cost of the output tokens.

attribute
total_cost: float

The total cost of the tokens.

attribute
input_cost_details: InputCostDetails

The cost details of the input tokens.

attribute
output_cost_details: OutputCostDetails

The cost details of the output tokens.

View source on GitHub