This repository demonstrates how to use the OpenAI .NET SDK with the new Response API.
-
SingleFunctionCallingStreamingAsync.cs: Single Function Calling with Streaming Response
-
MultiFunctionCallingStreamingAsync.cs: Multiple Function Calling with Streaming Response
-
FileUploadExample.cs: File Upload example with Response
- .NET 9 SDK
- OpenAI API key with access to the
response
endpoint andgpt-4o-mini
model
Set your API key as an environment variable
macOS / Linux:
export OPENAI_API_KEY=sk-...
Windows (PowerShell):
$env:OPENAI_API_KEY = "sk-..."
Run with one of the supported arguments:
-
single
– The model can make only one function call in response to the user’s question.dotnet run -- single
-
multi
– The model can make multiple function calls across multiple steps.dotnet run -- multi
-
file
– Demonstrates how to upload a file and ask a question about its contents..dotnet run -- file <file-path>
You will be prompted to enter a question like:
Enter your question: What is the weather in Tokyo?