openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-codeinterpretertoolcontainer

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/quickstart/responses/analyze_images_files_image_url.cs

20lines · modecode

1// SAMPLE: Analyzes image from an image URL through Responses API
2// PAGE: https://platform.openai.com/docs/quickstart?input-type=image-url#analyze-images-and-files
3// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
4#pragma warning disable OPENAI001
5
6#:package OpenAI@2.*
7
8using OpenAI.Responses;
9
10string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
11ResponsesClient client = new(key);
12
13ResponseResult response = client.CreateResponse("gpt-5.2", [
14 ResponseItem.CreateUserMessageItem([
15 ResponseContentPart.CreateInputTextPart("What is in this image?"),
16 ResponseContentPart.CreateInputImagePart(new Uri("https://openai-documentation.vercel.app/images/cat_and_otter.png"))
17 ])
18]);
19
20Console.WriteLine(response.GetOutputText());