ChatGPT will “hallucinate” and happily give you non-facts as if they were facts. Best to stick with the docs. They’ve got examples for most modern languages …
Docs…
API docs…
Sounds like you want completions, which would be…
post https://api.openai.com/v1/completions
Then you would need to pass it a model like text-davinci-003.
One of the problems is that you don’t post the apiKey as part of the POST. It needs to be in the header, like the content-type with the bearer text etc.
The JSON.stringify(input) may not be in the right format. Once you remove the apiKey from the input, output the stringify’ed text so we can what you end up with
Hopefully it includes the labels with the values. If it doesn’t that will be an issue too (Sorry I cant test stringify on my machine right now)
If you are lucky, removing the apiKey and putting it in the header (in the correct format) will fix your problem
Thank you both for your help. I had tried the Authorization header already but this is all a bit above my head as far as coding goes. I’ll have to find some help from somewhere that I can jump on a screen share with someone. Thank you both.