我们可以知道chatGPT的公开接口为:
请求接口: URL:-POST https://api.openai.com/v1/completions headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' +官网获取的api秘钥 } data:{prompt: 问题内容, max_tokens: 2048, model: "text-davinci-003"}
curl脚本测试
curl 'https://api.openai.com/v1/completions' \
-X POST \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer 官网密钥' \ -d '{"prompt":"你是谁?","max_tokens":2048,"model":"text-davinci-003"}' \ --compressed
其他各种语言的脚本可以自行根据上面的参数进行编写
例如我golang语言的测试
标签:prompt,completions,客服,接口,api,text,chatGPT From: https://www.cnblogs.com/taoshihan/p/17096902.html