-
Notifications
You must be signed in to change notification settings - Fork 2.5k
src backend src modules puterai contributors ai_usage_testing
This document provides guidance for testing and reporting AI usage in the Puter platform.
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.
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.
-
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.
The ai_usage
table tracks all AI service usage with the following key fields:
-
user_id
: The user who made the request -
service_name
: The AI service that was used (e.g., 'openai', 'claude') -
model_name
: The specific model that was used -
cost
: Expected cost in microcents (µ¢) -
value_uint_1
: Input tokens -
value_uint_2
: Output tokens -
created_at
: When the usage occurred
For the complete table definition, see the ai_usage table schema.
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.
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
- Index (README.md)
- api drivers
- Group Endpoints
- Notification Endpoints
- Share Endpoints
- Type-Tagged Objects
- Comment Prefixes
- contributors vscode
- Local Email Testing
- Puter Extensions
- Repository Structure and Tooling
- Configuring Domains for Self-Hosted Puter
- Configuring Puter
- First Run Issues
- self_hosters config_values
- self_hosters credit_context
- self_hosters support
- Self-Hosting Puter
- Backend Style
- Puter Backend - Directory Structure
- Puter Backend Boot Sequence
- Puter Kernel Moduels and Services
- Index (README.md)
- Configuring AI Services
- PuterAI API Request Examples
- src backend src modules puterai config
####### For Contributors