crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

OpenAI usage

Open ezequiroga opened this issue 2 years ago • 4 comments

Hi, I would like to know how to get information about the OpenAI usage from Agents. I mean, how could I know the tokens used by each Agents.

I need to know that for being able to estimate the cost of the solution.

Thanks!

ezequiroga avatar May 22 '24 21:05 ezequiroga

You can use langchain for that.

imnotdev25 avatar May 24 '24 03:05 imnotdev25

I added at the end of the crew run result = {{crew_name}}.kickoff() metrics={{crew_name}}.usage_metrics

return (result, metrics)

And captured on the calling side like

(result, metrics) = custom_crew.run()

cbruyndoncx avatar May 26 '24 07:05 cbruyndoncx

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 17 '24 12:08 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 22 '24 12:08 github-actions[bot]