Where
PAI/TOOLS/Inference.ts (same code present across releases, e.g. Releases/v5.0.0/.claude/PAI/TOOLS/Inference.ts, Releases/v4.0.x/.claude/PAI/Tools/Inference.ts, skills/PAI/Tools/Inference.ts).
Bug
inference() spawns a nested claude --print subprocess to force subscription billing instead of API-key billing. To do that, it deletes credentials from the child process's environment:
delete env.ANTHROPIC_API_KEY;
delete env.ANTHROPIC_AUTH_TOKEN;
It does not also clear ANTHROPIC_BASE_URL. If a user has ANTHROPIC_BASE_URL set in their shell environment (a common pattern for routing Claude Code traffic through a local proxy — e.g. LiteLLM — for cost tracking/observability), every nested inference() call — including the mode/tier classifier invoked by PromptProcessing.hook.ts on every prompt, and the Advisor calls in the Algorithm's VERIFY phase — still targets that local proxy, but now with zero valid Anthropic credentials in env (both keys were just stripped). The proxy correctly rejects the request with 401 Unauthorized. The subprocess has no way to succeed, retries, and eventually burns the full timeout (25s for the classifier) before giving up.
Observed impact: with ANTHROPIC_BASE_URL set, the mode classifier fails on every single message, forcing the fail-safe path (SOURCE: fail-safe, defaulting to Algorithm E3) instead of real classification — and the local proxy's logs get flooded with repeated 401s from the retries.
Fix
Scrub ANTHROPIC_BASE_URL alongside the existing two deletes, so nested subscription-billed calls always go straight to Anthropic's real API regardless of what the parent shell has configured for interactive use:
delete env.ANTHROPIC_API_KEY;
delete env.ANTHROPIC_AUTH_TOKEN;
delete env.ANTHROPIC_BASE_URL;
Happy to open a PR with this change (plus the matching one-liner in the corresponding file under LifeOS/install/) if that's preferred over a maintainer applying it directly.
Where
PAI/TOOLS/Inference.ts(same code present across releases, e.g.Releases/v5.0.0/.claude/PAI/TOOLS/Inference.ts,Releases/v4.0.x/.claude/PAI/Tools/Inference.ts,skills/PAI/Tools/Inference.ts).Bug
inference()spawns a nestedclaude --printsubprocess to force subscription billing instead of API-key billing. To do that, it deletes credentials from the child process's environment:It does not also clear
ANTHROPIC_BASE_URL. If a user hasANTHROPIC_BASE_URLset in their shell environment (a common pattern for routing Claude Code traffic through a local proxy — e.g. LiteLLM — for cost tracking/observability), every nestedinference()call — including the mode/tier classifier invoked byPromptProcessing.hook.tson every prompt, and the Advisor calls in the Algorithm's VERIFY phase — still targets that local proxy, but now with zero valid Anthropic credentials in env (both keys were just stripped). The proxy correctly rejects the request with401 Unauthorized. The subprocess has no way to succeed, retries, and eventually burns the full timeout (25s for the classifier) before giving up.Observed impact: with
ANTHROPIC_BASE_URLset, the mode classifier fails on every single message, forcing the fail-safe path (SOURCE: fail-safe, defaulting to Algorithm E3) instead of real classification — and the local proxy's logs get flooded with repeated 401s from the retries.Fix
Scrub
ANTHROPIC_BASE_URLalongside the existing two deletes, so nested subscription-billed calls always go straight to Anthropic's real API regardless of what the parent shell has configured for interactive use:Happy to open a PR with this change (plus the matching one-liner in the corresponding file under
LifeOS/install/) if that's preferred over a maintainer applying it directly.