• 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
openai_gateway_service.go 121 KB