You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用OpenAI GPT-3.5 Turbo API报错,请求无法通过寻求帮助

OpenAI Chat Completions API调用失败问题解决

问题场景

调用OpenAI的Chat Completions 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
    }
}

排查与解决步骤

  • 确认模型名称准确性:确保model参数值为gpt-3.5-turbo,不要混淆成gpt-3.5-turbo-instruct(该模型属于文本补全类,需使用v1/completions端点)。
  • 验证API密钥权限:检查你的API密钥是否具备访问gpt-3.5-turbo模型的权限,部分受限账号或旧账号可能无法使用该聊天模型。
  • 检查环境变量加载:确认$OPENAI_API_KEY环境变量已正确设置并被curl读取,可尝试直接将密钥字符串替换命令中的$OPENAI_API_KEY进行测试,排除环境变量加载失败的问题。
  • 核对API端点:确认使用的端点是https://api.openai.com/v1/chat/completions,该端点确实支持gpt-3.5-turbo模型,若使用区域专属服务(如Azure OpenAI)需对应调整域名与参数。

内容的提问来源于stack exchange,提问作者Rocky-y

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 18:33:25