so i was making a essay app i am getting this error
index.html:24
POST https://api.openai.com/v1/completions 429
This is my code
<!DOCTYPE html>
<html>
<head>
<title>Essay Generator</title>
</head>
<body style="background-color: crimson;">
<h1 style="text-align: center;">Essay Generator</h1>
<form style="background-color: aqua; text-align: center; border-color: rgb(16, 30, 221); border-radius: 10cm;">
<label for="topic">Topic:</label><br>
<input type="text" id="topic" name="topic"><br>
<label for="wordCount">Word Count:</label><br>
<input type="number" id="wordCount" name="wordCount"><br><br>
<button type="button" onclick="sendTopicAndWordCount()">Generate Essay</button>
</form>
<div id="response" style="text-align: center;"></div>
<script>
function sendTopicAndWordCount() {
// Get the topic and word count from the form
var topic = document.getElementById("topic").value;
var wordCount = document.getElementById("wordCount").value;
// Make the API request using a CORS proxy
fetch("https://api.openai.com/v1/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer key"
},
body: JSON.stringify({
"model": "text-davinci-003",
"prompt": "essay on" + topic,
"max_tokens": wordCount,
"temperature": 0.1
})
})
.then(response => response.json())
.then(response => {
// Display the API's response in the div
document.getElementById("response").innerHTML = response.text;
});
// https://cors-anywhere.herokuapp.com/https://api.openai.com/v1/completions
//https://api.openai.com/v1/text-davinci/questions
}
</script>
</body>
</html>