":{"message":"当前模型不支持指定的 response_format,请调整参数后重试。","type":"invalid_request_erro...
错误信息
http 400: {"error":{"message":"当前模型不支持指定的 response_format,请调整参数后重试。","type":"invalid_request_error","param":"","code":"invalid_request_error"}}
AI 解决方案
🔍 报错分析
1. 🌐 错误翻译
原文:{"error":{"message":"当前模型不支持指定的 response_format,请调整参数后重试。","type":"invalid_request_error","param":"","code":"invalid_request_error"}}
译文:{"error":{"message":"当前模型不支持指定的 response_format,请调整参数后重试。","type":"invalid_request_error","param":"","code":"invalid_request_error"}}
2. 🎯 原因分析
response_format参数与当前调用的模型不兼容,模型无法支持该响应格式要求response_format配置上3. 💡 解决方案
response_format参数:如果不需要特定格式,直接删除该参数;若需要结构化输出,切换到支持该格式的模型response_format的模型,更换模型后重试修复示例(删除不支持的参数):
// 原请求可能包含的不支持参数
const requestBody = {
model: "unsupported-model", // 假设该模型不支持指定格式
response_format: { type: "json_object" }, // 触发报错的参数
prompt: "请输出JSON格式的内容"
};
// 修复后的请求(移除response_format)
const fixedRequestBody = {
model: "compatible-model", // 更换为支持对应格式的模型
prompt: "请输出内容"
// 已移除 response_format 参数
};
4. 🛡️ 预防措施
response_format的可选值,避免使用模型不支持的参数组合