Davinci 003 request per minute issue

I am new to using the API of open AI. I have created the text-to-query model using the langchain framework. I have 5$ credit given by Open AI but when I am using it for the first time it also gives me a request-per-minute error. I tried after 5 minutes also to check if it would work or not because it was given that check after 20 seconds. but it is not working but in free trier is given that 3 rpm is allowed.

If you mean Langchain, that is an agent framework that is meant to make multiple calls to AI models per input. It also will empty your account balance (as quickly as the new “assistants” feature), so you can be thankful the rate limit kicked in.

The rate limit is not an absolute limiter. It is possible to make many requests quickly without having specified how many max_tokens you will use, and that then uses up the rate limit budget you were allocated for many minutes.

Here’s some example code to chat, with a single turn being consumed per question. We specify a model with 1/10th the cost. Were you to develop an end user product, having purchased an account credit, you would have much higher rate limits, but would also incorporate rate limit checking and other error handling in your code.

from openai import OpenAI
client = OpenAI()
system = [{"role": "system",
           "content": """You are a chatbot, giving expert answers."""}]
user = [{"role": "user", "content": "brief introduction?"}]
chat = []
while not user[0]['content'] == "exit":
    response = client.chat.completions.create(
        messages = system + chat[-10:] + user,
        model="gpt-3.5-turbo", top_p=0.9, stream=True)
    reply = ""
    for delta in response:
        if not delta.choices[0].finish_reason:
            word = delta.choices[0].delta.content or ""
            reply += word
            print(word, end ="")
    chat += user + [{"role": "assistant", "content": reply}]
    user = [{"role": "user", "content": input("\nPrompt: ")}]

You will need to set OPENAI_API_KEY as an environment variable in your operating system, ensuring the API key is not exposed in your code.

I am asking if there is a free tier that is provided for 3 requests per min. so why am not able to use it for at least 1 request?

If you have a $5 credit from having just signed up, and are in the free tier, then yes, you will have a rate limit that is three requests per minute.

However if you used a tool that exceeded that quickly by making many requests, you will have to wait many minutes for the budget of requests you were given to reset.

Langchain can also exceed the limit by making multiple API calls before you even get an answer back. It is software to delete unless you have a specific application for it and know why you are using it.

i am waited for hours and created new api key from different account but the issue remain the same . if I am understanding the your answer correctly you are saying even before hitting the API langachin hit API multiple time and that why I am getting the error of rpm

The forum is just regular users, so I cannot answer about your account.

You can check your API usage and the state of a free credit grant on this page:

https://platform.openai.com/usage

You can check your current account balance available at this page:

https://platform.openai.com/account/billing/overview

Then finally, go to the playground icon in your account, choose “chat” as the mode, and see if you can submit a user message to the gpt-3.5-turbo model.