Skip to content

guygregory/Responses-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Responses API samples

A selection of simple Responses API samples, which cover:

Sample description Previous generation API (202x-xx-xx) v1 preview API
Gradio-based chatbot with conversation history, image upload, Reasoning Summary responses-conversation-stream-gradio.py responses-conversation-stream-gradio-v1.py
Simple request/response with API key auth responses-basic-aoai.py responses-basic-aoai-v1.py
Simple request/response with Entra ID auth responses-basic-entra-aoai.py responses-basic-entra-aoai-v1.py
Simple conversation (referencing the previous message ID) responses-conversation-aoai.py responses-conversation-aoai-v1.py
Streaming using SSE and Streaming using Async responses-stream-sse-aoai.py, responses-stream-async-aoai.py responses-stream-sse-aoai-v1.py, responses-stream-async-aoai-v1.py
Function calling responses-function-weather-aoai.py responses-function-weather-aoai-v1.py
File Search responses-filesearch-aoai.py responses-filesearch-aoai-v1.py
🆕 PDF upload, via base64 (API key/Entra) n/a responses-pdfupload-base64-aoai-v1.py, responses-pdfupload-base64-entra-aoai-v1.py
🆕 PDF upload, via file upload (API key/Entra) n/a responses-pdfupload-aoai-v1.py, responses-pdfupload-aoai-entra-v1.py
🆕 Code Interpreter (API key/Entra) n/a responses-codeinterpreter-aoai-v1.py, responses-codeinterpreter-entra-aoai-v1.py
Structured Outputs responses-structured-aoai.py responses-structured-aoai-v1.py
Reasoning responses-reasoning-aoai.py responses-reasoning-aoai-v1.py
Vision: Image from a local file and Image from a URL responses-image-aoai.py, responses-imageurl-aoai.py responses-image-aoai-v1.py, responses-imageurl-aoai-v1.py
Image generation using gpt-image-1 with API key auth n/a responses-image-generate-aoai-v1.py
Image generation using gpt-image-1 with Entra ID auth n/a responses-image-generate-entra-aoai-v1.py
Background mode n/a responses-background-aoai-v1.py
MCP remote server with API key auth n/a responses-mcp-aoai-v1.py
MCP remote server with Entra ID auth n/a responses-mcp-entra-aoai-v1.py
MCP remote server with Gradio UI n/a responses-mcp-mslearn-gradio-aoai-v1.py

Reasoning Summary

Why are there two sets of samples? Which API version should I use?

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

Semantic Kernel

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

Recommended settings

I've personally tested these Responses API samples using:

Features currently unsupported on Responses API on Azure OpenAI

  • web_search tool (Azure AI Foundry Agent Service recommended if web search is needed)

Further reading

Attribution

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.

About

Responses API on Azure OpenAI samples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages