Microsoft Foundry Plugin for OpenClaw - Setup and Usage

Learn how to add Microsoft Foundry as a model provider to OpenClaw, including authentication, chat models, and image generation. For developers integrating Foundry deployments.

Read this when

  • You are installing, configuring, or auditing the microsoft-foundry plugin

Microsoft Foundry plugin

OpenClaw gains support for Microsoft Foundry as a model provider through this plugin.

Distribution

  • Package: @openclaw/microsoft-foundry
  • Installation method: bundled with OpenClaw

Surface

providers: microsoft-foundry; contracts: imageGenerationProviders

  • Image-generation provider: microsoft-foundry

Requirements

  • A Microsoft Foundry or Azure AI Foundry resource that has deployments set up.
  • Authentication via API key using AZURE_OPENAI_API_KEY or a provider API key that has been configured.
  • For Entra ID authentication, the Azure CLI must be installed and az login run before starting. OpenClaw keeps Microsoft Foundry runtime tokens current through az account get-access-token.

Chat models

Chat deployments in Microsoft Foundry rely on the provider model reference microsoft-foundry/<deployment-name>. During onboarding, the Azure CLI is used to locate Foundry resources and deployments, and the deployment name you pick gets written into the model configuration.

For supported OpenAI-compatible chat APIs, OpenClaw talks to the Foundry /openai/v1 endpoint:

  • GPT, o*, computer-use-preview, and DeepSeek-V4 model families use openai-responses by default.
  • MAI-DS-R1 and other chat-completion deployments fall back to openai-completions unless a specific supported API is set.
  • MAI-DS-R1 is flagged as reasoning-capable based on reasoning content rather than reasoning_effort. Its context and output token metadata sit at 163,840 tokens.

Anthropic Claude deployments within Microsoft Foundry follow the Anthropic Messages API format, not the OpenAI-compatible /openai/v1 one. Until the Microsoft Foundry plugin includes a native Anthropic runtime, configure these as a custom anthropic-messages provider. If the Foundry deployment name and the Claude model ID differ, set params.canonicalModelId on the model entry. That lets OpenClaw apply the right wire contracts per model, map /think off correctly, and keep signed thinking intact.

MAI image generation

The plugin registers microsoft-foundry for image_generate with the current Microsoft AI image models:

  • MAI-Image-2.5-Flash
  • MAI-Image-2.5
  • MAI-Image-2e
  • MAI-Image-2

Use a deployed MAI image deployment name as the model ref. Since the MAI API expects your deployment name in the request's model field, the provider does not set a default image model:

{
  agents: {
    defaults: {
      mediaModels: {
        image: {
          primary: "microsoft-foundry/<deployment-name>",
          timeoutMs: 600000,
        },
      },
    },
  },
}

Prompt-only generation hits Microsoft Foundry's MAI generations endpoint: /mai/v1/images/generations. For reference-image edits, /mai/v1/images/edits is called, and only MAI-Image-2.5-Flash and MAI-Image-2.5 deployments are supported.

When only the Foundry endpoint is configured, prompt-only generation can work with a custom deployment name. For image edits using a custom deployment name, pick the deployment via onboarding or supply model metadata so OpenClaw can confirm the deployment is powered by MAI-Image-2.5-Flash or MAI-Image-2.5.

Constraints for MAI images:

  • Output: a single PNG image per request.
  • Size: 1024x1024 is the default; width and height each need to be at least 768 px.
  • Total pixels: width × height cannot exceed 1,048,576.
  • Edits: one input image in PNG or JPEG format.
  • Shared hints that are unsupported, including aspectRatio, resolution, quality, background, and non-PNG outputFormat, are not forwarded to Microsoft Foundry.

Troubleshooting

  • az: command not found: get the Azure CLI installed or switch to API-key auth.
  • Microsoft Foundry endpoint missing for MAI image generation: choose a Foundry deployment during onboarding or add models.providers.microsoft-foundry.baseUrl.
  • supports MAI image deployments only: the chosen image model targets a deployment that is not MAI. For image_generate, use a deployed MAI image model.
546 words · updated Aug 14, 2026