{"record":{"id":"e9391d3bc4fc5e4c","repo":"BerriAI/litellm","slug":"api-key-is-required-e9391d","errorCode":null,"errorMessage":"api_key is required","messagePattern":"api_key is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/vector_stores/transformation.py","lineNumber":71,"sourceCode":"        ``/analyze`` inside the batch-write path); writes are classified before\n        reads, so such a path demands the write grant rather than being\n        shadowed into a read.\n        \"\"\"\n        return {\n            \"read\": [\n                (\"GET\", \"/indexes/\"),\n                (\"POST\", \"/docs/search\"),\n                (\"POST\", \"/docs/suggest\"),\n                (\"POST\", \"/docs/autocomplete\"),\n                (\"POST\", \"/analyze\"),\n            ],\n            \"write\": [(\"POST\", \"/docs/index\")],\n        }\n\n    def get_auth_credentials(self, litellm_params: dict) -> BaseVectorStoreAuthCredentials:\n        api_key: Final = litellm_params.get(\"api_key\")\n        if api_key is None:\n            raise ValueError(\"api_key is required\")\n\n        return {\n            \"headers\": {\n                \"api-key\": api_key,\n            }\n        }\n\n    def validate_environment(self, headers: dict, litellm_params: GenericLiteLLMParams | None) -> dict:\n        basic_headers: Final = self._base_validate_azure_environment(headers, litellm_params)\n        basic_headers.update({\"Content-Type\": \"application/json\"})\n        return basic_headers\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/vector_stores/transformation.py#L53-L89","documentation":"Azure AI Search vector-store operations authenticate with an api-key header. get_auth_credentials reads litellm_params['api_key'] and raises immediately if absent — there is no env-var fallback in this path, unlike the chat/rerank configs.","triggerScenarios":"Creating or using an azure_ai_search vector store (e.g. litellm.vector_store.create / search with provider azure_ai_search) where the vector store's litellm_params dict has no api_key entry.","commonSituations":"Configuring the vector store in proxy config.yaml with only azure_search_service_name set; migrating from a provider that pulled keys from env automatically; passing the key under a different name like azure_search_api_key.","solutions":["Add api_key to the vector store's litellm_params: litellm_params={'api_key': os.environ['AZURE_SEARCH_API_KEY'], 'azure_search_service_name': 'my-service'}","In proxy config, set vector_stores[i].litellm_params.api_key (supports os.environ/ references)","Verify with a quick print that the litellm_params dict actually contains a non-None api_key before the call"],"exampleFix":"# before\nvs_config = {'provider': 'azure_ai_search', 'litellm_params': {'azure_search_service_name': 'my-service'}}\n\n# after\nvs_config = {'provider': 'azure_ai_search', 'litellm_params': {'api_key': os.environ['AZURE_SEARCH_ADMIN_KEY'], 'azure_search_service_name': 'my-service'}}","handlingStrategy":"validation","validationCode":"if not litellm_params.get('api_key'):\n    raise ValueError('azure_ai_search vector store requires litellm_params[\"api_key\"]')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the full vector-store litellm_params dict in a config-check function at startup","Keep Azure Search admin keys in a secret manager and inject them at config build time"],"tags":["azure","vector-stores","azure-search","authentication"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}