Codex + Tencent LKEAP 401: It Was Not the Key
说明与用途
401错误是由于Codex期望Responses API,而腾讯LKEAP使用Chat Completions导致的协议不匹配。创建了本地Node.js代理来转换请求,并相应更新了配置。
问题
Codex misinterpreted a Tencent LKEAP endpoint as a Responses API, appending "/responses" to a Chat Completions URL and causing a 401 error.
结果
The 401 error was caused by a protocol mismatch; a local proxy successfully bridged the gap, allowing Codex to communicate with Tencent LKEAP.
工作流
- Inspect the final request URL for unexpected path patterns.
- Confirm the client’s wire protocol (Responses vs Chat Completions).
- Verify the upstream endpoint’s expected URL shape.
- If mismatch, either adjust the client config or implement a local protocol adapter.
- Set up a local Node.js proxy that forwards Responses requests to the correct Chat Completions URL.
- Configure Codex to point to the proxy and provide a dummy OPENAI_API_KEY.
- Test the setup with a real Tencent LKEAP API key and validate responses.
- Document any remaining gaps (streaming, tool‑call traffic, error mapping).
证据
unexpected status 401 Unauthorized
invalid configuration: wire_api = "chat" is no longer supported.
- 记录日期: 2026-09-05T13:58:38.697Z