BerriAI/litellm · error · ValueError

VANTAGE_API_KEY must be provided for Vantage exports

Error message

VANTAGE_API_KEY must be provided for Vantage exports

What it means

For provider="vantage", the factory resolves api_key from overrides or the VANTAGE_API_KEY env var. The Vantage API key is mandatory for authentication against api.vantage.sh, so a missing key raises ValueError before any destination object is constructed.

Source

Thrown at litellm/integrations/focus/destinations/factory.py:63

            resolved = {
                "bucket_name": overrides.get("bucket_name") or os.getenv("FOCUS_S3_BUCKET_NAME"),
                "region_name": overrides.get("region_name") or os.getenv("FOCUS_S3_REGION_NAME"),
                "endpoint_url": overrides.get("endpoint_url") or os.getenv("FOCUS_S3_ENDPOINT_URL"),
                "aws_access_key_id": overrides.get("aws_access_key_id") or os.getenv("FOCUS_S3_ACCESS_KEY"),
                "aws_secret_access_key": overrides.get("aws_secret_access_key") or os.getenv("FOCUS_S3_SECRET_KEY"),
                "aws_session_token": overrides.get("aws_session_token") or os.getenv("FOCUS_S3_SESSION_TOKEN"),
            }
            if not resolved.get("bucket_name"):
                raise ValueError("FOCUS_S3_BUCKET_NAME must be provided for S3 exports")
            return {k: v for k, v in resolved.items() if v is not None}
        if provider == "vantage":
            resolved = {
                "api_key": overrides.get("api_key") or os.getenv("VANTAGE_API_KEY"),
                "integration_token": overrides.get("integration_token") or os.getenv("VANTAGE_INTEGRATION_TOKEN"),
                "base_url": overrides.get("base_url") or os.getenv("VANTAGE_BASE_URL", "https://api.vantage.sh"),
            }
            if not resolved.get("api_key"):
                raise ValueError("VANTAGE_API_KEY must be provided for Vantage exports")
            if not resolved.get("integration_token"):
                raise ValueError("VANTAGE_INTEGRATION_TOKEN must be provided for Vantage exports")
            return {k: v for k, v in resolved.items() if v is not None}
        if provider == "gcs":
            resolved = {
                "bucket_name": overrides.get("bucket_name") or os.getenv("FOCUS_GCS_BUCKET_NAME"),
                "service_account_json": overrides.get("service_account_json")
                or os.getenv("FOCUS_GCS_PATH_SERVICE_ACCOUNT"),
            }
            if not resolved.get("bucket_name"):
                raise ValueError("FOCUS_GCS_BUCKET_NAME must be provided for GCS exports")
            return {k: v for k, v in resolved.items() if v is not None}
        if provider == "mavvrik":
            resolved = {
                "api_key": overrides.get("api_key") or os.getenv("MAVVRIK_API_KEY"),
                "api_endpoint": overrides.get("api_endpoint") or os.getenv("MAVVRIK_API_ENDPOINT"),
                "connection_id": overrides.get("connection_id") or os.getenv("MAVVRIK_CONNECTION_ID"),
            }

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set the env var: export VANTAGE_API_KEY=<your-key> from the Vantage console.
  2. Or pass api_key directly in the destination config overrides.
  3. If both VANTAGE_API_KEY and VANTAGE_INTEGRATION_TOKEN are needed, set both at once to avoid hitting the next validation error.
  4. Verify the value is non-empty (not just present) — empty strings are rejected.

Example fix

# before
config = focus_destination_config(provider="vantage", overrides={"integration_token": tok})

# after
config = focus_destination_config(
    provider="vantage",
    overrides={"api_key": os.environ["VANTAGE_API_KEY"], "integration_token": tok},
)
Defensive patterns

Strategy: validation

Validate before calling

import os

if not (overrides.get("api_key") or os.getenv("VANTAGE_API_KEY")):
    raise SystemExit("VANTAGE_API_KEY missing: set it before enabling the vantage Focus export")

Try / catch

try:
    cfg = focus_destination_config(provider="vantage", overrides=overrides)
except ValueError as e:
    if "VANTAGE_API_KEY" in str(e):
        fetch_and_store_vantage_credentials()
    raise

Prevention

When it happens

Trigger: Building a Focus export destination with provider="vantage" while overrides has no api_key and VANTAGE_API_KEY is unset/empty in the environment.

Common situations: The Vantage API key secret was not injected into the pod/container; the key was stored under a differently named variable (e.g. VANTAGE_KEY); CI runs without the vantage credentials; empty-string value from a templating system ({{ secrets.X | default('') }}) which fails the falsy check.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/cb1b314ca4ab959b. Report an issue: GitHub.