BerriAI/litellm · error · Exception
Invalid Argilla API Key given. _credentials_api_key=None.
Error message
Invalid Argilla API Key given. _credentials_api_key=None.
What it means
ArgillaLogger needs an API key to authenticate against your Argilla server. `get_credentials_from_env` resolves the key from the constructor argument or the ARGILLA_API_KEY environment variable; if both are absent it raises this Exception with the literal `_credentials_api_key=None` so you can tell the key resolution (not the server connection) failed.
Solutions
- Export the key before starting litellm/proxy: `export ARGILLA_API_KEY=your_key` (owner.api_key from your Argilla instance)
- In litellm proxy, inject it via the process environment of the proxy container/pod rather than per-request
- Verify with `python -c "import os; print(os.getenv('ARGILLA_API_KEY'))"` in the exact runtime environment
Example fix
# before litellm.callbacks = ["argilla"] # ARGILLA_API_KEY unset -> Exception # after import os os.environ["ARGILLA_API_KEY"] = "owner.apikey.local.xxx" litellm.callbacks = ["argilla"]
Defensive patterns
Strategy: validation
Validate before calling
import os
if not os.getenv("ARGILLA_API_KEY"):
raise SystemExit("ARGILLA_API_KEY is not set; refusing to enable argilla callback")
litellm.callbacks = ["argilla"] Try / catch
try:
ArgillaLogger()
except Exception as e:
if "Argilla API Key" in str(e):
log.warning("Argilla logging disabled: no API key")
# proceed without argilla rather than crashing serving
else:
raise Prevention
- Declare ARGILLA_API_KEY in docker-compose/k8s env spec alongside other integration secrets
- Add env-var presence checks to a preflight/startup validator for all enabled callbacks
When it happens
Trigger: Enabling `litellm.callbacks = ["argilla"]` without setting ARGILLA_API_KEY anywhere (constructor arg not passed, since the callback loads by name). Raised during logger init, before any HTTP request to Argilla is made.
Common situations: Local Argilla testing where the developer assumed the default API key was picked up automatically; forgetting the env var in docker-compose/k8s deployment of the proxy; env var set in a different shell than the one running litellm; secret name typo (e.g. ARGILLA_KEY).
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- API key is required
- api_key is required for Volcengine authentication
- Authentication failed. Check your BitBucket access token…
- Cannot migrate covered tables: no salt key / master key is…
- Could not resolve credentials - either dynamically or from…
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/8eb4c51e32aebc77.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/argilla.py:90
def validate_argilla_transformation_object(self, argilla_transformation_object: dict[str, Any]):
if not isinstance(argilla_transformation_object, dict):
raise Exception("'argilla_transformation_object' must be a dictionary, to log your payload to Argilla.")
for v in argilla_transformation_object.values():
if v not in SUPPORTED_PAYLOAD_FIELDS:
raise Exception(
f"All values in argilla_transformation_object must be a key in SUPPORTED_PAYLOAD_FIELDS, {v} is not a valid key."
)
def get_credentials_from_env(
self,
argilla_api_key: str | None,
argilla_dataset_name: str | None,
argilla_base_url: str | None,
) -> ArgillaCredentialsObject:
_credentials_api_key: Final = argilla_api_key or os.getenv("ARGILLA_API_KEY")
if _credentials_api_key is None:
raise Exception("Invalid Argilla API Key given. _credentials_api_key=None.")
_credentials_base_url: Final = argilla_base_url or os.getenv("ARGILLA_BASE_URL") or "http://localhost:6900/"
if _credentials_base_url is None:
raise Exception("Invalid Argilla Base URL given. _credentials_base_url=None.")
_credentials_dataset_name = argilla_dataset_name or os.getenv("ARGILLA_DATASET_NAME") or "litellm-completion"
if _credentials_dataset_name is None:
raise Exception("Invalid Argilla Dataset give. Value=None.")
else:
dataset_response: Final = litellm.module_level_client.get(
url=f"{_credentials_base_url}/api/v1/me/datasets?name={_credentials_dataset_name}",
headers={"X-Argilla-Api-Key": _credentials_api_key},
)
json_response: Final = dataset_response.json()
if (
"items" in json_response
and isinstance(json_response["items"], list)
and len(json_response["items"]) > 0View on GitHub (pinned to 77b7c6c40c)