BerriAI/litellm · error · ValueError
api_key must be provided for Vantage destination (set VANTAG
Error message
api_key must be provided for Vantage destination (set VANTAGE_API_KEY env var or pass in destination_config)
What it means
FocusVantageDestination.__init__ raises ValueError when no api_key is present in the destination config. The Vantage cost-import API requires an API key for every request; the error message names the two supported sources — the VANTAGE_API_KEY env var or destination_config['api_key'].
Source
Thrown at litellm/integrations/focus/destinations/vantage_destination.py:103
writer.writerow([row[i] for i in keep_indices])
return output.getvalue().encode("utf-8")
class FocusVantageDestination(FocusDestination):
"""Upload FOCUS CSV exports to the Vantage cost-import API."""
def __init__(
self,
*,
prefix: str,
config: dict[str, Any] | None = None,
) -> None:
config = config or {}
api_key: Final = config.get("api_key")
integration_token: Final = config.get("integration_token")
if not api_key:
raise ValueError(
"api_key must be provided for Vantage destination "
"(set VANTAGE_API_KEY env var or pass in destination_config)"
)
if not integration_token:
raise ValueError(
"integration_token must be provided for Vantage destination "
"(set VANTAGE_INTEGRATION_TOKEN env var or pass in destination_config)"
)
self.api_key = api_key
self.integration_token = integration_token
self.base_url = config.get("base_url", "https://api.vantage.sh")
self.prefix = prefix
async def deliver(
self,
*,
content: bytes,
time_window: FocusTimeWindow,View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set the env var: export VANTAGE_API_KEY=... (or the equivalent in your deployment secret).
- Or pass it explicitly: config={'api_key': '...', 'integration_token': '...'}.
- Verify with a print of os.getenv('VANTAGE_API_KEY') in the same process that builds the destination.
Example fix
# before
FocusVantageDestination(prefix="focus", config={"integration_token": "tok"})
# after
FocusVantageDestination(
prefix="focus",
config={"api_key": "vt_...", "integration_token": "vti_..."},
) Defensive patterns
Strategy: validation
Validate before calling
api_key = dest_config.get("api_key") or os.getenv("VANTAGE_API_KEY")
if not api_key:
raise ValueError("Set VANTAGE_API_KEY or destination_config['api_key'] before creating the Vantage destination") Prevention
- Check required env vars (VANTAGE_API_KEY, VANTAGE_INTEGRATION_TOKEN) in a startup preflight.
- Store Vantage credentials in a secret manager; fail deployment when missing rather than at first export.
- Unit-test destination construction with a fixture config containing both keys.
When it happens
Trigger: Constructing the Vantage destination with config lacking 'api_key' while VANTAGE_API_KEY is not set in the environment (the env fallback happens upstream when the config is assembled).
Common situations: Forgetting to export VANTAGE_API_KEY in the proxy pod/container; typos like VANTAGE_KEY; rotating keys and leaving the old env unset; multi-env deployments where only one environment has the var.
Related errors
- integration_token must be provided for Vantage destination (
- DD_API_KEY is not set, set 'DD_API_KEY=<>
- DD_SITE is not set in .env, set 'DD_SITE=<>
- DD_API_KEY is not set, set 'DD_API_KEY=<>'
- DD_SITE is not set, set 'DD_SITE=<>', example sit = `us5.dat
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/a3104cce8c37df03.
Report an issue: GitHub.