diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index 900ebc6ad9..66d6142f94 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -595,7 +595,7 @@ async def get_models(request: Request, url_idx: int | None = None, user=Depends( try: headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) - if api_config.get('azure', False): + if api_config.get('azure') or api_config.get('provider') == 'azure': models = { 'data': api_config.get('model_ids', []) or [], 'object': 'list', @@ -681,7 +681,7 @@ async def verify_connection( try: headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) - if api_config.get('azure', False): + if api_config.get('azure') or api_config.get('provider') == 'azure': # Only set api-key header if not using Azure Entra ID authentication auth_type = api_config.get('auth_type', 'bearer') if auth_type not in ('azure_ad', 'microsoft_entra_id'): @@ -1151,7 +1151,7 @@ async def generate_chat_completion( is_responses = api_config.get('api_type') == 'responses' - if api_config.get('azure', False): + if api_config.get('azure') or api_config.get('provider') == 'azure': # Only set api-key header if not using Azure Entra ID authentication auth_type = api_config.get('auth_type', 'bearer') if auth_type not in ('azure_ad', 'microsoft_entra_id'): @@ -1408,7 +1408,7 @@ async def responses( try: headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) - if api_config.get('azure', False): + if api_config.get('azure') or api_config.get('provider') == 'azure': auth_type = api_config.get('auth_type', 'bearer') if auth_type not in ('azure_ad', 'microsoft_entra_id'): headers['api-key'] = key @@ -1519,7 +1519,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)): try: headers, cookies = await get_headers_and_cookies(request, url, key, api_config, user=user) - if api_config.get('azure', False): + if api_config.get('azure') or api_config.get('provider') == 'azure': # Only set api-key header if not using Azure Entra ID authentication auth_type = api_config.get('auth_type', 'bearer') if auth_type not in ('azure_ad', 'microsoft_entra_id'): diff --git a/src/lib/components/AddConnectionModal.svelte b/src/lib/components/AddConnectionModal.svelte index 1ece26b404..05a0ca50a5 100644 --- a/src/lib/components/AddConnectionModal.svelte +++ b/src/lib/components/AddConnectionModal.svelte @@ -101,7 +101,8 @@ key, config: { auth_type, - ...(provider ? { provider } : azure ? { azure: true } : {}), + ...(provider ? { provider } : {}), + ...(azure ? { azure: true } : {}), api_version: apiVersion, ...(_headers ? { headers: _headers } : {}) } @@ -189,7 +190,8 @@ connection_type: connectionType, auth_type, headers: headers ? JSON.parse(headers) : undefined, - ...(provider ? { provider } : !ollama && azure ? { azure: true } : {}), + ...(provider ? { provider } : {}), + ...(!ollama && azure ? { azure: true } : {}), ...(azure ? { api_version: apiVersion } : {}), ...(apiType ? { api_type: apiType } : {}) }