win
a3f2d4577e
chore: remove LS pool implementation
...
Removing all LS (Language Server Pool) related code:
- backend/cmd/lsworker/
- backend/internal/pkg/lspool/
- backend/internal/service/lspool_bootstrap_service.*
- deploy/ls-bin/
- deploy/lsworker.Dockerfile
- deploy/lsworker-entrypoint.sh
Keeping:
- Claude custom fingerprint (immutable)
- Antigravity OAuth and telemetry improvements
- TLS fingerprint SOCKS5 Docker DNS fix
- Gemini OAuth security improvements
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-08 23:43:05 +08:00
win
3ba3a17652
chore: merge upstream origin/main (v0.1.109) - delete Sora, add group account filter, Cache-Driven RPM, Beta model whitelist, OpenAI normalize fixes, refresh token race fix, Gemini customtools fix
2026-04-08 06:28:50 +08:00
shaw
b2e379cf7a
fix: 非流式路径在上游终态事件output为空时从delta事件重建响应内容
...
上游API近期更新后,response.completed终态SSE事件的output字段可能为空,
实际内容仅通过response.output_text.delta等增量事件下发。流式路径不受影响,
但chat_completions非流式路径和responses OAuth非流式路径只依赖终态事件的
output,导致返回空响应。
新增BufferedResponseAccumulator累积器,在SSE扫描过程中收集delta事件内容
(文本、function_call、reasoning),当终态output为空时补充重建。
同时修复handleChatBufferedStreamingResponse遗漏response.done事件类型的问题。
2026-04-07 19:35:56 +08:00
Wesley Liddick
c71b1d63e5
Merge pull request #1460 from imfusheng/main
...
解决issue#1453提到的反重力不可用问题
2026-04-05 22:01:08 +08:00
erio
62e80c602d
revert: completely remove all Sora functionality
2026-04-05 17:11:01 +08:00
偷得浮生
66779f1c5f
同步ag版本号
2026-04-05 13:01:28 +08:00
偷得浮生
2c856b67ca
Update oauth.go
2026-04-05 13:00:23 +08:00
erio
1b5ae71d1f
fix: resolve golangci-lint issues — remove unused constants and functions, fix gofmt
...
- 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
2026-04-04 14:58:20 +08:00
erio
e59fa8637a
fix: resolve cherry-pick compilation and test issues
...
- 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
2026-04-04 12:38:50 +08:00
erio
3851628a43
fix: resolve golangci-lint issues
...
- 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
2026-04-04 11:17:24 +08:00
erio
d72ac92694
feat: image output token billing, channel-mapped billing source, credits balance precheck
...
- 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
2026-04-04 11:15:59 +08:00
erio
2555951be4
feat(channel): 渠道管理全链路集成 — 模型映射、定价、限制、用量统计
...
- 渠道模型映射:支持精确匹配和通配符映射,按平台隔离
- 渠道模型定价:支持 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 字段
2026-04-04 11:13:58 +08:00
erio
a51e0047b7
feat(usage): 使用记录增加计费模式字段 — 记录/展示/筛选 token/按次/图片
...
- DB: usage_logs 表新增 billing_mode VARCHAR(20) 列
- 后端: RecordUsage 写入时根据 image_count 判定计费模式
- 前端: 使用记录表格新增计费模式 badge 列 + 筛选下拉
2026-04-04 11:11:06 +08:00
win
47ce45fbed
fix: SOCKS5 dialer 日志改 Info 级别,OAuth 超时延长至 60s
2026-04-01 16:54:33 +08:00
win
cc737d789e
fix: SOCKS5ProxyDialer 使用 ContextDialer 避免 Docker 内本地 DNS 解析失败
...
- 原实现 proxy.SOCKS5(..., proxy.Direct) 会先在本地做 DNS 解析
Docker 容器内无法解析 platform.claude.com 导致 30s 超时
- 改用 &net.Dialer{} + DialContext 让域名直接发给代理端远端解析
- 同时影响 OAuth token exchange 和 API 请求的 SOCKS5 路由
2026-04-01 12:55:13 +08:00
win
58ad47ba80
fix: 对齐 Claude Code 2.1.88 源码指纹
...
- 1P event_logging/batch 添加 OAuth Bearer auth header
- DD hostname 改为固定 "claude-code"(与真实 CLI 一致)
- 事件名对齐真实 CLI: tengu_api_query/tengu_api_success/tengu_api_error/tengu_tool_use_success
- DD header 大小写改为 DD-API-KEY
- ResponseHeaderTimeout 300s → 600s(与真实 CLI 10min 超时对齐)
2026-04-01 08:53:39 +08:00
win
d8d8adb37f
feat: 移除 Node.js TLS 代理依赖,全部走 Go 原生 utls 指纹
...
- Do() 路由从 doViaNodeTLSProxy(转发到 localhost:3456 Node.js 进程)
改为 doWithTLSFingerprint(直接使用 Go utls dialer),解决 h2 connect
timeout 问题(Node.js proxy 的 H2 路径不支持 per-account 代理隧道)
- 新增 internal/pkg/telemetry 包,从 proxy.js 移植全部遥测逻辑:
Anthropic event_logging/batch + Datadog log intake + 虚拟主机身份 +
会话状态管理 + process metrics 模拟
- 保留 proxy.js 中的 H1 降级修复作为备用
2026-04-01 08:24:49 +08:00
YanzheL
095bef9554
fix(gemini): add customtools fallback metadata
2026-04-01 02:19:10 +08:00
win
b856586412
修复h1
CI / test (push) Failing after 16m30s
CI / golangci-lint (push) Failing after 4s
Security Scan / backend-security (push) Failing after 1m35s
Security Scan / frontend-security (push) Failing after 1m31s
2026-04-01 01:35:49 +08:00
win
dab4142ab2
feat: Claude Code 2.1.88 源码级指纹还原
...
CI / test (push) Failing after 11s
CI / golangci-lint (push) Failing after 8s
Security Scan / backend-security (push) Failing after 5s
Security Scan / frontend-security (push) Failing after 6s
基于 Claude Code 2.1.88 反编译源码,完成全面的反追踪指纹还原:
1. 版本升级 2.1.87 → 2.1.88(constants.go, identity_service.go, proxy.js)
2. 新增 6 个 beta header 常量(task-budgets, token-efficient-tools, structured-outputs, advisor, web-search)
3. 更新所有组合 beta header 字符串,加入 context-1m, redact-thinking, effort 等
4. 注入 x-anthropic-billing-header attribution block 到 system prompt 首位
- 完整复刻 fingerprint 算法: SHA256(salt + msg[4,7,20] + version)[:3]
- 正确省略 cch 字段(npm 版行为,非原生二进制)
5. X-Claude-Code-Session-Id: 有则同步,无则按 account 生成
6. x-client-request-id: 每请求自动生成 UUID
7. Bootstrap 预热: 模拟 GET /api/claude_cli/bootstrap(per-account, 1h cooldown)
8. 停止无条件剥离 temperature/tool_choice(与真实 CLI 行为一致)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 21:57:51 +08:00
win
53eaae61a3
fix: TLS fingerprint lifecycle consistency and bump CLI version to 2.1.87
...
- Update User-Agent from claude-cli/2.1.84 to 2.1.87 in constants.go
and identity_service.go to match latest Claude Code binary
- Replace ImpersonateChrome() in OAuth createReqClient with Node.js 24.x
uTLS profile (tlsfingerprint.Profile) to ensure consistent JA3 hash
across token exchange, refresh, and API calls
- Support direct/HTTP-proxy/SOCKS5 proxy modes with uTLS in OAuth client
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:14:56 +08:00
win
6620b56b5a
fix: encode ls model credits topic values as base64
CI / test (push) Failing after 3s
CI / golangci-lint (push) Failing after 2s
Security Scan / backend-security (push) Failing after 3s
Security Scan / frontend-security (push) Failing after 3s
2026-03-31 08:34:00 +08:00
win
0e9f780815
fix: surface ls quota exhaustion in antigravity streams
CI / test (push) Failing after 3s
CI / golangci-lint (push) Failing after 3s
Security Scan / backend-security (push) Failing after 4s
Security Scan / frontend-security (push) Failing after 3s
2026-03-31 01:26:48 +08:00
win
860fc736bf
Merge branch 'codex/internal-sync-20260330'
CI / test (push) Failing after 16m34s
CI / golangci-lint (push) Failing after 1m33s
Security Scan / backend-security (push) Failing after 33s
Security Scan / frontend-security (push) Failing after 1m32s
2026-03-31 00:00:49 +08:00
win
0cda0e0b96
feat: add dockerized antigravity ls worker mode
CI / test (push) Failing after 8s
CI / golangci-lint (push) Failing after 5s
Security Scan / backend-security (push) Failing after 7s
Security Scan / frontend-security (push) Failing after 6s
2026-03-30 23:57:25 +08:00
win
8eb2bbcb20
feat: 从 main 分支迁移 Claude 指纹常量和实例级隔离配置
...
CI / test (push) Failing after 5s
CI / golangci-lint (push) Failing after 13s
Security Scan / backend-security (push) Failing after 7s
Security Scan / frontend-security (push) Failing after 7s
将 main 分支的 Claude/Anthropic 相关逆向工作迁移到 codex 分支:
- claude/constants.go: 添加 4 个新 Beta 常量 + 版本升级至 2.1.84/0.74.0
- config.go: 添加 InstanceSalt 和 FingerprintDefaultsConfig 配置
- identity_service: 版本升级 + instanceSalt 支持 + ApplyDefaultFingerprintOverrides
- wire_gen.go: 初始化指纹覆盖 + 使用 NewIdentityServiceWithSalt
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 19:04:52 +08:00
Elysia
81ca4f12dd
修复误删的url
2026-03-28 00:55:55 +08:00
Elysia
941c469ab9
fix: use standard PKCE code verifier generation
...
Replace charset→base64url double-encoding with standard random
bytes→base64url approach to match official client behavior and avoid
risk control detection.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 00:47:31 +08:00
Elysia
8fcd819e6f
feat: add user:file_upload OAuth scope
...
Align OAuth scopes with upstream Claude Code client which now includes
the user:file_upload scope for file upload support.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 00:40:36 +08:00
shaw
1854050df3
feat(tls-fingerprint): 新增 TLS 指纹 Profile 数据库管理及代码质量优化
...
新增功能:
- 新增 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 回调签名被错误替换的问题
2026-03-27 14:33:05 +08:00
QTom
975e6b1563
fix: 修复 golangci-lint 报告的 5 个问题
...
- gofmt: 修复 admin_service/antigravity_oauth_service/token_refresh_service 格式
- staticcheck S1009: 移除 SetUserSettingsResponse.IsSuccess 中冗余的 nil 检查
- unused: 将仅测试使用的 applyAntigravitySubscriptionResult 移至测试文件
Made-with: Cursor
2026-03-25 19:03:12 +08:00
QTom
f6fd7c83e3
feat(antigravity): 从 LoadCodeAssist 复用 TierInfo 提取 plan_type
...
复用已有 GetTier() 返回的 tier ID(free-tier / g1-pro-tier /
g1-ultra-tier),通过 TierIDToPlanType 映射为 Free / Pro / Ultra,
在 loadProjectIDWithRetry 中顺带提取并写入 credentials.plan_type;
前端增加 Abnormal 异常套餐红色标记。
Made-with: Cursor
2026-03-25 17:38:41 +08:00
QTom
c2965c0fb0
feat(antigravity): 自动设置隐私并支持后台手动重试
...
新增 Antigravity OAuth 隐私设置能力,在账号创建、刷新、导入和后台
Token 刷新路径自动调用 setUserSettings + fetchUserInfo 关闭遥测;
持久化后同步内存 Extra,错误处理改为日志记录。
Made-with: Cursor
2026-03-25 17:38:41 +08:00
Wesley Liddick
5f41b74707
Merge pull request #1242 from Ethan0x0000/feat/anthropic-openai-endpoint-compat
...
支持 Anthropic Responses / Chat Completions 兼容端点并完善会话一致性与错误可观测性
2026-03-24 15:16:26 +08:00
QTom
91b1d812ce
feat(openai): Mobile RT 补全 plan_type、精确匹配账号、刷新时自动设置隐私
...
1. accounts/check 补全 plan_type:当 id_token 缺少 plan_type(如 Mobile RT),
自动调用 accounts/check 端点获取订阅类型
2. orgID 精确匹配账号:从 JWT 提取 poid 匹配正确账号,避免 Go map
遍历顺序随机导致 plan_type 不稳定
3. RT 刷新时设置隐私:调用 disableOpenAITraining 关闭训练数据共享,
结果存入 extra.privacy_mode,后续跳过重复设置
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:50:03 +08:00
Ethan0x0000
f10e56be7e
refactor(test): improve type assertions in ops endpoint context tests
2026-03-24 09:52:56 +08:00
Ethan0x0000
68f151f5c0
feat(apicompat): add Responses↔Anthropic bidirectional format conversion
...
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 URI↔base64, 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
2026-03-23 16:24:09 +08:00
mutuyihao
4feacf2213
fix(apicompat): support array content for system and tool messages
2026-03-21 15:34:28 +08:00
Wesley Liddick
a225a241d7
Merge pull request #1162 from remxcode/main
...
feat(openai): 增加 gpt-5.4-mini/nano 模型支持与定价配置
2026-03-20 13:57:47 +08:00
alfadb
8afa8c1091
fix(apicompat): 修正 Anthropic→OpenAI 推理级别映射
...
旧映射错误地将所有级别上移一档(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
2026-03-20 12:01:02 +08:00
erio
528ff5d28c
fix(antigravity): fast-fail on proxy unavailable, temp-unschedule account
...
## 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
2026-03-19 23:48:37 +08:00
Rose Ding
e443a6a1ea
fix: 移除 staticcheck S1005 警告的多余 blank identifier
...
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:14:29 +08:00
Rose Ding
963494ec6f
fix: Anthropic tool schema 转 Responses API 时补充缺失的 properties 字段
...
当 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: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:08:20 +08:00
Remx
42d73118fd
feat(openai): 增加 gpt-5.4-mini/nano 模型支持与定价配置
...
- 接入 gpt-5.4-mini/nano 模型识别与规范化,补充默认模型列表
- 增加 gpt-5.4-mini/nano 输入/缓存命中/输出价格与计费兜底逻辑
- 同步前端模型白名单与 OpenCode 配置
- 补充 service tier(priority/flex) 计费回归测试
2026-03-19 19:03:13 +08:00
shaw
a6764e82f2
修复 OAuth/SetupToken 转发请求体重排并增加调试开关
2026-03-19 16:56:18 +08:00
Ethan0x0000
cfaac12af1
Merge upstream/main into pr/upstream-model-tracking
...
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent )
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-18 14:16:50 +08:00
QTom
961c30e7c0
feat(admin): 分组管理列表新增用量列与账号数分类
...
分组管理列表增强:
1. 今日/累计用量列:
- 新增独立端点 GET /admin/groups/usage-summary
- 一次查询返回所有分组的今日费用和累计费用(actual_cost)
- 前端异步加载后合并显示在分组列表中
2. 账号数区分可用/限流/总量:
- 将账号数列从单一总量改为 badge 内多行展示
- 可用: active + schedulable 的账号数(绿色)
- 限流: rate_limit/overload/temp_unschedulable 的账号数(橙色,无限流时隐藏)
- 总量: 全部关联账号数
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:06:35 +08:00
Ethan0x0000
eeff451bc5
test(backend): add tests for upstream model tracking and model source filtering
...
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.
2026-03-17 19:26:30 +08:00
Ethan0x0000
7134266acf
feat(dashboard): add model source dimension to stats queries
...
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.
2026-03-17 19:25:52 +08:00
Wesley Liddick
6cf77040e7
Merge pull request #1075 from touwaeriol/feat/dashboard-user-breakdown
...
feat(dashboard): add per-user drill-down for distribution charts
2026-03-17 09:25:43 +08:00