Token Usage
Overview
The Token & Credit Usage Dashboard is an administrative interface for monitoring ComusThumbz license API usage, credit balance, and transaction history. It connects to the ComusThumbz license server to display real-time account information, pricing data, and detailed usage logs. The dashboard includes intelligent caching to reduce API calls while maintaining data freshness.
Location: Navigate to this page via Admin Panel → Reports → Token Usage or access directly via ct/admin/tokenusage.php
[Screenshot: token-usage-main-interface]
Getting to This Page
Navigate to Admin Panel → ReportsClick Token Usage link
- Alternatively, access directly via
ct/admin/tokenusage.php
This page displays your ComusThumbz license API credit balance and usage statistics. Credits are consumed by AI-powered features like image processing and data enrichment.
System Requirements
This page requires a valid ComusThumbz license with API credentials configured. Internet connectivity to the license server is required for data retrieval.
PHP Requirements
Required PHP Extensions
Required PHP Functions
Folder Permissions
Network Requirements
Features & UI Elements
Page Header
[Screenshot: token-usage-header]
Navigation Buttons
[Screenshot: token-usage-navigation]
Account Overview Card
[Screenshot: token-usage-account-overview]
Balance & Usage Statistics Card
[Screenshot: token-usage-balance-stats]
Current API Pricing Card
[Screenshot: token-usage-pricing]
Live pricing from the license server:
Estimated Usage Remaining Card
[Screenshot: token-usage-estimated]
Calculates remaining usage based on current balance:
Low Balance Warning
[Screenshot: token-usage-warning]
When balance drops below $1.00, a prominent red warning banner appears with a link to purchase more credits at comusthumbz.com/projects/buycredits.php
Transaction History Table
[Screenshot: token-usage-transactions]
Pagination
[Screenshot: token-usage-pagination]
Dashboard Footer
Caching System
The dashboard implements a two-tier caching system:
Pricing Cache
Transaction Cache
AI Provider Name Branding
The dashboard sanitizes AI provider names for consistent branding:
This ensures transaction descriptions show branded names instead of third-party AI provider names.
Step-by-Step Usage
Viewing Credit Balance
- Navigate to Admin Panel → Reports → Token Usage
- View Current Balance in Balance & Usage Statistics card
- Green color indicates healthy balance (> $1.00)
- Red color indicates low balance (< $1.00)
Checking Usage Statistics
- View Balance & Usage Statistics card
- Note total tokens used and credits consumed
- Check Estimated Usage Remaining for projections
- Monitor API calls and images processed counts
Downloading Transaction History
- Click Download History button in navigation
- CSV file downloads automatically
- File includes all transactions with:
- Date, Type, Service, Amount, Tokens, Images, Description
- Open in Excel or spreadsheet application
Refreshing Data
- Click Refresh Data button
- All caches are cleared
- Fresh data fetched from API
- Page reloads with updated information
Clearing Caches Manually
Clear Pricing Cache:
- Click Update Pricing button
- Pricing cache deleted
- Latest pricing fetched from API
Clear Transaction Cache:
- Click Clear Cache button
- All transaction cache files deleted
- Fresh transaction history fetched on next load
Debugging API Issues
- Click Debug API button
- Page displays raw API responses:
- Configuration settings
- Cache file status
- USER INFO response
- USER STATS response
- First 5 transactions
- Use for troubleshooting connection issues
Purchasing More Credits
- When low balance warning appears
- Click "Click here to purchase credits" link
- Redirects to comusthumbz.com purchase page
- Complete credit purchase
- Return to dashboard and click Refresh Data
API Endpoints Used
The dashboard calls the following license server endpoints:
All requests include authentication parameters:
licensekey- Your license keydomain- Registered domainemail- Account email
Troubleshooting
Common Errors
"Failed to connect to License API"
Cause: Network connectivity or SSL issues
Solution:
- Check internet connectivity
- Verify cURL extension is enabled
- Check if SSL certificates are valid
- Try accessing API URL in browser
"API returned HTTP 500"
Cause: Server-side API error
Solution:
- Wait a few minutes and retry
- Contact ComusThumbz support if persistent
- Check license validity
"Invalid API response format"
Cause: API returned non-JSON response
Solution:
- Use Debug API to see raw response
- Check for PHP errors on license server
- Verify license credentials
"Unable to Load Account Data"
Cause: License configuration missing or incorrect
Solution:
- Verify licenseconfig in config.inc.php
- Check licensekey, domain, email values
- Ensure license is active and not expired
Cache not updating
Cause: Permission issues or stale cache
Solution:
Click Clear Cache and Update PricingCheck write permissions on ct/dat/ folder
- Verify ct/dat/transactioncache/ exists
Debug Mode
Access debug mode by adding ?debug=1 to the URL:
ct/admin/tokenusage.php?debug=1
Debug output includes:
- API Base URL
- License Key (truncated)
- Domain and Email
- Cache file paths and status
- Raw API responses for all endpoints
Auto-Refresh
The dashboard automatically refreshes every 10 minutes:
setTimeout(function() {
window.location.href = '?action=refreshdata';
}, 600000);
Leave the dashboard open to monitor credit usage in near real-time. Data refreshes automatically every 10 minutes.
Keyboard Navigation
CSV Export Format
Downloaded CSV includes UTF-8 BOM for Excel compatibility:
Translatable Strings
The following strings should be added to backendtranslations.md:
tokenusagetitle = "Token & Credit Usage Dashboard"
tokenusagebreadcrumb = "Token Usage"
tokenusageoverview = "Overview"
tokenusagerefresh = "Refresh Data"
tokenusagedownload = "Download History"
tokenusageupdatepricing = "Update Pricing"
tokenusageclearcache = "Clear Cache"
tokenusagedebug = "Debug API"
tokenusageback = "Back to Reports"
tokenusagehelp = "Help"
tokenusageaccountoverview = "Account Overview"
tokenusageemail = "Email"
tokenusagelicensetype = "License Type"
tokenusagedomain = "Domain"
tokenusagemembersince = "Member Since"
tokenusagebalancestats = "Current Balance & Usage Statistics"
tokenusagecurrentbalance = "Current Balance"
tokenusagetokensused = "Tokens Used"
tokenusagecreditsused = "Credits Used"
tokenusageapicalls = "API Calls Made"
tokenusageimagesprocessed = "Images Processed"
tokenusagelastupdated = "Last Updated"
tokenusagepricing = "Current API Pricing (Live)"
tokenusageimageprocessing = "Image Processing"
tokenusageinputtokens = "Input Tokens"
tokenusagecompletiontokens = "Completion Tokens"
tokenusagecachedtokens = "Cached Tokens"
tokenusageestimated = "Estimated Usage Remaining"
tokenusageimagesearches = "Image Searches"
tokenusagelowbalance = "LOW BALANCE WARNING"
tokenusagelowbalancemsg = "Your credit balance is below $1.00. Consider purchasing more credits to continue using AI services."
tokenusagebuycredits = "Click here to purchase credits"
tokenusagetransactionhistory = "Complete Transaction History"
tokenusageshowing = "Showing"
tokenusageof = "of"
tokenusagetransactions = "transactions"
tokenusagepage = "Page"
tokenusagecache = "Cache"
tokenusageold = "old"
tokenusageprevious = "Previous"
tokenusagenext = "Next"
tokenusagedate = "Date"
tokenusagetype = "Type"
tokenusageservice = "Service"
tokenusageamount = "Amount"
tokenusagetokens = "Tokens"
tokenusageimages = "Images"
tokenusagedescription = "Description"
tokenusagenotransactions = "No transaction history available"
tokenusageunableload = "Unable to Load Account Data"
tokenusagecheckconfig = "Please check your license configuration and try again."
tokenusageretry = "Retry Loading Data"
tokenusagenotransactionsdownload = "No transaction history available to download."
tokenusagedownloadfailed = "Failed to fetch data for download. Please try again."
tokenusagedatarefreshed = "Data refreshed successfully"
tokenusagepricingcleared = "Pricing cache cleared. Latest prices will be fetched."
tokenusagecachecleared = "Cleared transaction cache files. Fresh data will be fetched."
Version History
Related Documentation
- Financial Reports - Creator monetization financial tracking
- AI Image Selector - Image search using credits
- AI Model Data Update - Model data enrichment
- Reports Overview - All admin reports