Skip to main content

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
from_date="2024-11-06"
to_date="2024-11-07"

Considerations

  1. Only users with Platform Admin role are allowed to generate billing reports!
  2. Billing reports will only be valid for dates after billing is enabled in the environment

Generating a Report using the Core SDK

  1. 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)
  1. 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

  1. 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

  1. Request for billing report files download url
billing_report = dfl.get_billing_report_url(`<billing-report-id>`)
  1. Download the zip file from the link & share it with DynamoAI team