Skip to main content

lmux-azure-foundry

Azure AI Foundry provider for lmux. Talks to the Azure OpenAI REST API directly with httpx.

Supports chat completions, streaming, embeddings, and the Responses API.

Part of the lmux ecosystem: standardized interface, cost tracking on every response, and registry-based routing across providers.

Optional Extras

  • lmux-azure-foundry[identity]: Azure AD token authentication via azure-identity

Auth

Three authentication methods:

API Key (default)

Set AZURE_FOUNDRY_API_KEY in your environment:

from lmux_azure_foundry import AzureFoundryProvider

provider = AzureFoundryProvider(endpoint="https://your-resource.openai.azure.com")

Azure AD Token

from lmux_azure_foundry import AzureFoundryProvider, AzureAdToken

provider = AzureFoundryProvider(
    endpoint="https://your-resource.openai.azure.com",
    auth=my_auth_returning_azure_ad_token,
)

Token Provider

from lmux_azure_foundry import AzureFoundryTokenAuthProvider

provider = AzureFoundryProvider(
    endpoint="https://your-resource.openai.azure.com",
    auth=AzureFoundryTokenAuthProvider(),  # uses azure-identity DefaultAzureCredential
)

Usage

Chat

from lmux import UserMessage

response = provider.chat("gpt-4o", [UserMessage(content="Hello")])
print(response.content)
print(response.cost)

Streaming

for chunk in provider.chat_stream("gpt-4o", [UserMessage(content="Hello")]):
    if chunk.delta:
        print(chunk.delta, end="")

Embeddings

response = provider.embed("text-embedding-3-small", "Hello")
print(response.embeddings)

Responses API

Required for models that are only served through the Responses API:

response = provider.create_response("gpt-5-pro", "Hello")
print(response.output_text)

Async

All methods have async variants: achat, achat_stream, aembed, acreate_response.

Registry

Use with the lmux registry to route across multiple providers:

from lmux import Registry

registry = Registry()
registry.register("azure", provider)
response = registry.chat("azure/gpt-4o", messages)

Provider Params

from lmux_azure_foundry import AzureFoundryParams

response = provider.chat(
    "gpt-4o",
    messages,
    provider_params=AzureFoundryParams(deployment_type="data_zone"),
)
Parameter Type Description
reasoning_effort "low" | "medium" | "high" Reasoning effort for o-series models
seed int Deterministic sampling seed
user str End-user identifier
prompt_cache_key str Cache key for Azure's automatic prompt caching (chat + responses)
prompt_cache_retention "in_memory" | "24h" Prompt cache retention policy (chat + responses)
deployment_type "global" | "data_zone" | "regional" Affects cost calculation only, not sent to API
data_zone "us" | "eu" Pricing zone for Data Zone deployments; defaults to "us"

deployment_type="data_zone" uses US pricing when data_zone is omitted. Set data_zone="eu" for an EU Data Zone deployment. This selects the applicable model-specific premium for cost reporting; it does not change API routing. Other deployment types ignore data_zone.

Constructor Options

AzureFoundryProvider(
    endpoint=...,      # required, Azure resource endpoint
    auth=...,          # AuthProvider, default: AzureFoundryKeyAuthProvider()
    api_version=...,   # API version (default: "2025-04-01-preview")
    timeout=...,       # Request timeout in seconds
    max_retries=...,   # Max retry attempts
    default_headers=...,  # Optional headers included with every request
    transport=...,        # Optional httpx.BaseTransport for the sync client (proxies, testing)
    async_transport=...,  # Optional httpx.AsyncBaseTransport for the async client
)

default_headers is useful for gateway authentication, tracing, and routing. Foundry-managed authentication and content-type headers take precedence over caller values, case-insensitively.

Metadata

Release files for lmux-azure-foundry 0.10.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lmux-azure-foundry 0.10.8
File Size Uploaded Provenance Actions
lmux_azure_foundry-0.10.8.tar.gz 19.7 kB With provenance Details for lmux_azure_foundry-0.10.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lmux-azure-foundry 0.10.8
File Interpreter ABI Platform Actions
lmux_azure_foundry-0.10.8-py3-none-any.whl Python 3 none any Details for lmux_azure_foundry-0.10.8-py3-none-any.whl

Total release size: 42.3 kB

Release files / lmux_azure_foundry-0.10.8.tar.gz

Download URL lmux_azure_foundry-0.10.8.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1089c0b41ce04d87fa75ece5394b979fb416385e49fed88fd10f9183fd0ae63a
BLAKE2b-256 checksum
How to use checksums
eb4803e26bf0c6d7c208ff040e495e561c90bd6e09a1369f80af7abbcd8a6f78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / lmux_azure_foundry-0.10.8-py3-none-any.whl

Download URL lmux_azure_foundry-0.10.8-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53d415989383ecd8954f9ab6081c41755d889cc5642a805ed5cb2c06ad7760a7
BLAKE2b-256 checksum
How to use checksums
6769c21ee1b2fb4aff56b7a9e521023e811976f918d3d40b000d2ca3b7d7d5b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for lmux-azure-foundry 0.10.8

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lmux_azure_foundry-0.10.8.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page