1. 21 Feb, 2026 1 commit
    • yangjianbo's avatar
      feat(anthropic): 支持 API Key 自动透传并优化透传链路性能 · bde9dbc5
      yangjianbo authored
      - 新增 Anthropic API Key 自动透传开关与后端透传分支(仅替换认证)
      
      - 账号编辑页新增自动透传开关,默认关闭
      
      - 优化透传性能:SSE usage 解析 gjson 快路径、减少请求体重复拷贝、优化流式写回与非流式 usage 解析
      
      - 补充单元测试与 benchmark,确保 Claude OAuth 路径不受影响
      bde9dbc5
  2. 19 Feb, 2026 2 commits
  3. 18 Feb, 2026 1 commit
  4. 17 Feb, 2026 1 commit
  5. 16 Feb, 2026 1 commit
  6. 14 Feb, 2026 2 commits
    • shaw's avatar
      feat: 区分 Anthropic 5m/1h 缓存创建 token 的差异化计费 · a817cafe
      shaw authored
      Anthropic API 的 cache_creation 对象区分了 ephemeral_5m 和 ephemeral_1h
      两种缓存创建 token,1h 单价远高于 5m(如 claude-3-5-haiku: 5m=$1/MTok,
      1h=$6/MTok)。此前系统统一按 5m 单价计费,导致计费偏低。
      
      后端:
      - pricing_service: 加载 LiteLLM 的 cache_creation_input_token_cost_above_1hr
      - billing_service: GetModelPricing 启用分类计费(安全守卫 1h>5m),
        CalculateCost 按 5m/1h 分别计费,无明细时回退到 5m 单价
      - gateway_service: parseSSEUsage/handleNonStreamingResponse 用 gjson
        提取嵌套 cache_creation 对象的 ephemeral_5m/1h_input_tokens
      - antigravity_gateway_service: extractSSEUsage/extractClaudeUsage 同步提取
      - usage_log: 修复 GORM column tag 确保写入正确的数据库列
      - 新增迁移 054: 删除 GORM 自动生成的重复列
      
      前端:
      - 使用记录 tooltip 展示 5m/1h 缓存创建明细(带彩色 badge 区分)
      - 表格单元格缓存写入数值旁显示 1h 标识
      a817cafe
    • yangjianbo's avatar
  7. 12 Feb, 2026 1 commit
    • yangjianbo's avatar
      chore(logging): 完成后端日志审计与结构化迁移 · 584cfc3d
      yangjianbo authored
      - 将高密度服务与处理器日志迁移到新日志系统(LegacyPrintf/结构化日志)
      - 增加 stdlog bridge 与兼容测试,保留旧日志捕获能力
      - 将 OpenAI 断流告警改为结构化 Warn 并改造对应测试为 sink 捕获
      - 补齐后端相关文件 logger 引用并通过全量 go test
      584cfc3d
  8. 11 Feb, 2026 1 commit
  9. 10 Feb, 2026 2 commits
  10. 09 Feb, 2026 4 commits
    • Edric Li's avatar
      feat: same-account retry before failover for transient errors · d6c2921f
      Edric Li authored
      For retryable transient errors (Google 400 "invalid project resource name"
      and empty stream responses), retry on the same account up to 2 times
      (with 500ms delay) before switching to another account.
      
      - Add RetryableOnSameAccount field to UpstreamFailoverError
      - Add same-account retry loop in both Gemini and Claude/OpenAI handler paths
      - Move temp-unschedule from service layer to handler layer (only after
        all same-account retries exhausted)
      - Reduce temp-unschedule cooldown from 30 minutes to 1 minute
      d6c2921f
    • yangjianbo's avatar
    • Rose Ding's avatar
      fix: 单账号分组首次 503 不设模型限流标记,避免后续请求雪崩 · 021abfca
      Rose Ding authored
      单账号 antigravity 分组收到 503 (MODEL_CAPACITY_EXHAUSTED) 时,
      原逻辑会设置 ~29s 模型限流标记。由于只有一个账号无法切换,
      后续所有新请求在预检查时命中限流 → 几毫秒内直接返回 503,
      导致约 30 秒的雪崩窗口。
      
      修复:在 Handler 入口处检查分组是否只有单个 antigravity 账号,
      如果是则提前设置 SingleAccountRetry context 标记,让 Service 层
      首次 503 就走原地重试逻辑(不设限流标记),避免污染后续请求。
      021abfca
    • erio's avatar
      refactor: replace scope-level rate limiting with model-level rate limiting · fc095bf0
      erio authored
      Merge functional changes from develop branch:
      - Remove AntigravityQuotaScope system (claude/gemini_text/gemini_image)
      - Replace with per-model rate limiting using resolveAntigravityModelKey
      - Remove model load statistics (IncrModelCallCount/GetModelLoadBatch)
      - Simplify account selection to unified priority→load→LRU algorithm
      - Remove SetAntigravityQuotaScopeLimit from AccountRepository
      - Clean up scope-related UI indicators and API fields
      fc095bf0
  11. 08 Feb, 2026 4 commits
  12. 07 Feb, 2026 10 commits
  13. 06 Feb, 2026 4 commits
    • yangjianbo's avatar
      perf(service): SSE Scanner buffer 改用 sync.Pool 复用,减少高并发 GC 压力 · d71537d4
      yangjianbo authored
      
      
      将流式响应中 bufio.Scanner 的 64KB buffer 从每次 make 分配改为
      sync.Pool 复用,统一切片表达式为 [:0]、变量命名为 scanBuf,
      并补充对应的单元测试。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      d71537d4
    • shaw's avatar
      fix(gateway): 移除 PR #316 引入的工具名转换逻辑 · d182ef03
      shaw authored
      移除响应阶段的工具名/schema/description 转换逻辑,修复第三方工具调用时
      工具名被错误转换的问题(如 Task → task)。
      
      移除内容:
      - 工具名相关正则变量(toolPrefixRe, toolNameBoundaryRe 等)
      - openCodeToolOverrides 和 claudeToolNameOverrides 映射表
      - 工具名转换函数(normalizeToolNameForClaude, normalizeToolNameForOpenCode 等)
      - 响应体工具名替换函数(replaceToolNamesInText, replaceToolNamesInResponseBody 等)
      - 参数名转换函数(normalizeParamNameForOpenCode, rewriteParamKeysInValue)
      - 工具描述清理函数(sanitizeToolDescription)
      - 输入 schema 转换函数(normalizeToolInputSchema)
      - 模型 ID 正则替换函数(replaceModelIDInText)
      
      保留内容:
      - 系统提示词清理(sanitizeSystemText)
      - Claude Code 指纹 headers 处理
      - 模型 ID 映射(通过 JSON 对象操作)
      d182ef03
    • yangjianbo's avatar
      fix(兼容): 将 Kimi cached_tokens 映射到 Claude 标准 cache_read_input_tokens · f33a9501
      yangjianbo authored
      
      
      Kimi 等 Claude 兼容 API 返回缓存信息使用 OpenAI 风格的 cached_tokens 字段,
      而非 Claude 标准的 cache_read_input_tokens,导致客户端收不到缓存命中信息且
      内部计费缓存折扣为 0。
      
      新增 reconcileCachedTokens 辅助函数,在 cache_read_input_tokens == 0 且
      cached_tokens > 0 时自动填充,覆盖流式(message_start/message_delta)和
      非流式两种响应路径。对 Claude 原生上游无影响。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      f33a9501
    • yangjianbo's avatar
      fix(兼容): 将 Kimi cached_tokens 映射到 Claude 标准 cache_read_input_tokens · c6a456c7
      yangjianbo authored
      
      
      Kimi 等 Claude 兼容 API 返回缓存信息使用 OpenAI 风格的 cached_tokens 字段,
      而非 Claude 标准的 cache_read_input_tokens,导致客户端收不到缓存命中信息且
      内部计费缓存折扣为 0。
      
      新增 reconcileCachedTokens 辅助函数,在 cache_read_input_tokens == 0 且
      cached_tokens > 0 时自动填充,覆盖流式(message_start/message_delta)和
      非流式两种响应路径。对 Claude 原生上游无影响。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      c6a456c7
  14. 05 Feb, 2026 3 commits
    • shaw's avatar
      feat: 新增全局错误透传规则功能 · 39e05a2d
      shaw authored
      支持管理员配置上游错误如何返回给客户端:
      - 新增 ErrorPassthroughRule 数据模型和 Ent Schema
      - 实现规则的 CRUD API(/admin/error-passthrough-rules)
      - 支持按错误码、关键词匹配,支持 any/all 匹配模式
      - 支持按平台过滤(anthropic/openai/gemini/antigravity)
      - 支持透传或自定义响应状态码和错误消息
      - 实现两级缓存(Redis + 本地内存)和多实例同步
      - 集成到 gateway_handler 的错误处理流程
      - 新增前端管理界面组件
      - 新增单元测试覆盖核心匹配逻辑
      
      优化:
      - 移除 refreshLocalCache 中的冗余排序(数据库已排序)
      - 后端 Validate() 增加匹配条件非空校验
      39e05a2d
    • shaw's avatar
      feat: 支持用户专属分组倍率配置 · 2b192f7d
      shaw authored
      2b192f7d
    • shaw's avatar
      fix(gateway): 修复工具名转换破坏 Anthropic 特殊工具的问题 · 05af95da
      shaw authored
      未知工具名不再进行 PascalCase/snake_case 转换,保持原样透传。
      修复 text_editor_20250728 等 Anthropic 特殊工具被错误转换的问题。
      05af95da
  15. 04 Feb, 2026 1 commit
    • shaw's avatar
      fix(gateway): 修复模型前缀映射逻辑错误 · 8f397548
      shaw authored
      问题:normalizeClaudeModelForAnthropic 函数错误地将长模型ID截断为短ID,
      导致 APIKey 账号的模型名被错误修改。
      
      修复:
      - 删除错误的 normalizeClaudeModelForAnthropic 函数和 anthropicPrefixMappings 变量
      - 直接使用 claude.NormalizeModelID(正确的短ID->长ID扩展)
      - APIKey 账号无显式映射时透传原始模型名
      8f397548
  16. 03 Feb, 2026 2 commits
    • bayma888's avatar
      fix(lint): format gateway_service.go with gofmt · 3fed478e
      bayma888 authored
      3fed478e
    • bayma888's avatar
      feat(api-key): add independent quota and expiration support · 6146be14
      bayma888 authored
      This feature allows API Keys to have their own quota limits and expiration
      times, independent of the user's balance.
      
      Backend:
      - Add quota, quota_used, expires_at fields to api_key schema
      - Implement IsExpired() and IsQuotaExhausted() checks in middleware
      - Add ResetQuota and ClearExpiration API endpoints
      - Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini)
      - Include quota/expiration fields in auth cache for performance
      - Expiration check returns 403, quota exhausted returns 429
      
      Frontend:
      - Add quota and expiration inputs to key create/edit dialog
      - Add quick-select buttons for expiration (+7, +30, +90 days)
      - Add reset quota confirmation dialog
      - Add expires_at column to keys list
      - Add i18n translations for new features (en/zh)
      
      Migration:
      - Add 045_add_api_key_quota.sql for new columns
      6146be14