feat: improve proxy auth compatibility and request logging#74
Open
yuwei5380 wants to merge 3 commits intoicebear0828:masterfrom
Open
feat: improve proxy auth compatibility and request logging#74yuwei5380 wants to merge 3 commits intoicebear0828:masterfrom
yuwei5380 wants to merge 3 commits intoicebear0828:masterfrom
Conversation
Closed
icebear0828
requested changes
Mar 15, 2026
Owner
icebear0828
left a comment
There was a problem hiding this comment.
感谢提交!Auth 兼容和 admin basic auth 的思路很好,但这个 PR 混合了多个不相关的改动,且有几个阻断问题需要先解决:
需要 Revert 的改动
config/default.yaml
- 硬编码了
proxy_api_key和admin_basic_auth_password,密钥会永久留在 git 历史中,请务必 revert 这个文件的所有改动 - 默认端口 8080→18080、模型改 gpt-5.4、reasoning 改 xhigh、host 从
::改0.0.0.0(丢失 IPv6)——这些是个人偏好,不应改动上游默认值
docker-compose.yml
- 镜像地址改为
yuwei/codex-proxy:latest,这是私人镜像,需要 revert
config/models.yaml
- 新模型(gpt-5.4、gpt-5.3-codex)已通过后端动态获取自动同步到 models.yaml,不需要手动添加,请 revert
需要讨论的改动
src/routes/responses.ts — instructions 默认值
instructions从必填改为可选并注入"You are a helpful assistant."—— Codex API 要求 instructions 为必填字段,注入默认值可能导致上游行为不可预测。建议改为在文档中说明客户端需要配置 instructions
src/proxy/codex-api.ts — interactionContext
- mutable setter
setInteractionContext在 retry 场景下可能被多次覆盖,建议改为将 logger 作为createResponse的参数传入
可以接受的部分 👍
proxy-auth.ts— 统一 API key 提取逻辑,支持Authorization/x-api-key/api-key多种格式,兼容 openclaw/opencodeadmin-basic-auth.ts— 管理端 Basic Auth 中间件,用了timingSafeEqualllm-interaction-log.ts— 结构化请求日志系统(建议补充测试)
建议
拆分为 2-3 个独立 PR 会更容易 review 和合并:
- proxy auth 兼容 —
proxy-auth.ts+ 各路由的 key 提取重构 - admin basic auth — 中间件 + config schema + 测试
- LLM interaction log — logger + proxy-handler 集成 + 测试
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1、support openclaw、opencode: set default instructions(You are a helpful assistant.)
2、record llm logging
3、add gpt 5.3、gpt5.4
4、support openclaw: fix header auth