{"record":{"id":"9b5ed79805c4ec88","repo":"BerriAI/litellm","slug":"azureopenai-client-is-not-an-instance-of-asyncazur","errorCode":null,"errorMessage":"AzureOpenAI client is not an instance of AsyncAzureOpenAI. Make sure you passed an AsyncAzureOpenAI client.","messagePattern":"AzureOpenAI client is not an instance of AsyncAzureOpenAI\\. Make sure you passed an AsyncAzureOpenAI client\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure/files/handler.py","lineNumber":80,"sourceCode":"        client: AzureOpenAI | AsyncAzureOpenAI | OpenAI | AsyncOpenAI | None = None,\n        litellm_params: dict | None = None,\n    ) -> OpenAIFileObject | Coroutine[Any, Any, OpenAIFileObject]:\n        openai_client: AzureOpenAI | AsyncAzureOpenAI | OpenAI | AsyncOpenAI | None = self.get_azure_openai_client(\n            litellm_params=litellm_params or {},\n            api_key=api_key,\n            api_base=api_base,\n            api_version=api_version,\n            client=client,\n            _is_async=_is_async,\n        )\n        if openai_client is None:\n            raise ValueError(\n                \"AzureOpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment.\"\n            )\n\n        if _is_async is True:\n            if not isinstance(openai_client, (AsyncAzureOpenAI, AsyncOpenAI)):\n                raise ValueError(\n                    \"AzureOpenAI client is not an instance of AsyncAzureOpenAI. Make sure you passed an AsyncAzureOpenAI client.\"\n                )\n            return self.acreate_file(create_file_data=create_file_data, openai_client=openai_client)\n        response: Final = cast(AzureOpenAI | OpenAI, openai_client).files.create(\n            **self._prepare_create_file_data(create_file_data)\n        )\n        return OpenAIFileObject(**response.model_dump())\n\n    async def afile_content(\n        self,\n        file_content_request: FileContentRequest,\n        openai_client: AsyncAzureOpenAI | AsyncOpenAI,\n    ) -> HttpxBinaryResponseContent:\n        response: Final = await openai_client.files.content(**file_content_request)\n        return HttpxBinaryResponseContent(response=response.response)\n\n    def file_content(\n        self,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure/files/handler.py#L62-L98","documentation":"Error \"AzureOpenAI client is not an instance of AsyncAzureOpenAI. Make sure you passed an AsyncAzureOpenAI client.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure/files/handler.py:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an AsyncAzureOpenAI client instance."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}