How-To: Monitor Balance and Usage
Accessing the Balance and Usage Dashboard
Log in to the web console to access the Main Page, which provides an overview of your account’s balance and usage.
Monitoring Credit Balance and Usage
The dashboard displays the following key metrics:

1
2
Custom Periods for Worker Runtime and Queries
Both Worker Runtime Summary and End-User Query Summary can be viewed for the following periods:
Daily: Statistics for the last 24 hours.
Monthly: Statistics for the last calendar month.
Yearly: Statistics for the last calendar year.
from datetime import datetime
import lattica_common.auth_local_state as auth
import lattica_common.app_api as agent_app
# Function to convert a datetime object to Unix timestamp in milliseconds
def to_unix_millis(dt: datetime) -> int:
return int(dt.timestamp() * 1000)
# Notice your account token expires every 30 days and it's up to you to renew it
auth.set_session_token("your_account_token_you_got_in_your_email")
credits = agent_app.account.get_credits_balance()
# Example Date Range 1: January 1, 2024 to January 31, 2024
start_date1 = to_unix_millis(datetime(2024, 1, 1))
end_date1 = to_unix_millis(datetime(2024, 1, 31, 23, 59, 59))
# In the given dates range, returns a list of worker sessions runtime per model
# of the account.
account_worker_sessions = agent_app.account.get_worker_sessions(start_date1, end_date1)
# Example Date Range 2: February 1, 2024 to February 28, 2024
start_date2 = to_unix_millis(datetime(2024, 2, 1))
end_date2 = to_unix_millis(datetime(2024, 2, 28, 23, 59, 59))
# In the given dates range, returns a list of queries done per model of the account
account_models_usage = agent_app.account.get_queries_per_model(start_date2, end_date2)
Last updated
Was this helpful?