Skip to main content

Azure AI Foundry plugin for LLM - access Anthropic, Llama, Mistral and more via Azure

Project description

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)

Project details


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.0.tar.gz (8.9 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.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_azure-2.0.tar.gz
  • Upload date:
  • Size: 8.9 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.0.tar.gz
Algorithm Hash digest
SHA256 cbb3dfc872e3e1b8a03eea1a661240b2e46c188970bd1ae6e5abf12719f6f35f
MD5 b86f5b6972a887194da060c4214545df
BLAKE2b-256 1188d5f2744fcfa4ea9699515193b0e483652a75a3eb5dbb461b3d04d33ced4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_azure-2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: llm_azure-2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0da282696b7f9a348f68015558378fda182c520401aa75e2db73257ba14ca9b8
MD5 2edb688b3e247e28e30832c415eded7f
BLAKE2b-256 b29f17a9f338ca5a1d3faaf3bf498e77f0cc1bec51da8b8b5e66a18ec85b1828

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_azure-2.0-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.

Supported by

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