VinciGit00 / Scrapegraph-ai

Python scraper based on AI

Home Page:https://scrapegraphai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get tokens usage count or price?

SumeraMartin opened this issue · comments

Is your feature request related to a problem? Please describe.
Hi, is there a way of how to count token usage? In case when I'm using commercial API it would be handy to know how much each request cost or at least how many tokens were used. Right now I got my parsed data from the url but I really can't say if this is viable way since I don't know if the usage cost me 0.001 USD or 0.1 USD which is huge difference.

Describe the solution you'd like
Would love to see either cost in USD or token count at the end of the run. Maybe this setting could be included in the configuration how this should be calculated.

Describe alternatives you've considered
I don't see any alternative here.

Additional context
Without this feature I really hesitating to use this library in production and I would need to considered to use alternatives where I'm able to get this information.

hi, look at this example link here you can find the function prettify_exec_info