Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCost Plugin for OpenAI usage data #22

Closed
lmello opened this issue Jul 25, 2024 · 9 comments · Fixed by #38
Closed

OpenCost Plugin for OpenAI usage data #22

lmello opened this issue Jul 25, 2024 · 9 comments · Fixed by #38
Assignees

Comments

@lmello
Copy link
Member

lmello commented Jul 25, 2024

Is your feature request related to a problem? Please describe.
no.

Describe the solution you'd like
Integrate the openai usage data and costs with opencost.

Describe alternatives you've considered
NA

Additional context

@dwbrown2
Copy link

Thanks for creating this FR, I've talked with 2-3 teams that have requested this recently. Any interest in working on this? Last I heard OpenAI has billing usage APIs but they are undocumented.

cc @kwombach12 who I believe is also interested in this!

@kwombach12
Copy link

We would love to collaborate with you on this @lmello! If you're interested, here is a blog post on how to get started.

PS: We are offering $1,000 for accepted plug-in contributions as we start to build out our library!

@lmello
Copy link
Member Author

lmello commented Aug 4, 2024

I am working to build an OpenAI usage dashboard in zendesk to track our usage, currently their usage api is undocumented and broken (v1/usage). I talked with the TAM assigned to us and they plan to fix it and release a working api but I didn’t got any dates yet.

The work around I did was using the export api from the usage dashboard , but those api’s only work with a session credential instead of an api key.

I don’t know if we would want to build this integration using a session credential provided this would require us to update the credential every two weeks.

@lmello
Copy link
Member Author

lmello commented Aug 4, 2024

The current usage api returns the usage models, metrics for the model and this can be used to calculate the cost, but it does not return the api key or user id which are essential to display usage and cost per user.

We might be able to use it to display cost and usage per model until they fix the v1/usage api.

@kwombach12
Copy link

@lmello interesting! I think it would be worth looking at the cost/usage per model until they fix that API. Is that something you'd be interested in working on with us?

@lmello
Copy link
Member Author

lmello commented Sep 20, 2024

@kwombach12 discussed it with @ameijer and we will have a meeting next week to start this work.
I already shared some details about the api with him in slack.

@kwombach12
Copy link

@lmello That's awesome! Please let me know if I can be of any help testing, identifying scope, or providing feedback. Super excited to work with you on this!

@lmello
Copy link
Member Author

lmello commented Sep 20, 2024

@kwombach12 I am working on it with @ameijer .

@ameijer
Copy link
Contributor

ameijer commented Oct 10, 2024

basic implementation undergoing review here: #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants