Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do I obtain api usage by SKU programmatically?

I'm using Google's Text-to-Speech api whose cost is based upon the selected voice and number of characters converted to audio. I can see my api usage in the Console's Report page but I can't seem to figure out how to obtain this information programmatically.

I would really like to obtain my current usage before kicking off large TTS operations.

TIA!

1 4 470
4 REPLIES 4

Not programmatically, but you can view the reports in your billing tab under Reports, You may the project, org, SKU and etc etc,

Screenshot 2023-10-12 3.34.52 AM.png

You would see cost bar normally here if you have API usage

Thank you @nceniza . I know how to generate reports by sku so I see data like the following. Supposedly, I should be able to push this report into BigQuery and then run *that* query to obtain [relatively] up-to-date usage statistics. I'm still trying to figure out how to do that. 😞

sku.jpg

 

I see, Would be exporting billing to Bigquery would help? https://cloud.google.com/billing/docs/how-to/export-data-bigquery 

It might - looking into that now. Thank you!