Detailed Per-Model Token Metrics Now Available in GitHub AI Usage API
GitHub's AI usage REST API now provides per-model token breakdowns, enhancing billing transparency and data integration for developers and enterprises.

Introduction to Per-Model Token Breakdown in GitHub AI Usage API
GitHub has introduced a significant improvement to its AI usage REST API by enabling a per-model token breakdown for AI credits. This enhancement allows users to retrieve detailed token counts associated with specific AI models directly through the API, providing greater granularity in usage data. The update applies to various billing scopes including enterprise, organization, and individual user levels, facilitating comprehensive monitoring across different account types.
This new capability is accessible via existing endpoints for enterprises, organizations, and users, with no changes required in permissions. It supports admins on Copilot Business and Copilot Enterprise plans, as well as all users on Copilot for individuals, ensuring broad availability. The token counts are raw and do not include pricing or discount adjustments, focusing purely on usage metrics.
The per-model token breakdown aligns with the AI usage report definitions, enabling seamless integration of token data into custom dashboards and tools without the need to download separate reports. This consistency simplifies data engineering efforts for developers and data teams who rely on accurate and timely AI usage metrics for cost management and operational insights.
Token Categories and Their Significance
The API now returns six distinct raw token counts for each usage item, covering both input and output tokens for text and images, as well as cache-related tokens. These categories include tokenInput (input tokens sent to the model), tokenOutput (output tokens generated by the model), tokenImageInput (image input tokens), tokenImageOutput (image output tokens), tokenCacheRead (cached tokens read by the model), and tokenCacheWrite (tokens written to the cache, excluding extended cache creation).
This detailed categorization provides a comprehensive view of how tokens are consumed across different modalities and caching mechanisms. For developers and data engineers, understanding these token flows is critical for optimizing AI model usage, managing costs, and improving system efficiency. For example, distinguishing between image and text tokens can inform resource allocation and usage patterns for multimodal AI applications.
Additionally, cache read and write tokens offer insights into the effectiveness of caching strategies, which can impact both performance and billing. By monitoring these metrics, teams can fine-tune cache policies to reduce redundant token consumption and improve response times, ultimately enhancing the user experience and controlling expenses.
API Endpoints and Access Details
The per-model token breakdown is available through three main REST API endpoints tailored to different billing scopes: enterprise, organization, and user. Specifically, these are GET /enterprises/{enterprise}/settings/billing/ai_credit/usage, GET /organizations/{org}/settings/billing/ai_credit/usage, and GET /users/{username}/settings/billing/ai_credit/usage. Each endpoint returns token counts filtered by parameters such as time period, user, and model, maintaining consistency with existing API behavior.
Importantly, the new token fields appear in the API responses without requiring any changes to existing permissions or authentication mechanisms. This design choice ensures a smooth transition for current users who can immediately benefit from the enhanced data without modifying their integration or access controls.
From a data engineering perspective, these endpoints facilitate automated ingestion of detailed token usage data into billing and analytics pipelines. Enterprises and organizations can now programmatically track AI credit consumption at a granular level, enabling more precise cost allocation, budgeting, and forecasting based on model-specific usage patterns.
Data Availability and Historical Usage Considerations
Token count data generally starts from December 1, 2026, marking the beginning of detailed per-model token tracking. Customers with early access may have partial data from before this date, but for periods prior to December 1, token fields will return zero. This limitation is important for teams analyzing historical usage trends or reconciling past billing data.
To access token details for usage before the API capture start date, users must download the AI usage report from the AI usage page in their billing settings. This approach maintains backward compatibility while encouraging adoption of the new API features for ongoing and future usage monitoring.
For developers and data engineers, this means that historical data integration may require combining API data with previously downloaded reports to achieve a complete view. Planning data pipelines accordingly will ensure continuity and accuracy in usage analytics and cost management workflows.
Implications for Developers and Data Engineering Teams
The introduction of per-model token breakdowns in the AI usage REST API presents several opportunities and challenges for developers and data engineering professionals. First, it enables more granular cost attribution by model, which is essential for organizations running multiple AI models or experimenting with different versions.
From an implementation standpoint, teams should update their data ingestion processes to incorporate the new token fields, ensuring that dashboards and billing tools reflect the enhanced granularity. This may involve schema updates, API client modifications, and validation logic to handle the new token categories.
Moreover, the availability of detailed token data supports advanced analytics, such as identifying high-cost models, optimizing token usage, and correlating token consumption with application performance. Developers should leverage this data to implement usage alerts, budget controls, and efficiency improvements, ultimately driving better resource management and cost savings.
Next Steps for Practitioners and Best Practices
Practitioners should begin by reviewing the updated API documentation for enterprises, organizations, and personal accounts to understand the new token fields and their semantics. Testing the enhanced endpoints in development environments will help identify integration points and potential impacts on existing workflows.
It is advisable to update monitoring and reporting tools to include per-model token metrics, enabling stakeholders to gain insights into AI credit consumption patterns. Teams should also consider automating data collection and analysis to promptly detect anomalies or unexpected usage spikes.
Finally, organizations should communicate these changes internally to billing, finance, and engineering teams to align on usage tracking and cost management strategies. By proactively adopting the new token breakdown capabilities, practitioners can improve transparency, optimize AI resource utilization, and enhance operational decision-making.
Sources and verification
Researched and drafted with AI assistance from the primary sources cited below. Every factual statement is checked automatically against a verbatim passage in its source before publication. No interviews or quotations are fabricated. Read our editorial standards.


