hf-msft-foundry
hf-msft-foundry is an extension for the hf CLI to deploy open models from the Hugging Face collection on Microsoft Foundry, on managed compute within your own Azure subscription, without going through the Microsoft Foundry portal.
Installation
hf extensions install alvarobartt/hf-msft-foundry
Or install it from PyPI with pip install hf-msft-foundry or uv tool install hf-msft-foundry, and use it as hf-msft-foundry instead of hf msft-foundry.
Authentication
Log in with az login, or set the environment variables for a service principal or managed identity. The subscription and the Microsoft Foundry resource default to the Azure CLI selection and the only resource in the subscription, otherwise set AZURE_SUBSCRIPTION_ID and FOUNDRY_ACCOUNT_NAME, or pass --subscription-id and --account.
If you don't have a Microsoft Foundry resource yet, create one with:
hf msft-foundry accounts create my-foundry --resource-group my-foundry-rg --location eastus
Getting started
| Model | Size | Default deployment template |
|---|---|---|
zai-org/GLM-5.3-Flash |
321B | 4 x AMD Instinct MI300X at 512K context |
nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-FP8 |
120B (12B active) | 2 x NVIDIA H100 at 256K context |
google/gemma-4-26B-A4B-it |
26B (4B active) | 1 x NVIDIA A100 at 256K context |
Find a model and its deployment templates, i.e. the accelerators, context length and hourly price per instance:
hf msft-foundry models --search "gemma 4"
hf msft-foundry models google/gemma-4-26B-A4B-it deployment-templates
NAME ACCELERATOR_TYPE ACCELERATOR_COUNT MAX_MODEL_LEN ENVIRONMENT PRICE_PER_HOUR DEFAULT
google--gemma-4-26b-a4b-it--256k-amd-mi300x MI300_192GB 1 262144 hf-vllm-v0-33-0-amd 7.91 False
google--gemma-4-26b-a4b-it--256k-nvidia-a100 A100_80GB 1 262144 hf-vllm-v0-33-0-nvidia 3.95 True
google--gemma-4-26b-a4b-it--256k-nvidia-h100 H100_80GB 1 262144 hf-vllm-v0-33-0-nvidia 7.91 False
google--gemma-4-26b-a4b-it--256k-nvidia-h200 H200_141GB 1 262144 hf-vllm-v0-33-0-nvidia 9.1 False
Check hf msft-foundry quota and hf msft-foundry capacity for the accelerators you need, then deploy with the default template, or another one via --deployment-template:
hf msft-foundry deploy google/gemma-4-26B-A4B-it
hf msft-foundry deploy google/gemma-4-26B-A4B-it --deployment-template 256k-nvidia-h100
It waits until the deployment is ready, which takes about 20 minutes, unless --no-wait is set. The deployment name defaults to <author>--<model>--<timestamp> e.g. google--gemma-4-26b-a4b-it--5083872, or set it with --name.
Then send OpenAI-compatible requests with the deployment name as the model:
export OPENAI_BASE_URL=$(hf msft-foundry accounts info -o json | jq -r .openai_base_url)
export OPENAI_API_KEY=$(hf msft-foundry accounts keys -o json | jq -r .key1)
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="google--gemma-4-26b-a4b-it--5083872",
messages=[{"role": "user", "content": "What's the capital of France?"}],
max_completion_tokens=1024,
)
print(completion.choices[0].message.content)
Finally, delete the deployment to stop paying for it:
hf msft-foundry deployments delete google--gemma-4-26b-a4b-it--5083872 --wait
Commands
| Command | Description |
|---|---|
models [<model> [info|deployment-templates]] [--search] [--version] |
List models, show one, or list its deployment templates |
deploy <model> [--deployment-template] [--name] [--instances] [--version] [--no-wait] |
Deploy a model |
deployments {list,status,wait,scale,delete} |
Manage the deployments |
accounts {list,info,keys,create} |
Manage the Microsoft Foundry resources |
capacity / quota |
Show the available accelerators and the managed compute quota |
All commands accept -o json for machine-readable output, including errors.
Agents
The hf-msft-foundry skill teaches agents how to find, deploy, use and delete models on Microsoft Foundry with hf-msft-foundry.
Metadata
Release files for hf-msft-foundry 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hf_msft_foundry-0.1.1.tar.gz | 14.0 kB | Without provenance | Details for hf_msft_foundry-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hf_msft_foundry-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for hf_msft_foundry-0.1.1-py3-none-any.whl |
Total release size: 31.9 kB
Release files / hf_msft_foundry-0.1.1.tar.gz
| Download URL | hf_msft_foundry-0.1.1.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0a61844b9eb4a745d806091f683591d2e2b2c90d9c24ee0828ed51bdaa8a265
|
|
BLAKE2b-256 checksum How to use checksums |
8df10b0558698473af8bae32da56676d51873d71276c4b295e740f732b49afe3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / hf_msft_foundry-0.1.1-py3-none-any.whl
| Download URL | hf_msft_foundry-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf290e5d7a4724759a1ef066560c5fc1a31fd778fbf7363372145cce7d58fbb3
|
|
BLAKE2b-256 checksum How to use checksums |
20a11579aa310f6d159edae4f468c6840b8c740e5385ab36f208fc9bd4893778
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for hf-msft-foundry 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.