1. 05 Apr, 2026 1 commit
  2. 04 Apr, 2026 2 commits
    • erio's avatar
      feat(usage): 使用记录增加计费模式字段 — 记录/展示/筛选 token/按次/图片 · a51e0047
      erio authored
      - DB: usage_logs 表新增 billing_mode VARCHAR(20) 列
      - 后端: RecordUsage 写入时根据 image_count 判定计费模式
      - 前端: 使用记录表格新增计费模式 badge 列 + 筛选下拉
      a51e0047
    • erio's avatar
      feat(channel): 缓存扁平化 + 网关映射集成 + 计费模式统一 + 模型限制 · ebac0dc6
      erio authored
      - 缓存重构为 O(1) 哈希结构 (pricingByGroupModel, mappingByGroupModel)
      - 渠道模型映射接入网关流程 (Forward 前应用, a→b→c 映射链)
      - 新增 billing_model_source 配置 (请求模型/最终模型计费)
      - usage_logs 新增 channel_id, model_mapping_chain, billing_tier 字段
      - 每种计费模式统一支持默认价格 + 区间定价
      - 渠道模型限制开关 (restrict_models)
      - 分组按平台分类展示 + 彩色图标
      - 必填字段红色星号 + 模型映射 UI
      - 去除模型通配符支持
      ebac0dc6
  3. 31 Mar, 2026 1 commit
  4. 30 Mar, 2026 1 commit
  5. 27 Mar, 2026 1 commit
    • 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
  6. 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
  7. 24 Mar, 2026 1 commit
  8. 21 Mar, 2026 1 commit
  9. 20 Mar, 2026 3 commits
    • Ethan0x0000's avatar
    • wucm667's avatar
      fix: quota display shows stale cumulative usage after daily/weekly reset · 0d45d866
      wucm667 authored
      The quota reset mechanism is lazy — quota_daily_used/quota_weekly_used
      in the database are only reset on the next IncrementQuotaUsed call.
      The scheduling layer (IsQuotaExceeded) correctly checks period expiry
      before enforcing limits, so the account remains usable. However, the
      API response mapper reads the raw DB value without checking expiry,
      causing the frontend to display cumulative usage (e.g. 110%) even
      after the reset period has passed.
      
      Add IsDailyQuotaPeriodExpired/IsWeeklyQuotaPeriodExpired methods and
      use them in the mapper to return used=0 when the period has expired.
      0d45d866
    • shaw's avatar
      feat: add max_claude_code_version setting and disable auto-upgrade env var · 01d8286b
      shaw authored
      Add maximum Claude Code version limit to complement the existing minimum
      version check. Refactor the version cache from single-value to unified
      bounds struct (min+max) with a single atomic.Value and singleflight group.
      
      - Backend: new constant, struct field, cache refactor, validation (semver
        format + cross-validation max >= min), gateway enforcement, audit diff
      - Frontend: settings UI input, TypeScript types, zh/en i18n
      - Add CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 to all Claude Code
        tutorials on /keys page (unix/cmd/powershell/vscode settings.json)
      01d8286b
  10. 18 Mar, 2026 3 commits
  11. 17 Mar, 2026 1 commit
    • Ethan0x0000's avatar
      feat(api): expose model_source filter in dashboard endpoints · 56fcb20f
      Ethan0x0000 authored
      Add model_source query parameter to GetModelStats and GetUserBreakdown handlers with explicit IsValidModelSource validation. Include model_source in cache key to prevent cross-source cache hits. Expose upstream_model in usage log DTO with omitempty semantics.
      56fcb20f
  12. 15 Mar, 2026 3 commits
    • shaw's avatar
      ae44a943
    • YanzheL's avatar
      fix: extract and log Claude output_config.effort in usage records · 1bff2292
      YanzheL authored
      Claude's output_config.effort parameter (low/medium/high/max) was not
      being extracted from requests or logged in the reasoning_effort column
      of usage logs. Only the OpenAI path populated this field.
      
      Changes:
      - Extract output_config.effort in ParseGatewayRequest
      - Add ReasoningEffort field to ForwardResult
      - Populate reasoning_effort in both RecordUsage and RecordUsageWithLongContext
      - Guard against overwriting service-set effort values in handler
      - Update stale comments that described reasoning_effort as OpenAI-only
      - Add unit tests for extraction, normalization, and persistence
      1bff2292
    • Ethan0x0000's avatar
      feat: 完善使用记录端点可观测性与分布统计 · eefab159
      Ethan0x0000 authored
      将入站、上游与路径三类端点分布统一到使用记录页的一致化卡片交互中,并补齐端点元数据与统计链路,提升排障与流量分析效率。
      eefab159
  13. 14 Mar, 2026 1 commit
    • SsageParuders's avatar
      refactor: merge bedrock-apikey into bedrock with auth_mode credential · 4644af2c
      SsageParuders authored
      Consolidate two separate channel types (bedrock + bedrock-apikey) into
      a single "AWS Bedrock" channel. Authentication mode is now distinguished
      by credentials.auth_mode ("sigv4" | "apikey") instead of separate types.
      
      Backend:
      - Remove AccountTypeBedrockAPIKey constant
      - IsBedrock() simplified; IsBedrockAPIKey() checks auth_mode
      - Add IsAPIKeyOrBedrock() helper to eliminate repeated type checks
      - Extend pool mode, quota scheduling, and billing to bedrock
      - Add RetryableOnSameAccount to handleBedrockUpstreamErrors
      - Add "bedrock" scope to Beta Policy for independent control
      
      Frontend:
      - Merge two buttons into one "AWS Bedrock" with auth mode radio
      - Badge displays "Anthropic | AWS"
      - Pool mode and quota limit UI available for bedrock
      - Quota display in account list (usage bars, capacity badges, reset)
      - Remove all bedrock-apikey type references
      4644af2c
  14. 13 Mar, 2026 1 commit
    • wucm667's avatar
      feat: 账号配额支持固定时间重置模式 · 5b850059
      wucm667 authored
      - 后端新增 rolling/fixed 两种配额重置模式,支持日配额和周配额
      - fixed 模式下可配置重置时刻(小时)、重置星期几(周配额)及时区(IANA)
      - 在 account_repo.go 中使用 SQL 表达式适配两种模式的过期判断与重置时间推进
      - 新增 ComputeQuotaResetAt / ValidateQuotaResetConfig 等辅助函数
      - DTO 层新增相关字段并在 mappers 中完整映射
      - 前端 QuotaLimitCard 新增 rolling/fixed 切换 UI、时区选择器
      - CreateAccountModal / EditAccountModal 透传新配置字段
      - i18n(zh/en)同步新增相关翻译词条
      5b850059
  15. 11 Mar, 2026 1 commit
    • John Doe's avatar
      feat: add Backend Mode toggle to disable user self-service · 6826149a
      John Doe authored
      
      
      Add a system-wide "Backend Mode" that disables user self-registration
      and self-service while keeping admin panel and API gateway fully
      functional. When enabled, only admin can log in; all user-facing
      routes return 403.
      
      Backend:
      - New setting key `backend_mode_enabled` with atomic cached reads (60s TTL)
      - BackendModeUserGuard middleware blocks non-admin authenticated routes
      - BackendModeAuthGuard middleware blocks registration/password-reset auth routes
      - Login/Login2FA/RefreshToken handlers reject non-admin when enabled
      - TokenPairWithUser struct for role-aware token refresh
      - 20 unit tests (middleware + service layer)
      
      Frontend:
      - Router guards redirect unauthenticated users to /login
      - Admin toggle in Settings page
      - Login page hides register link and footer in backend mode
      - 9 unit tests for router guard logic
      - i18n support (en/zh)
      
      27 files changed, 833 insertions(+), 17 deletions(-)
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      6826149a
  16. 10 Mar, 2026 1 commit
  17. 09 Mar, 2026 2 commits
  18. 07 Mar, 2026 6 commits
  19. 05 Mar, 2026 2 commits
    • erio's avatar
    • 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
  20. 04 Mar, 2026 1 commit
  21. 03 Mar, 2026 2 commits
  22. 02 Mar, 2026 3 commits
    • erio's avatar
      fix: security hardening and architectural improvements for custom menu · e97c3766
      erio authored
      
      
      1. (Critical) Filter admin-only menu items from public API responses -
         both GetPublicSettings handler and GetPublicSettingsForInjection now
         exclude visibility=admin items, preventing unauthorized access to
         admin menu URLs.
      
      2. (Medium) Validate JSON array structure in sanitizeCustomMenuItemsJSON -
         use json.Unmarshal into []json.RawMessage instead of json.Valid to
         reject non-array JSON values that would cause frontend runtime errors.
      
      3. (Medium) Decouple router from business JSON parsing - move origin
         extraction logic from router.go to SettingService.GetFrameSrcOrigins,
         eliminating direct JSON parsing of custom_menu_items in the routing
         layer.
      
      4. (Low) Restrict custom menu item ID charset to [a-zA-Z0-9_-] via
         regex validation, preventing route-breaking characters like / ? # or
         spaces.
      
      5. (Low) Handle crypto/rand error in generateMenuItemID - return error
         instead of silently ignoring, preventing potential duplicate IDs.
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      e97c3766
    • erio's avatar
      fix: custom menu security hardening and code quality improvements · bf6fe5e9
      erio authored
      
      
      - Add admin menu permission check in CustomPageView (visibility + role)
      - Sanitize SVG content with DOMPurify before v-html rendering (XSS prevention)
      - Decouple router.go from dto package using anonymous struct
      - Consolidate duplicate parseCustomMenuItems into dto.ParseCustomMenuItems
      - Enhance menu item validation (count, length, ID uniqueness limits)
      - Add audit logging for purchase_subscription and custom_menu_items changes
      - Update API contract test to include custom_menu_items field
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      bf6fe5e9
    • erio's avatar
      feat: custom menu pages with iframe embedding and CSP injection · 067810fa
      erio authored
      
      
      Add configurable custom menu items that appear in sidebar, each rendering
      an iframe-embedded external page. Includes shared URL builder with
      src_host/src_url tracking, CSP frame-src multi-origin deduplication,
      admin settings UI, and i18n support.
      
      chore: bump version to 0.1.87.19
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      067810fa