fix: skip Anthropic preconnect for third-party providers (#309)

This commit is contained in:
KRATOS
2026-04-04 14:51:18 +05:30
committed by GitHub
parent b4725c19e0
commit 08be5181ab
2 changed files with 75 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
import { getOauthConfig } from '../constants/oauth.js'
import { isEnvTruthy } from './envUtils.js'
import { getAPIProvider } from './model/providers.js'
let fired = false
@@ -32,6 +33,11 @@ export function preconnectAnthropicApi(): void {
if (fired) return
fired = true
// Third-party providers should not warm a connection to Anthropic.
if (getAPIProvider() !== 'firstParty') {
return
}
// Skip if using a cloud provider — different endpoint + auth
if (
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||