Luis Pater
39dc4557c1
Merge pull request #2412 from sususu98/feat/signature-cache-toggle
...
feat: configurable signature cache toggle for Antigravity/Claude thinking blocks
2026-04-09 21:54:47 +08:00
ZTXBOSS666
30e94b6792
fix(antigravity): refine 429 handling and credits fallback
...
Includes: restore SDK docs under docs/; update antigravity executor credits tests; gofmt.
2026-04-09 21:48:32 +08:00
sususu98
cf249586a9
feat(antigravity): configurable signature cache with bypass-mode validation
...
Antigravity 的 Claude thinking signature 处理新增 cache/bypass 双模式,
并为 bypass 模式实现按 SIGNATURE-CHANNEL-SPEC.md 的签名校验。
新增 antigravity-signature-cache-enabled 配置项(默认 true):
- cache mode(true):使用服务端缓存的签名,行为与原有逻辑完全一致
- bypass mode(false):直接使用客户端提供的签名,经过校验和归一化
支持配置热重载,运行时可切换模式。
校验流程:
1. 剥离历史 cache-mode 的 'modelGroup#' 前缀(如 claude#Exxxx → Exxxx)
2. 首字符必须为 'E'(单层编码)或 'R'(双层编码),否则拒绝
3. R 开头:base64 解码 → 内层必须以 'E' 开头 → 继续单层校验
4. E 开头:base64 解码 → 首字节必须为 0x12(Claude protobuf 标识)
5. 所有合法签名归一化为 R 形式(双层 base64)发往 Antigravity 后端
非法签名处理策略:
- 非严格模式(默认):translator 静默丢弃无签名的 thinking block
- 严格模式(antigravity-signature-bypass-strict: true):
executor 层在请求发往上游前直接返回 HTTP 400
按 SIGNATURE-CHANNEL-SPEC.md 解析 Claude 签名的完整 protobuf 结构:
- Top-level Field 2(容器)→ Field 1(渠道块)
- 渠道块提取:channel_id (Field 1)、infrastructure (Field 2)、
model_text (Field 6)、field7 (Field 7)
- 计算 routing_class、infrastructure_class、schema_features
- 使用 google.golang.org/protobuf/encoding/protowire 解析
- resolveThinkingSignature 拆分为 resolveCacheModeSignature / resolveBypassModeSignature
- hasResolvedThinkingSignature:mode-aware 签名有效性判断
(cache: len>=50 via HasValidSignature,bypass: non-empty)
- validateAntigravityRequestSignatures:executor 预检,
仅在 bypass + strict 模式下拦截非法签名返回 400
- 响应侧签名缓存逻辑与 cache mode 集成
- Cache mode 行为完全保留:无 '#' 前缀的原生签名静默丢弃
2026-04-09 21:12:40 +08:00
Luis Pater
5e81b65f2f
fix(auth, executor): normalize Qwen base URL, adjust RefreshLead duration, and add tests
2026-04-09 18:07:07 +08:00
Luis Pater
941334da79
fix(auth): handle OAuth model alias in retry logic and refine Qwen quota handling
2026-04-09 03:44:19 +08:00
Luis Pater
d54f816363
fix(executor): update Qwen user agent and enhance header configuration
2026-04-09 01:45:52 +08:00
Luis Pater
12b967118b
Merge pull request #2592 from router-for-me/tests
...
fix(tests): update test cases
2026-04-08 11:57:15 +08:00
hkfires
d390b95b76
fix(tests): update test cases
2026-04-08 08:53:50 +08:00
Luis Pater
d1f6224b70
Merge pull request #2569 from LucasInsight/fix/record-zero-usage
...
fix: record zero usage
2026-04-08 08:13:11 +08:00
Luis Pater
91e7591955
fix(executor): add transient 429 resource exhausted handling with retry logic
2026-04-08 02:48:53 +08:00
Luis Pater
c8b7e2b8d6
fix(executor): ensure empty stream completions use output_item.done as fallback
...
Fixed : #2583
2026-04-07 18:21:12 +08:00
Luis Pater
cad45ffa33
Merge pull request #2578 from LemonZuo/feat_socks5h
...
feat: support socks5h scheme for proxy settings
2026-04-07 09:57:18 +08:00
Lemon
163d68318f
feat: support socks5h scheme for proxy settings
2026-04-07 07:46:11 +08:00
Michael
8b9dbe10f0
fix: record zero usage
2026-04-06 20:19:42 +08:00
Luis Pater
9f5bdfaa31
Merge pull request #2531 from jamestut/openai-vertex-token-usage-fix
...
Fix missing `response.completed.usage` for late-usage OpenAI-compatible streams
2026-04-06 09:30:49 +08:00
Luis Pater
c3f8dc362e
Merge pull request #2491 from mpfo0106/feature/claude-code-safe-alignment-sentinels
...
test(claude): add compatibility sentinels and centralize builtin fallback handling
2026-04-06 09:27:08 +08:00
Luis Pater
c1818f197b
Merge pull request #1940 from Blue-B/fix/claude-interleaved-thinking-amp-gzip-budget
...
fix(claude): enable interleaved-thinking beta, decode AMP error gzip, fix budget 400
2026-04-06 09:08:23 +08:00
Luis Pater
22a1a24cf5
feat(executor): add tests for preserving key order in cache control functions
...
Added comprehensive tests to ensure key order is maintained when modifying payloads in `normalizeCacheControlTTL` and `enforceCacheControlLimit` functions. Removed unused helper functions and refactored implementations for better readability and efficiency.
2026-04-05 17:58:13 +08:00
Luis Pater
c2d4137fb9
feat(executor): enhance Qwen system message handling with strict injection and merging rules
...
Closes : #2537
2026-04-04 21:51:02 +08:00
rensumo
8d5e470e1f
feat: dynamically fetch antigravity UA version from releases API
...
Fetch the latest version from the antigravity auto-updater releases
endpoint and cache it for 6 hours. Falls back to 1.21.9 if the API
is unreachable or returns unexpected data.
2026-04-04 14:52:59 +08:00
James
65e9e892a4
Fix missing response.completed.usage for late-usage OpenAI-compatible streams
2026-04-04 05:58:04 +00:00
rensumo
f3ab8f4bc5
chore: update antigravity UA version to 1.21.9
2026-04-04 07:35:08 +08:00
Luis Pater
754b126944
fix(executor): remove commented-out code in QwenExecutor
2026-04-04 02:14:48 +08:00
Luis Pater
ae37ccffbf
Merge pull request #2520 from Arronlong/main
...
fix:qwen invalid_parameter_error
2026-04-04 02:13:09 +08:00
Luis Pater
42c062bb5b
Merge pull request #2509 from adamhelfgott/fix-claude-thinking-temperature
...
Normalize Claude temperature when thinking is enabled
2026-04-03 23:55:50 +08:00
Arronlong
29dba0399b
Comment out system message check in Qwen executor
...
fix qwen invalid_parameter_error
2026-04-03 23:07:33 +08:00
Adam Helfgott
f63cf6ff7a
Normalize Claude temperature for thinking
2026-04-03 03:45:51 -04:00
Luis Pater
d2419ed49d
feat(executor): ensure default system message in QwenExecutor payload
2026-04-03 11:18:48 +08:00
mpfo0106
9b5ce8c64f
Keep Claude builtin helpers aligned with the shared helper layout
...
The review asked for the builtin tool registry helper to live with the rest
of executor support utilities. This moves the registry code into the helps
package, exports the minimal surface executor needs, and keeps behavior tests
with the executor while leaving registry-focused checks with the helper.
Constraint: Requested layout keeps executor helper utilities centralized under internal/runtime/executor/helps
Rejected: Keep the files in executor and reply with rationale | conflicts with requested package organization
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep executor behavior tests near applyClaudeToolPrefix and keep pure registry tests in helps
Tested: go test ./internal/runtime/executor/helps ./internal/runtime/executor -run 'Claude|Builtin|Tool'; go test ./test/...; go test ./...
Not-tested: End-to-end Claude Code direct-connect/session runtime behavior
2026-04-03 00:13:02 +09:00
Luis Pater
e3eb048c7a
Merge pull request #2489 from Soein/upstream-pr
...
fix: 增强 Claude 反代检测对抗能力
2026-04-02 21:16:58 +08:00
Luis Pater
a59e92435b
Merge pull request #2490 from router-for-me/logs
...
Refactor websocket logging and error handling
2026-04-02 20:47:31 +08:00
mpfo0106
da3a498a28
Keep Claude Code compatibility work low-risk and reviewable
...
This change stops short of broader Claude Code runtime alignment and instead
hardens two safe edges: builtin tool prefix handling and source-informed
sentinel coverage for future drift checks.
Constraint: Must preserve existing default behavior for current users
Rejected: Implement control-plane/session alignment now | too much runtime risk for a first slice
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Treat the new fixtures as compatibility sentinels, not a full Claude Code schema contract
Tested: go test ./test/...; go test ./sdk/translator/...; go test ./internal/runtime/executor -run 'Claude|Builtin|Tool'; go test ./...
Not-tested: End-to-end Claude Code direct-connect/session runtime behavior
2026-04-02 20:35:39 +09:00
pzy
bb44671845
fix: 修复反代检测对抗的 3 个问题
...
- computeFingerprint 使用 rune 索引替代字节索引,修复多字节字符指纹不匹配
- utls Chrome TLS 指纹仅对 Anthropic 官方域名生效,自定义 base_url 走标准 transport
- IPv6 地址使用 net.JoinHostPort 正确拼接端口
2026-04-02 19:12:55 +08:00
Luis Pater
09e480036a
feat(auth): add support for managing custom headers in auth files
...
Closes #2457
2026-04-02 19:11:09 +08:00
pzy
249f969110
fix: Claude API 请求使用 utls Chrome TLS 指纹
...
Claude executor 的 API 请求之前使用 Go 标准库 crypto/tls,JA3 指纹
与真实 Claude Code(Bun/BoringSSL)不匹配,可被 Cloudflare 识别。
- 新增 helps/utls_client.go,封装 utls Chrome 指纹 + HTTP/2 + 代理支持
- Claude executor 的 4 处 NewProxyAwareHTTPClient 替换为 NewUtlsHTTPClient
- 其他 executor(Gemini/Codex/iFlow 等)不受影响,仍用标准 TLS
- 非 HTTPS 请求自动回退到标准 transport
2026-04-02 19:09:56 +08:00
hkfires
4f8acec2d8
refactor(logging): centralize websocket handshake recording
2026-04-02 18:39:32 +08:00
hkfires
34339f61ee
Refactor websocket logging and error handling
...
- Introduced new logging functions for websocket requests, handshakes, errors, and responses in `logging_helpers.go`.
- Updated `CodexWebsocketsExecutor` to utilize the new logging functions for improved clarity and consistency in websocket operations.
- Modified the handling of websocket upgrade rejections to log relevant metadata.
- Changed the request body key to a timeline body key in `openai_responses_websocket.go` to better reflect its purpose.
- Enhanced tests to verify the correct logging of websocket events and responses, including disconnect events and error handling scenarios.
2026-04-02 17:30:51 +08:00
pzy
4045378cb4
fix: 增强 Claude 反代检测对抗能力
...
基于 Claude Code v2.1.88 源码分析,修复多个可被 Anthropic 检测的差距:
- 实现消息指纹算法(SHA256 盐值 + 字符索引),替代随机 buildHash
- billing header cc_version 从设备 profile 动态取版本号,不再硬编码
- billing header cc_entrypoint 从客户端 UA 解析,支持 cli/vscode/local-agent
- billing header 新增 cc_workload 支持(通过 X-CPA-Claude-Workload 头传入)
- 新增 X-Claude-Code-Session-Id 头(每 apiKey 缓存 UUID,TTL=1h)
- 新增 x-client-request-id 头(仅 api.anthropic.com,每请求 UUID)
- 补全 4 个缺失的 beta flags(structured-outputs/fast-mode/redact-thinking/token-efficient-tools)
- OAuth scope 对齐 Claude Code 2.1.88(移除 org:create_api_key,添加 sessions/mcp/file_upload)
- Anthropic-Dangerous-Direct-Browser-Access 仅在 API key 模式发送
- 响应头网关指纹清洗(剥离 litellm/helicone/portkey/cloudflare/kong/braintrust 前缀头)
2026-04-02 15:55:22 +08:00
Luis Pater
4f99bc54f1
test: update codex header expectations
2026-04-02 11:19:37 +08:00
Luis Pater
913f4a9c5f
test: fix executor tests after helpers refactor
2026-04-02 11:12:30 +08:00
Luis Pater
25d1c18a3f
fix: scope experimental cch signing to billing header
2026-04-02 11:03:11 +08:00
Luis Pater
d09dd4d0b2
Merge commit '15c2f274ea690c9a7c9db22f9f454af869db5375' into dev
2026-04-02 10:59:54 +08:00
edlsh
15c2f274ea
fix: preserve cloak config defaults when mode omitted
2026-04-01 13:20:11 -04:00
edlsh
37249339ac
feat: add opt-in experimental Claude cch signing
2026-04-01 13:03:17 -04:00
Luis Pater
105a21548f
fix(codex): centralize session management with global store and add tests for executor session lifecycle
2026-04-01 13:17:10 +08:00
Luis Pater
ca11b236a7
refactor(runtime, openai): simplify header management and remove redundant websocket logging logic
2026-04-01 11:57:31 +08:00
Luis Pater
330e12d3c2
fix(codex): conditionally set Session_id header for Mac OS user agents and clean up redundant logic
2026-04-01 11:11:45 +08:00
Luis Pater
b468ca79c3
Merge branch 'dev' of github.com:router-for-me/CLIProxyAPI into dev
2026-04-01 03:09:03 +08:00
Luis Pater
d2c7e4e96a
refactor(runtime): move executor utilities to helps package and update references
2026-04-01 03:08:20 +08:00
Luis Pater
1c7003ff68
Merge pull request #2452 from Lucaszmv/fix-qwen-cli-v0.13.2
...
fix(qwen): update CLI simulation to v0.13.2 and adjust header casing
2026-04-01 02:44:27 +08:00