1. 01 Apr, 2026 1 commit
    • 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. 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
  3. 24 Mar, 2026 1 commit
  4. 23 Mar, 2026 1 commit
  5. 22 Mar, 2026 1 commit
  6. 20 Mar, 2026 1 commit
  7. 17 Mar, 2026 1 commit
    • Ethan0x0000's avatar
      feat(service): record upstream model across all gateway paths · 2e4ac88a
      Ethan0x0000 authored
      Propagate UpstreamModel through ForwardResult and OpenAIForwardResult in Anthropic direct, API-key passthrough, Bedrock, and OpenAI gateway flows. Extract optionalNonEqualStringPtr and optionalTrimmedStringPtr into usage_log_helpers.go. Store upstream_model only when it differs from the requested model.
      
      Also introduces anthropicPassthroughForwardInput struct to reduce parameter count.
      2e4ac88a
  8. 16 Mar, 2026 1 commit
    • QTom's avatar
      fix(gateway): 防止 OpenAI Codex 跨用户串流 · ab4e8b2c
      QTom authored
      根因:多个用户共享同一 OAuth 账号时,conversation_id/session_id 头
      未做用户隔离,导致上游 chatgpt.com 将不同用户的请求关联到同一会话。
      
      HTTP SSE 修复:
      - 新增 isolateOpenAISessionID(apiKeyID, raw),将 API Key ID 混入
        session 标识符(xxhash),确保不同 Key 的用户产生不同上游会话
      - buildUpstreamRequest: OAuth 分支先 Del 客户端透传的 session 头,
        再用隔离值覆盖
      - buildUpstreamRequestOpenAIPassthrough: 透传路径同样隔离
      - ForwardAsAnthropic: Anthropic Messages 兼容路径同步修复
      - buildOpenAIWSHeaders: WS 路径的 OAuth session 头同步隔离
      ab4e8b2c
  9. 15 Mar, 2026 2 commits
    • erio's avatar
      feat(ops): add ignore insufficient balance errors toggle and extract error constants · cfe72159
      erio authored
      - Add 5th error filter switch IgnoreInsufficientBalanceErrors to suppress
        upstream insufficient balance / insufficient_quota errors from ops log
      - Extract hardcoded error strings into package-level constants for
        shouldSkipOpsErrorLog, normalizeOpsErrorType, classifyOpsPhase, and
        classifyOpsIsBusinessLimited
      - Define ErrNoAvailableAccounts sentinel error and replace all
        errors.New("no available accounts") call sites
      - Update tests to use require.ErrorIs with the sentinel error
      cfe72159
    • Ethan0x0000's avatar
      feat: 完善使用记录端点可观测性与分布统计 · eefab159
      Ethan0x0000 authored
      将入站、上游与路径三类端点分布统一到使用记录页的一致化卡片交互中,并补齐端点元数据与统计链路,提升排障与流量分析效率。
      eefab159
  10. 14 Mar, 2026 1 commit
  11. 12 Mar, 2026 1 commit
  12. 11 Mar, 2026 6 commits
  13. 09 Mar, 2026 3 commits
  14. 08 Mar, 2026 1 commit
  15. 07 Mar, 2026 5 commits
  16. 06 Mar, 2026 5 commits
  17. 05 Mar, 2026 4 commits
    • erio's avatar
    • erio's avatar
      refactor: unify post-usage billing logic and fix account quota calculation · 02dea7b0
      erio authored
      - Extract postUsageBilling() to consolidate billing logic across
        GatewayService.RecordUsage, RecordUsageWithLongContext, and
        OpenAIGatewayService.RecordUsage, eliminating ~120 lines of
        duplicated code
      - Fix account quota to use TotalCost × accountRateMultiplier
        (was using raw TotalCost, inconsistent with account cost stats)
      - Fix RecordUsageWithLongContext API Key quota only updating in
        balance mode (now updates regardless of billing type)
      - Fix WebSocket client disconnect detection on Windows by adding
        "an established connection was aborted" to known disconnect errors
      02dea7b0
    • erio's avatar
      feat: add quota limit for API key accounts · 05527b13
      erio authored
      - Add configurable spending limit (quota_limit) for apikey-type accounts
      - Atomic quota accumulation via PostgreSQL JSONB operations on TotalCost
      - Scheduler filters out over-quota accounts with outbox-triggered snapshot refresh
      - Display quota usage ($used / $limit) in account capacity column
      - Add "Reset Quota" action in account menu to reset usage to zero
      - Editing account settings preserves quota_used (no accidental reset)
      - Covers all 3 billing paths: Anthropic, Gemini, OpenAI RecordUsage
      
      chore: bump version to 0.1.90.4
      05527b13
    • yangjianbo's avatar
      feat(openai-ws): 合并 WS v2 透传模式与前端 ws mode · 1d0872e7
      yangjianbo authored
      
      
      新增 OpenAI WebSocket v2 passthrough relay 数据面与服务适配层,
      支持按账号 ws mode 在 ctx_pool 与 passthrough 间路由。
      
      同步调整前端 OpenAI ws mode 选项为 off/ctx_pool/passthrough,
      并补充 i18n 文案与对应单测。
      
      新增 Caddyfile.dmit 与 docker-compose-aicodex.yml 部署配置,
      用于宿主机场景下的反向代理与服务编排。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      1d0872e7
  18. 03 Mar, 2026 2 commits
    • shaw's avatar
      feat: apikey支持5h/1d/7d速率控制 · a80ec5d8
      shaw authored
      a80ec5d8
    • QTom's avatar
      fix(gateway): 分组隔离 — 禁止未分组账号被跨组调度 · 530a1629
      QTom authored
      当 API Key 无分组时,调度仅从未分组账号池中选取。
      修复 isAccountInGroup 在 groupID==nil 时的逻辑,
      同时补全 scheduler_snapshot_service 和 gemini_compat_service
      中的 SimpleMode 保护,确保分组隔离在所有调度路径生效。
      
      新增 ListSchedulableUngroupedByPlatform/s 方法,
      使用 Ent 的 Not(HasAccountGroups()) 谓词实现未分组账号隔离。
      新增 17 个单元和端到端隔离测试,覆盖所有分支和边界条件。
      530a1629
  19. 28 Feb, 2026 1 commit
  20. 22 Feb, 2026 1 commit
    • yangjianbo's avatar
      fix(codex): 修复额度窗口过期展示并补齐高覆盖测试 · 10636d8a
      yangjianbo authored
      - 后端新增绝对重置时间字段计算(codex_5h_reset_at/codex_7d_reset_at)
      
      - 前端统一窗口解析逻辑:绝对时间优先,updated_at+seconds 回退,过期自动归零
      
      - 新增后端与前端单元测试,覆盖关键边界与异常场景
      10636d8a