mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
#14404 BugFix - Add support for Azure AD token-based authorization in image generation request headers definition for Azure
This commit is contained in:
parent
7216983f48
commit
a2793bdb57
1 changed files with 9 additions and 0 deletions
|
|
@ -314,6 +314,15 @@ def image_generation( # noqa: PLR0915
|
|||
"Content-Type": "application/json",
|
||||
"api-key": api_key,
|
||||
}
|
||||
|
||||
if api_key is None and azure_ad_token_provider is not None:
|
||||
azure_ad_token = azure_ad_token_provider()
|
||||
if azure_ad_token:
|
||||
default_headers.pop(
|
||||
"api-key", None
|
||||
)
|
||||
default_headers["Authorization"] = f"Bearer {azure_ad_token}"
|
||||
|
||||
for k, v in default_headers.items():
|
||||
if k not in headers:
|
||||
headers[k] = v
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue