Skip to main content

llm-azure

PyPI Changelog License

LLM plugin for Azure AI Foundry.

Why this plugin?

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 login instead 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.

Installation

llm install llm-azure

# For Claude models:
llm install llm-azure[anthropic]

Quick Start

  1. Login to Azure:

    az login
    
  2. Create config file:

    mkdir -p "$(dirname "$(llm logs path)")/azure"
    
  3. Add models to azure/config.yaml:

    - model_id: azure-gpt4o
      provider: openai
      model_name: gpt-4o
      endpoint: https://YOUR_RESOURCE.openai.azure.com/openai/v1/
    
  4. Use it:

    llm -m azure-gpt4o "Hello!"
    

Configuration

Models are configured in azure/config.yaml in your LLM config directory (find it with dirname "$(llm logs path)").

OpenAI-compatible models (GPT, Mistral, DeepSeek, Llama)

- 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]

Claude models

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]

Configuration options

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)

Authentication

Entra ID (default)

Uses DefaultAzureCredential from the Azure SDK. Make sure you're logged in:

az login

Your user needs the "Cognitive Services User" role on the Azure AI resource.

API Key

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-prod

Then set the key (the name can be anything you choose):

llm keys set azure-prod

Multiple models can share the same key name.

Providers

Provider Models SDK
openai GPT, Mistral, DeepSeek, Llama, etc. openai
anthropic Claude anthropic

Migrating from v1.x

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_baseendpoint (add /openai/v1/ suffix)
  • api_version → removed (no longer needed)
  • provider → required (openai or anthropic)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_azure-2.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_azure-2.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file llm_azure-2.1.tar.gz.

File metadata

  • Download URL: llm_azure-2.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_azure-2.1.tar.gz
Algorithm Hash digest
SHA256 5d71d5d90cf5efecd2d4f8f563ee6405232a3c2454c901bee9578fbd2c9c7f90
MD5 58be67508c9f60ecfef0403f5f65831f
BLAKE2b-256 3552847f80512b35f9f76520022c37e21f00a93f20becf266601ceeb25e72b2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_azure-2.1.tar.gz:

Publisher: publish.yml on fabge/llm-azure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_azure-2.1-py3-none-any.whl.

File metadata

  • Download URL: llm_azure-2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_azure-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c55d2503fa1bfd18504c830aea40c21cc8ae168d3b22864005c38d399e2d0d28
MD5 750197454f6d4e6d1094fae3249fd5a2
BLAKE2b-256 8a7f34f10594da82f89cbf53f742444956c66ed963c3bba442c79f2db57dbc06

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_azure-2.1-py3-none-any.whl:

Publisher: publish.yml on fabge/llm-azure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.1 This release

2 files

2.0

2 files

1.2

2 files

1.1

2 files

1.0

2 files

0.4

2 files

0.3

2 files

0.2

2 files

0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page