gpt4 book ai didi

openai-api - Chatgpt api url 问题 : Chatgpt3. 5 错误

转载 作者:行者123 更新时间:2023-12-02 22:48:36 26 4
gpt4 key购买 nike

我尝试使用openai的api,但没有成功。

这是 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": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Who won the world series in 2020?"},
{"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
{"role": "user", "content": "Where was it played?"}
]
}'

而且,这就是结果。

{
"error": {
"message": "This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?",
"type": "invalid_request_error",
"param": "model",
"code": null
}
}

我看了 openai 文档,网址是正确的。但没有通过。

感谢您的帮助!

最佳答案

这也可能是由于操作系统解析破坏了curl命令参数而导致的。例如,在 Microsoft Windows 上,语法应该不同

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\\": \\"system\\", \\"content\\": \\"You are a helpful assistant\\"},{\\"role\\": \\"user\\", \\"content\\": \\"Who won the world series in 2020?\\"},{\\"role\\": \\"assistant\\", \\"content\\": \\"The Los Angeles Dodgers won the World Series in 2020.\\"}, {\\"role\\": \\"user\\", \\"content\\": \\"Where was it played?\\"}]}"

关于openai-api - Chatgpt api url 问题 : Chatgpt3. 5 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76172889/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com