Commit 83f9d8d
feat: Add comprehensive Azure OpenAI support
This commit adds full Azure OpenAI integration to the proxy server, allowing
users to route requests to Azure OpenAI deployments using the azure/ model prefix.
## Key Features Added:
### Server Integration (server.py):
- Added Azure environment variables (AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_API_VERSION, AZURE_DEPLOYMENT_NAME)
- Enhanced API key selection logic to detect azure/ model prefix
- Proper Azure credential and endpoint configuration for LiteLLM
- Updated model validation to include Azure models
- Azure models use OpenAI-compatible message processing
- Fixed undefined endpoint variable issue in log_request_beautifully function
- Added Azure model mapping for both small and big models
- Improved error detail serialization for exceptions
### Environment Configuration (.env.example):
- Added Azure OpenAI configuration section with examples
- Clear documentation on azure/ model format usage
- No default values for version/deployment (explicit configuration required)
### Test Suite:
- test_azure_openai.py: Direct Azure OpenAI connectivity test using LiteLLM
- test_azure_proxy.py: Proxy server Azure routing test
## Usage:
Set Azure configuration in .env file, then use model format: azure/your-deployment-name
## Testing:
- ✅ Direct Azure connection via LiteLLM
- ✅ Proxy routing to Azure OpenAI
- ✅ Token usage tracking
- ✅ Error handling and validation
- ✅ Response parsing and formatting
## Technical Details:
- Uses same LiteLLM library for consistency
- Explicit configuration (no defaults for version/deployment)
- Proper error messages and validation
- Clean separation from other providers
- Compatible with existing OpenAI message processing
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent e9c8cf8 commit 83f9d8d
File tree
4 files changed
+927
-401
lines changed4 files changed
+927
-401
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments