Cost Analysis and Usage Statistics is a core feature module for AI Gateway cost management. It includes two sub-features: Token Consumption Statistics and Cost Analysis Reports, supporting multi-dimensional views of AI Gateway call usage and cost details.
Token Consumption Statistics
Token Consumption Statistics provides Token consumption data for all AI requests of the AI Gateway. It supports viewing and filtering by different dimensions and exporting the data as CSV files.
Feature overview
6 Metric Cards: Input Token Count, Output Token Count, Cache Hit Token Count, Total Request Count, Top Consumer, Total Cost
Data Export: supports export in CSV format.
Operation Steps
Going to the Token Consumption Statistics Page
2. On the instance list page, click the ID of the gateway instance you want to configure to go to its basic information page.
3. In the left sidebar, click the Token Consumption Statistics tab.
Viewing Metric Cards
Statistical metric cards are displayed at the top of the page.
|
Input Token | Total input tokens |
Output Token | Total output tokens |
Cache Hit Token | Total input tokens from cache hits |
Total number of requests | Total number of AI calls |
Top Consumer | Top consumer by consumption |
Total Fee | Total cost of Token usage |
Model Usage Summary
A model usage summary table is located below the trend chart, displaying overall model usage summary data.
Supports filtering by time range, conditional filtering, and keyword search.
Exporting data
1. Click the Export CSV button in the upper-right corner of the list.
2. The system will generate a CSV file containing cost analysis data for the current dimension and automatically download it.
Cost Analysis Report
Cost Analysis Reports are generated by automatically calculating invocation costs across various dimensions based on model unit price configurations and Token consumption data. They support multi-dimensional cost detail viewing, cost trend analysis, and data export.
Feature overview
5 Dimension Tabs: Consumer, Consumer Group, Model Service, Model API, Route
Cost Details Table: displays details of Token consumption and cost amounts across various dimensions.
Cost Trend Chart: displays the cost change trend over time.
Statistical Cards: display total cost and various aggregated data.
Data Export: supports export in CSV format.
Prerequisites
Model pricing must be configured; otherwise, the cost amount will be displayed as 0.
AI invocation records already exist for the gateway instance.
Operation Steps
Step 1: Go to the Cost Analysis Report Page
2. On the instance list page, click the ID of the gateway instance you want to configure to go to its basic information page.
3. In the left sidebar, select Cost Management.
4. On the Cost Management page, click the Cost Analysis Report tab.
Step 2: Select the Analysis Time
In the Tab bar at the top of the page, select the time dimension you want to analyze.
Viewing Statistical Cards
Statistical summary cards are displayed at the top of the page.
Total Cost: the total invocation cost within the selected time range
Cost Breakdown by Dimension: shows the distribution of each dimension's proportion of the total cost.
Viewing the Cost Trend Chart
A cost trend chart is displayed below the summary cards. You can select a time range and switch to a daily view to intuitively understand cost trends.
Cost Details
A cost breakdown table is located below the trend chart, displaying detailed data across various dimensions.
Supports filtering by time range, conditional filtering, and keyword search.
Exporting data
1. Click the Export CSV button in the upper-right corner of the list.
2. The system will generate a CSV file containing cost analysis data for the current dimension and automatically download it.
Note:
The cost amount is calculated based on the configured model pricing. For models without configured pricing, the cost is displayed as 0.
The scope of the exported data matches the filter criteria set on the current page.
FAQs
Q1: Why Is the Cost Amount Displayed as 0?
Please check the following possible causes:
Check whether pricing has been configured for this model (configure it on the Model Pricing Configuration page).
Check whether AI invocation records already exist for the gateway instance.
Check whether the cost management feature is enabled.
Q2: What Is the Difference Between Token Consumption Statistics and the Cost Analysis Report?
Token Consumption Statistics: focuses on displaying raw data of Token usage and does not rely on pricing configuration.
Cost Analysis Report: calculates the actual invocation cost based on Token consumption data and model unit prices.
Q3: How Often Is the Data Updated?
Token consumption and cost data require approximately 30 seconds to 1 minute to synchronize. You can view the data on the page after it is updated.