Azure OpenAI - `model` parameter in request body causes failures when deployment name differs from model name
Maintainer thường phản hồi trong vòng 1 ngày
@fengjikui đang làm issue này rồi.
Từ ngày 24/6/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu trong openai/lib/azure.py tại AzureOpenAI._build_request và kiểm tra cách _deployments_endpoints cùng options.json_data được xử lý. Tái hiện yêu cầu images.generate với các tên deployment và model khác nhau, sau đó xác minh rằng việc định tuyến deployment vẫn hoạt động và phần thân yêu cầu khớp với các yêu cầu của Azure OpenAI REST API.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
When using AzureOpenAI client, the SDK sends the model parameter in the request body even though Azure OpenAI uses URL-based routing (/deployments/{deployment-id}/...). This causes failures when the deployment name doesn't match the model name exactly.
This is particularly problematic for gpt-image-1.5 because:
- Azure resource naming rules prohibit periods (dots) in deployment names
- The model name contains a dot:
gpt-image-1.5 - Therefore, deployment name can never match model name (e.g., must use
gpt-image-1-5)
The Azure backend validates the body's model field against actual model names, rejecting valid deployment names.
To Reproduce
Steps to Reproduce
from openai import AzureOpenAI
client = AzureOpenAI(
azure_endpoint="https://<resource>.openai.azure.com/",
api_key="<key>",
api_version="2024-10-21"
)
# Deployment name: "gpt-image-1-5" (dashes, due to Azure naming rules)
# Model name: "gpt-image-1.5" (dot)
response = client.images.generate(
model="gpt-image-1-5", # deployment name
prompt="A sunset over mountains",
size="1024x1024",
n=1
)
Expected Behavior
Request succeeds because URL routing correctly targets the deployment:
POST /openai/deployments/gpt-image-1-5/images/generations
Actual Behavior
Request fails with:
{
"error": {
"message": "Model not supported with Responses API. Supported models are: ['gpt-image-1', 'gpt-image-1-mini', 'gpt-image-1.5']",
"type": "invalid_request_error"
}
}
The Azure backend is validating "model": "gpt-image-1-5" in the request body against model names, not deployment names.
Root Cause
In openai/lib/azure.py, the _build_request method uses model from the body to construct the URL but doesn't remove it from the body:
def _build_request(self, options, *, retries_taken=0):
if options.url in _deployments_endpoints and is_mapping(options.json_data):
model = options.json_data.get("model")
if model is not None and "/deployments" not in str(self.base_url.path):
options.url = f"/deployments/{model}{options.url}"
# BUG: model is still in options.json_data
return super()._build_request(options, retries_taken=retries_taken)
The Azure OpenAI REST API spec does not include model in the request body for deployment-based endpoints - model selection is done entirely via the URL path.
Code snippets
OS
Linux (Ubuntu)
Python version
3.12
Library version
2.7.1 (also tested against latest)
- Ngôn ngữ chính
- Python
- Star
- 31.8k
- Fork
- 8k
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 137
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openai/openai-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openai/openai-python#4022 · 19 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(auth): SubjectTokenProviderError drops response and duplicates error message in workload identity providersCó thể đã có người làm @mohmedmm đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
openai/openai-python#4017 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Querystring drops explicit empty-string scalar valuesCó thể đã có người làm @sylvesterkaczmarek đã nhận 34 ngày trước. Đang mởsdk-breaking-change v4
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
openai/openai-python#3837 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Define + export `ServiceTiers` string literalCó thể đã có người làm @SparshGarg999 đã nhận 60 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openai/openai-python#3556 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Empty OPENAI_BASE_URL prevents fallback to default API endpointCó thể đã có người làm @Sehastrajit-S đã nhận 27 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openai/openai-python#2927 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openai/openai-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
onyx-dot-app/onyx#16016 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
black --check exits 0 and prints All done when a multi file run is interruptedCó thể đã có người làm @jiteshgulati đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Non-positive worker counts wait for results without starting workersCó thể đã có người làm @IlyaKhalafi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày