GPT api接口调用demo import openai # 你自己的key openai.api_key = 'sk-********************************'completion = openai.ChatCompletion.create(model="gpt-3.5-turbo",messages=[{"role": "user", "content": "你叫什么名字!"}] )""" {# 我是xx助手,没有实际姓名。"content": "\u6211\u662fAI\u52a9\u624b\uff0c\u6ca1\u6709\u5b9e\u9645\u59d3\u540d\u3002","role": "assistant" } {# 我是XX语言模型,没有姓名,可以称呼我为Assistant。"content": "\u6211\u662fAI\u8bed\u8a00\u6a21\u578b\uff0c\u6ca1\u6709\u59d3\u540d\uff0c\u53ef\u4ee5\u79f0\u547c\u6211\u4e3aAssistant\u3002","role": "assistant" }""" print(completion.choices[0].message)