LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Traceable
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerTraceableJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithschemasUsageMetadata
Type●Since v0.1

UsageMetadata

Usage metadata for a message, such as token counts.

Copy
UsageMetadata

Properties

property
input_cost: number

The cost of the input tokens.

property
input_cost_details: Record<string, unknown>

The cost details of the input tokens.

property
input_token_details: InputTokenDetails

Breakdown of input token counts.

Does not need to sum to full input token count. Does not need to have all keys.

property
input_tokens: number

Count of input (or prompt) tokens. Sum of all input token types.

property
output_cost: number

The cost of the output tokens.

property
output_cost_details: Record<string, unknown>

The cost details of the output tokens.

property
output_token_details: OutputTokenDetails

Breakdown of output token counts.

Does not need to sum to full output token count. Does not need to have all keys.

property
output_tokens: number

Count of output (or completion) tokens. Sum of all output token types.

property
total_cost: number

The total cost of the tokens.

property
total_tokens: number

Total token count, combining prompt and completion.

View source on GitHub