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 tofoundry_models.yamlautomatically on the nextllminvocation.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_microsoft_foundry-0.1.1.tar.gz.
File metadata
- Download URL: llm_microsoft_foundry-0.1.1.tar.gz
- Upload date:
- Size: 11.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04766fa2f159650d074345dcc4327601d5e5837143e7d74cf9d1751cdf3bb510
|
|
| MD5 |
0af5a47c5c97f892a27384516d2ad5d5
|
|
| BLAKE2b-256 |
e0a6571c9e8121f37ec009b619de1a13d90a7ca9e142bdcb97096b28b5e4470e
|
File details
Details for the file llm_microsoft_foundry-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llm_microsoft_foundry-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
160741f47bd65f029781dc85d9894e0beaf20abb98a3fc65e2735dfb3e741837
|
|
| MD5 |
a52701c79b5ee5caf7334534bd591de1
|
|
| BLAKE2b-256 |
7e8e16c69684d2e6e1cda67c10efc8990bfe4ad4a5033238c5954f4761ffc40d
|