Overview
This document outlines the steps involved to generate billing reports for DynamoGuard.
How is Billing Calculated?
- Billing is based on the number of tokens that are inferenced using the /analyze/ or /chat/ endpoints
- This does not take into consideration the number of policies that applied
Generating a Billing Report
Inputs
The Billing Report will always be generated using the following inputs describing the time period of billing
- From Date: The start date from which you need to compute billing [Inclusive]
- To Date: The end date till which you need to compute billing [Exclusive]
- Example if you want to compute the tokens used on
6/11/2024
- Example if you want to compute the tokens used on
from_date="2024-11-06"
to_date="2024-11-07"
Considerations
- Only users with Platform Admin role are allowed to generate billing reports!
- Billing reports will only be valid for dates after billing is enabled in the environment
Generating a Report using the Core SDK
- Create dynamofl sdk client
from dynamofl import DynamoFL
API_KEY=`<api-key-of-user-with-platform-admin-role>`
API_HOST=`<api-url-of-env>`
dfl = DynamoFL(API_KEY, host=API_HOST, log_level=logging.INFO)
- Generating a Report and Extracting the Report ID
billing_report = dfl.generate_billing_report(
from_date="2024-11-07",
to_date=""2024-11-08""
)
This is what the response would look like
BillingReport(id=37, from_time='2024-11-07T00:00:00.000Z', to_time='2024-11-08T00:00:00.000Z', data_store_path=None, is_billing_data_corrupted=False, job_id='672d0dd5135bd9eae20af4ff', status='QUEUED')
This triggers an asynchronous job that runs and generates the billing report and stores in the datastore
- Use the id to view status of the report
billing_report = dfl.get_billing_report(`<billing-report-id>`)
Run this till you get the status as COMPLETED
- Request for billing report files download url
billing_report = dfl.get_billing_report_url(`<billing-report-id>`)
- Download the zip file from the link & share it with DynamoAI team