Postman调用人工智能chat功能互动

1、首先访问人工智能官网(注意科学上网)

首先找到Developers,接着API reference

2、点击API reference

3、点击chat,复制相关的curl请求

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

4、在Postman中导入

5、将箭头位置更换为自己的key

6、获取密钥key

7、Postman进行测试调用,箭头位置是需要发送的内容

如上内容演示chat部分调用,其他功能也是如此

猜你喜欢

转载自blog.csdn.net/weixin_46085718/article/details/129754664