> ## Documentation Index
> Fetch the complete documentation index at: https://gomodel.enterpilot.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure OpenAI: Deployment URLs and api-version

> Configure Azure OpenAI and Azure AI Foundry in GoModel using v1 or deployment-based URLs.

Azure OpenAI speaks the OpenAI API shape with two GoModel-handled differences:
an `api-key` header instead of `Authorization: Bearer`, and an `api-version`
query parameter on deployment-scoped URLs.

## Configure

```bash theme={null}
AZURE_API_KEY=...
AZURE_BASE_URL=https://your-resource.openai.azure.com/openai/deployments/your-deployment
AZURE_API_VERSION=2024-10-21   # optional, defaults to 2024-10-21
GOMODEL_MASTER_KEY=change-me
```

Or in `config.yaml`:

```yaml theme={null}
providers:
  azure:
    type: azure
    base_url: "${AZURE_BASE_URL}"
    api_key: "${AZURE_API_KEY}"
    api_version: "2024-10-21"
```

### Azure AI Foundry (v1 API)

Azure AI Foundry endpoints such as
`https://proj1-resource.services.ai.azure.com/openai/v1/responses` use the
unversioned v1 API. Set the base URL to everything up to `/openai/v1`:

```bash theme={null}
AZURE_API_KEY=...
AZURE_BASE_URL=https://proj1-resource.services.ai.azure.com/openai/v1
```

On a `/openai/v1` base URL GoModel sends no `api-version` by default, and the
`model` in the request body selects the deployment, so one provider covers
every deployment in the resource. Leave `AZURE_API_VERSION` (and `api_version`
in the YAML above) unset; set it to `preview` only to opt into preview features. Classic `https://your-resource.openai.azure.com/openai/v1`
URLs work the same way. Realtime sessions use the GA
`/openai/v1/realtime?model=<deployment>` websocket.

`/openai/v1/models` lists the resource's models, so a deployment named after its
model (the Foundry default) routes as-is. For custom deployment names, list them
in `AZURE_MODELS` and set `AZURE_MODELS_MODE=merge` so the listed models stay
alongside the discovered ones (see [Models modes](https://gomodel.enterpilot.io/docs/advanced/config-yaml.md#models-modes)).

## Run GoModel

```bash Docker (.env file) theme={null}
docker run --rm -p 8080:8080 --env-file .env enterpilot/gomodel
```

```bash Docker (inline -e) theme={null}
docker run --rm -p 8080:8080 \
  -e GOMODEL_MASTER_KEY="change-me" \
  -e AZURE_API_KEY="..." \
  -e AZURE_BASE_URL="https://your-resource.openai.azure.com/openai/deployments/your-deployment" \
  enterpilot/gomodel
```

```bash Binary (make build) theme={null}
make build
./bin/gomodel
```

## Verify

```bash curl theme={null}
curl -s http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer $GOMODEL_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "messages": [{"role": "user", "content": "Reply with the single word ok."}],
    "max_tokens": 80
  }'
```

```python Python theme={null}
import os

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",
    api_key=os.environ["GOMODEL_MASTER_KEY"],
)

completion = client.chat.completions.create(
    model="gpt-5",
    messages=[{"role": "user", "content": "Reply with the single word ok."}],
    max_tokens=80,
)

print(completion.choices[0].message.content)
```

```javascript JavaScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "http://localhost:8080/v1",
  apiKey: process.env.GOMODEL_MASTER_KEY,
});

const completion = await client.chat.completions.create({
  model: "gpt-5",
  messages: [{ role: "user", content: "Reply with the single word ok." }],
  max_tokens: 80,
});

console.log(completion.choices[0].message.content);
```

`GET /v1/models` returns the deployments the Azure resource exposes with
`owned_by: "azure"`. Streaming, Responses, embeddings, and batches all work the
same way; batches route through the `/openai/batches` resource path
(`/openai/v1/batches` on v1 base URLs).

## Decision models

Foundry serves two kinds of decision model, and GoModel answers
[`POST /v1/decisions`](https://gomodel.enterpilot.io/docs/advanced/decisions-api) for both, whichever
`AZURE_BASE_URL` form you use:

| Model | Foundry API | How GoModel serves it |
| - | - | - |
| `gpt-6-luna` | OpenAI's Decisions API (`/openai/v1/decisions`) | Forwarded as sent; text and images |
| `Microsoft-Decision-1` | System One (`/providers/microsoft/v1/systemone`) | Translated; also forwarded on [`POST /v1/systemone`](https://gomodel.enterpilot.io/docs/advanced/systemone-api); text and JSON only |

GoModel picks the API by deployment: one its model catalog describes as a chat
model, such as `gpt-6-luna`, goes to the Decisions API, and any other goes to
System One. Name the `gpt-6-luna` deployment `gpt-6-luna`.

Azure rejects deployment names containing `Microsoft`, so name the
Microsoft-Decision-1 deployment, for example, `ms-decision-1`, and list it so
GoModel can route it:

```bash theme={null}
AZURE_MODELS=ms-decision-1
AZURE_MODELS_MODE=merge
```

```bash theme={null}
curl -s http://localhost:8080/v1/decisions \
  -H "Authorization: Bearer $GOMODEL_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "azure/ms-decision-1",
    "input": "The API returns 500 on every call.",
    "questions": [{
      "type": "choice",
      "name": "team",
      "instructions": "Which team should handle this ticket?",
      "choices": [
        {"value": "billing", "description": "Charges, invoices, and refunds"},
        {"value": "engineering", "description": "Bugs, errors, and outages"}
      ]
    }]
  }'
```

Microsoft-Decision-1 reads text and JSON only: `/v1/decisions` refuses images
for it, while `/v1/systemone` forwards them and returns Foundry's response,
including any error. `gpt-6-luna`'s Decisions API is not available in East US 2.
New subscriptions start with no quota for either model, so request quota before
deploying.

## Multiple deployments

Each Azure deployment is its own endpoint. Register them as separate providers
with suffixed env vars:

```bash theme={null}
AZURE_GPT5_API_KEY=...
AZURE_GPT5_BASE_URL=https://your-resource.openai.azure.com/openai/deployments/gpt-5

AZURE_EMBED_API_KEY=...
AZURE_EMBED_BASE_URL=https://your-resource.openai.azure.com/openai/deployments/text-embedding-3-small
```

This registers `azure-gpt5` and `azure-embed`. To expose every deployment under
one resource through a single provider, use a
[v1 base URL](#azure-ai-foundry-v1-api) instead.

## Notes

* GoModel accepts the deployment-scoped URL the portal hands you. For
  account-wide operations (model listing, batches) GoModel strips the
  `/openai/deployments/<deployment>` suffix automatically, so one
  `AZURE_BASE_URL` covers both chat and resource-level calls.
* `AZURE_API_VERSION` defaults to `2024-10-21` on deployment-scoped URLs and
  to none on v1 URLs. Set it only when you need a different stable or preview
  version — for example a newer Responses API surface.

## Troubleshooting

* **`401 Unauthorized` / `403`** — `AZURE_API_KEY` does not match the resource
  hosting the deployment, or the deployment name in the URL is wrong.
* **`Resource not found` / `DeploymentNotFound`** — the model in the request
  body must be the deployment name, not the underlying base model.
* **`unsupported api version`** — bump `AZURE_API_VERSION` to a version the
  feature you're calling supports. Newer Responses API features require recent
  preview versions. On v1 base URLs, leave it unset or use `preview`.
* **`404` on Azure AI Foundry** — the base URL must end at `/openai/v1`, not at
  the full endpoint (`/openai/v1/responses`) or the project URL
  (`/api/projects/...`).

## References

* [Use the Azure OpenAI Decisions API](https://learn.microsoft.com/azure/foundry/openai/how-to/decisions)
* [Deploy and use Microsoft-Decision-1](https://learn.microsoft.com/azure/foundry/foundry-models/how-to/use-foundry-models-microsoft-decision)
* [Azure OpenAI v1 API lifecycle](https://learn.microsoft.com/azure/ai-foundry/openai/api-version-lifecycle)
* [Azure OpenAI REST API versioning](https://learn.microsoft.com/azure/ai-services/openai/reference)
* [Azure OpenAI deployments](https://learn.microsoft.com/azure/ai-services/openai/how-to/create-resource)
* [Azure OpenAI authentication](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.