|
| 1 | +--- |
| 2 | +summary: "Use an Azure OpenAI resource with OpenClaw for chat, Responses, and images" |
| 3 | +read_when: |
| 4 | + - You have an Azure OpenAI resource and want to use it in OpenClaw |
| 5 | + - You searched for "Azure OpenAI" and could not find setup steps |
| 6 | +title: "Azure OpenAI" |
| 7 | +--- |
| 8 | + |
| 9 | +OpenClaw can run agents on your own Azure OpenAI resource. This page is the |
| 10 | +starting point if you have an Azure OpenAI deployment and want to use it for |
| 11 | +chat and Responses traffic. |
| 12 | + |
| 13 | +<Note> |
| 14 | +This is not [Azure Speech](/providers/azure-speech), which uses a separate |
| 15 | +Speech resource key for text-to-speech. If you have an Azure OpenAI key and |
| 16 | +want chat, Responses, or image models, you are in the right place. |
| 17 | +</Note> |
| 18 | + |
| 19 | +## Which route to use |
| 20 | + |
| 21 | +Azure OpenAI reaches OpenClaw through three routes depending on what you need: |
| 22 | + |
| 23 | +| Goal | Route | Auth | |
| 24 | +| --- | --- | --- | |
| 25 | +| Chat / Responses on a direct Azure OpenAI resource | `azure-openai-responses` custom provider (this page) | Azure OpenAI API key | |
| 26 | +| Chat / images through Microsoft or Azure AI Foundry | [Microsoft Foundry plugin](/plugins/reference/microsoft-foundry) | API key or Entra ID (`az login`) | |
| 27 | +| Image generation on the bundled `openai` provider | [OpenAI provider, Azure endpoints](/providers/openai#azure-openai-endpoints) | Azure OpenAI API key | |
| 28 | + |
| 29 | +If you want Entra ID (`az login`) auth or Foundry deployment discovery, use the |
| 30 | +Microsoft Foundry plugin instead. The rest of this page covers the direct |
| 31 | +API-key path. |
| 32 | + |
| 33 | +## Requirements |
| 34 | + |
| 35 | +- An Azure OpenAI resource with at least one model deployment. |
| 36 | +- An Azure OpenAI API key (not an OpenAI Platform key). |
| 37 | +- A deployment in a region that supports the Responses API. Older regions or |
| 38 | + clients can return 404 for Responses. |
| 39 | + |
| 40 | +## Endpoint styles |
| 41 | + |
| 42 | +Azure exposes two endpoint shapes and OpenClaw handles both: |
| 43 | + |
| 44 | +- **v1 (recommended).** Point `baseUrl` at `.../openai/v1/`. OpenClaw talks to |
| 45 | + it directly and no `api-version` is required. |
| 46 | +- **Classic.** Point `baseUrl` at the bare resource |
| 47 | + (`https://<resource>.openai.azure.com`). OpenClaw adds the Azure |
| 48 | + `api-version` automatically. The default is `preview`; override it with the |
| 49 | + `AZURE_OPENAI_API_VERSION` environment variable. |
| 50 | + |
| 51 | +## Setup with onboarding |
| 52 | + |
| 53 | +`openclaw onboard` can configure this for you. Choose the custom-provider path |
| 54 | +and paste your Azure OpenAI endpoint. Onboarding recognizes |
| 55 | +`*.openai.azure.com` and `*.services.ai.azure.com` hosts, applies the Azure |
| 56 | +deployment path, and sets Azure-appropriate context and token defaults. |
| 57 | + |
| 58 | +## Setup with manual config |
| 59 | + |
| 60 | +Define a custom provider under `models.providers` with the |
| 61 | +`azure-openai-responses` adapter, then set it as your default model. The |
| 62 | +provider id you choose (here, `azure`) becomes the model ref prefix. |
| 63 | + |
| 64 | +```json5 |
| 65 | +{ |
| 66 | + models: { |
| 67 | + providers: { |
| 68 | + azure: { |
| 69 | + api: "azure-openai-responses", |
| 70 | + baseUrl: "https://<your-resource>.openai.azure.com/openai/v1/", |
| 71 | + apiKey: "<azure-openai-api-key>", |
| 72 | + models: [{ id: "<your-deployment-name>" }], |
| 73 | + }, |
| 74 | + }, |
| 75 | + }, |
| 76 | + agents: { |
| 77 | + defaults: { |
| 78 | + model: { primary: "azure/<your-deployment-name>" }, |
| 79 | + }, |
| 80 | + }, |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +Prefer environment substitution for the key rather than inlining it. |
| 85 | + |
| 86 | +### Model names are deployment names |
| 87 | + |
| 88 | +Azure binds models to deployments, so the model `id` in OpenClaw must be your |
| 89 | +**Azure deployment name**, not the public OpenAI model id. If your deployment |
| 90 | +name differs from the model id you want to reference, remap it with the |
| 91 | +`AZURE_OPENAI_DEPLOYMENT_NAME_MAP` environment variable. |
| 92 | + |
| 93 | +### API version |
| 94 | + |
| 95 | +The classic endpoint uses `AZURE_OPENAI_API_VERSION`, which defaults to |
| 96 | +`preview`. The v1 endpoint does not require it. Pin a specific dated version |
| 97 | +when you need a particular GA or preview feature set: |
| 98 | + |
| 99 | +```bash |
| 100 | +export AZURE_OPENAI_API_VERSION="preview" |
| 101 | +``` |
| 102 | + |
| 103 | +## Verify |
| 104 | + |
| 105 | +```bash |
| 106 | +openclaw models list --provider azure |
| 107 | +openclaw models status --probe --probe-provider azure |
| 108 | +``` |
| 109 | + |
| 110 | +## Reported issues |
| 111 | + |
| 112 | +These are open, user-reported issues on the Azure Responses path that |
| 113 | +maintainers have not yet reproduced or confirmed. Treat them as things to watch |
| 114 | +for rather than confirmed platform behavior, and check the linked threads for |
| 115 | +current status before you rely on Responses in production: |
| 116 | + |
| 117 | +- Some resources are reported to return a synthetic zero-token refusal on every |
| 118 | + Responses turn; the `openai-completions` adapter is the suggested workaround |
| 119 | + ([#79570](https://github.com/openclaw/openclaw/issues/79570)). |
| 120 | +- Responses are reported to stall before the first event when memory tools are |
| 121 | + exposed ([#80926](https://github.com/openclaw/openclaw/issues/80926)). |
| 122 | +- Some endpoints are reported to reject `prompt_cache_key` with a 400 |
| 123 | + ([#102907](https://github.com/openclaw/openclaw/issues/102907)). |
| 124 | + |
| 125 | +If chat fails on the Responses adapter, try the same deployment with an |
| 126 | +`openai-completions` custom provider as a fallback. |
| 127 | + |
| 128 | +## Related |
| 129 | + |
| 130 | +- [OpenAI provider](/providers/openai) — Azure image endpoints and shared config |
| 131 | +- [Microsoft Foundry plugin](/plugins/reference/microsoft-foundry) — Entra ID and Foundry deployments |
| 132 | +- [Model providers](/concepts/model-providers) — provider config reference |
0 commit comments