{"record":{"id":"80adfd25adf543bc","repo":"BerriAI/litellm","slug":"missing-api-key-for-volcengine-set-ark-api-key-or","errorCode":null,"errorMessage":"Missing API key for Volcengine. Set ARK_API_KEY or VOLCENGINE_API_KEY environment variable or pass api_key parameter.","messagePattern":"Missing API key for Volcengine\\. Set ARK_API_KEY or VOLCENGINE_API_KEY environment variable or pass api_key parameter\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/main.py","lineNumber":6868,"sourceCode":"                model=model,\n                input=transformed_input,\n                custom_llm_provider=custom_llm_provider,\n                api_base=api_base,\n                api_key=api_key,\n                logging_obj=logging,\n                timeout=timeout,\n                model_response=EmbeddingResponse(),\n                optional_params=optional_params,\n                litellm_params={},\n                client=client,\n                aembedding=aembedding,\n            )\n        elif custom_llm_provider == \"volcengine\":\n            volcengine_key: Final = (\n                api_key or litellm.api_key or get_secret_str(\"ARK_API_KEY\") or get_secret_str(\"VOLCENGINE_API_KEY\")\n            )\n            if volcengine_key is None:\n                raise ValueError(\n                    \"Missing API key for Volcengine. Set ARK_API_KEY or VOLCENGINE_API_KEY environment variable or pass api_key parameter.\"\n                )\n            if extra_headers is not None and isinstance(extra_headers, dict):\n                headers = extra_headers\n            else:\n                headers = {}\n            response = base_llm_http_handler.embedding(\n                model=model,\n                input=input,\n                timeout=timeout,\n                custom_llm_provider=custom_llm_provider,\n                logging_obj=logging,\n                api_base=api_base,\n                optional_params=optional_params,\n                litellm_params={},\n                model_response=EmbeddingResponse(),\n                api_key=volcengine_key,\n                client=client,","sourceCodeStart":6850,"sourceCodeEnd":6886,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/main.py#L6850-L6886","documentation":"Volcengine (ByteDance Ark) embeddings authenticate with an API key. litellm checks the api_key kwarg, litellm.api_key, then the ARK_API_KEY and VOLCENGINE_API_KEY environment variables; when none is present it raises before sending any request.","triggerScenarios":"litellm.embedding(model='volcengine/<ep-xxx>', input=[...]) with none of api_key, litellm.api_key, ARK_API_KEY, or VOLCENGINE_API_KEY set.","commonSituations":"New Volcengine/Ark integration; key stored under a different name (e.g. ARK_TOKEN); secrets not injected into the container or .env not loaded.","solutions":["export ARK_API_KEY=<key> (or VOLCENGINE_API_KEY) in the process environment","Or pass api_key=<key> directly to the embedding call","Or assign litellm.api_key once at startup","Verify the env var is visible: python -c \"import os; print(bool(os.environ.get('ARK_API_KEY')))\""],"exampleFix":"# before\nresp = litellm.embedding(model=\"volcengine/ep-20240xxx\", input=[\"hi\"])\n\n# after\nos.environ[\"ARK_API_KEY\"] = \"...\"\nresp = litellm.embedding(model=\"volcengine/ep-20240xxx\", input=[\"hi\"])","handlingStrategy":"validation","validationCode":"import os\n\nvolc_key = os.environ.get(\"ARK_API_KEY\") or os.environ.get(\"VOLCENGINE_API_KEY\")\nif not volc_key:\n    raise SystemExit(\"ARK_API_KEY / VOLCENGINE_API_KEY not set\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.embedding(model=\"volcengine/ep-x\", input=[\"hi\"])\nexcept ValueError as e:\n    if \"Volcengine\" in str(e):\n        raise RuntimeError(\"Volcengine credentials missing\") from e","preventionTips":["Assert required secret env vars at process start, not at first request","Keep provider credential names in one constants module to avoid typos"],"tags":["volcengine","ark","embedding","api-key","litellm"],"backgroundTag":"missing-api-key","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}