Error occured while Chat completion API connection

HI Team,
Pleaase tke a moment for help me.I am continusely receiving the same error .please find the attachement.When i try to establish API in chat completion getting following error

Code

onst response = await fetch(apiUrl, {
method: “POST”,
headers: {
‘Content-Type’: ‘application/json;charset=UTF-8’,
‘Authorization’: Bearer ${process.env.NEXT_PUBLIC_OPENAI_API_KEY}
},
body: JSON.stringify({
messages: [
{
“role”: “system”,
“content”: “You are a helpful assistant.”
},
{
“role”: “user”,
“content”: “Hello!”
}
],
model: ‘gpt-3.5-turbo-0125’, // Correct model identifier’gpt-3.5-turbo’, // Adjust the model based on your preference
prompt: ‘message’,

so i have a question for u now too when i have used this in the past i have had to make a try-catch and/or await fetch statement to give it time to respond and if theres an error its not displayed as the code dosnt tell it to save or store the error code anywhere why ur not getting the “log” but have u tryed making a json library as to ur needs yet? if not than i recamend doing so or utilizing a open library and the code exsample that works for me `

try {
const response = await fetch(apiUrl, {
method: “POST”,
headers: {
‘Content-Type’: ‘application/json;charset=UTF-8’,
‘Authorization’: Bearer ${process.env.NEXT_PUBLIC_OPENAI_API_KEY}
},
body: JSON.stringify({
messages: [
{
“role”: “system”,
“content”: “You are a helpful assistant.”
},
{
“role”: “user”,
“content”: “Hello!”
}
],
model: ‘gpt-3.5-turbo-0125’, // Correct model identifier
prompt: ‘message’,
})
});

// Continue with handling the response here

} catch (error) {
console.error(“Error during API request:”, error);
// Handle the error appropriately
}

Hi Michael,

I have added that but seems error(Prompt)

i dont have enough information to help if u could plz provide the main script

without the API-key

" Pro tip"
you can draw a line over key to make it so people can’t see it or use it just make it so others can’t see it.

and the error message the coding terminal ur currently using to help for more reference.