azure-openai
БесплатноБез исполняемых скриптовНе проверенAzure OpenAI is Microsoft's hosted service for OpenAI models (GPT, gpt-image, Whisper, embeddings) on Azure infrastructure. Use when calling OpenAI models…
Об этом скилле
Azure OpenAI Service
Overview
Azure OpenAI hosts OpenAI models on Microsoft Azure (now part of Microsoft Foundry). It adds enterprise features: Entra ID and Managed Identity auth, private endpoints, regional data residency, configurable content filtering and Azure RBAC.
Since August 2025 there is a v1 API: you use the plain OpenAI client with base_url set to https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1/, with no api-version parameter and no Azure-specific client. Microsoft recommends the Responses API for Azure OpenAI models; chat completions, embeddings, images and audio also work. The older AzureOpenAI client with dated api_version strings still works and is what many tutorials show.
Azure vs OpenAI direct
| Feature | OpenAI direct | Azure OpenAI |
|---|---|---|
| Auth | API key | API key, Entra ID, Managed Identity |
| Model name in calls | model name | your deployment name |
| Data residency | Limited | Choose region or data zone |
| Network isolation | No | Private endpoints, VNET |
| Content filtering | Moderation endpoint | Built-in, configurable per deployment |
| Quota | Per org | Per deployment and region |
Instructions
Setup
pip install openai azure-identity # Node: npm install openai @azure/identity
export AZURE_OPENAI_API_KEY="..." # from the resource's Keys and Endpoint page
export AZURE_OPENAI_ENDPOINT="https://northwind-ai.openai.azure.com"
Create a model deployment first (portal or CLI); its name is what you pass as model.
Chat and Responses with an API key (v1 API)
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AZURE_OPENAI_API_KEY"],
base_url=f"{os.environ['AZURE_OPENAI_ENDPOINT']}/openai/v1/",
)
resp = client.responses.create(model="gpt-4.1-mini", input="What is Azure OpenAI Service?")
print(resp.output_text)
chat = client.chat.completions.create(
model="gpt-4.1-mini", # deployment name
messages=[{"role": "user", "content": "Summarise RBAC in one sentence."}],
)
print(chat.choices[0].message.content)
Setting OPENAI_BASE_URL and OPENAI_API_KEY lets you call OpenAI() with no arguments.
Entra ID / Managed Identity (no keys)
from openai import OpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://ai.azure.com/.default")
client = OpenAI(base_url="https://northwind-ai.openai.azure.com/openai/v1/", api_key=token_provider)
DefaultAzureCredential uses Managed Identity on Azure (VM, AKS, App Service, Functions) and az login locally. Assign the identity the Cognitive Services OpenAI User role on the resource. The client refreshes tokens automatically.
TypeScript / Node.js
import OpenAI from "openai";
import { DefaultAzureCredential, getBearerTokenProvider } from "@azure/identity";
const client = new OpenAI({
baseURL: "https://northwind-ai.openai.azure.com/openai/v1/",
apiKey: getBearerTokenProvider(new DefaultAzureCredential(), "https://ai.azure.com/.default"),
});
// key auth: apiKey: process.env.AZURE_OPENAI_API_KEY
const res = await client.chat.completions.create({
model: "gpt-4.1-mini",
messages: [{ role: "user", content: "Explain TypeScript generics." }],
});
console.log(res.choices[0].message.content);
Streaming
stream = client.chat.completions.create(
model="gpt-4.1-mini",
messages=[{"role": "user", "content": "Write a sonnet about cloud computing."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Guard chunk.choices: Azure can send an initial chunk with an empty list while content filter results arrive.
Function calling
import json
tools = [{
"type": "function",
"function": {
"name": "get_azure_resource_cost",
"description": "Get this month's cost of an Azure resource",
"parameters": {
"type": "object",
"properties": {"resource_group": {"type": "string"}, "resource_name": {"type": "string"}},
"required": ["resource_group", "resource_name"],
},
},
}]
messages = [{"role": "user", "content": "How much is vm-prod01 costing this month?"}]
response = client.chat.completions.create(model="gpt-4.1-mini", messages=messages, tools=tools)
msg = response.choices[0].message
if msg.tool_calls:
call = msg.tool_calls[0]
print(call.function.name, json.loads(call.function.arguments))
messages += [msg, {"role": "tool", "tool_call_id": call.id,
"content": json.dumps({"cost_usd": 142.53})}]
final = client.chat.completions.create(model="gpt-4.1-mini", messages=messages)
print(final.choices[0].message.content)
Image generation (gpt-image)
DALL-E 3 was retired on 2026-03-04; use a gpt-image-* deplo
Установить azure-openai в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл azure-openai?
Azure OpenAI is Microsoft's hosted service for OpenAI models (GPT, gpt-image, Whisper, embeddings) on Azure infrastructure. Use when calling OpenAI models through Azure, authenticating with Managed Identity or Entra ID, setting up content filters, or deploying with enterprise compliance, regional data residency or private networking.
Как установить скилл azure-openai?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл azure-openai запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic