diff --git a/ssw-common/ssw-common-biz/src/main/java/ssw/common/util/SswLLMClient.java b/ssw-common/ssw-common-biz/src/main/java/ssw/common/util/SswLLMClient.java index 3ddede6..102e472 100644 --- a/ssw-common/ssw-common-biz/src/main/java/ssw/common/util/SswLLMClient.java +++ b/ssw-common/ssw-common-biz/src/main/java/ssw/common/util/SswLLMClient.java @@ -101,12 +101,16 @@ public class SswLLMClient { String requestBody = isAnthropic ? toAnthropicBody(model, systemPrompt, userPrompt, maxTokens) : body.toJSONString(); - HttpResponse resp = HttpRequest.post(url) - .header("Authorization", "Bearer " + credential) - .header("Content-Type", "application/json") - .body(requestBody) - .timeout(READ_TIMEOUT * 1000) - .execute(); + // v0.17+ (2026-07-06): minimax anthropic 端点要求 X-Api-Key header + // (实测 401: 'Please carry the API secret key in the X-Api-Key field') + HttpRequest req = HttpRequest.post(url).header("Content-Type", "application/json"); + if (isAnthropic) { + req = req.header("X-Api-Key", credential) + .header("anthropic-version", "2023-06-01"); + } else { + req = req.header("Authorization", "Bearer " + credential); + } + HttpResponse resp = req.body(requestBody).timeout(READ_TIMEOUT * 1000).execute(); if (!resp.isOk()) { log.error("[SswLLMClient] HTTP {} body={}", resp.getStatus(), resp.body());