"you must provide a model parameter"

hi, i tried to work through this course.
but i hang on first try of request.
i do provide a model parameter but it been not recognized.
What am I overlooking?

sure, i tried with a real api key - not “xxx” :wink:
thank you!

Edit:

app.js

const API_KEY = "■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■63xAcwDiUvU"


async function fetchDate() {
    const response = await fetch("https://api.openai.com/v1/completions", {
        method: "POST",
        headers: {
            Authorization: `Bearer ${API_KEY}`,
            "Contant-Type": "application/json"
        },
        body: JSON.stringify({
            model: "text-davinci-003",
            prompt: "hello, how are you today?",
            max_tokens: 7
        })
    })
    const data = await response.json()
    console.log(data)
}

fetchDate()

index.html

<!DOCTYPE html>
<html leng="en">
  <head>
    <meta charset="UTF-8"
    <title>My App</title>
  </head>
  <body>
    <script src="app.js"></script>
  </body>
</html>


Might be a syntax error in the json, it sometimes gives me this error when I have a mistake in my structure.

Maybe someone will see this error and could help.

Is there anyone here who can see the error in the code or in the syntax?
i don’t get it running :frowning:

Maybe it would be easier to find some error in the code or syntax if people could read the code. An image with 1/3 of the code I suppose is not helpful - but it is just a supposition. :confused: :confused:

i thought that 100% of code is visible. i added it to the first post and hope it helps.^^

1 Like

there is a typo in the headers section where
Content-Type is misspelled as “Contant-Type”.
:wink:

1 Like

really?? Oh damn. sorry and thank you alot!!

(this sentence is not enough as a answer?! got this error:
“An error occurred: Body seems unclear, is it a complete sentence?”)

welcome.
are you talking about this forum rules? yes, we must write.
Yes, no, ok, really - is not enough.

So it’s only about the first one-word-sentence (really??) and not the total amount of text?

I can’t remember the exact number, but I think it is a minimum of 25 characters.

even 43 characters were not enough :wink:
(“So it’s only about the first sentence and not the total amount?”)

There are user levels in this forum - all these rules and restrictions become suggestions after some levels, badges, activities, etc.