BerriAI/litellm · error · XecGuardMissingCredentials
XecGuard API key is required. Set XECGUARD_API_KEY in the en
Error message
XecGuard API key is required. Set XECGUARD_API_KEY in the environment or pass api_key in the guardrail config.
What it means
Error "XecGuard API key is required. Set XECGUARD_API_KEY in the environment or pass api_key in the guardrail config." thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/guardrails/guardrail_hooks/xecguard/xecguard.py:97
class XecGuardMissingCredentials(Exception):
pass
class XecGuardGuardrail(CustomGuardrail):
def __init__(
self,
api_key: str | None = None,
api_base: str | None = None,
xecguard_model: str | None = None,
policy_names: list[str] | None = None,
block_on_error: bool | None = None,
grounding_strictness: str | None = None,
**kwargs: Any,
) -> None:
self.api_key = api_key or os.environ.get("XECGUARD_API_KEY")
if not self.api_key:
raise XecGuardMissingCredentials(
"XecGuard API key is required. "
"Set XECGUARD_API_KEY in the "
"environment or pass api_key in "
"the guardrail config."
)
self.api_base = (api_base or os.environ.get("XECGUARD_API_BASE") or _DEFAULT_API_BASE).rstrip("/")
self.xecguard_model = xecguard_model or _DEFAULT_MODEL
self.policy_names = policy_names
if block_on_error is None:
env: Final = os.environ.get("XECGUARD_BLOCK_ON_ERROR", "true")
self.block_on_error = env.lower() in (
"true",
"1",
"yes",
)View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set the XECGUARD_API_KEY environment variable.
- Or pass api_key in the xecguard guardrail config.
When it happens
Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/xecguard/xecguard.py:97 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/188ebf98069e05bf.
Report an issue: GitHub.