BerriAI/litellm · error · AzureOpenAIError
azure_client is not an instance of AsyncAzureOpenAI
Error message
azure_client is not an instance of AsyncAzureOpenAI
What it means
Error "azure_client is not an instance of AsyncAzureOpenAI" thrown in BerriAI/litellm.
Solutions
- Pass an AsyncAzureOpenAI client instance.
When it happens
Trigger: Thrown at litellm/llms/azure/completion/handler.py:216 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/3448399a2a7e82e6.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/azure/completion/handler.py:216
azure_ad_token: str | None = None,
client=None, # this is the AsyncAzureOpenAI
litellm_params: dict = {},
):
response = None
try:
# init AzureOpenAI Client
# setting Azure client
azure_client: Final = self.get_azure_openai_client(
api_version=api_version,
api_base=api_base,
api_key=api_key,
model=model,
_is_async=True,
client=client,
litellm_params=litellm_params,
)
if not isinstance(azure_client, AsyncAzureOpenAI):
raise AzureOpenAIError(
status_code=500,
message="azure_client is not an instance of AsyncAzureOpenAI",
)
## LOGGING
logging_obj.pre_call(
input=data["prompt"],
api_key=azure_client.api_key,
additional_args={
"headers": {"Authorization": f"Bearer {azure_client.api_key}"},
"api_base": azure_client._base_url._uri_reference,
"acompletion": True,
"complete_input_dict": data,
},
)
raw_response: Final = await azure_client.completions.with_raw_response.create(**data, timeout=timeout)
response = raw_response.parse()
return openai_text_completion_config.convert_to_chat_model_response_object(View on GitHub (pinned to 77b7c6c40c)