Public
Like
6
Townie
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
A dashboard for monitoring API usage and inference calls.
- User summary view with aggregated usage data
- All requests view with collapsible rows showing inference calls
- Inference calls view with filtering options
- Pagination for handling large datasets
- Comparison between usage data and inference calls for debugging
- Fallback to inference data when usage data is missing
The dashboard is built with a modular architecture:
/usage-dashboard/
index.ts # Main entry point and routing
auth.ts # Authentication logic
/api/
index.ts # API request handler
requests.ts # API endpoints for requests data
inference-calls.ts # API endpoints for inference calls
user-summary.ts # API endpoints for user summary data
/views/
layout.ts # Common layout template
dashboard.ts # User summary view
requests.ts # Requests view with collapsible rows
inference-calls.ts # Inference calls view
/utils/
formatters.ts # Shared formatting utilities
pagination.ts # Pagination utilities
Access the dashboard at the root URL. Authentication is required.
-
User Summary - Shows aggregated usage data by user
- When usage data is missing, it falls back to inference call data
- Indicated with an "I" badge
-
All Requests - Shows all usage requests with pagination
- Click on a row to see associated inference calls
- Compares usage data with inference call totals
- Highlights discrepancies for debugging
-
Inference Calls - Shows all inference calls with pagination
- Can be filtered by usage_id
- Links back to the associated request
/api/requests
- Get paginated requests/api/requests?usage_id=123
- Get a specific request/api/inference-calls
- Get paginated inference calls/api/inference-calls?usage_id=123
- Get inference calls for a specific request/api/user-summary
- Get user summary data
The dashboard includes several features for debugging:
- Collapsible Rows - Click on a request to see its inference calls
- Token Comparison - Compare tokens and price between usage and inference data
- Discrepancy Highlighting - Visual indicators when data doesn't match
- Inference Data Fallback - Use inference data when usage data is missing