# Azure OpenAI Responses Migration

Migrates Python apps from Azure OpenAI Chat Completions to the Responses API.

- Repository: https://github.com/microsoft/ai-agents-for-beginners (78611 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-31
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add microsoft/ai-agents-for-beginners --skill azure-openai-to-responses -g -a claude-code -y`
Codex: `npx skills add microsoft/ai-agents-for-beginners --skill azure-openai-to-responses -g -a codex -y`
Cursor: `npx skills add microsoft/ai-agents-for-beginners --skill azure-openai-to-responses -g -a cursor -y`
Gemini CLI: `npx skills add microsoft/ai-agents-for-beginners --skill azure-openai-to-responses -g -a gemini-cli -y`

## Description

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: building new apps from scratch (start with responses directly), Node/TypeScript/C#/Java/Go migrations (this skill is Python-only), Azure infrastructure setup (use azure-prepare), deploying models (use microsoft-foundry).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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`/`AsyncAzureOpenAI` to standard `OpenAI`/`AsyncOpenAI` client with the v1 endpoint
- Fix deprecation warnings related to `AzureOpenAI` constructors or `api_version`

---

## ⚠️ Model Compatibility, CHECK FIRST

> **Before migrating, verify your Azure OpenAI deployment supports the Responses API.**

### 1. Smoke-test your deployment (fastest)

```python
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_tokens` has 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:

The rest: https://github.com/microsoft/ai-agents-for-beginners/blob/HEAD/.agents/skills/azure-openai-to-responses/SKILL.md
