# ChatGPT-4o-mini error 429 NOT on too many requests

**URL:** <https://community.openai.com/t/chatgpt-4o-mini-error-429-not-on-too-many-requests/1006705>\
**Category:** API\
**Tags:** chatgpt, api\
**Created:** [November 6, 2024, 5:37pm UTC](https://community.openai.com/t/chatgpt-4o-mini-error-429-not-on-too-many-requests/1006705 "2024-11-06T17:37:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VivacityDesign](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/vivacitydesign/32/230492_2.png) [@VivacityDesign](https://community.openai.com/u/VivacityDesign)\
**Post date:** [November 6, 2024, 5:37pm UTC](https://community.openai.com/t/chatgpt-4o-mini-error-429-not-on-too-many-requests/1006705/1 "2024-11-06T17:37:50Z")

</div>

Something strange is happening to my chatbot since yesterday.  
I have 1.89/10$ usage in my dashboard, i did not use my API connection to the model for hours (i was in office) and suddenly since yesterday evening i cannot send any more requests and when i try i get:

> Failed to load resource: the server responded with a status of 429 ()  
> txtchatbot.html:763 Error:  
> Error while requesting to the API

I was very disapointed because error 429 usually is for too many request, which was not the case… but when i click on the link for the completion in the error, i get the following result:

```auto
{
    "error": {
        "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

```

Which is not the case as well, because the API key is correctly sent to the model via this code.

```auto
// Fuction to interrogate OpenAI model and get response (TXT chatbot - simple chat)
async function getChatGPTResponse(userInput, chatMemory = []) {
  const apikey = localStorage.getItem("openaikey");      
  document.getElementById("apikey").value = apikey; 
console.log(apikey);
  if (apikey === "") {
    alert("No OpenAI API Key found.");
  } else {
    console.log(apikey);
  }      
  const chatContainer = document.getElementById("chathistory");
  const typingIndicator = document.createElement("p");
  typingIndicator.id = "typing-indicator";
  typingIndicator.innerHTML =
    '<img src="preloader.gif" class="preloader" alt="Loading...">'; // need to have this gif in your folder
  chatContainer.appendChild(typingIndicator);

  try {
    const response = await fetch("https://api.openai.com/v1/chat/completions", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",

        Authorization: "Bearer " + apikey
      },
      body: JSON.stringify({
        model: "gpt-4o-mini", // new model up to Oct. 2023
        messages: [...chatMemory, { role: "user", content: userInput }]
      })
    });
    if (!response.ok) {
      throw new Error("Error while requesting to the API");
    }
    const data = await response.json();
    if (
      !data.choices ||
      !data.choices.length ||
      !data.choices[0].message ||
      !data.choices[0].message.content
    ) {
      throw new Error("Invalid API response");
    }

```

and the console correctly reports the api key sent:

> ResponsiveVoice r1.8.3  
> responsivevoice.js?key=yZtZhFyg:340 isHidden: false  
> responsivevoice.js?key=yZtZhFyg:341 Prerender: false  
> txtchatbot.html:1 [DOM] Password field is not contained in a form: (More info: [Create Amazing Password Forms](https://goo.gl/9p2vKq)) \<input type=​"password" id=​"apikey" placeholder=​"Your API key" readonly\>​  
> responsivevoice.js?key=yZtZhFyg:402 Configuring  
> responsivevoice.js?key=yZtZhFyg:144 RV: Voice support ready  
> 2responsivevoice.js?key=yZtZhFyg:452 Selected text \*\*  
> txtchatbot.html:590  
> sk-ZvwHV----------(dashed for security reason)  
> txtchatbot.html:595  
> sk-ZvwHV----------(dashed for security reason)  
> txtchatbot.html:684  
> sk-ZvwHV----------(dashed for security reason)  
> txtchatbot.html:688  
> sk-ZvwHV----------(dashed for security reason)  
> [api.openai.com/v1/chat/completions:1](http://api.openai.com/v1/chat/completions:1)
> 
> ```
> Failed to load resource: the server responded with a status of 429 ()
> 
> ```
> 
> txtchatbot.html:763 Error: Error while requesting to the API  
> at getChatGPTResponse (txtchatbot.html:712:13)  
> at async sendMessage (txtchatbot.html:601:20)  
> getChatGPTResponse @ txtchatbot.html:763
