错误信息: The requested operation is unsupported. 堆栈信息: AI_APICallError: The request...

2026年04月29日 09:38 processing

错误信息

错误名称: AI_APICallError 错误信息: The requested operation is unsupported. 堆栈信息: AI_APICallError: The requested operation is unsupported. at file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:51840:11 at async postToApi$2 (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:51735:24) at async OpenAICompatibleChatLanguageModel.doStream (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:69358:48) at async wrapStream (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:104705:32) at async fn (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:103355:17) at async file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:99626:19 at async _retryWithExponentialBackoff (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:99816:10) at async streamStep (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:103324:109) at async fn (file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:103641:5) at async file:///C:/APP/cherrystudio/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-BIiyx8Gb.js:99626:19 错误原因: "[undefined]" 状态码: 400 请求路径: https://www.dmxapi.cn/v1/chat/completions 请求体: { "model": "gpt-image-2", "user": "[undefined]", "max_tokens": "[undefined]", "temperature": "[undefined]", "top_p": "[undefined]", "frequency_penalty": "[undefined]", "presence_penalty": "[undefined]", "response_format": "[undefined]", "stop": "[undefined]", "seed": "[undefined]", "reasoning_effort": "[undefined]", "verbosity": "[undefined]", "messages": [ { "role": "system", "content": "test" }, { "role": "user", "content": "hi" } ], "tools": "[undefined]", "tool_choice": "[undefined]", "stream": true, "stream_options": { "include_usage": true } } 响应首部: { "cache-control": "no-cache", "content-type": "text/event-stream", "date": "Wed, 29 Apr 2026 01:38:29 GMT", "document-policy": "include-js-call-stacks-in-crash-reports", "server": "nginx", "x-rixapi-request-id": "20260429093821859298132uXu0GfEQ" } 响应内容: { "error": { "message": "The requested operation is unsupported.", "type": "rix_api_error", "param": "", "code": null } } 数据: { "error": { "message": "The requested operation is unsupported.", "type": "rix_api_error", "param": "", "code": null } }

AI 解决方案

报错分析报告

1.错误翻译


原文:The requested operation is unsupported.
译文:请求的操作不受支持。

2. 原因分析


  • 根本原因:使用图像生成模型gpt-image-2调用了仅支持聊天补全的/v1/chat/completions接口(该模型不支持聊天操作)。

  • 发生位置OpenAICompatibleChatLanguageModel.doStream异步调用中,向DMXAPI发送了不兼容的模型请求;请求体含大量[undefined]无效参数。
  • 3.解决方案


    // 修复后的请求配置(以fetch为例,使用支持聊天的模型)
    const requestBody = {
      model: "gpt-3.5-turbo", // 替换为DMXAPI支持的聊天模型
      messages: [
        { role: "system", content: "test" },
        { role: "user", content: "hi" }
      ],
      stream: true,
      stream_options: { include_usage: true }
      // 移除所有[undefined]的无意义参数(如user/max_tokens等未定义项)
    };
    
    // 发送请求
    fetch("https://www.dmxapi.cn/v1/chat/completions", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(requestBody)
    });
    

    4. 预防措施


  • ✅ 调用API前核对模型与接口兼容性(参考DMXAPI文档的模型-接口映射表);

  • ✅ 用Postman/Swagger调试请求,避免传递undefined或未定义参数;

  • -推荐工具:DMXAPI官方模型列表、Postman API调试器。