How to track a run's cost in USD?
# apify-platform
n
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.
Copy code
# ...
            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?
h
Someone will reply to you shortly. In the meantime, this might help:
j
Hi @nel549 , Can you try to wait about 5secs after the Run, and then call Actor.get for the same Run and compare the price with the one on the Platform?