Originally launched by OpenAI and now natively supported in Azure AI Foundry, the Responses API combines the simplicity of the Chat Completions API with the advanced tool-calling capabilities of the legacy Assistants API. It offers a streamlined way to build powerful agentic experiences by allowing developers to structure prompts, invoke tools, and manage outputs - all within a single API call.
This repo includes a selection of minimal Python samples covering the most of the common features of Responses API on Azure OpenAI:
The quickest way to get started is using GitHub Codespaces, a hosted environment that is automatically set up for you. Click this button to create a Codespace (4-core machine recommended):
Wait for the Codespace to initialize. Python 3.12, Python extension, and dependencies will be automatically installed. For an even more streamlined experience, add the environment variables into your Codespace user secrets.
Starting in May 2025, you use the next generation v1 APIs which adds support for:
- Ongoing access to the latest features with no need to update api-version each month.
- OpenAI client support with minimal code changes to swap between OpenAI and Azure OpenAI when using key-based authentication.
Code samples have been provided for both the v1 API (now GA for Responses API), and also the older API versions. The v1 API samples have a v1.py suffix to distinguish them.
If you want the latest features, I would recommend using the v1 API. With the GA release, you no longer need to specify an api-version parameter.
If you need to use the older API versions, you can use the legacy samples. At time of writing, the latest GA API release is 2024-10-21.
Azure OpenAI in Azure AI Foundry Models API lifecycle
Microsoft Agent Framework has supported Responses API for both Azure OpenAI and OpenAI since the initial public preview on 1st October 2025 (version 1.0.0b251001). The following Azure OpenAI samples provide code for image analysis, function calling, conversation threads, and code interpreter.
As of 1.27, Semantic Kernel supports Responses API for both Azure OpenAI and OpenAI. The following samples provide examples for conversation history, plugins, Web Search (currently OpenAI only), File Search, vision, and Structured Outputs.
Getting started with Responses API in Semantic Kernel
If you're coming to this for the first time, and want some suggestions for the most compatible/simplest way to try out the latest features, try the following:
- Model: gpt-4.1 (see docs for a full list of supported models and versions)
- Region: East US2 or Sweden Central (see docs for a full list of supported regions)
- Deployment: Global Standard
- API version: v1 (GA)
- If using the "Legacy" API version: 2025-04-01-preview
- OpenAI library 1.99.2 or above (ideally the latest stable release)
- Semantic Kernel 1.36.1 or above (ideally the latest stable release)
- web_search tool (Azure AI Foundry Agent Service recommended if web search is needed)
- The Responses API in Azure AI Foundry is now generally available
- Introducing New Tools and Features in the Responses API in Azure AI Foundry
- Announcing the Responses API and Computer-Using Agent in Azure AI Foundry
- Microsoft Learn Documentation
- Azure OpenAI in Azure AI Foundry Models v1 REST API reference
- OpenAI documentation
These examples are loosely based on @mrbullwinkle's samples from the Microsoft Learn Documentation, and also helped by the documentation from OpenAI. Thanks to @moonbox3 for providing the Semantic Kernel and Microsoft Agent Framework samples. Thanks to Rafal Rutyna for providing useful information on the May 2025 updates.
