DeploymentNotFound llm config_error ai_generated true

openai.NotFoundError: Resource not found. Deployment '<deployment-name>' does not exist.

ID: llm/azure-openai-deployment-not-found

Also available as: JSON · Markdown · 中文
95%Fix Rate
90%Confidence
1Evidence
2023-12-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
openai==1.30.0 active
azure-identity==1.16.0 active
azure-ai-openai==1.0.0 active

Root Cause

Azure OpenAI endpoint URL or deployment name is misconfigured: the deployment may have been deleted, renamed, or the resource group/region in the endpoint URL does not match the actual deployment location.

generic

中文

Azure OpenAI 端点 URL 或部署名称配置错误:部署可能已被删除、重命名,或者端点 URL 中的资源组/区域与实际部署位置不匹配。

Official Documentation

https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal#deploy-a-model

Workarounds

  1. 95% success Verify the deployment name in Azure Portal: go to Azure OpenAI Studio > Deployments > copy the exact deployment name (case-sensitive). Then set `openai.Deployment('your-deployment-name')`.
    Verify the deployment name in Azure Portal: go to Azure OpenAI Studio > Deployments > copy the exact deployment name (case-sensitive). Then set `openai.Deployment('your-deployment-name')`.
  2. 90% success List all deployments programmatically: `from openai import AzureOpenAI; client = AzureOpenAI(api_key=key, api_version='2023-12-01-preview', azure_endpoint=endpoint); deployments = client.deployments.list(); print([d.id for d in deployments])`
    List all deployments programmatically: `from openai import AzureOpenAI; client = AzureOpenAI(api_key=key, api_version='2023-12-01-preview', azure_endpoint=endpoint); deployments = client.deployments.list(); print([d.id for d in deployments])`
  3. 98% success Ensure the `azure_endpoint` includes the full resource URL (e.g., `https://my-resource.openai.azure.com/`) and matches the region where the deployment was created.
    Ensure the `azure_endpoint` includes the full resource URL (e.g., `https://my-resource.openai.azure.com/`) and matches the region where the deployment was created.

中文步骤

  1. Verify the deployment name in Azure Portal: go to Azure OpenAI Studio > Deployments > copy the exact deployment name (case-sensitive). Then set `openai.Deployment('your-deployment-name')`.
  2. List all deployments programmatically: `from openai import AzureOpenAI; client = AzureOpenAI(api_key=key, api_version='2023-12-01-preview', azure_endpoint=endpoint); deployments = client.deployments.list(); print([d.id for d in deployments])`
  3. Ensure the `azure_endpoint` includes the full resource URL (e.g., `https://my-resource.openai.azure.com/`) and matches the region where the deployment was created.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The error is about the deployment name, not the API key; a valid key with a wrong deployment still fails.

  2. 85% fail

    The deployment is tied to a specific model; changing the model in code doesn't change the deployment's actual model.

  3. 95% fail

    The endpoint URL must match the exact resource; a wrong region or resource name will still cause NotFoundError.