Class TokenUsage
Unified token usage information across all AI providers. Always populated from the official API response data.
public class TokenUsage
- Inheritance
-
TokenUsage
- Inherited Members
Properties
CacheCreationTokens
Tokens written to cache for future reuse (Anthropic only). Mapped from: Anthropic cache_creation_input_tokens.
public int CacheCreationTokens { get; set; }
Property Value
CacheHitRatio
Cache hit ratio (0.0 to 1.0). Returns 0 if no input tokens.
public double CacheHitRatio { get; }
Property Value
CachedInputTokens
Input tokens served from cache (reduced cost). Mapped from: Anthropic cache_read_input_tokens, OpenAI cached_tokens, DeepSeek prompt_cache_hit_tokens, Gemini cachedContentTokenCount.
public int CachedInputTokens { get; set; }
Property Value
HasCacheActivity
Whether any cache activity occurred (hit or creation).
public bool HasCacheActivity { get; }
Property Value
InputTokens
Number of tokens in the input/prompt
public int InputTokens { get; set; }
Property Value
NonCachedInputTokens
Input tokens that were NOT served from cache.
public int NonCachedInputTokens { get; }
Property Value
OutputTokens
Number of tokens in the output/completion
public int OutputTokens { get; set; }
Property Value
ReasoningTokens
Tokens used for internal reasoning/thinking. Mapped from: OpenAI reasoning_tokens, Gemini thoughtsTokenCount.
public int ReasoningTokens { get; set; }
Property Value
TotalTokens
Total tokens used (input + output)
public int TotalTokens { get; set; }
Property Value
VisibleOutputTokens
Output tokens excluding reasoning (visible output only).
public int VisibleOutputTokens { get; }