DeploymentNotFound llm config_error ai_generated true

openai.NotFoundError:未找到资源。部署 '<deployment-name>' 不存在。

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

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

其他格式: JSON · Markdown 中文 · English
95%修复率
90%置信度
1证据数
2023-12-01首次发现

版本兼容性

版本状态引入弃用备注
openai==1.30.0 active
azure-identity==1.16.0 active
azure-ai-openai==1.0.0 active

根因分析

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

English

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

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 90% 失败

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

  2. 85% 失败

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

  3. 95% 失败

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