Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16891

How to check the validity of the OpenAI key from python?

$
0
0

When I ask Chat GPT to complete a message

import openairesponse = openai.ChatCompletion.create(    model="gpt-3.5-turbo",    messages=[{"role": "user", "content": "What are the trade-offs around deadwood in forests?"}])print(response)

I get a RateLimitError: You exceeded your current quota, please check your plan and billing details.

Is there a python method to check that the key is valid?

In [35]: openai.api_keyOut[35]: 'sk-...'

Viewing all articles
Browse latest Browse all 16891


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>