azure-openai-to-responses
Skill này làm gì
Skill này hướng dẫn việc chuyển một ứng dụng Python dùng Azure OpenAI sang Responses API mới hơn. Nó dành cho lập trình viên muốn cập nhật mã cũ hoặc chuẩn bị cho các model mới hơn.
Khi nào nên dùng
- ✓Khi bạn có một ứng dụng Python dùng Azure OpenAI và muốn chuyển sang Responses API.
- ✓Khi bạn chuẩn bị mã cho một model mới hơn cần Responses API trên Azure.
- ✓Khi bạn thấy cảnh báo ngừng hỗ trợ về client AzureOpenAI và muốn sửa.
Liên kết skill
https://github.com/microsoft/ai-agents-for-beginners/blob/main/.agents/skills/azure-openai-to-responses/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy chuyển chatbot Python của tôi từ Azure OpenAI chat completions sang Responses API.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent trước hết dùng một bài kiểm tra nhỏ để xác nhận model Azure của bạn hỗ trợ API mới. Sau đó nó cập nhật cách khởi tạo client, streaming và tool call sang định dạng mới.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Migrate Python Apps from Azure OpenAI Chat Completions to Responses API
AUTHORITATIVE GUIDANCE — FOLLOW EXACTLY
This skill migrates Python codebases using Azure OpenAI Chat Completions to the unified Responses API. Follow these instructions precisely. Do not improvise parameter mappings or invent API shapes.
Triggers
Activate this skill when user wants to:
- Migrate a Python app from Azure OpenAI Chat Completions to Responses API
- Upgrade Python OpenAI SDK usage to the latest API shape against Azure OpenAI
- Prepare Python code for GPT-5 or newer models that require Responses on Azure
- Switch from
AzureOpenAI/AsyncAzureOpenAIto standardOpenAI/AsyncOpenAIclient with the v1 endpoint - Fix deprecation warnings related to
AzureOpenAIconstructors orapi_version
⚠️ Model Compatibility — CHECK FIRST
Before migrating, verify your Azure OpenAI deployment supports the Responses API.
1. Smoke-test your deployment (fastest)
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AZURE_OPENAI_API_KEY"],
base_url=f"{os.environ['AZURE_OPENAI_ENDPOINT'].rstrip('/')}/openai/v1/",
)
try:
resp = client.responses.create(
model=os.environ["AZURE_OPENAI_DEPLOYMENT"],
input="ping",
max_output_tokens=50,
store=False,
)
print(f"✅ Deployment supports Responses API: {resp.output_text}")
except Exception as e:
print(f"❌ Deployment does NOT support Responses API: {e}")
Note:
max_output_tokenshas a minimum of 16 on Azure OpenAI. Values below 16 return a 400 error. Use 50+ for smoke tests.
If this returns a 404, the deployment's model doesn't support Responses yet — check the reference below or redeploy with a supported model.
2. Check available models in your region (recommended)
Run the built-in model compatibility tool to see what's available with Responses API support in your specific region:
python migrate.py models --subscription YOUR_SUB_ID --location YOUR_REGION
This queries Azure ARM live and shows a compatibility matrix — which models support Responses, structured output, tools, etc. Use --filter gpt-5.1,gpt-5.2 to narrow results or --json for scripting.
3. Full model support reference
- Live query:
python migrate.py models(see above — region-specific, always up to date) - Browse availability: Model summary table and region availability
- Quickstart & guidance: https://aka.ms/openai/start
⚠️ Older model limitations
WARNING: Older models (those predating
gpt-4.1) may not support all Responses API features fully.Known limitations with older models:
reasoningparameter: Not supported on many non-reasoning models. Only migratereasoningif it was already present in the original code.seedparameter: Not supported in Responses API at all — remove from all requests.- Structured output via
text.format: Older models may not enforcestrict: trueJSON schemas reliably.- Tool orchestration: GPT-5+ orchestrates tool calls as part of internal reasoning. Older models on Responses still work but lack this deep integration.
- Temperature constraints: When migrating to
gpt-5, temperature must be omitted or set to1. Older models have no such constraint.
O-series reasoning models (o1, o3-mini, o3, o4-mini)
O-series models have unique parameter constraints. When migrating apps that target o-series models:
temperature: Must be1(or omitted). O-series models do not accept other values.max_completion_tokens→max_output_tokens: Apps using the Azure-specificmax_completion_tokensmust switch tomax_output_tokens. Set high values (4096+) because reasoning tokens count against the limit.reasoning_effort: If the app usesreasoning_effort(low/medium/high), keep it — the Responses API supports this parameter for o-series models.- Streaming behavior: O-series models may buffer output until reasoning completes before emitting text delta events. Streaming still works, but the first
response.output_text.deltamay arrive after a longer delay than with GPT models. top_p: Not supported on o-series — remove if present.
Câu hỏi thường gặp
Tôi có cần kiểm tra model trước không?
Có. Skill khuyên kiểm tra deployment trước khi chuyển, vì không phải model nào cũng hỗ trợ Responses API.
Nó có dùng được cho các nhà cung cấp AI khác không?
Không. Nó dành cho mã Python dùng Azure OpenAI.
Nó có đề cập đăng nhập Entra ID không?
Có. Nó có bao gồm xác thực EntraID trong các bước chuyển đổi.
Chi tiết
Mô tả gốc của tác giả
Migrate Python apps from Azure OpenAI Chat Completions to the Responses API. Covers AzureOpenAI/AsyncAzureOpenAI client migration to the v1 endpoint, streaming, tools, structured output, multi-turn, EntraID auth, and model compatibility checks. Python-focused, Azure OpenAI-specific. USE FOR: migrate to responses API, switch from chat completions, openai responses, upgrade openai SDK, responses API migration, move from completions to responses, gpt-5 migration, azure openai python migration, chat completions to responses, AzureOpenAI to OpenAI client, python azure openai upgrade. DO NOT USE FOR
Độ phổ biến
- Sao GitHub
- 79k
- Vị trí xếp hạng
- #1723
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
deploying-scalable-agents
79kGiúp agent của bạn chuyển một agent AI đang chạy tốt thành môi trường production có thể mở rộng và được giám sát trên Microsoft Foundry.
jupyter-notebook
79kGiúp agent của bạn tạo hoặc dọn gọn các notebook Jupyter cho thí nghiệm hoặc hướng dẫn từng bước, bằng các template có sẵn.
local-ai-agents
79kDạy agent của bạn xây dựng trợ lý AI chạy hoàn toàn trên máy tính với model và công cụ cục bộ, không cần cloud.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.