Azure.AI.OpenAI 2.1.0 Released — GA Streaming, Vision, and Structured Outputs

From NuGet Release .NET 8 Azure.AI.OpenAI 2.1.0 OpenAI 2.1.0
By Rajesh Mishra · Jan 28, 2026 · Verified: Jan 28, 2026 · 6 min read

Release Overview

Azure.AI.OpenAI 2.1.0 marks the first Generally Available (GA) release of the complete SDK rewrite. The 2.x series was built jointly with the OpenAI team and uses the OpenAI .NET client library as its foundation — Azure-specific features (deployment mapping, Azure AD auth, content filtering metadata) layer on top.

Key Features

Native Streaming with IAsyncEnumerable

Streaming chat completions now use IAsyncEnumerable<StreamingChatCompletionUpdate> — no callbacks, no event handlers:

using Azure.AI.OpenAI;
using Azure.Identity;
using OpenAI.Chat;

var client = new AzureOpenAIClient(
    new Uri(configuration["AzureOpenAI:Endpoint"]!),
    new DefaultAzureCredential());

ChatClient chatClient = client.GetChatClient("gpt-4o");

await foreach (StreamingChatCompletionUpdate update in
    chatClient.CompleteChatStreamingAsync("Explain RAG in one paragraph"))
{
    foreach (ChatMessageContentPart part in update.ContentUpdate)
    {
        Console.Write(part.Text);
    }
}

Structured Outputs (JSON Schema Enforcement)

The response_format parameter now supports strict JSON Schema enforcement — the model is constrained to only produce valid JSON matching your schema:

ChatCompletionOptions options = new()
{
    ResponseFormat = ChatResponseFormat.CreateJsonSchemaFormat(
        jsonSchemaFormatName: "product_classification",
        jsonSchema: BinaryData.FromBytes("""
            {
              "type": "object",
              "properties": {
                "category": { "type": "string" },
                "confidence": { "type": "number" },
                "tags": { "type": "array", "items": { "type": "string" } }
              },
              "required": ["category", "confidence", "tags"],
              "additionalProperties": false
            }
            """u8.ToArray()),
        jsonSchemaIsStrict: true)
};

ChatCompletion completion = await chatClient.CompleteChatAsync(
    [new UserChatMessage("Classify: wireless noise-cancelling headphones")],
    options);

// completion.Content[0].Text is guaranteed to be valid JSON
var result = JsonSerializer.Deserialize<ProductClassification>(completion.Content[0].Text);

GPT-4 Vision (Multimodal Inputs)

Pass images alongside text in a single chat request:

ChatMessage[] messages =
[
    new UserChatMessage(
        ChatMessageContentPart.CreateTextPart("What is in this image?"),
        ChatMessageContentPart.CreateImagePart(
            imageUri: new Uri("https://example.com/diagram.png"),
            imageDetailLevel: ChatImageDetailLevel.High))
];

ChatCompletion result = await chatClient.CompleteChatAsync(messages);

For local images, use BinaryData directly:

var imageData = BinaryData.FromBytes(await File.ReadAllBytesAsync("screenshot.png"));
ChatMessageContentPart.CreateImagePart(imageData, "image/png");

Azure Managed Identity Authentication

// In production: use DefaultAzureCredential for Managed Identity
var client = new AzureOpenAIClient(
    new Uri(environment.GetVariable("AZURE_OPENAI_ENDPOINT")!),
    new DefaultAzureCredential());

// In development: authenticates via Azure CLI / VS credentials
// No API key needed or stored

How to Install

dotnet add package Azure.AI.OpenAI --version 2.1.0

The OpenAI 2.1.0 package is automatically pulled in as a transitive dependency — you do not need to reference it separately unless you use the base OpenAI types directly.

Breaking Changes from 1.x

1.x2.x
new OpenAIClient(endpoint, credential)new AzureOpenAIClient(endpoint, credential)
GetChatCompletionsAsyncGetChatClient("deployment").CompleteChatAsync
ChatRequestUserMessagenew UserChatMessage(...)
StreamingResponse<StreamingChatCompletions>IAsyncEnumerable<StreamingChatCompletionUpdate>
Choice.Message.ContentChatCompletion.Content[0].Text

Compatibility

Targets netstandard2.0 — works on .NET 8 LTS, .NET 9, .NET 10, and .NET Framework 4.7.2+.

Resources

AI-Friendly Summary

Summary

Azure.AI.OpenAI 2.1.0 is the first generally available release of the v2 SDK rewrite. It provides IAsyncEnumerable streaming for chat completions, GPT-4 Vision support, structured output enforcement via JSON Schema response_format, and full Azure Active Directory/Entra ID authentication. Compatible with .NET 8 LTS and later.

Key Takeaways

  • 2.x is a complete rewrite — existing 1.x code requires update when migrating
  • Streaming uses IAsyncEnumerable<StreamingChatCompletionUpdate> — no custom callbacks needed
  • Structured outputs enforce JSON Schema compliance at the API level for reliable parsing
  • GPT-4 Vision (multimodal) supported via ChatMessageContentPart.CreateImagePart
  • Azure Managed Identity / Entra ID authentication works via DefaultAzureCredential

Implementation Checklist

  • Install Azure.AI.OpenAI 2.1.0 and OpenAI 2.1.0
  • Replace OpenAIClient constructor with AzureOpenAIClient
  • Update GetChatClient call with Azure deployment name
  • Configure DefaultAzureCredential for Managed Identity auth
  • Test streaming with await foreach over CompleteChatStreamingAsync
  • Verify JSON structured output schema definitions

Frequently Asked Questions

What is the difference between Azure.AI.OpenAI 1.x and 2.x?

The 2.x series is a major breaking rewrite. It is built on top of the OpenAI .NET client library, inherits its type system, and adds Azure-specific authentication, deployment mapping, and Azure-only features on top. All new development should target 2.x — the 1.x series is in maintenance mode.

Does Azure.AI.OpenAI 2.x work on .NET 8?

Yes. The Azure.AI.OpenAI package targets netstandard2.0, which means it runs on .NET 8 LTS, .NET 9, and .NET 10. No .NET 9-specific SDK is required.

How do I migrate from Azure.AI.OpenAI 1.x to 2.x?

The migration requires significant code changes. The core type has changed from OpenAIClient to AzureOpenAIClient, and all method names follow the new OpenAI .NET naming convention. Refer to the official migration guide at aka.ms/azure-openai-dotnet-migration.

Related Articles

Was this article useful?

Feedback is anonymous and helps us improve content quality.

Discussion

Engineering discussion powered by GitHub Discussions.

#Azure OpenAI #Azure.AI.OpenAI #.NET 8+ #NuGet Release #Streaming