Skip to main content

llm-microsoft-foundry

LLM plugin for Microsoft Foundry models.

Authenticates transparently using az login (no API key needed) and lets you talk to any model deployed in a Foundry resource directly from the llm CLI.

Install

llm install llm-microsoft-foundry
# or, from a local clone:
llm install -e .

Dependencies (azure-identity, httpx) are installed automatically.

Authenticate

az login
az account set --subscription "<subscription-id-or-name>"

The plugin uses DefaultAzureCredential, so any credential that works with the Azure SDK (az cli cache, managed identity, env vars) works here too.

Configure a model

llm foundry add-model \
  --model-id foundry-gpt-5.4 \
  --api-base https://<your-resource>.services.ai.azure.com \
  --deployment gpt-5.4 \
  --tools \
  --alias gpt54
Option Description
--model-id Unique local identifier (used with llm -m)
--api-base Foundry resource root URL (the resource root, not a project URL)
--deployment Exact deployment name in Foundry (defaults to --model-id)
--tools / --no-tools Enable tool calling support
--vision / --no-vision Enable image attachment support
--alias Short alias(es), repeatable

Settings are stored in <llm user dir>/foundry_models.yaml — same folder as llm's own config files (C:\Users\<you>\AppData\Roaming\io.datasette.llm\ on Windows). You can edit it directly:

models:
- model_id: foundry-gpt-5.4
  api_base: https://my-resource.services.ai.azure.com
  deployment: gpt-5.4
  supports_tools: true
  supports_vision: false

- model_id: foundry-deepseek-v3.2
  api_base: https://my-resource.services.ai.azure.com
  deployment: DeepSeek-V3.2
  supports_tools: false
  supports_vision: false
  aliases:
  - deepseek

Migrating from an older version? If you have a foundry_config.json, it is migrated to foundry_models.yaml automatically on the next llm invocation.

Use

# List configured models
llm foundry list-models

# Prompt a model
llm -m foundry-gpt-5.4 "What is the capital of France?"

# Or using an alias
llm -m gpt54 "Explain quantum entanglement in one sentence"

# Set as default model
llm models default foundry-gpt-5.4

# Check which Azure identity is active
llm foundry whoami

Options

llm -m foundry-gpt-5.4 -o temperature 0.2 -o max_tokens 512 "Write a haiku"
Option Default Description
temperature model default Sampling temperature (0–2)
max_tokens model default Max output tokens
top_p model default Nucleus sampling probability

Remove a model

llm foundry remove-model foundry-gpt-5.4

Required Azure role

The identity must have the Cognitive Services User role on the Foundry resource (Owner/Contributor alone does not grant inference access).

How it works

llm CLI
  └─ llm-microsoft-foundry plugin
       ├─ DefaultAzureCredential (azure-identity)  ← uses az login cache
       │    └─ Entra token for https://ai.azure.com/.default
       └─ POST <api_base>/openai/deployments/<deployment>/chat/completions?api-version=v1
              Authorization: Bearer <token>

No proxy, no extra service, no master key — direct to Foundry.

Development

git clone https://github.com/stefanstranger/llm-microsoft-foundry
cd llm-microsoft-foundry
llm install -e .

Download files

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

Source Distribution

llm_microsoft_foundry-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

llm_microsoft_foundry-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file llm_microsoft_foundry-0.1.0.tar.gz.

File metadata

  • Download URL: llm_microsoft_foundry-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llm_microsoft_foundry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b1089333182cb6b0844a39c4b2ea7a18113c3b31a870a9be596760627617ffb
MD5 fb7e02c6ca857a2b78d6b6d9104f9ae2
BLAKE2b-256 30cd9c49107f02fb8ce2ea6278a6d321d348faed52d81d2fe27f2bcd984365a1

See more details on using hashes here.

File details

Details for the file llm_microsoft_foundry-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_microsoft_foundry-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llm_microsoft_foundry-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f228291a84b7d4c4c4b248c47caaae3bfe9d409c5c790938cd1ba9aaf900b7de
MD5 f2176331e910a0350e788b3c058c43f2
BLAKE2b-256 e7cd0b51acc94a281a300cc90e8191c17a03074c26c9b3563064276b6db71743

See more details on using hashes here.

Supported by

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