v0.1.0
ccwrap owns the network boundary between Claude Code and the upstream API — route Claude Code through any Anthropic-compatible gateway while it still believes it's on the first-party path, swap models per provider, and inspect every request and response.
Highlights
- First-party-looking routing — point Claude Code at any Anthropic-compatible gateway without it silently downgrading the request body.
- Model aliases — keep Claude on logical model IDs; rewrite to the provider's model upstream and normalize responses back.
- Third-party cache fix — strip the per-request
cchattestation block for non-claude-*models so prefix/KV caching isn't defeated. - Pinned egress proxy — send the upstream (and telemetry) through a chosen http/socks5 egress.
- Live hot-swap — switch profile or edit model aliases mid-session, no relaunch.
- Native TLS fingerprint — replay Claude Code's own ClientHello upstream (utls) instead of leaking a Go fingerprint.
- Request inspector — read every
/v1/messagesverbatim (system prompts, tool schemas, subagent orchestration) in a local browser UI.
Install
npm install -g @hoper-j/ccwrap
# or: curl -fsSL https://raw.githubusercontent.com/Hoper-J/ccwrap/main/install.sh | sh
# or: go install github.com/Hoper-J/ccwrap/cmd/ccwrap@latestFull docs: https://github.com/Hoper-J/ccwrap
ccwrap 接管 Claude Code 与上游 API 之间的网络边界 —— 把 Claude Code 路由到任意 Anthropic 兼容网关,同时让它以为自己还在第一方路径上,按 provider 替换模型,并检查每一条请求与响应。
特性
- 第一方伪装路由 —— 把 Claude Code 指到任意 Anthropic 兼容网关,不会因第一方判定没过就静默降级请求体。
- 模型别名 —— 本地只暴露 Claude model id,上游改写成 provider 的模型、响应再归一化回来。
- 修复第三方缓存 —— 为非
claude-*模型去掉每次都变的cch计费 block,避免破坏上游 prefix/KV 缓存。 - 固定出口代理 —— 让上游(及遥测)走指定的 http/socks5 网络出口。
- 配置热切换 —— 会话中途切 profile / 改别名,立即生效、无需重启。
- 保持原生 TLS 指纹 —— 用 utls 把 Claude Code 自己的 ClientHello 原样复刻到上游,而不是漏出 Go 指纹。
- 请求检查器 —— 在本地浏览器里逐字读每条
/v1/messages(system prompt、tool schema、派生 subagent 的编排提示词)。
安装
npm install -g @hoper-j/ccwrap
# 或:curl -fsSL https://raw.githubusercontent.com/Hoper-J/ccwrap/main/install.sh | sh
# 或:go install github.com/Hoper-J/ccwrap/cmd/ccwrap@latest