Ask: How to change my request to gpt-3.5-turbo

@app.route(‘/message’, methods=[‘POST’])
def mess():
msg = request.json.get(‘msg’)
maxtoken = request.json.get(‘maxtoken’)

req ='',
                    json={"prompt": msg + " Humorous and professional reply in Chinese", "max_tokens": maxtoken, "model": "text-davinci-003", "temperature": 0.8},
                    headers={'content-type': 'application/json', 'Authorization': 'Bearer ' + openai_key})
if req.status_code == 200:
    reqdic = json.loads(req.text)
    res = {
        "resmsg": reqdic,
        "code": 200


You need to change the url, the json and the way you parse the response

Have a look at this. It will give you the new parameters and the new response

Thank you, I am not proficient in code, and I don’t know how to modify it after reading it, thank you anyway :joy:

  1. change the request url to “/v1/chat/completions”
  2. the json chage to gpt-3.5-turbo request format, with “model” to “gpt-3.5-turbo” and “messages” to your prompt
  3. That’s all. You can check the document in here: OpenAI API

And I think you may get a better answer from ChatGPT itself other than user forum.