How can i use openai new model

response = await fetch(‘’, {
method: ‘POST’,
headers: {
‘Authorization’: Bearer ${mySecret},
‘Content-Type’: ‘application/json’
},
body: JSON.stringify({
prompt: Write a complete essay at least 120 words about ${topic}with the note provided ${note}, with each paragraph marked **, don't make over 5 paragraphs and less than 3 paragraphs.,
max_tokens: 2000
})
});
}
return response.json();
}

this is the old code

Specify in the code which model you want to use.

deleted my answer because it was not correct

That won’t work, because there is no gpt-4-turbo model name, and the chat models do not take a “prompt” parameter.

What’s likely not seen above in the “my code” is a deprecated “engine” url that includes the model name, which also needs to be updated to something that won’t be turned off next month.

The exchange here is like AI bot vs bot…

There’s an API reference link on the forum sidebar, where for “chat”, curl will give you an idea of the request format, and node.js will give you an idea how to write a javascript backend.

1 Like

From python script that was using 3.5 and adapted it into a js copying it’s structure manually. Totally gave for granted it was correct and was just missing a parameter. Replaced my 3.5 into 4. I will revise my answer.