#Python rate limit error

1 messages · Page 1 of 1 (latest)

proper kestrel
#

Hi, I wanted to test out the API and I'm getting the openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details. error for the first message I send. Is there something I'm missing? It's a simple console application that receives a message and then prints the response from the gtp-3.5-turbo-0301 model. Here's the code:

import openai

openai.api_key = open("key.txt", "r").read() # My key
MODEL = "gpt-3.5-turbo-0301"


def get_chat_response(message):
    return openai.ChatCompletion.create(model=MODEL, messages=[
        {"role": "system", "content": "You are a cheerful chatbot."},
        {"role": "user", "content": message}])


def send_message(message):
    response = get_chat_response(message)

    if response is None:
        print("Something went wrong.")
        return

    finish_reason = response["choices"][0]["finish_reason"]
    message_response = response["choices"][0]["message"]["content"]

    if finish_reason == "stop":
        print(message_response)
    else:
        print("Something went wrong.")


def get_message():
    message = input("Message: ")

    return message


while True:
    send_message(get_message())