FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
valdottown
valdottownTownie
AI assistant that can edit your vals
Public
Like
6
Townie
Home
Code
10
.vscode
1
backend
5
frontend
6
prompts
2
.cursorrules
.vtignore
README.md
TODOs.md
deno.json
H
index.ts
Branches
7
Pull requests
2
Remixes
8
History
Environment variables
2
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.
Sign up now
Code
/
backend
/
database
/
usage-dashboard
/
README.md
Code
/
backend
/
database
/
usage-dashboard
/
README.md
Search
5/8/2025
README.md

Usage Dashboard

A dashboard for monitoring API usage and inference calls.

Features

  • 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

Architecture

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

Usage

Access the dashboard at the root URL. Authentication is required.

Views

  1. 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
  2. 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
  3. Inference Calls - Shows all inference calls with pagination

    • Can be filtered by usage_id
    • Links back to the associated request

API Endpoints

  • /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

Debugging

The dashboard includes several features for debugging:

  1. Collapsible Rows - Click on a request to see its inference calls
  2. Token Comparison - Compare tokens and price between usage and inference data
  3. Discrepancy Highlighting - Visual indicators when data doesn't match
  4. Inference Data Fallback - Use inference data when usage data is missing
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.