MCPcopy Create free account
hub / github.com/1jehuang/jcode / TokenUsage

Class TokenUsage

scripts/compare_token_usage.py:39–56  ·  view source on GitHub ↗

Token usage from a single run.

Source from the content-addressed store, hash-verified

37
38@dataclass
39class TokenUsage:
40 """Token usage from a single run."""
41 input_tokens: int
42 output_tokens: int
43 cache_read_tokens: int
44 cache_creation_tokens: int
45 total_cost_usd: Optional[float] = None
46 duration_ms: Optional[int] = None
47
48 @property
49 def total_input(self) -> int:
50 """Total input tokens including cache."""
51 return self.input_tokens + self.cache_read_tokens + self.cache_creation_tokens
52
53 @property
54 def total(self) -> int:
55 """Total tokens (input + output)."""
56 return self.total_input + self.output_tokens
57
58
59@dataclass

Callers 2

run_claude_cliFunction · 0.70
run_jcodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected