Skip to content

Commit 079986d

Browse files
authored
Merge branch 'main' into main
2 parents a817a76 + 02298cb commit 079986d

5 files changed

Lines changed: 456 additions & 15 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
> Which Claude do you like? The open source one is the best.
1212
13-
牢 A (Anthropic) 官方 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI 工具的源码反编译/逆向还原项目。目标是将 Claude Code 大部分功能及工程化能力复现 (问就是老佛爷已经付过钱了)。虽然很难绷, 但是它叫做 CCB(踩踩背)... 而且, 我们实现了企业版或者需要登陆 Claude 账号才能使用的特性, 实现技术普惠
13+
牢 A (Anthropic) 官方 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 完整复原的工程化项目。虽然很难绷, 但是它叫做 CCB(踩踩背)... 而且, 我们实现了企业版或者需要登陆 Claude 账号才能使用的特性, 并在此基础上扩展了更多好玩的特性。
1414

15-
> 我们将会在五一期间进行整个代码仓库的 lint 规范化, 这个期间提交的 PR 可能会有非常多的冲突, 所以大的功能请尽量在这之前提交哈
16-
17-
[文档在这里, 支持投稿 PR](https://ccb.agent-aura.top/) | [留影文档在这里](./Friends.md) | [Discord 群组](https://discord.gg/uApuzJWGKX)
15+
[Peri Code](https://github.com/KonghaYao/peri):Claude Code 兼容的 Rust Agent,多年大模型经验匠心制作,国内大模型(DeepSeek/GLM)精调,CPU/内存极致优化,在开发版/树莓派上也能跑 CC 一样的体验。
1816

17+
[文档在这里](https://ccb.agent-aura.top/) | [留影文档在这里](./Friends.md) | [Discord 群组,群主在线答疑](https://discord.gg/uApuzJWGKX)
1918

2019
| 特性 | 说明 | 文档 |
2120
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
@@ -158,9 +157,13 @@ bun run build
158157
- **Ollama 深度集成**: 可直接在 CLI 中查看已安装模型,或输入模型名(如 `llama3.1`)一键拉取(Pull)。支持模型列表交互切换和硬件状态自动检测。
159158
- 自动检测本地运行状态和默认端口。
160159

161-
#### /login 字段说明 (云端模式):
162-
163-
> ℹ️ 支持所有 Anthropic API 兼容服务(如 OpenRouter、AWS Bedrock 代理等),只要接口兼容 Messages API 即可。
160+
| 📌 字段 | 📝 说明 | 💡 示例 |
161+
| ------------ | ------------- | ---------------------------- |
162+
| Base URL | API 服务地址 | `https://api.example.com/v1` |
163+
| API Key | 认证密钥 | `sk-xxx` |
164+
| Haiku Model | 快速模型 ID | `claude-haiku-4-5-20251001` |
165+
| Sonnet Model | 均衡模型 ID | `claude-sonnet-4-6` |
166+
| Opus Model | 高性能模型 ID | `claude-opus-4-6` |
164167

165168
### 🩺 系统诊断 /doctor
166169

contributors.svg

Lines changed: 2 additions & 2 deletions
Loading

src/utils/apiPreconnect.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,18 @@
2525

2626
import { getOauthConfig } from '../constants/oauth.js'
2727
import { isEnvTruthy } from './envUtils.js'
28+
import { isEssentialTrafficOnly } from './privacyLevel.js'
2829

2930
let fired = false
3031

3132
export function preconnectAnthropicApi(): void {
3233
if (fired) return
3334
fired = true
3435

36+
// Also skip when non-essential traffic is disabled via
37+
// CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC / DISABLE_TELEMETRY / proxy env.
38+
if (isEssentialTrafficOnly()) return
39+
3540
// Skip if using a cloud provider — different endpoint + auth
3641
if (
3742
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||

src/utils/model/model.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@ export function getBestModel(): ModelName {
120120
return getDefaultOpusModel()
121121
}
122122

123+
/**
124+
* Resolve the provider's primary model from its env var (e.g. OPENAI_MODEL).
125+
* Returns undefined for providers that don't have a primary-model env var
126+
* (Bedrock, Vertex, Foundry, firstParty).
127+
*/
128+
function getProviderPrimaryModel(): ModelName | undefined {
129+
const provider = getAPIProvider()
130+
if (provider === 'openai') return process.env.OPENAI_MODEL
131+
if (provider === 'gemini') return process.env.GEMINI_MODEL
132+
if (provider === 'grok') return process.env.GROK_MODEL
133+
return undefined
134+
}
135+
123136
// @[MODEL LAUNCH]: Update the default Opus model (3P providers may lag so keep defaults unchanged).
124137
export function getDefaultOpusModel(): ModelName {
125138
const provider = getAPIProvider()
@@ -138,10 +151,12 @@ export function getDefaultOpusModel(): ModelName {
138151
if (process.env.ANTHROPIC_DEFAULT_OPUS_MODEL) {
139152
return process.env.ANTHROPIC_DEFAULT_OPUS_MODEL
140153
}
141-
// 3P providers (Bedrock, Vertex, Foundry) all publish Opus 4.7 in sync
142-
// with firstParty as of 2026-04-17 (AWS Bedrock, Google Vertex AI, and
143-
// Microsoft Foundry announcements and model catalogs all confirm). The
144-
// branch is kept as a structural hook in case a future launch lags on 3P.
154+
// 3P providers: if user set a primary model (e.g. OPENAI_MODEL=glm-5.1),
155+
// fall back to it instead of a hardcoded Anthropic model. This prevents
156+
// sideQuery / background tasks from sending requests to Anthropic's API
157+
// when the user configured a third-party provider.
158+
const primaryModel = getProviderPrimaryModel()
159+
if (primaryModel) return primaryModel
145160
if (provider !== 'firstParty') {
146161
return getModelStrings().opus47
147162
}
@@ -166,7 +181,11 @@ export function getDefaultSonnetModel(): ModelName {
166181
if (process.env.ANTHROPIC_DEFAULT_SONNET_MODEL) {
167182
return process.env.ANTHROPIC_DEFAULT_SONNET_MODEL
168183
}
169-
// Default to Sonnet 4.5 for 3P since they may not have 4.6 yet
184+
// 3P providers: fall back to user's primary model instead of a hardcoded
185+
// Anthropic model name. Prevents background API calls from being routed to
186+
// Anthropic when the user configured a third-party endpoint.
187+
const primaryModel = getProviderPrimaryModel()
188+
if (primaryModel) return primaryModel
170189
if (provider !== 'firstParty') {
171190
return getModelStrings().sonnet45
172191
}
@@ -191,6 +210,10 @@ export function getDefaultHaikuModel(): ModelName {
191210
if (process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL) {
192211
return process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL
193212
}
213+
// 3P providers: fall back to user's primary model instead of a hardcoded
214+
// Anthropic model name.
215+
const primaryModel = getProviderPrimaryModel()
216+
if (primaryModel) return primaryModel
194217

195218
// Haiku 4.5 is available on all platforms (first-party, Foundry, Bedrock, Vertex)
196219
return getModelStrings().haiku45

0 commit comments

Comments
 (0)