I tried to send a post request through the macrodroid app with these parameters:
Content type - application/json
Content body - Text
{
“model”: “gpt-3.5-turbo”,
“messages”: test
}
Authorization - Bearer …
and it’s output this:
{
“error”: {
“message”: “We could not parse the JSON body of your request. (HINT: This likely means you aren’t using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}
Can someone help, please?
To replicate the initial request made by my operating Python script I have at hand using your standalone HTTPS request utility, you would need to format the “content body” with JSON data to make a similar request. Here’s how you should structure your JSON input:
Make sure to set the Content-Type header to application/json and include an Authorization header with your OpenAI API key in the format Bearer YOUR_API_KEY_HERE. This JSON structure and the headers are what you need, in addition to the https request being sent to the correct chat completions URL https://api.openai.com/v1/chat/completions