using NUnit.Framework;
using OpenAI.Responses;
using System;
using System.Threading.Tasks;
namespace OpenAI.Examples;
// This example uses experimental APIs which are subject to change. To use experimental APIs,
// please acknowledge their experimental status by suppressing the corresponding warning.
#pragma warning disable OPENAI001
public partial class ResponseExamples
{
[Test]
public async Task Example01_SimpleResponseAsync()
{
ResponsesClient client = new(apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
ResponseResult response = await client.CreateResponseAsync("gpt-5", "Say 'this is a test.'");
Console.WriteLine($"[ASSISTANT]: {response.GetOutputText()}");
}
}
#pragma warning restore OPENAI001openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
examples/Responses/Example01_SimpleResponseAsync.cs
25lines · modepreview