Class UsageMetadata
Usage metadata returned by AI service providers after a generation request. Contains token usage details for billing and monitoring.
[Serializable]
public class UsageMetadata
- Inheritance
-
objectUsageMetadata
Constructors
UsageMetadata()
public UsageMetadata()
UsageMetadata(params Usage[])
public UsageMetadata(params Usage[] usages)
Parameters
usagesUsage[]
Fields
usages
public List<Usage> usages
Field Value
- List<Usage>
Properties
AcceptedPredictionTokens
Number of tokens that matched model predictions and were accepted (prediction mode).
public int? AcceptedPredictionTokens { get; set; }
Property Value
- int?
AudioInputTokens
Number of tokens derived from audio input (e.g., in transcriptions).
public int? AudioInputTokens { get; set; }
Property Value
- int?
AudioOutputTokens
Number of tokens used for audio output (e.g., in TTS responses).
public int? AudioOutputTokens { get; set; }
Property Value
- int?
CachedInputReadTokens
Number of tokens read from cached input.
public int? CachedInputReadTokens { get; set; }
Property Value
- int?
CachedInputTokens
Number of tokens reused from cache instead of re-sending in the input (for efficiency).
public int? CachedInputTokens { get; set; }
Property Value
- int?
CachedInputWriteTokens
Number of tokens written to cached input.
public int? CachedInputWriteTokens { get; set; }
Property Value
- int?
CitationTokens
Number of tokens used for citations or references in the output.
public int? CitationTokens { get; set; }
Property Value
- int?
ImageInputTokens
Number of tokens derived from image input (vision)
public int? ImageInputTokens { get; set; }
Property Value
- int?
ImageOutputTokens
Number of tokens used for Image Generation tool output.
public int? ImageOutputTokens { get; set; }
Property Value
- int?
InputTokens
Number of tokens used in the prompt (input sent by the user).
public int? InputTokens { get; set; }
Property Value
- int?
IsEmpty
Returns true if no usage data is present.
public bool IsEmpty { get; }
Property Value
- bool
OutputTokens
Number of tokens generated in the response (output by the model).
public int? OutputTokens { get; set; }
Property Value
- int?
ReasoningTokens
Number of tokens spent on internal reasoning (e.g., CoT steps).
public int? ReasoningTokens { get; set; }
Property Value
- int?
RejectedPredictionTokens
Number of tokens that were predicted but rejected or unused.
public int? RejectedPredictionTokens { get; set; }
Property Value
- int?
ToolUseTokens
Number of tokens used for tool call prompts.
public int? ToolUseTokens { get; set; }
Property Value
- int?
TotalTokens
Total number of tokens used in the request. This is not calculated internally. It's sent by the API.
public int? TotalTokens { get; set; }
Property Value
- int?
TrainingTokens
Number of tokens used for fine-tuning or training the model.
public int? TrainingTokens { get; set; }
Property Value
- int?
Methods
GetTotalCostInUsd()
public double GetTotalCostInUsd()
Returns
- double
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.