","param":"","code":""} INVALID_REQUEST
错误信息
本轮运行失败404: {"message":"Invalid URL (POST /v1/chat/completions/chat/completions)","type":"invalid_request_error","param":"","code":""}
INVALID_REQUEST
AI 解决方案
🔍 报错分析
1. 🌐 错误翻译
原文:Invalid URL (POST /v1/chat/completions/chat/completions)
译文:无效的URL (POST /v1/chat/completions/chat/completions)
2. 🎯 原因分析
根本原因:API请求URL路径重复拼接,导致路径格式错误。
具体位置:请求的完整路径为 /v1/chat/completions/chat/completions,其中 /chat/completions 被重复添加,违反了API接口的标准路径格式。
3. 💡 解决方案
检查并修正代码中的API请求URL,确保路径正确。以下是修复后的示例代码:
// 错误示例(重复路径)
const response = await fetch('https://api.example.com/v1/chat/completions/chat/completions', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ /* 请求参数 */ })
});
// 修复后的代码(正确的URL路径)
const response = await fetch('https://api.example.com/v1/chat/completions', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ /* 请求参数 */ })
});