WSL2 环境首次请求必现 401 invalid api key,重试成功,请求后端日志排查

Abierto
#31 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado

Línea de trabajo

The issue provides request and response examples for POST /v1/chat/completions and asks for backend authentication logs, but it names no repository files, tests, or implementation entry point. Start by reproducing the first-request 401 followed by a successful retry, then inspect backend logs for both requests and compare their authentication results. Done means identifying the cause of the first 401 and confirming whether the same behavior occurs for other new connections.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

尊敬的 MiniMax 技术支持团队:

您好!我在使用 MiniMax API 时遇到一个稳定复现的问题,已自行排查但无法定位根因,恳请协助查询后端日志。

一、账号与环境信息
项目 值
平台 国内 MiniMax 开放平台
GroupId [请在此处填写你的 GroupId]
Endpoint https://api.minimaxi.com/v1
API Key 类型 sk-api-*(按量付费)
调用环境 Windows 11 + WSL2 Ubuntu 22.04
客户端 OpenClaw v2026.4.1(OpenAI-compatible 格式)
使用模型 MiniMax-M2.5
二、问题现象

核心问题: 每次新建连接后,首次请求必返回 HTTP 401,等待 2-5 秒后重试完全相同的请求即可成功(HTTP 200),后续调用持续正常。

请求次序 HTTP 状态码 响应内容 结果
首次 401 {"error": "invalid api key"} ❌ 失败
重试(2-5 秒后) 200 {"choices": [...]} ✅ 成功
后续调用 200 正常 ✅ 成功

复现频率: 100%(每次新连接首次请求必现)

三、已排查内容
排查项 结果
API Key 有效性 ✅ 确认有效(重试后成功)
Endpoint 配置 ✅ 国内平台使用 api.minimaxi.com,配置正确
请求格式 ✅ 符合 OpenAI-compatible 规范
网络连通性 ✅ 同一环境访问其他服务(如 aicodewith 中转)无此问题
客户端版本 ✅ OpenClaw 已升级至最新版 v2026.4.1
四、请求与响应示例(已脱敏)

首次请求(失败):

POST /v1/chat/completions HTTP/1.1
Host: api.minimaxi.com
Authorization: Bearer sk-api-****(已脱敏)
Content-Type: application/json

{"model": "MiniMax-M2.5", "messages": [{"role": "user", "content": "hi"}]}

← HTTP/1.1 401 Unauthorized
{"error": "invalid api key"}

重试请求(成功):

← HTTP/1.1 200 OK
{"choices": [{"message": {"content": "Hello!"}}]}
五、初步技术分析(待官方确认)

我们推测可能的原因包括:

  1. TLS 握手超时导致首次请求被截断
  2. API Key 验证服务存在冷启动延迟
  3. 连接池预热问题

但以上均为猜测,需要后端日志协助确认。

六、诉求

恳请协助查询对应时间段的后端日志,确认:

  1. 401 请求到达后端时的具体鉴权失败原因(Key 无效?超时?其他?)
  2. 失败请求与成功请求的差异(如 IP、Header、Key 状态、处理时长等)
  3. 是否存在首次连接特殊处理逻辑(如冷启动、连接池预热等)
Lenguaje dominante
Sin datos de lenguaje
Estrellas
588
Forks
83
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MiniMax-AI/MiniMax-M2.5

Todos los issues de MiniMax-AI/MiniMax-M2.5

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.