Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

715 B
Raw Blame
/**
 * HouMinXi: one connection's failures must not open the breaker for every
 * account on that provider. A dead proxy still uses the provider key, because
 * it fails every account the same way.
 */
import { resolveProviderId } from "../../src/shared/constants/providers";

export function connectionCircuitBreakerName(provider: string, connectionId: string): string {
  return `${resolveProviderId(provider)}::conn::${connectionId}`;
}

export function failureCircuitBreakerName(
  provider: string,
  connectionId?: string | null,
  isNetworkError?: boolean
): string {
  if (connectionId && !isNetworkError) return connectionCircuitBreakerName(provider, connectionId);
  return resolveProviderId(provider);
}