LLM plugin for Azure AI Foundry.
LLM has built-in support for OpenAI-compatible models via extra-openai-models.yaml, but it only supports API key authentication.
This plugin adds:
- Entra ID authentication - Use
az logininstead of managing API keys - Claude models on Azure - Access Anthropic models through Azure AI Foundry
If you only need API key authentication for OpenAI-compatible models, you don't need this plugin.
llm install llm-azure
# For Claude models:
llm install llm-azure[anthropic]-
Login to Azure:
az login
-
Create config file at
~/.config/io.datasette.llm/azure/config.yaml:mkdir -p "$(dirname "$(llm logs path)")/azure" touch "$(dirname "$(llm logs path)")/azure/config.yaml"
-
Add models to the config file:
- model_id: azure-gpt4o provider: openai model_name: gpt-4o endpoint: https://YOUR_RESOURCE.openai.azure.com/openai/v1/
-
Use it:
llm -m azure-gpt4o "Hello!"
Models are configured in ~/.config/io.datasette.llm/azure/config.yaml.
- model_id: azure-gpt4o
provider: openai
model_name: gpt-4o
endpoint: https://YOUR_RESOURCE.openai.azure.com/openai/v1/
aliases: [agpt]
- model_id: mistral-large
provider: openai
model_name: Mistral-Large-3
endpoint: https://YOUR_RESOURCE.openai.azure.com/openai/v1/
aliases: [mistral]Requires llm install llm-azure[anthropic].
- model_id: claude-opus
provider: anthropic
model_name: claude-opus-4-5
endpoint: https://YOUR_RESOURCE.openai.azure.com/anthropic/
aliases: [opus]| Field | Required | Description |
|---|---|---|
model_id |
Yes | Name used with llm -m |
provider |
Yes | openai or anthropic |
model_name |
Yes | Model name as deployed in Azure |
endpoint |
Yes | Azure endpoint URL |
aliases |
No | Short names for the model |
api_key_name |
No | Use API key instead of Entra ID (see below) |
Uses DefaultAzureCredential from the Azure SDK. Make sure you're logged in:
az loginYour user needs the "Cognitive Services User" role on the Azure AI resource.
Add api_key_name to your model config:
- model_id: azure-gpt4o
provider: openai
model_name: gpt-4o
endpoint: https://YOUR_RESOURCE.openai.azure.com/openai/v1/
api_key_name: azure-prodThen set the key (the name can be anything you choose):
llm keys set azure-prodMultiple models can share the same key name.
| Provider | Models | SDK |
|---|---|---|
openai |
GPT, Mistral, DeepSeek, Llama, etc. | openai |
anthropic |
Claude | anthropic |
Version 2.0 has a new config format:
# Old format (v1.x)
- model_id: gpt-4o
model_name: gpt-4o
api_base: https://YOUR_RESOURCE.openai.azure.com/
api_version: '2024-12-01-preview'
# New format (v2.0)
- model_id: gpt-4o
provider: openai
model_name: gpt-4o
endpoint: https://YOUR_RESOURCE.openai.azure.com/openai/v1/Changes:
api_base→endpoint(add/openai/v1/suffix)api_version→ removed (no longer needed)provider→ required (openaioranthropic)