AI Usage Testing and Reporting
This document provides guidance for testing and reporting AI usage in the Puter platform.
Manual Testing for AI Usage Reporting
When testing AI usage reporting and tracking, it's sometimes necessary to manipulate the timestamps of usage records for testing purposes. This can be useful for validating reporting over specific time periods or for troubleshooting issues with usage limits.
Backdating AI Usage Records
To move all records in the ai_usage table back by one week, you can use the following SQL query for SQLite:
UPDATE ai_usage
SET created_at = datetime(created_at, '-7 days');
This query updates the created_at timestamp for all records in the table, shifting them back by 7 days.
Common Testing Scenarios
-
Testing daily usage limits: Backdate some records to earlier in the current day to test daily usage limit calculations.
-
Testing monthly reports: Distribute usage records across a month to validate monthly usage reports.
-
Testing billing cycles: Adjust record timestamps to span multiple billing cycles to ensure proper attribution.
Usage Table Structure
The ai_usage table tracks all AI service usage with the following key fields:
user_id: The user who made the requestservice_name: The AI service that was used (e.g., 'openai', 'claude')model_name: The specific model that was usedcost: Expected cost in microcents (µ¢)value_uint_1: Input tokensvalue_uint_2: Output tokenscreated_at: When the usage occurred
For the complete table definition, see the ai_usage table schema.
Resetting Test Data
After testing, you may want to reset the timestamps to their original values. This is only possible if you've kept a backup of the original data or timestamps.
General
API
- Index (README.md)
- api drivers
- Group Endpoints
- Notification Endpoints
- Share Endpoints
- Type-Tagged Objects
Concepts
Types
For Contributors
- Comment Prefixes
- contributors vscode
- Local Email Testing
- Puter Extensions
- Repository Structure and Tooling
Extensions
Devmeta
Planning
- Micro Modules
- [planning alternatives_to_
](planning-alternatives_to_)
Self_hosters
- Configuring Domains for Self-Hosted Puter
- Configuring Puter
- First Run Issues
- self_hosters config_values
- self_hosters support
- Self-Hosting Puter
Src
Backend
A_and_A
For Contributors
- Backend Style
- Puter Backend - Directory Structure
- Puter Backend Boot Sequence
- Puter Kernel Moduels and Services
Features
- Batch and Symlinks
- Metered Services and Cost Management
- Protected Apps and Subdomains
- Service Scripts
Lists_of_things
Modules
Puterai
Notes
Services
Src
Modules
Puterai
- Index (README.md)
- Configuring AI Services
- PuterAI API Request Examples
- src backend src modules puterai config
####### For Contributors
Test_drivers
Gui
Phoenix
Tools
Api_tester
Uncategorized
This wiki is generated from the repository. Do not edit files the wiki.
You are reading documentation for Puter, an open-source high-level operating system.
Getting started with Puter on localhost is as simple as:
git clone https://github.com/HeyPuter/puter.git
npm install
npm run start