openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
achandmsft-patch-2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/overview/responses_overview.cs

12lines · modecode

1// SAMPLE: Developer QuickStart
2// GUIDANCE: https://platform.openai.com/docs/overview
3// HOWTO: Instructions to run this code: https://aka.ms/oai/net/start
4#:package OpenAI@2.2.*-*
5#:property PublishAot false
6
7using OpenAI.Responses;
8
9string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
10OpenAIResponseClient client = new("gpt-4.1", key);
11OpenAIResponse response = client.CreateResponse("Write a one-sentence bedtime story about a unicorn.");
12Console.WriteLine(response.GetOutputText());
13