1. 08 Apr, 2026 1 commit
  2. 07 Apr, 2026 1 commit
  3. 05 Apr, 2026 4 commits
  4. 04 Apr, 2026 6 commits
    • erio's avatar
      revert: remove antigravity credits precheck logic (not part of channel feature) · d4ff835b
      erio authored
      Restore account_usage_service.go, antigravity_gateway_service.go,
      antigravity_credits_overages.go and its test to upstream/main state.
      These credits balance precheck changes were accidentally included
      during cherry-pick of channel management commits.
      d4ff835b
    • erio's avatar
      feat: image output token billing, channel-mapped billing source, credits balance precheck · d72ac926
      erio authored
      - Parse candidatesTokensDetails from Gemini API to separate image/text output tokens
      - Add image_output_tokens and image_output_cost to usage_log (migration 089)
      - Support per-image-token pricing via output_cost_per_image_token from model pricing data
      - Channel pricing ImageOutputPrice override works in token billing mode
      - Auto-fill image_output_price in channel pricing form from model defaults
      - Add "channel_mapped" billing model source as new default (migration 088)
      - Bills by model name after channel mapping, before account mapping
      - Fix channel cache error TTL sign error (115s → 5s)
      - Fix Update channel only invalidating new groups, not removed groups
      - Fix frontend model_mapping clearing sending undefined instead of {}
      - Credits balance precheck via shared AccountUsageService cache before injection
      - Skip credits injection for accounts with insufficient balance
      - Don't mark credits exhausted for "exhausted your capacity on this model" 429s
      d72ac926
    • erio's avatar
      feat(channel): 通配符定价匹配 + OpenAI BillingModelSource + 按次价格校验 + 用户端计费模式展示 · 8d03c52e
      erio authored
      - 定价查找支持通配符(suffix *),最长前缀优先匹配
      - 模型限制(restrict_models)同样支持通配符匹配
      - OpenAI 网关接入渠道映射/BillingModelSource/模型限制
      - 按次/图片计费模式创建时强制要求价格或层级(前后端)
      - 用户使用记录列表增加计费模式 badge 列
      8d03c52e
    • erio's avatar
      feat(billing): 网关计费迁移到 CalculateCostUnified + 模型限制错误统一 · 632035aa
      erio authored
      - GatewayService/OpenAIGatewayService 注入 ModelPricingResolver
      - RecordUsage 从旧路径迁移到 CalculateCostUnified(支持 per_request/image 模式)
      - 无渠道时自动回退旧路径,保持原有行为
      - 长上下文双倍计费仅在无渠道定价时生效
      - CostBreakdown 新增 BillingMode 字段,使用日志记录实际计费模式
      - 模型限制错误改为与"无可用账号"相同的 503 响应
      632035aa
    • erio's avatar
      feat(channel): 模型价格自动填充 + 默认定价 API · 12d03e40
      erio authored
      - 新增 GET /admin/channels/model-pricing?model=xxx API
      - 从 BillingService 查询 LiteLLM/Fallback 默认定价
      - 前端添加模型时自动查询并填充价格($/MTok)
      - 仅在所有价格字段为空时才自动填充,不覆盖手动配置
      12d03e40
    • erio's avatar
      feat(channel): 渠道管理系统 — 多模式定价 + 统一计费解析 · 91c9b8d0
      erio authored
      Cherry-picked from release/custom-0.1.106: a9117600
      91c9b8d0
  5. 30 Mar, 2026 1 commit
  6. 27 Mar, 2026 3 commits
    • erio's avatar
      feat(antigravity): progressive penalty for consecutive INTERNAL 500 errors · 093a5a26
      erio authored
      When an antigravity account returns 500 "Internal error encountered."
      on all 3 retry attempts, increment a Redis counter and apply escalating
      penalties:
      - 1st round: temp unschedulable 10 minutes
      - 2nd round: temp unschedulable 10 hours
      - 3rd round: permanently mark as error
      
      Counter resets on any successful response (< 400).
      093a5a26
    • github-actions[bot]'s avatar
      fdd8499f
    • shaw's avatar
      feat(tls-fingerprint): 新增 TLS 指纹 Profile 数据库管理及代码质量优化 · 1854050d
      shaw authored
      新增功能:
      - 新增 TLS 指纹 Profile CRUD 管理(Ent schema + 迁移 + Admin API + 前端管理界面)
      - 支持账号绑定数据库中的自定义 TLS Profile,或随机选择(profile_id=-1)
      - HTTPUpstream.DoWithTLS 接口从 bool 改为 *tlsfingerprint.Profile,支持按账号指定 Profile
      - AccountUsageService 注入 TLSFingerprintProfileService,统一 usage 场景与网关的 Profile 解析逻辑
      
      代码优化:
      - 删除已被 TLSFingerprintProfileService 完全取代的 registry.go 死代码(418 行)
      - 提取 3 个 dialer 的重复 TLS 握手逻辑为 performTLSHandshake() 共用函数
      - 修复 GetTLSFingerprintProfileID 缺少 json.Number 处理的 bug
      - gateway_service.Forward 中 ResolveTLSProfile 从重试循环内重复调用改为预解析局部变量
      - 删除冗余的 buildClientHelloSpec() 单行 wrapper 和 int64(e.ID) 无效转换
      - tls_fingerprint_profile_cache.go 日志从 log.Printf 改为 slog 结构化日志
      - dialer_capture_test.go 添加 //go:build integration 标签,防止 CI 失败
      - 去重 TestProfileExpectation 类型至共享 test_types_test.go
      - 修复 9 个测试文件缺少 tlsfingerprint import 的编译错误
      - 修复 error_policy_integration_test.go 中 handleError 回调签名被错误替换的问题
      1854050d
  7. 24 Mar, 2026 1 commit
  8. 20 Mar, 2026 1 commit
  9. 19 Mar, 2026 1 commit
    • erio's avatar
      fix(antigravity): fast-fail on proxy unavailable, temp-unschedule account · 528ff5d2
      erio authored
      ## Problem
      
      When a proxy is unreachable, token refresh retries up to 4 times with
      30s timeout each, causing requests to hang for ~2 minutes before
      failing with a generic 502 error. The failed account is not marked,
      so subsequent requests keep hitting it.
      
      ## Changes
      
      ### Proxy connection fast-fail
      - Set TCP dial timeout to 5s and TLS handshake timeout to 5s on
        antigravity client, so proxy connectivity issues fail within 5s
        instead of 30s
      - Reduce overall HTTP client timeout from 30s to 10s
      - Export `IsConnectionError` for service-layer use
      - Detect proxy connection errors in `RefreshToken` and return
        immediately with "proxy unavailable" error (no retries)
      
      ### Token refresh temp-unschedulable
      - Add 8s context timeout for token refresh on request path
      - Mark account as temp-unschedulable for 10min when refresh fails
        (both background `TokenRefreshService` and request-path
        `GetAccessToken`)
      - Sync temp-unschedulable state to Redis cache for immediate
        scheduler effect
      - Inject `TempUnschedCache` into `AntigravityTokenProvider`
      
      ### Account failover
      - Return `UpstreamFailoverError` on `GetAccessToken` failure in
        `Forward`/`ForwardGemini` to trigger handler-level account switch
        instead of returning 502 directly
      
      ### Proxy probe alignment
      - Apply same 5s dial/TLS timeout to shared `httpclient` pool
      - Reduce proxy probe timeout from 30s to 10s
      528ff5d2
  10. 18 Mar, 2026 2 commits
  11. 15 Mar, 2026 1 commit
    • erio's avatar
      feat: unified OAuth token refresh API with distributed locking · 1fc9dd7b
      erio authored
      Introduce OAuthRefreshAPI as the single entry point for all OAuth token
      refresh operations, eliminating the race condition where background
      refresh and inline refresh could simultaneously use the same
      refresh_token (fixes #1035).
      
      Key changes:
      - Add OAuthRefreshExecutor interface extending TokenRefresher with CacheKey
      - Add OAuthRefreshAPI.RefreshIfNeeded with lock → DB re-read → double-check flow
      - Add ProviderRefreshPolicy / BackgroundRefreshPolicy strategy types
      - Simplify all 4 TokenProviders to delegate to OAuthRefreshAPI
      - Rewrite TokenRefreshService.refreshWithRetry to use unified API path
      - Add MergeCredentials and BuildClaudeAccountCredentials helpers
      - Add 40 unit tests covering all new and modified code paths
      1fc9dd7b
  12. 14 Mar, 2026 1 commit
    • Rose Ding's avatar
      fix: 按 review 意见重构数据库备份服务(安全性 + 架构 + 健壮性) · 1047f973
      Rose Ding authored
      
      
      1. S3 凭证加密存储:使用 SecretEncryptor (AES-256-GCM) 加密 SecretAccessKey,
         防止备份文件中泄露 S3 凭证,兼容旧的未加密数据
      2. 修复 saveRecord 竞态条件:添加 recordsMu 互斥锁保护 records 的 load/save
      3. 恢复操作增加服务端验证:handler 层要求重新输入管理员密码,通过 bcrypt
         校验,前端弹出密码输入框
      4. pg_dump/psql/S3 操作抽象为接口:定义 DBDumper 和 BackupObjectStore 接口,
         实现放入 repository 层,遵循项目依赖注入架构规范
      5. 改为流式处理避免大数据库 OOM:备份时 pg_dump stdout -> gzip -> io.Pipe ->
         S3 upload;恢复时 S3 download -> gzip reader -> psql stdin,不再全量加载
      6. loadRecords 区分"无数据"和"数据损坏"场景:JSON 解析失败返回明确错误
      7. 添加 18 个核心逻辑单元测试:覆盖加密、并发、流式备份/恢复、错误处理等
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      1047f973
  13. 13 Mar, 2026 2 commits
  14. 12 Mar, 2026 2 commits
  15. 09 Mar, 2026 1 commit
    • ischanx's avatar
      feat: 允许管理员为持有有效订阅的用户绑定订阅类型分组 · 767a41e2
      ischanx authored
      
      
      之前管理员无法通过 API 密钥管理将用户绑定到订阅类型分组(直接返回错误)。
      现在改为检查用户是否持有该分组的有效订阅,有则允许绑定,无则拒绝。
      
      - admin_service: 新增 userSubRepo 依赖,替换硬拒绝为订阅校验
      - admin_service: 区分 ErrSubscriptionNotFound 和内部错误,避免 DB 故障被误报
      - wire_gen/api_contract_test: 同步新增参数
      - UserApiKeysModal: 管理员分组下拉不再过滤订阅类型分组
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      767a41e2
  16. 08 Mar, 2026 1 commit
  17. 07 Mar, 2026 2 commits
    • kyx236's avatar
      feat(admin): 支持定时测试自动恢复并统一账号恢复入口 · 0c29468f
      kyx236 authored
      - 为定时测试计划增加 auto_recover 配置,补齐前后端类型、接口、仓储与数据库迁移
      - 在定时测试成功后自动恢复账号 error、rate-limit 等可恢复运行时状态
      - 新增 /admin/accounts/:id/recover-state 接口,合并原有重置状态与清限流操作
      - 更新账号管理菜单与定时测试面板,补充自动恢复开关、说明提示和状态展示
      - 补充账号恢复、限流清理与仓储同步相关测试
      0c29468f
    • shaw's avatar
      feat: 支持后台设置是否启用整流开关 · a3791104
      shaw authored
      a3791104
  18. 06 Mar, 2026 1 commit
    • yangjianbo's avatar
      fix(openai): 统一专属倍率计费链路并补齐回归测试 · a18bbb5f
      yangjianbo authored
      抽取共享的用户分组专属倍率解析器,统一缓存、singleflight 与回退逻辑。\n\n让 OpenAI 独立计费链路复用专属倍率解析,修复 usage 记录与实际扣费未命中用户专属倍率的问题。\n\n补齐 OpenAI 计费与解析器单元测试,并修复全量回归中暴露的 lint 阻塞项。\n\nCo-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
      a18bbb5f
  19. 05 Mar, 2026 4 commits
  20. 03 Mar, 2026 2 commits
  21. 02 Mar, 2026 2 commits
    • erio's avatar
      50a8116a
    • QTom's avatar
      feat(gateway): 双模式用户消息队列 — 串行队列 + 软性限速 · a9285b8a
      QTom authored
      新增 UMQ (User Message Queue) 双模式支持:
      - serialize: 账号级分布式串行锁 + RPM 自适应延迟(严格限流)
      - throttle: 仅 RPM 自适应前置延迟,不阻塞并发(软性限速)
      
      后端:
      - config: 新增 Mode 字段,保留 Enabled 向后兼容
      - service: 新增 UserMessageQueueService(Lua 锁/延迟算法/清理 worker)
      - repository: 新增 UserMsgQueueCache(Redis Lua acquire/release/force-release)
      - handler: 新增 UserMsgQueueHelper(SSE ping + 等待循环 + throttle)
      - gateway: 按 mode 分支集成 serialize/throttle 逻辑
      - lint: 修复 gofmt rewrite rules、errcheck 类型断言、staticcheck QF1012
      
      前端:
      - 三态选择器 UI(关闭/软性限速/串行队列)替代 toggle 开关
      - BulkEdit 支持 null 语义(不修改)
      - i18n 中英文文案
      
      通过 6 轮专家评审(42 次 review)、golangci-lint、单元测试、集成测试。
      a9285b8a