1. 07 Apr, 2026 1 commit
    • shaw's avatar
      fix: 非流式路径在上游终态事件output为空时从delta事件重建响应内容 · b2e379cf
      shaw authored
      上游API近期更新后,response.completed终态SSE事件的output字段可能为空,
      实际内容仅通过response.output_text.delta等增量事件下发。流式路径不受影响,
      但chat_completions非流式路径和responses OAuth非流式路径只依赖终态事件的
      output,导致返回空响应。
      
      新增BufferedResponseAccumulator累积器,在SSE扫描过程中收集delta事件内容
      (文本、function_call、reasoning),当终态output为空时补充重建。
      
      同时修复handleChatBufferedStreamingResponse遗漏response.done事件类型的问题。
      b2e379cf
  2. 05 Apr, 2026 3 commits
  3. 04 Apr, 2026 6 commits
    • erio's avatar
      fix: resolve golangci-lint issues — remove unused constants and functions, fix gofmt · 1b5ae71d
      erio authored
      - Remove unused claudeMax*Tokens constants (Claude Max feature not included)
      - Remove unused UsageMapHook type, SetUsageMapHook method, and usageToMap function
      - Fix gofmt formatting in channel_service.go, openai_model_mapping_test.go,
        chatcompletions_to_responses.go
      1b5ae71d
    • erio's avatar
      fix: resolve cherry-pick compilation and test issues · e59fa863
      erio authored
      - Add int64(0) param to SelectAccountWithLoadAwareness callers (signature change from channel scheduling refactor)
      - Add UsageMapHook type and struct field to StreamingProcessor
      - Revert Claude Max cache billing code to upstream/main (not part of channel feature)
      - Revert credits overages logic to upstream/main (non-channel change)
      - Remove Instructions field reference (non-channel OpenAI feature)
      - Restore sora_client_handler_test.go from upstream + add channel service nil params
      e59fa863
    • erio's avatar
      fix: resolve golangci-lint issues · 3851628a
      erio authored
      - Fix errcheck: defer rows.Close() with nolint
      - Fix errcheck: type assertion with ok check in channel cache
      - Fix staticcheck ST1005: lowercase error string
      - Fix staticcheck SA5011: nil check cost before use in openai gateway
      - Fix gofmt: format chatcompletions_to_responses.go
      3851628a
    • 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): 渠道管理全链路集成 — 模型映射、定价、限制、用量统计 · 2555951b
      erio authored
      - 渠道模型映射:支持精确匹配和通配符映射,按平台隔离
      - 渠道模型定价:支持 token/按次/图片三种计费模式,区间分层定价
      - 模型限制:渠道可限制仅允许定价列表中的模型
      - 计费模型来源:支持 requested/upstream 两种计费模型选择
      - 用量统计:usage_logs 新增 channel_id/model_mapping_chain/billing_tier/billing_mode 字段
      - Dashboard 支持 model_source 维度(requested/upstream/mapping)查看模型统计
      - 全部 gateway handler 统一接入 ResolveChannelMappingAndRestrict
      - 修复测试:同步 SoraGenerationRepository 接口、SQL INSERT 参数、scan 字段
      2555951b
    • erio's avatar
      feat(usage): 使用记录增加计费模式字段 — 记录/展示/筛选 token/按次/图片 · a51e0047
      erio authored
      - DB: usage_logs 表新增 billing_mode VARCHAR(20) 列
      - 后端: RecordUsage 写入时根据 image_count 判定计费模式
      - 前端: 使用记录表格新增计费模式 badge 列 + 筛选下拉
      a51e0047
  4. 31 Mar, 2026 3 commits
  5. 27 Mar, 2026 4 commits
    • Elysia's avatar
      修复误删的url · 81ca4f12
      Elysia authored
      81ca4f12
    • Elysia's avatar
      fix: use standard PKCE code verifier generation · 941c469a
      Elysia authored
      
      
      Replace charset→base64url double-encoding with standard random
      bytes→base64url approach to match official client behavior and avoid
      risk control detection.
      Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
      941c469a
    • Elysia's avatar
      feat: add user:file_upload OAuth scope · 8fcd819e
      Elysia authored
      
      
      Align OAuth scopes with upstream Claude Code client which now includes
      the user:file_upload scope for file upload support.
      Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
      8fcd819e
    • 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. 25 Mar, 2026 3 commits
    • QTom's avatar
      fix: 修复 golangci-lint 报告的 5 个问题 · 975e6b15
      QTom authored
      - gofmt: 修复 admin_service/antigravity_oauth_service/token_refresh_service 格式
      - staticcheck S1009: 移除 SetUserSettingsResponse.IsSuccess 中冗余的 nil 检查
      - unused: 将仅测试使用的 applyAntigravitySubscriptionResult 移至测试文件
      
      Made-with: Cursor
      975e6b15
    • QTom's avatar
      feat(antigravity): 从 LoadCodeAssist 复用 TierInfo 提取 plan_type · f6fd7c83
      QTom authored
      复用已有 GetTier() 返回的 tier ID(free-tier / g1-pro-tier /
      g1-ultra-tier),通过 TierIDToPlanType 映射为 Free / Pro / Ultra,
      在 loadProjectIDWithRetry 中顺带提取并写入 credentials.plan_type;
      前端增加 Abnormal 异常套餐红色标记。
      
      Made-with: Cursor
      f6fd7c83
    • QTom's avatar
      feat(antigravity): 自动设置隐私并支持后台手动重试 · c2965c0f
      QTom authored
      新增 Antigravity OAuth 隐私设置能力,在账号创建、刷新、导入和后台
      Token 刷新路径自动调用 setUserSettings + fetchUserInfo 关闭遥测;
      持久化后同步内存 Extra,错误处理改为日志记录。
      
      Made-with: Cursor
      c2965c0f
  7. 24 Mar, 2026 2 commits
  8. 23 Mar, 2026 1 commit
    • Ethan0x0000's avatar
      feat(apicompat): add ResponsesAnthropic bidirectional format conversion · 68f151f5
      Ethan0x0000 authored
      Add reverse-direction converters for Anthropic platform groups to accept
      OpenAI-format requests:
      
      - ResponsesToAnthropicRequest: Responses API input → Anthropic Messages
        request with system extraction, tool/toolChoice mapping, reasoning
        effort conversion, image data URIbase64, and consecutive role merging
      - AnthropicToResponsesResponse: Anthropic response → Responses response
        with content block→output item mapping, usage, stop_reason→status
      - AnthropicEventToResponsesEvents: stateful SSE stream converter
        (Anthropic streaming protocol → Responses streaming protocol)
      - FinalizeAnthropicResponsesStream: synthetic termination for
        incomplete streams
      68f151f5
  9. 21 Mar, 2026 1 commit
  10. 20 Mar, 2026 2 commits
    • alfadb's avatar
      fix(apicompat): 修正 Anthropic→OpenAI 推理级别映射 · 8afa8c10
      alfadb authored
      旧映射错误地将所有级别上移一档(medium→high, high→xhigh),
      导致 effort=max 被原样透传到 OpenAI 上游并返回 400 错误。
      
      根据两边官方 API 定义对齐:
      - Anthropic: low, medium, high(默认), max
      - OpenAI:    low, medium, high(默认), xhigh
      
      新的 1:1 映射:low→low, medium→medium, high→high, max→xhigh
      8afa8c10
    • Remx's avatar
      feat(openai): 增加 gpt-5.4-mini/nano 模型支持与定价配置 · c810cad7
      Remx authored
      - 接入 gpt-5.4-mini/nano 模型识别与规范化,补充默认模型列表
      - 增加 gpt-5.4-mini/nano 输入/缓存命中/输出价格与计费兜底逻辑
      - 同步前端模型白名单与 OpenCode 配置
      - 补充 service tier(priority/flex) 计费回归测试
      c810cad7
  11. 19 Mar, 2026 5 commits
    • 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
    • Rose Ding's avatar
    • Rose Ding's avatar
      fix: Anthropic tool schema 转 Responses API 时补充缺失的 properties 字段 · 963494ec
      Rose Ding authored
      
      
      当 Claude Code 发来的 MCP tool 的 input_schema 为 {"type":"object"} 且缺少
      properties 字段时,OpenAI Codex 后端会拒绝并报错:
      Invalid schema for function '...': object schema missing properties.
      
      新增 normalizeToolParameters 函数,在 convertAnthropicToolsToResponses 中
      对每个 tool 的 InputSchema 做规范化处理后再赋给 Parameters。
      Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
      963494ec
    • Remx's avatar
      feat(openai): 增加 gpt-5.4-mini/nano 模型支持与定价配置 · 42d73118
      Remx authored
      - 接入 gpt-5.4-mini/nano 模型识别与规范化,补充默认模型列表
      - 增加 gpt-5.4-mini/nano 输入/缓存命中/输出价格与计费兜底逻辑
      - 同步前端模型白名单与 OpenCode 配置
      - 补充 service tier(priority/flex) 计费回归测试
      42d73118
    • shaw's avatar
  12. 18 Mar, 2026 1 commit
    • QTom's avatar
      feat(admin): 分组管理列表新增用量列与账号数分类 · 961c30e7
      QTom authored
      
      
      分组管理列表增强:
      
      1. 今日/累计用量列:
         - 新增独立端点 GET /admin/groups/usage-summary
         - 一次查询返回所有分组的今日费用和累计费用(actual_cost)
         - 前端异步加载后合并显示在分组列表中
      
      2. 账号数区分可用/限流/总量:
         - 将账号数列从单一总量改为 badge 内多行展示
         - 可用: active + schedulable 的账号数(绿色)
         - 限流: rate_limit/overload/temp_unschedulable 的账号数(橙色,无限流时隐藏)
         - 总量: 全部关联账号数
      Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
      961c30e7
  13. 17 Mar, 2026 2 commits
    • Ethan0x0000's avatar
      test(backend): add tests for upstream model tracking and model source filtering · eeff451b
      Ethan0x0000 authored
      Cover IsValidModelSource/NormalizeModelSource, resolveModelDimensionExpression SQL expressions, invalid model_source 400 responses on both GetModelStats and GetUserBreakdown, upstream_model in scan/insert SQL mock expectations, and updated passthrough/billing test signatures.
      eeff451b
    • Ethan0x0000's avatar
      feat(dashboard): add model source dimension to stats queries · 7134266a
      Ethan0x0000 authored
      Support querying model statistics by 'requested', 'upstream', or 'mapping' dimension. Add resolveModelDimensionExpression for safe SQL expression generation, IsValidModelSource whitelist validator, and NormalizeModelSource fallback. Repository persists and scans upstream_model in all insert/select paths.
      7134266a
  14. 16 Mar, 2026 3 commits
    • erio's avatar
      feat(dashboard): add per-user drill-down for group, model, and endpoint distributions · 4b41e898
      erio authored
      Click on a group name, model name, or endpoint name in the distribution
      tables to expand and show per-user usage breakdown (requests, tokens,
      actual cost, standard cost).
      
      Backend: new GET /admin/dashboard/user-breakdown API with group_id,
      model, endpoint, endpoint_type filters.
      Frontend: clickable rows with expand/collapse sub-table in all three
      distribution charts.
      4b41e898
    • QTom's avatar
      feat(backup): 备份/恢复异步化,解决 504 超时 · c1fab7f8
      QTom authored
      
      
      POST /backups 和 POST /backups/:id/restore 改为异步:立即返回 HTTP 202,
      后台 goroutine 独立执行 pg_dump → gzip → S3 上传,前端每 2s 轮询状态。
      
      后端:
      - 新增 StartBackup/StartRestore 方法,后台 goroutine 不依赖 HTTP 连接
      - Graceful shutdown 等待活跃操作完成,启动时清理孤立 running 记录
      - BackupRecord 新增 progress/restore_status 字段支持进度和恢复状态追踪
      
      前端:
      - 创建备份/恢复后轮询 GET /backups/:id 直到完成或失败
      - 标签页切换暂停/恢复轮询,组件卸载清理定时器
      - 正确处理 409(备份进行中)和轮询超时
      Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
      c1fab7f8
    • erio's avatar
      71f72e16
  15. 15 Mar, 2026 3 commits