openllmetry icon indicating copy to clipboard operation
openllmetry copied to clipboard

🚀 Feature: cost metrics across all instrumentations

Open nirga opened this issue 1 year ago • 6 comments

Which component is this feature for?

All Packages

🔖 Feature description

Add span attributes and metrics for total cost for each model we instrument. Right now we only send token usage but we can easily extend this and send cost as well - we just need to define a prices const in each instrumentation and multiple the prompt/completion token usage.

🎤 Why is this feature needed ?

Better visibility into the cost for OpenLLMetry usage. Right now we only provide token usage which is basically just a proxy for cost.

✌️ How do you aim to achieve this?

See feature decsription

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • [X] I checked and didn't find similar issue

Are you willing to submit PR?

None

nirga avatar May 14 '24 10:05 nirga

Is this available to work on? Im going to go ahead and give it a shot if no one else is already working on it

apuwk avatar May 15 '24 17:05 apuwk

Might be able to re-use an existing mapping: https://github.com/openlit/openlit/blob/main/assets/pricing.json

kocobee avatar Jun 06 '24 13:06 kocobee

@apuwk any progress?

If not, I might take this.

kocobee avatar Jun 25 '24 15:06 kocobee

@kocobee looks like he started working on it with #1303 but didn't continue. Let's wait for him to comment and if not maybe you can take it from there. You could also work on doing something similar to Anthropic or other frameworks - he hasn't done that and we'd love that as well :)

nirga avatar Jun 26 '24 16:06 nirga

@kocobee Hi, Yeah I'm still working on this and would like to keep working through it. But like Nir mentioned, you could start working on doing the same for other frameworks. Just update this chat with what you are working on if you can.

apuwk avatar Jun 26 '24 16:06 apuwk

@kocobee Sorry about the delay and stuff. You can carry on with this task. I don't think i'll be able to complete it.

apuwk avatar Jul 22 '24 01:07 apuwk