Table of Contents

Class TokenUsage

Namespace
Mythosia.AI.Models.Streaming
Assembly
Mythosia.AI.Abstractions.dll

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

int

CacheHitRatio

Cache hit ratio (0.0 to 1.0). Returns 0 if no input tokens.

public double CacheHitRatio { get; }

Property Value

double

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

int

HasCacheActivity

Whether any cache activity occurred (hit or creation).

public bool HasCacheActivity { get; }

Property Value

bool

InputTokens

Number of tokens in the input/prompt

public int InputTokens { get; set; }

Property Value

int

NonCachedInputTokens

Input tokens that were NOT served from cache.

public int NonCachedInputTokens { get; }

Property Value

int

OutputTokens

Number of tokens in the output/completion

public int OutputTokens { get; set; }

Property Value

int

ReasoningTokens

Tokens used for internal reasoning/thinking. Mapped from: OpenAI reasoning_tokens, Gemini thoughtsTokenCount.

public int ReasoningTokens { get; set; }

Property Value

int

TotalTokens

Total tokens used (input + output)

public int TotalTokens { get; set; }

Property Value

int

VisibleOutputTokens

Output tokens excluding reasoning (visible output only).

public int VisibleOutputTokens { get; }

Property Value

int