How to track a run's cost in USD?

I'm using the Python SDK to run apify actors and get data for my application> I want to track how much money I'm spending on each run so I can calculate my average costs.

As I spoke with the Apify AI chat bot and by reading the documentation, I discovered that there is the 'usageTotalUsd' key in the run object that should represent how much I paid for the run.

However, the data isn't right at all. In the apify dashboard I'll see one number and in my logs I will see a different value for how much I actually paid.

            # ...
            run_input = {
                # Run input data
            }

            # Running the scraper
            run = apify_client.actor("apify/instagram-scraper").call(run_input=run_input)
            for user in apify_client.dataset(run["defaultDatasetId"]).iterate_items():
                # Process the result...

            print('Run usage: ', run['usageTotalUsd'])
            total_apify_usage += run['usageTotalUsd']
            
            # ...


Am I doing something wrong?
Was this page helpful?