Is the current model pricing available via the API?

Hi,

I found this list for the current prices per token for the various models:

It would be very convenient if those prices were available via the API, too.

For instance, it would be great if the below list would also contain the current prices per token, which, afaik, it doesn’t.

import openai
openai.Model.list()

Does someone know whether it is currently possible to obtain the pricing information programmatically?

Thank you for your help!

2 Likes

Thanks a lot for the above code snippet! In fact, I had the same idea to let it parse the web-site. Good to know to this is not so easy. I will then follow your advice and for now manually maintain a little “pricing database” within the code.

Yes, it would be great to have the current pricing available as API endpoint.