Skip to content

fabge/llm-azure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 at ~/.config/io.datasette.llm/azure/config.yaml:

    mkdir -p "$(dirname "$(llm logs path)")/azure"
    touch "$(dirname "$(llm logs path)")/azure/config.yaml"
  3. 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/
  4. Use it:

    llm -m azure-gpt4o "Hello!"

Configuration

Models are configured in ~/.config/io.datasette.llm/azure/config.yaml.

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)

About

LLM plugin for Azure AI Foundry with Entra ID authentication

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages