{"record":{"id":"a3104cce8c37df03","repo":"BerriAI/litellm","slug":"api-key-must-be-provided-for-vantage-destination","errorCode":null,"errorMessage":"api_key must be provided for Vantage destination (set VANTAGE_API_KEY env var or pass in destination_config)","messagePattern":"api_key must be provided for Vantage destination \\(set VANTAGE_API_KEY env var or pass in destination_config\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/vantage_destination.py","lineNumber":103,"sourceCode":"        writer.writerow([row[i] for i in keep_indices])\n\n    return output.getvalue().encode(\"utf-8\")\n\n\nclass FocusVantageDestination(FocusDestination):\n    \"\"\"Upload FOCUS CSV exports to the Vantage cost-import API.\"\"\"\n\n    def __init__(\n        self,\n        *,\n        prefix: str,\n        config: dict[str, Any] | None = None,\n    ) -> None:\n        config = config or {}\n        api_key: Final = config.get(\"api_key\")\n        integration_token: Final = config.get(\"integration_token\")\n        if not api_key:\n            raise ValueError(\n                \"api_key must be provided for Vantage destination \"\n                \"(set VANTAGE_API_KEY env var or pass in destination_config)\"\n            )\n        if not integration_token:\n            raise ValueError(\n                \"integration_token must be provided for Vantage destination \"\n                \"(set VANTAGE_INTEGRATION_TOKEN env var or pass in destination_config)\"\n            )\n        self.api_key = api_key\n        self.integration_token = integration_token\n        self.base_url = config.get(\"base_url\", \"https://api.vantage.sh\")\n        self.prefix = prefix\n\n    async def deliver(\n        self,\n        *,\n        content: bytes,\n        time_window: FocusTimeWindow,","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/focus/destinations/vantage_destination.py#L85-L121","documentation":"FocusVantageDestination.__init__ raises this ValueError when the config dict for uploading FOCUS CSV exports to the Vantage cost-import API has no api_key. The factory resolves api_key from explicit overrides or the VANTAGE_API_KEY environment variable, so hitting this means neither source produced a value. The api_key authenticates calls to https://api.vantage.sh.","triggerScenarios":"Configuring destination_type='vantage' for FOCUS exports with VANTAGE_API_KEY unset and no api_key override; running the proxy in a shell/deployment where the env var was never exported; passing an empty-string api_key in destination_config.","commonSituations":"CI or container deployments where secrets are injected via a vault but the variable name doesn't match VANTAGE_API_KEY; rotating keys and briefly having an empty value; copying a config template that only included the integration token.","solutions":["Export VANTAGE_API_KEY in the proxy's environment: export VANTAGE_API_KEY=<your key>.","Pass api_key directly in destination_config overrides: {'api_key': '...', 'integration_token': '...'}. Note integration_token is also required (a separate error is raised if it's missing).","Check for empty-string values — only truthy values pass the check.","Confirm the destination type is spelled 'vantage'; a typo can route to a different factory path."],"exampleFix":"# before (shell)\n# VANTAGE_API_KEY not set, config only has integration_token\n\n# after\nexport VANTAGE_API_KEY=\"vt_...\"\nexport VANTAGE_INTEGRATION_TOKEN=\"it_...\"","handlingStrategy":"validation","validationCode":"import os\n\napi_key = overrides.get('api_key') or os.getenv('VANTAGE_API_KEY')\nif not api_key:\n    raise SystemExit('VANTAGE_API_KEY (or api_key override) is required for Vantage FOCUS exports')","typeGuard":"def has_vantage_api_key(config: dict) -> bool:\n    return bool(config.get('api_key') or os.getenv('VANTAGE_API_KEY'))","tryCatchPattern":null,"preventionTips":["Add both VANTAGE_API_KEY and VANTAGE_INTEGRATION_TOKEN to the same secret-store entry so they deploy together.","Add a preflight check in your deploy script that prints which required env vars are missing.","Never pass empty strings — only truthy values pass."],"tags":["vantage","focus-export","api-key","configuration"],"backgroundTag":"missing-api-key","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}