Strange, Frustrating OpenAI Error

I have an active OpenAi account and working key. Yet when I try to do embeddings or use a retrieval QA chain I get this error.

Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.._completion_with_retry in 4.0 seconds as it raised RateLimitError: Your account is not active, please check your billing details on our website…

Yet this code runs fine

llm_model = "gpt-3.5-turbo"

def get_completion(prompt, model=llm_model):
    messages = [{"role": "user", "content": prompt}]
    response = openai.ChatCompletion.create(
    return response.choices[0].message["content"]

get_completion('what is 2^32?')

So frustrating. I’m at a total loss. Can anyone help?

Hi Patrick,
If you were working on a Retrieval chain, it is likely the problem was related to the embedding model. The code which is ok does not involve any embedding model. Anyway, can you provide the code snippet you are struggling with in order for me to diagonose better?

Same issue…seems to be a quota problem rather than an embedding one

FIxed. Mine was that I was setting an OpenAi key in the environment that I didn’t know about . Some where in the codebase reads that variable from the environment even if you specify it in your code.

So it would use the key I set in my code for chat, but for embeddings, it tried to pull the environment variable.

Anyway, I grew up and started using pipenv and doing it right so… problem solved.

1 Like