1. 26 Mar, 2026 1 commit
    • shaw's avatar
      feat: 网关请求头 wire casing 保持、转发行为开关、调试日志增强及 accept-encoding 恢复 · b20e1422
      shaw authored
      - 新增 header_util.go,通过 setHeaderRaw/getHeaderRaw/addHeaderRaw 绕过
        Go 的 canonical-case 规范化,保持真实 Claude CLI 抓包的请求头大小写
        (如 "x-app" 而非 "X-App","X-Stainless-OS" 而非 "X-Stainless-Os")
      - 新增管理后台开关:指纹统一化(默认开启)和 metadata 透传(默认关闭),
        使用 atomic.Value + singleflight 缓存模式,60s TTL
      - 调试日志从控制台 body 打印升级为文件级完整快照
        (按真实 wire 顺序输出 headers + 格式化 JSON body + 上下文元数据)
      - 恢复 accept-encoding 到白名单,在 http_upstream.go 新增 decompressResponseBody
        处理 gzip/brotli/deflate 解压(Go 显式设置 Accept-Encoding 时不会自动解压)
      - OAuth 服务 axios UA 从 1.8.4 更新至 1.13.6
      - 测试断言改用 getHeaderRaw 适配 raw header 存储方式
      b20e1422
  2. 19 Mar, 2026 1 commit
  3. 17 Mar, 2026 1 commit
  4. 12 Mar, 2026 1 commit
  5. 05 Mar, 2026 1 commit
  6. 28 Feb, 2026 1 commit
  7. 26 Feb, 2026 3 commits
    • alfadb's avatar
    • alfadb's avatar
      fix(gateway): return 404 instead of fake 200 for unsupported count_tokens endpoint · 94895314
      alfadb authored
      PR #635 returned HTTP 200 with {"input_tokens": 0} when upstream doesn't
      support count_tokens (404). This caused Claude Code CLI to trust the zero
      value, believing context uses 0 tokens, so auto-compression never triggers.
      
      Fix: return 404 with proper error body so CLI falls back to its local
      tokenizer for accurate estimation. Return nil (not error) to avoid
      polluting ops error metrics with expected 404s.
      
      Affected paths:
      - Passthrough APIKey accounts: upstream 404 now passed through as 404
      - Antigravity accounts: same fix (was also returning fake 200)
      94895314
    • alfadb's avatar
      fix: count_tokens 端点不支持时降级返回空值 (404 only) · 03bcd94a
      alfadb authored
      第三方 Anthropic 中转站通常不支持 /v1/messages/count_tokens 端点,
      上游返回 404 时降级返回 {input_tokens: 0},客户端 fallback 到本地估算。
      
      - 仅匹配 404 状态码,语义明确:端点不存在
      - 其他错误 (400/429/500) 保留原始处理链和 ops 遥测
      - 无需解析错误消息内容,不依赖字符串匹配
      - 新增 table-driven 测试覆盖 fallback 和 non-fallback 路径
      03bcd94a
  8. 21 Feb, 2026 2 commits