我们可以知道chatGPT的公开接口为:请求接口:
URL:-POST https://api.openai.com/v1/com...
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语言的测试
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。