Skip to content

Commit a92a385

Browse files
committed
feat: add azure openai service support
1 parent a3bb7df commit a92a385

4 files changed

Lines changed: 583 additions & 117 deletions

File tree

azure-openai-integration.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
sidebar_position: 450
3+
title: "☁️ Azure OpenAI Integration"
4+
---
5+
6+
# Azure OpenAI Integration
7+
8+
Open WebUI supports integration with Azure OpenAI Services, allowing you to connect to your Azure-hosted models alongside other model providers. This guide explains how to set up and use Azure OpenAI with Open WebUI.
9+
10+
## Prerequisites
11+
12+
Before you begin, make sure you have:
13+
14+
- An active Azure subscription
15+
- Access to Azure OpenAI Services
16+
- At least one deployed model in your Azure OpenAI resource
17+
- Your Azure OpenAI endpoint URL and API key
18+
19+
## Adding an Azure OpenAI Connection
20+
21+
To connect Open WebUI to your Azure OpenAI Services:
22+
23+
1. Navigate to **Settings > OpenAI API**
24+
2. Click **Add New Connection**
25+
3. Enter your Azure OpenAI endpoint URL (format: `https://{your-resource-name}.openai.azure.com`)
26+
4. Enter your Azure OpenAI API key
27+
5. Click **Save**
28+
29+
Open WebUI will automatically detect that you're using Azure OpenAI and will fetch your available deployments.
30+
31+
## Model Compatibility
32+
33+
Open WebUI supports different Azure OpenAI model types, each with specific requirements:
34+
35+
### Standard Models (like gpt-4o)
36+
37+
These models use the `2023-03-15-preview` API version by default and work with standard OpenAI parameters.
38+
39+
### O-Series Models (like o4-mini)
40+
41+
These models require:
42+
- API version `2024-12-01-preview`
43+
- Use of `max_completion_tokens` instead of `max_tokens`
44+
- Temperature value of 1 (other values are not supported)
45+
46+
Open WebUI automatically handles these differences, selecting the appropriate API version and converting parameters as needed.
47+
48+
## Environment Variables
49+
50+
You can configure the default Azure OpenAI API version using an environment variable:
51+
52+
```
53+
AZURE_OPENAI_API_VERSION=2023-03-15-preview
54+
```
55+
56+
This is useful when running Open WebUI in Docker or other deployment environments.
57+
58+
## Troubleshooting
59+
60+
### Connection Issues
61+
62+
If you're having trouble connecting to Azure OpenAI:
63+
64+
- Verify your endpoint URL is correct (should be in the format `https://{your-resource-name}.openai.azure.com`)
65+
- Check that your API key is valid and has the necessary permissions
66+
- Ensure your Azure OpenAI resource is in an available state
67+
68+
### Model Not Found
69+
70+
If your models aren't appearing:
71+
72+
- Verify you have deployments created in your Azure OpenAI resource
73+
- Check that your API key has access to the deployments
74+
- Try refreshing the model list in Open WebUI
75+
76+
### API Version Errors
77+
78+
If you see errors related to API versions:
79+
80+
- For o-series models (like o4-mini), ensure they're using API version `2024-12-01-preview`
81+
- For other models, the default `2023-03-15-preview` should work
82+
- You can override the default API version using the environment variable mentioned above
83+
84+
## Limitations
85+
86+
- Azure OpenAI may have different rate limits than standard OpenAI
87+
- Some advanced features might require specific API versions
88+
- Parameter support may vary between different model types
89+
90+
## Additional Resources
91+
92+
- [Azure OpenAI Service Documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/)
93+
- [Azure OpenAI API Reference](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference)

backend/open_webui/env.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,3 +557,5 @@ def parse_section(section):
557557
####################################
558558

559559
EXTERNAL_PWA_MANIFEST_URL = os.environ.get("EXTERNAL_PWA_MANIFEST_URL")
560+
# Azure OpenAI API version
561+
AZURE_OPENAI_API_VERSION = os.environ.get("AZURE_OPENAI_API_VERSION", "2023-03-15-preview")

0 commit comments

Comments
 (0)