A proxy for Azure OpenAI API that can convert a Azure OpenAI request into an OpenAI request.
5.0K
Azure OAI Proxy is a lightweight, high-performance proxy server that enables seamless integration between Azure OpenAI Services and applications designed for OpenAI API only compatible endpoints. This project bridges the gap for tools and services that are built to work with OpenAI's API structure but need to utilize Azure's OpenAI services, including support for the latest reasoning models through Azure's Responses API.
This proxy is particularly useful for:
While azure oai proxy serves as a convenient bridge, it's recommended to use the official Azure OpenAI SDK or API directly in production environments or when building new services.
Direct integration offers:
This proxy is ideal for testing, development, and scenarios where modifying the original application to use Azure OpenAI directly is not feasible.
Also, I strongly recommend using TLS/SSL for secure communication between the proxy and the client. This is especially important when using the proxy in a production environment (even though you shouldn't but well, here you are anyway). TBD: Add docker compose including nginx proxy manager.
The latest version of the Azure OpenAI service supports the following APIs:
| Path | Status | Notes |
|---|---|---|
| /v1/chat/completions | β | Auto-routes to Responses API for reasoning models |
| /v1/completions | β | |
| /v1/embeddings | β | |
| /v1/images/generations | β | |
| /v1/fine_tunes | β | |
| /v1/files | β | |
| /v1/models | β | |
| /v1/responses | β | New - Azure Responses API support |
| /v1/responses/:response_id | β | New - Retrieve, delete, cancel operations |
| /v1/responses/:response_id/input_items | β | New - List input items |
| /deployments | β | |
| /v1/audio/speech | β | |
| /v1/audio/transcriptions | β | |
| /v1/audio/translations | β | |
| /v1/models/:model_id/capabilities | β |
The proxy automatically detects model capabilities and routes requests appropriately:
AZURE_OPENAI_MODEL_MAPPER if needed)Reasoning models automatically use Azure's Responses API while maintaining OpenAI chat completion interface compatibility.
| Parameter | Description | Default Value | Required |
|---|---|---|---|
| AZURE_OPENAI_ENDPOINT | Azure OpenAI Endpoint | Yes | |
| AZURE_OPENAI_PROXY_ADDRESS | Service listening address | 0.0.0.0:11437 | No |
| AZURE_OPENAI_PROXY_MODE | Proxy mode, can be either "azure" or "openai" | azure | No |
| AZURE_OPENAI_APIVERSION | Azure OpenAI API version (for general operations) | 2024-08-01-preview | No |
| AZURE_OPENAI_MODELS_APIVERSION | Azure OpenAI API version (for fetching models) | 2024-10-21 | No |
| AZURE_OPENAI_RESPONSES_APIVERSION | Azure OpenAI API version (for Responses API/O-series) | 2024-08-01-preview | No |
| AZURE_OPENAI_MODEL_MAPPER | Comma-separated list of model=deployment pairs | No | |
| AZURE_AI_STUDIO_DEPLOYMENTS | Comma-separated list of serverless deployments | No | |
| AZURE_OPENAI_KEY_* | API keys for serverless deployments (replace * with uppercase model name) | No |
β οΈ Important: When using Docker, you must set the API version environment variables in your compose file to override the defaults. Older Docker images may have outdated API versions hardcoded.
Here's an example docker-compose.yml file with all possible environment variable options:
services:
azure-oai-proxy:
image: 'gyarbij/azure-oai-proxy:latest'
# container_name: azure-oai-proxy
# Alternatively, use GitHub Container Registry:
# image: 'ghcr.io/gyarbij/azure-oai-proxy:latest'
restart: always
environment:
- AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
- AZURE_OPENAI_APIVERSION=2024-08-01-preview
- AZURE_OPENAI_MODELS_APIVERSION=2024-10-21
- AZURE_OPENAI_RESPONSES_APIVERSION=2024-08-01-preview
# - AZURE_OPENAI_PROXY_ADDRESS=0.0.0.0:11437
# - AZURE_OPENAI_PROXY_MODE=azure
# - AZURE_OPENAI_MODEL_MAPPER=gpt-3.5-turbo=gpt-35-turbo,gpt-4=gpt-4-turbo
# - AZURE_AI_STUDIO_DEPLOYMENTS=mistral-large-2407=Mistral-large2:swedencentral,llama-3.1-405B=Meta-Llama-3-1-405B-Instruct:northcentralus,claude-sonnet-4.5=Claude-Sonnet-45:eastus2
# - AZURE_OPENAI_KEY_MISTRAL-LARGE-2407=your-api-key-1
# - AZURE_OPENAI_KEY_LLAMA-3.1-405B=your-api-key-2
# - AZURE_OPENAI_KEY_CLAUDE-SONNET-4.5=your-api-key-3
ports:
- '11437:11437'
# Uncomment the following line to use an .env file:
# env_file: .env
To use this configuration:
compose.yaml.your-endpoint, your-api-key-1, etc.) with your actual Azure OpenAI configuration.compose.yaml file:docker compose up -d
To use an .env file instead of environment variables in the Docker Compose file:
.env in the same directory as your docker-compose.yml..env file, one per line:AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/
AZURE_OPENAI_APIVERSION=2024-08-01-preview
AZURE_OPENAI_MODELS_APIVERSION=2024-10-21
AZURE_OPENAI_RESPONSES_APIVERSION=2024-08-01-preview
AZURE_AI_STUDIO_DEPLOYMENTS=mistral-large-2407=Mistral-large2:swedencentral,llama-3.1-405B=Meta-Llama-3-1-405B-Instruct:northcentralus,claude-sonnet-4.5=Claude-Sonnet-45:eastus2
AZURE_OPENAI_KEY_MISTRAL-LARGE-2407=your-api-key-1
AZURE_OPENAI_KEY_LLAMA-3.1-405B=your-api-key-2
AZURE_OPENAI_KEY_CLAUDE-SONNET-4.5=your-api-key-3
env_file: .env line in your docker-compose.yml.docker-compose up -d to start the container with the environment variables from the .env file.To run the Azure OAI Proxy using the image from GitHub Container Registry:
docker run -d -p 11437:11437 \
-e AZURE_OPENAI_ENDPOINT=https://your-endpoint.openai.azure.com/ \
-e AZURE_OPENAI_MODELS_APIVERSION=2024-10-21 \
-e AZURE_AI_STUDIO_DEPLOYMENTS=mistral-large-2407=Mistral-large2:swedencentral \
-e AZURE_OPENAI_KEY_MISTRAL-LARGE-2407=your-api-key \
ghcr.io/gyarbij/azure-oai-proxy:latest
Replace the placeholder values with your actual Azure OpenAI configuration.
Once the proxy is running, you can call it using the OpenAI API format:
curl http://localhost:11437/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-azure-api-key" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
β οΈ Important for Claude Models:
AZURE_OPENAI_MODEL_MAPPER to map the model name to your actual deployment nameExample with standard deployment name:
curl http://localhost:11437/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-azure-api-key" \
-d '{
"model": "claude-sonnet-4.5",
"messages": [{"role": "user", "content": "Explain quantum computing in simple terms"}],
"max_tokens": 1000
}'
Example with custom deployment name:
If your Claude deployment has a different name (e.g., Claude-Sonnet-45-20251001), use the model mapper:
AZURE_OPENAI_MODEL_MAPPER=claude-sonnet-4.5=Claude-Sonnet-45-20251001
curl http://localhost:11437/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-azure-api-key" \
-d '{
"model": "phi-4",
"messages": [{"role": "user", "content": "What is machine learning?"}]
}'
curl http://localhost:11437/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-azure-api-key" \
-d '{
"model": "o3-pro",
"messages": [{"role": "user", "content": "Solve this complex reasoning problem..."}],
"stream": true
}'
curl http://localhost:11437/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-azure-api-key" \
-d '{
"model": "o3-pro",
"input": "What are the implications of quantum computing?",
"stream": false
}'
For serverless deployments, use the model name as defined in your AZURE_AI_STUDIO_DEPLOYMENTS configuration.
These are the default mappings for the most common models, if your Azure OpenAI deployment uses different names, you can set the AZURE_OPENAI_MODEL_MAPPER environment variable to define custom mappings. The proxy also includes a comprehensive failsafe list to handle a wide variety of model names:
| OpenAI Model | Azure OpenAI Model |
|---|---|
"o1" | "o1" |
"o1-preview" | "o1-preview" |
"o1-mini" | "o1-mini" |
"o1-mini-2024-09-12" | "o1-mini-2024-09-12" |
"o3" | "o3" |
"o3-mini" | "o3-mini" |
"o3-pro" | "o3-pro" |
"o3-pro-2025-06-10" | "o3-pro-2025-06-10" |
"o4" | "o4" |
"o4-mini" | "o4-mini" |
| OpenAI Model | Azure OpenAI Model |
|---|---|
"claude-opus-4.5" | "claude-opus-4.5" |
"claude-opus-4-5" | "claude-opus-4.5" |
"claude-sonnet-4.5" | "claude-sonnet-4.5" |
"claude-sonnet-4-5" | "claude-sonnet-4.5" |
"claude-haiku-4.5" | "claude-haiku-4.5" |
"claude-haiku-4-5" | "claude-haiku-4.5" |
"claude-opus-4.1" | "claude-opus-4.1" |
"claude-opus-4-1" | "claude-opus-4.1" |
| OpenAI Model | Azure OpenAI Model |
|---|---|
"gpt-4o" | "gpt-4o" |
"gpt-4o-2024-05-13" | "gpt-4o-2024-05-13" |
"gpt-4o-2024-08-06" | "gpt-4o-2024-08-06" |
"gpt-4o-2024-11-20" | "gpt-4o-2024-11-20" |
"gpt-4o-mini" | "gpt-4o-mini" |
"gpt-4o-mini-2024-07-18" | "gpt-4o-mini-2024-07-18" |
"gpt-4" | "gpt-4-0613" |
"gpt-4-turbo" | "gpt-4-turbo" |
"gpt-4-turbo-2024-04-09" | "gpt-4-turbo-2024-04-09" |
"gpt-3.5-turbo" | "gpt-35-turbo-0613" |
"gpt-3.5-turbo-16k" | "gpt-35-turbo-16k-0613" |
| OpenAI Model | Azure OpenAI Model |
|---|---|
"phi-3" | "phi-3" |
"phi-3-mini" | "phi-3-mini" |
"phi-3-small" | "phi-3-small" |
"phi-3-medium" | "phi-3-medium" |
"phi-4" | "phi-4" |
| OpenAI Model | Azure OpenAI Model |
|---|---|
"text-embedding-3-small" | "text-embedding-3-small-1" |
"text-embedding-3-large" | "text-embedding-3-large-1" |
"dall-e-2" | "dall-e-2-2.0" |
"dall-e-3" | "dall-e-3-3.0" |
"tts" | "tts-001" |
"tts-hd" | "tts-hd-001" |
"whisper" | "whisper-001" |
For custom fine-tuned models, the model name can be passed directly. For models with deployment names different from the model names, custom mapping relationships can be defined, such as:
| Model Name | Deployment Name |
|---|---|
| gpt-3.5-turbo | gpt-35-turbo-upgrade |
| gpt-3.5-turbo-0301 | gpt-35-turbo-0301-fine-tuned |
The proxy automatically detects when you're using reasoning models (O1, O3, O4 series) and:
/v1/chat/completions requests to use Azure's /openai/v1/responses endpointo1, o1-preview, o1-mini, o1-mini-2024-09-12o3, o3-pro, o3-mini, o3-pro-2025-06-10o4, o4-miniWhen using reasoning models, you get access to:
Error: "This model is not supported by Responses API"
Error: "Unknown model: claude-sonnet-4-5" or similar
AZURE_OPENAI_MODEL_MAPPER to map the model name to your actual Azure deployment name:
# If your deployment is named something like "Claude-Sonnet-45-20251001"
AZURE_OPENAI_MODEL_MAPPER=claude-sonnet-4.5=Claude-Sonnet-45-20251001
Deployment Requirements:
Error: "Resource not found" (404)
gpt-4o-mini./v1/models endpoint, replacing hardcoded model list./v1/audio/speech, /v1/audio/transcriptions, and /v1/audio/translations./v1/models/:model_id/capabilities./v1/images/generations, fine-tuning operations /v1/fine_tunes, and file management /v1/files.Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
This project is not officially associated with or endorsed by Microsoft Azure or OpenAI. Use at your own discretion and ensure compliance with all relevant terms of service.
Content type
Image
Digest
sha256:933fce129β¦
Size
18.5 MB
Last updated
9 months ago
docker pull gyarbij/azure-oai-proxy