1. 01 Apr, 2026 3 commits
    • YanzheL's avatar
    • YanzheL's avatar
      test(gateway): add tests for content-based session hash fallback · 4fb16030
      YanzheL authored
      - 20 unit tests for deriveOpenAIContentSessionSeed covering:
        - Empty/nil inputs, model-only, stable across turns
        - Different model/system/first-user produce different seeds
        - Tools, functions, developer role, structured content
        - Responses API: input string, input array, instructions, input_text typed items
        - JSON canonicalization (whitespace/key-order insensitive)
        - Prefix presence, empty tools ignored, messages preferred over input
      - 3 integration tests for GenerateSessionHash content fallback:
        - Content fallback produces stable hash
        - Explicit signals override content fallback
        - Empty body still returns empty hash
      4fb16030
    • YanzheL's avatar
      fix(gateway): add content-based session hash fallback for non-Codex clients · c5aac125
      YanzheL authored
      When no explicit session signals (session_id, conversation_id, prompt_cache_key)
      are provided, derive a stable session seed from the request body content
      (model + tools + system prompt + first user message) to enable sticky routing
      and prompt caching for non-Codex clients using the Chat Completions API.
      
      This mirrors the content-based fallback already present in GatewayService.
      GenerateSessionHash, adapted for the OpenAI gateway's request formats (both
      Chat Completions messages and Responses API input).
      
      JSON fragments are canonicalized via normalizeCompatSeedJSON to ensure
      semantically identical requests produce the same seed regardless of
      whitespace or key ordering.
      
      Closes #1421
      c5aac125
  2. 31 Mar, 2026 7 commits
  3. 30 Mar, 2026 4 commits
  4. 29 Mar, 2026 5 commits
  5. 28 Mar, 2026 1 commit
    • wucm667's avatar
      fix(billing): 计费始终使用用户请求的原始模型,而非映射后的上游模型 · f5764d8d
      wucm667 authored
      当账号配置了模型映射(如 claude-sonnet-4-6 → glm-5.0)时,系统错误地
      使用映射后的上游模型名计算费用。由于上游模型(如 glm-5.0)在定价系统中
      没有价格配置,导致计费失败后被静默置为 0,用户不被扣费。
      
      修改 forwardResultBillingModel 优先返回请求模型名,并移除 OpenAI 路径
      中 BillingModel 字段对计费模型的覆盖逻辑。
      f5764d8d
  6. 27 Mar, 2026 15 commits
  7. 26 Mar, 2026 2 commits
    • shaw's avatar
      feat(rectifier): 请求整流器增加 API Key 账号签名整流支持 · d571f300
      shaw authored
      新增独立开关控制 API Key 账号的签名整流功能,支持配置自定义
      匹配关键词以捕获不同格式的上游错误响应。
      
      - 新增 apikey_signature_enabled 开关(默认关闭)
      - 新增 apikey_signature_patterns 自定义关键词配置
      - 内置签名检测规则对 API Key 账号同样生效
      - 自定义关键词对完整响应体做不区分大小写匹配
      - 重试二阶段检测仅做模式匹配,不重复校验开关
      - Handler 层校验关键词数量(≤50)和长度(≤500)
      - API 响应 nil patterns 统一序列化为空数组
      - OAuth/SetupToken/Upstream/Bedrock 账号行为不变
      d571f300
    • 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
  8. 25 Mar, 2026 3 commits