API Access to Hard Limit / Usage / Billing data

Hey there,

is there any way to have access to the billing limit and/or current spenting per month through an api?

I want to be transparent with my users and show them how much money has already been used and i don’t want to rely solely on counting the tokens used.

3 Likes

Tokens used per month * openAI pricing model = $ spent per month

I know I could do that using data.usage.total_tokens and counting dallE access but they I would still be missing the configured hard limit. Would need to hardcode that and update the code everytime I up or downgrade the limit

Also you dont get token counts when you are streaming replies

1 Like

Like @sehrknusprig, I have a use case that would need such an API. My current project would at least require read access to current and historical usage, and usage limits.

@drewworkman3245’s suggestion is insufficient when monitoring your own costs while using tools developed by others or while using multiple tools with the same account.

:point_right: Ideally, having API access to ‘Account’ would open up great opportunities for improving the user experience of free Apps that use OpenAI.

I searched for a way to submit this as a #FeatureRequest but only found community forum posts, not an official resource.

Does this functionality already exist
somewhere? If not, has anyone found a workaround?
Did I miss an official resource to submit feature requests?

A great feature would be token used and $ per API key.

Throwing my hat in the “requesting account usage data available via API” ring. We would like this available so we can monitor our usage and alert on being close to our spend limits.

Some use cases:

  1. Periodically checking our usage limit and alerting if it goes above a certain ratio (current spend / limit > 0.70, say).
  2. Checking per-project spend to see if it is increasing or decreasing in an unexpected way (first derivative over time). Or per API key. Or per service account.
1 Like