Azure OpenAI "DeploymentNotFound" — deployment name vs model ID (2026) — Fix Guide (2026) | AI Error Hub
Home Providers Azure OpenAI Deployment name vs model ID
Azure OpenAI Routing · Deployment ID Severity: High HTTP 404

Azure OpenAI DeploymentNotFound — deployment name vs model ID

Every developer coming from openai.com hits this within their first hour on Azure. The SDK looks identical but the model parameter means something completely different.

By Ahmed R. · Senior AI Infrastructure Engineer Published 2026-07-26 Verified 2026-07-26

Quick fix (TL;DR)

Resolution: On Azure OpenAI, the model parameter is not the model ID (gpt-4o) — it is the deployment name you chose when you deployed the model in the Azure portal or via az cognitiveservices. Use the AzureOpenAI client (not OpenAI) and pass your deployment name to model= or azure_deployment=. The fix is a two-line change to the client instantiation.

Real error messages you'll see

These are the exact strings returned by the Azure OpenAI service and its SDKs when this error occurs. Copy-paste-searching any of them should land on this page.

Python SDK — openai 1.x (raw)
openai.NotFoundError: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}
REST — raw HTTP response
HTTP/1.1 404 Not Found
apim-request-id: 8f42a1b3-9c7e-4d5f-b8a1-3c8e7f9d2b4c
Content-Type: application/json

{
  "error": {
    "code": "DeploymentNotFound",
    "message": "The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."
  }
}
Node.js SDK — @azure/openai
RestError: The API deployment for this resource does not exist. (code: 'DeploymentNotFound', statusCode: 404)

Reference

openai.com vs Azure OpenAI — what the parameters actually mean

Same SDK signature, different semantics. The model field is polymorphic: on the OpenAI platform it identifies a foundation model; on Azure it identifies your deployment (which happens to wrap a model).

Conceptopenai.comAzure OpenAI
Client classOpenAI()AzureOpenAI()
Auth parameterapi_keyapi_key + azure_endpoint + api_version
Value of model=Model ID, e.g. gpt-4oDeployment name you chose, e.g. gpt4o-prod
Alt parametern/aazure_deployment= on client init
URL shapeapi.openai.com/v1/chat/completions{resource}.openai.azure.com/openai/deployments/{deployment}/chat/completions?api-version=...
Discover namesGET /v1/modelsAzure portal → your resource → Deployments; or az cognitiveservices account deployment list

Where the deployment name comes from

The name is user-defined at deployment creation time and is independent of the underlying model.

Underlying modelTypical deployment names in the wildWhat developers wrongly pass
gpt-4o (2024-08-06)gpt4o-prod, gpt-4o, chat-prodgpt-4o (may or may not exist)
gpt-4o-minigpt4o-mini, cheap-chatgpt-4o-mini
text-embedding-3-largeembed-large, text-embedding-3-largetext-embedding-3-large
gpt-4.1gpt41, gpt-4.1-prodgpt-4.1
o3-minio3-mini, reasoning-prodo3-mini

Root causes, ranked by frequency

Based on developer reports across Azure OpenAI SDK forums, GitHub issues, and Microsoft Q&A during 2025–2026.

  • 55%
    Passing the OpenAI model ID (gpt-4o) instead of your Azure deployment name. This is the #1 cause. The deployment name is arbitrary — whatever the team who provisioned the resource picked. The two only match when someone deliberately named the deployment after the model.
  • 18%
    Using the OpenAI client instead of AzureOpenAI. Even with a valid deployment name, hitting api.openai.com with an Azure API key produces auth or 404 errors — AzureOpenAI routes to {resource}.openai.azure.com/openai/deployments/<name>/….
  • 11%
    Deployment exists in a different region or resource. Development uses East US, production hits West Europe — deployments are per-resource, not shared. The name being identical is a coincidence, not a guarantee.
  • 7%
    Deployment was created < 5 minutes ago. Azure sometimes needs propagation time; the error message says so explicitly. Retry after 60–120 seconds.
  • 5%
    Case mismatch or typo. Deployment names are case-sensitive in the URL path: GPT4o-Prod and gpt4o-prod are different deployments.
  • 3%
    Deployment was deleted or renamed and code still references the old name. Common after infra migrations or Terraform re-deploys.
  • 1%
    Wrong api_version. Some deployments (e.g. o3-mini, embeddings v3) require newer API versions; older versions return 404 instead of a clear "API version not supported" error.

Fixes — copy-paste solutions

Fix #1

Use AzureOpenAI client and pass your deployment name

The canonical fix for 80% of cases.

Swap the OpenAI client for AzureOpenAI, provide the endpoint and API version, and pass your deployment name as the model argument. Nothing else in your code changes.

chat_azure.py
import os
from openai import AzureOpenAI

# CORRECT: AzureOpenAI client, not OpenAI
client = AzureOpenAI(
    api_key=os.environ["AZURE_OPENAI_API_KEY"],
    azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],   # https://myresource.openai.azure.com
    api_version="2024-10-21",                              # or a newer GA version
)

# CORRECT: model= is your DEPLOYMENT NAME, not "gpt-4o"
response = client.chat.completions.create(
    model="gpt4o-prod",                                    # <-- your deployment name
    messages=[
        {"role": "user", "content": "Hello Azure!"},
    ],
    max_tokens=200,
)

print(response.choices[0].message.content)
.env
# Fill these three. The deployment name is what you set in Azure Portal
# under: your Azure OpenAI resource -> Deployments -> Deployment name column.
AZURE_OPENAI_API_KEY=your-key-here
AZURE_OPENAI_ENDPOINT=https://myresource.openai.azure.com
AZURE_OPENAI_DEPLOYMENT=gpt4o-prod
Common trap: your teammate names the deployment gpt-4o literally so the code looks the same. It only works because someone chose that name. Never assume — always confirm the deployment name from the portal or CLI before shipping.
Fix #2

List deployments programmatically to discover the correct name

Use this in scripts, CI, or when onboarding a new environment.

The Azure OpenAI data plane does not expose a deployment listing endpoint; you use the Azure Cognitive Services management API instead. This snippet lists every deployment and its underlying model so you can pick the right name at runtime.

list_deployments.py
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient

# Uses az login or workload identity — no static keys needed
credential = DefaultAzureCredential()
subscription_id = os.environ["AZURE_SUBSCRIPTION_ID"]
resource_group = os.environ["AZURE_RESOURCE_GROUP"]
account_name = os.environ["AZURE_OPENAI_RESOURCE"]   # the resource name, not endpoint

client = CognitiveServicesManagementClient(credential, subscription_id)

print(f"Deployments in {account_name}:")
print(f"{'Deployment name':<30} {'Model':<25} {'Version':<15} {'SKU':<15}")
print("-" * 85)

for deployment in client.deployments.list(resource_group, account_name):
    props = deployment.properties
    model = props.model
    sku = deployment.sku.name if deployment.sku else "-"
    print(f"{deployment.name:<30} {model.name:<25} {model.version:<15} {sku:<15}")
run.sh
# Prereqs
pip install azure-identity azure-mgmt-cognitiveservices

# Login (interactive) — for CI use a service principal or workload identity
az login

# Set context
export AZURE_SUBSCRIPTION_ID=$(az account show --query id -o tsv)
export AZURE_RESOURCE_GROUP=my-rg
export AZURE_OPENAI_RESOURCE=my-aoai-resource

python list_deployments.py
Alternative one-liner: az cognitiveservices account deployment list --name $AZURE_OPENAI_RESOURCE --resource-group $AZURE_RESOURCE_GROUP -o table.
Fix #3

Guard the client with a deployment-existence check on startup

Fail fast in dev; retry gracefully in prod (handles the 5-minute propagation window).

Wrap your client factory so that startup fails immediately with a clear error if the deployment does not exist, and retries with backoff when the error indicates recent creation. This turns a runtime 404 into a boot-time assertion.

azure_client_factory.py
import os
import time
import logging
from typing import Optional
from openai import AzureOpenAI, NotFoundError

log = logging.getLogger(__name__)

class DeploymentMissingError(RuntimeError):
    """Raised when the configured Azure OpenAI deployment does not exist."""

def build_azure_client(
    deployment: str,
    api_version: str = "2024-10-21",
    warmup: bool = True,
    max_retries: int = 3,
) -> AzureOpenAI:
    """Build an AzureOpenAI client and verify the deployment is reachable."""

    client = AzureOpenAI(
        api_key=os.environ["AZURE_OPENAI_API_KEY"],
        azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
        api_version=api_version,
    )

    if not warmup:
        return client

    # Cheap probe: 1-token completion. Costs a fraction of a cent.
    for attempt in range(1, max_retries + 1):
        try:
            client.chat.completions.create(
                model=deployment,
                messages=[{"role": "user", "content": "ok"}],
                max_tokens=1,
            )
            log.info("Deployment %s reachable", deployment)
            return client
        except NotFoundError as e:
            body = str(e).lower()
            recently_created = "last 5 minutes" in body or "please wait" in body
            if recently_created and attempt < max_retries:
                wait = 30 * attempt
                log.warning("Deployment %s not ready — retry in %ss", deployment, wait)
                time.sleep(wait)
                continue
            raise DeploymentMissingError(
                f"Azure OpenAI deployment '{deployment}' does not exist on "
                f"{os.environ['AZURE_OPENAI_ENDPOINT']}. "
                f"Check portal -> Deployments, or run: az cognitiveservices "
                f"account deployment list --name <resource> -g <rg>"
            ) from e

# Usage in app startup
if __name__ == "__main__":
    client = build_azure_client(deployment=os.environ["AZURE_OPENAI_DEPLOYMENT"])
Cost note: the 1-token probe runs once per process start, not per request. For most services this is well under one cent per day and catches configuration drift before real traffic sees the 404.

Prevention checklist

Ship these seven safeguards once and this error stops appearing in your logs.

  • Always instantiate AzureOpenAI (not OpenAI) when your endpoint is *.openai.azure.com. Add a lint rule or import-check in CI.
  • Store the deployment name in an environment variable (e.g. AZURE_OPENAI_DEPLOYMENT) rather than hardcoding — this is the value that varies per environment.
  • Document the mapping deployment name → underlying model → API version in your infra README. Include what to do when Azure deprecates a model version.
  • On startup, probe the deployment with a 1-token request and fail fast if it returns 404 — cheaper than discovering it under production load.
  • When onboarding a new environment, run az cognitiveservices account deployment list before writing any code — never assume names carry across resources.
  • Pin api_version to a GA version (e.g. 2024-10-21) and bump it deliberately when adopting new features. Preview versions can disappear.
  • If you use Terraform or Bicep, output the deployment name as a stack output and consume it from your app config — never let humans retype it.

Frequently asked questions

Azure OpenAI is a managed service where you provision capacity per model, per region, per SKU (standard, provisioned throughput, batch). The deployment name is the unit that Azure meters, bills, and applies quotas to — it wraps the underlying model. This lets one Azure resource host multiple deployments of the same model with different SKUs or content filters, which a raw model ID cannot express.
Yes, and many teams do — e.g. naming a GPT-4o deployment gpt-4o. Your code then works verbatim on both platforms. The trade-off is that you lose the ability to run multiple deployments of the same model (for A/B testing, blue-green, or different content filter policies). For simple single-tenant apps this is fine; for platforms serving multiple clients it forces you to prefix deployment names anyway.
No. A 404 from Azure OpenAI is billed as a rejected request — you are charged neither for input tokens nor output tokens. However, high volumes of 404s can trigger throttling and pollute your monitoring dashboards. Fix the config, do not retry blindly.
openai.com returns "model not found" when the model ID does not exist on the platform (typos, deprecated names). Azure OpenAI returns DeploymentNotFound when the deployment does not exist on your specific resource — even if the underlying model is generally available. The Azure error is scoped per-resource, per-region, per-tenant; the OpenAI error is global.
Three things to check in order:
  1. Case-sensitivity — the deployment name in the URL is case-sensitive, GPT4o and gpt4o are different.
  2. Endpoint mismatch — verify azure_endpoint points to the same resource that hosts the deployment, not a sibling resource in the same subscription.
  3. API version — some newer models require api_version 2024-10-21 or later, and older versions surface as 404 instead of a clearer error.

Get the weekly AI-error digest

New fixes, provider status recaps, and one deep tutorial — every Tuesday. 8,400+ engineers.