Default Constructor.
Creates a new token usage component with all counters initialized to zero. Constructs fresh input and output objects with default values, providing a clean starting point for tracking token consumption in an agent phase.
Initializer Constructor.
Creates a new component populated with existing token usage data. Directly assigns the provided values to instance properties, preserving the exact token counts and structure from the source data for accurate tracking continuation.
Token usage data to initialize the component
Readonly
inputDetailed breakdown of input token consumption.
Tracks how many tokens were processed as input to the AI agent, including:
The cache efficiency (cached/total ratio) indicates how well the system is reusing context across multiple invocations.
Readonly
outputDetailed breakdown of output token generation.
Categorizes generated tokens by their purpose and acceptance status:
These metrics help understand the AI's generation efficiency and the effectiveness of its predictive mechanisms.
Total token count combining all input and output tokens.
Represents the complete token consumption for this component, providing a single metric for overall resource utilization. This value is critical for cost calculations and comparing efficiency across different agents or processing phases.
Add token usage data to current statistics.
Increments all token counters in this component by the corresponding values from the provided component data. This method performs in-place updates, modifying the current instance rather than creating a new one.
Updates include:
Token usage component data to add to current values
Export token usage data as JSON.
Converts the component's token usage statistics to the standardized IAutoBeTokenUsageJson.IComponent format. This serialization maintains the complete structure including total counts and detailed breakdowns for both input and output tokens.
JSON representation of the token usage component
Static
minusStatic
plusCreate new component combining two token usage statistics.
Performs element-wise addition of all token counters from two components, creating a new AutoBeTokenUsageComponent instance with the combined totals. This static method is useful for aggregating token usage across multiple agent invocations or combining statistics from parallel processing.
First token usage component
Second token usage component
New component with combined token statistics
Token usage component for individual AI agents in the vibe coding pipeline.
Represents detailed token consumption statistics for a specific processing phase (facade, analyze, prisma, interface, test, or realize). This class tracks both input and output token usage with granular breakdowns, enabling precise cost analysis and performance optimization for each agent.
The component structure includes:
This granular tracking helps identify optimization opportunities and understand the computational characteristics of each agent phase.
Author
SunRabbit123