# Azure AI Openai Dotnet

Azure OpenAI SDK for .NET.

- Repository: https://github.com/microsoft/skills (3164 stars)
- Category: DevOps
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add microsoft/skills --skill azure-ai-openai-dotnet -g -a claude-code -y`
Codex: `npx skills add microsoft/skills --skill azure-ai-openai-dotnet -g -a codex -y`
Cursor: `npx skills add microsoft/skills --skill azure-ai-openai-dotnet -g -a cursor -y`
Gemini CLI: `npx skills add microsoft/skills --skill azure-ai-openai-dotnet -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add microsoft/skills`

## Description

Azure OpenAI SDK for .NET. Client library for Azure OpenAI and OpenAI services. Use for chat completions, embeddings, image generation, audio transcription, and assistants. Triggers: "Azure OpenAI", "AzureOpenAIClient", "ChatClient", "chat completions .NET", "GPT-4", "embeddings", "DALL-E", "Whisper", "OpenAI .NET".

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Azure.AI.OpenAI (.NET)

Client library for Azure OpenAI Service providing access to OpenAI models including GPT-4, GPT-4o, embeddings, DALL-E, and Whisper.

## Installation

```bash
dotnet add package Azure.AI.OpenAI

# For OpenAI (non-Azure) compatibility
dotnet add package OpenAI
```

**Current Version**: 2.1.0 (stable)

## Environment Variables

```bash
AZURE_OPENAI_ENDPOINT=https://<resource-name>.openai.azure.com  # Required: Azure OpenAI endpoint
AZURE_OPENAI_API_KEY=<api-key>  # Only required for AzureKeyCredential auth
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o-mini  # Required: model deployment name
AZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production
```

## Client Hierarchy

```
AzureOpenAIClient (top-level)
├── GetChatClient(deploymentName)      → ChatClient
├── GetEmbeddingClient(deploymentName) → EmbeddingClient
├── GetImageClient(deploymentName)     → ImageClient
├── GetAudioClient(deploymentName)     → AudioClient
└── GetAssistantClient()               → AssistantClient
```

## Authentication

### API Key Authentication

```csharp
using Azure;
using Azure.AI.OpenAI;

AzureOpenAIClient client = new(
    new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!),
    new AzureKeyCredential(Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY")!));
```

### Microsoft Entra Token Credential

```csharp
using Azure.Identity;
using Azure.AI.OpenAI;

The rest: https://github.com/microsoft/skills/blob/HEAD/.github/plugins/azure-sdk-dotnet/skills/azure-ai-openai-dotnet/SKILL.md
