A selection of simple Responses API samples, which cover:
Starting in May 2025, you can now opt in to our next generation of v1 Azure OpenAI APIs which add 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 Preview, and also the older API versions. The v1 API Preview samples have a v1.py suffix to distinguish them.
If you want the latest features, I would recommend using the v1 API Preview, with the api-version
set to preview
.
If you need a stable, GA version, and don't need the latest features, then you can use the older API. At time of writing, the latest GA API release is 2024-10-21
.
Azure OpenAI in Azure AI Foundry Models API lifecycle
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
I've personally tested these Responses API samples using:
- gpt-4o 2024-08-06, gpt-4.1, o4-mini, and more (see docs for a full list of supported models and versions)
- East US and Sweden Central (see docs for a full list of supported regions)
- Global Standard and Standard deployments
- API version 2025-03-01-preview (2025-04-01-preview if using Reasoning Summaries)
- OpenAI library 1.68.2 or above
- Semantic Kernel 1.27 or above
- web_search tool (Azure AI Foundry Agent Service recommended if web search is needed)
- 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
- 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 samples. Thanks to Rafal Rutyna for providing useful information on the May 2025 updates.