Search Results for

    Show / Hide Table of Contents

    Class Usage

    Usage metadata returned by AI service providers after a generation request. Contains token usage details for billing and monitoring.

    Inheritance
    object
    Usage
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Glitch9.AIDevKit
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    [Serializable]
    [JsonConverter(typeof(UsageJsonConverter))]
    public class Usage

    Constructors

    | Edit this page View Source

    Usage()

    Declaration
    public Usage()
    | Edit this page View Source

    Usage(params UsageInfo[])

    Declaration
    public Usage(params UsageInfo[] usages)
    Parameters
    Type Name Description
    UsageInfo[] usages

    Properties

    | Edit this page View Source

    AcceptedPredictionTokens

    Number of tokens that matched model predictions and were accepted (prediction mode).

    Declaration
    public int? AcceptedPredictionTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    AudioInputTokens

    Number of tokens derived from audio input (e.g., in transcriptions).

    Declaration
    public int? AudioInputTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    AudioOutputTokens

    Number of tokens used for audio output (e.g., in TTS responses).

    Declaration
    public int? AudioOutputTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    CachedInputReadTokens

    Number of tokens read from cached input.

    Declaration
    public int? CachedInputReadTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    CachedInputWriteTokens

    Number of tokens written to cached input.

    Declaration
    public int? CachedInputWriteTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    CitationTokens

    Number of tokens used for citations or references in the output.

    Declaration
    public int? CitationTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    ImageInputTokens

    Number of tokens derived from image input (vision)

    Declaration
    public int? ImageInputTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    ImageOutputTokens

    Number of tokens used for Image Generation tool output.

    Declaration
    public int? ImageOutputTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    Images

    Declaration
    public int? Images { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    InputTokens

    Number of tokens used in the prompt (input sent by the user).

    Declaration
    public int? InputTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    IsEmpty

    Returns true if no usage data is present.

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsFree

    Declaration
    public bool IsFree { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    OutputTokens

    Number of tokens generated in the response (output by the model).

    Declaration
    public int? OutputTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    ReasoningTokens

    Number of tokens spent on internal reasoning (e.g., CoT steps).

    Declaration
    public int? ReasoningTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    RejectedPredictionTokens

    Number of tokens that were predicted but rejected or unused.

    Declaration
    public int? RejectedPredictionTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    ToolUseTokens

    Number of tokens used for tool call prompts.

    Declaration
    public int? ToolUseTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    TotalTokens

    Total number of tokens used in the request. This is not calculated internally. It's sent by the API.

    Declaration
    public int? TotalTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    TrainingTokens

    Number of tokens used for fine-tuning or training the model.

    Declaration
    public int? TrainingTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    WebSearches

    Declaration
    public int? WebSearches { get; set; }
    Property Value
    Type Description
    int?

    Methods

    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Extension Methods

    UsageCalculator.CalcCostsOnRequestComplete(Usage, string)
    UsageCalculator.GetTotalCostInUsd(Usage)
    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation