From 6e383996e3fa6172fe14f937d75f29480b00b5ad Mon Sep 17 00:00:00 2001 From: Rene Fichtmueller Date: Mon, 6 Apr 2026 04:07:21 +0200 Subject: [PATCH] fix(llm): checkHealth uses key presence check, not live API call Live Anthropic API call during health check causes 429 when the pipeline is actively running, blocking all subsequent regenerate requests. --- packages/api/src/llm/client.ts | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/api/src/llm/client.ts b/packages/api/src/llm/client.ts index a95c009..7f064eb 100644 --- a/packages/api/src/llm/client.ts +++ b/packages/api/src/llm/client.ts @@ -282,26 +282,8 @@ export async function chat( /** Check if configured LLM provider is available */ export async function checkHealth(): Promise<{ ok: boolean; model: string; provider: string; error?: string }> { if (BLOG_LLM_PROVIDER === "anthropic" && ANTHROPIC_API_KEY) { - try { - // Quick validation — just check API key works - const resp = await fetch("https://api.anthropic.com/v1/messages", { - method: "POST", - headers: { - "Content-Type": "application/json", - "x-api-key": ANTHROPIC_API_KEY, - "anthropic-version": "2023-06-01", - }, - body: JSON.stringify({ - model: ANTHROPIC_MODEL, - max_tokens: 5, - messages: [{ role: "user", content: "hi" }], - }), - signal: AbortSignal.timeout(10000), - }); - return { ok: resp.ok, model: ANTHROPIC_MODEL, provider: "anthropic" }; - } catch (err) { - return { ok: false, model: ANTHROPIC_MODEL, provider: "anthropic", error: (err as Error).message }; - } + // Key presence check only — live API call causes 429 when pipeline is running + return { ok: true, model: ANTHROPIC_MODEL, provider: "anthropic" }; } try {