bitter-appointment-81509
11/21/2025, 1:12 PMtall-airline-16756
11/21/2025, 1:12 PMtall-airline-16756
11/21/2025, 1:12 PMAPIConnectionError: failed to generate LLM completion after 4 attempts when using Azure OpenAI with LiveKit Agents. I can help troubleshoot this.
Can you provide the following so I can pinpoint the cause quickly?
1. The code snippet where you configure openai.LLM.with_azure(...) (redact secrets).
2. Values (redacted okay) of these environment variables: AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY or AZURE_OPENAI_ENTRA_TOKEN, and OPENAI_API_VERSION.
3. Result of this connectivity test run from the same VPS:
curl -v "https://<your-resource>.openai.azure.com/openai/deployments?api-version=<OPENAI_API_VERSION>" -H "api-key: $AZURE_OPENAI_API_KEY"
Copy the HTTP status and any error body or connection error.
1. Whether the VPS is behind a firewall/proxy, or in a restricted hosting provider (OVH/Hetzner/etc.), and whether outbound HTTPS is allowed.
2. The deployment name you’re using (e.g., gpt-4o) and whether that deployment exists and is healthy in the Azure portal.
What I’ll check once you provide those:
• Endpoint format and credentials correctness.
• Network reachability and DNS/SSL issues from the VPS.
• Any retry/connection options in your LiveKit config that may need adjustment.
Send those details and I’ll propose targeted next steps.
Sources: Azure OpenAI Realtime API and LiveKit | LiveKit Docs | AI Service Plugin Ecosystem | livekit/livekit_composite | DeepWiki | Azure OpenAI LLM plugin guide | LiveKit docs | Troubleshooting Guide | livekit/livekit_composite | DeepWikibitter-appointment-81509
11/21/2025, 1:13 PMtall-airline-16756
11/21/2025, 1:13 PMAPIStatusError 404 with body {'code':'404','message':'Resource not found'} from livekit.agents when calling Azure OpenAI. That tells us the request reached Azure but the specific resource or deployment couldn’t be found.
To diagnose quickly, please provide:
1. The openai.LLM.with_azure(...) call (redact secrets) — especially the azure_deployment and azure_endpoint values.
2. The exact AZURE_OPENAI_ENDPOINT and azure_deployment you’re using (redact resource name if you prefer).
3. Output of this curl run from the same VPS (copy status and body):
curl -v "https://<your-resource>.openai.azure.com/openai/deployments?api-version=<OPENAI_API_VERSION>" -H "api-key: $AZURE_OPENAI_API_KEY"
1. Confirm OPENAI_API_VERSION value and whether the named deployment exists and is listed in the Azure portal for that resource.
2. Any recent changes to the Azure resource (deleted/renamed deployment, region change) or use of a wrong resource name / trailing slash in the endpoint.
What I’ll check once you send those: endpoint/deployment mismatch, wrong API version, or calling a deployment name that doesn’t exist.bitter-appointment-81509
11/21/2025, 1:14 PMtall-airline-16756
11/21/2025, 1:14 PMgpt-4.1 deployment.
A 404 means Azure reached your request but couldn’t find the named deployment/resource. Please check and share the following so I can help you fix it quickly:
1. The openai.LLM.with_azure(...) call (redact keys) — show azure_deployment and azure_endpoint.
2. Exact AZURE_OPENAI_ENDPOINT and azure_deployment values you set (redact resource name if preferred).
3. OPENAI_API_VERSION value.
4. Output of this curl run from the same VPS (status and response body):
curl -v "https://<your-resource>.openai.azure.com/openai/deployments?api-version=<OPENAI_API_VERSION>" -H "api-key: $AZURE_OPENAI_API_KEY"
1. Confirm in the Azure portal that a deployment named exactly gpt-4.1 exists under that OpenAI resource (deployment names are case-sensitive and must match exactly).
Common causes to double-check:
• Deployment name typo or missing deployment.
• Using the wrong OpenAI resource/endpoint (must be https://<your-resource>.openai.azure.com/).
• Incompatible or incorrect OPENAI_API_VERSION.
Share the requested values/output and I’ll point out the mismatches and next steps.bitter-appointment-81509
11/21/2025, 1:48 PMtall-airline-16756
11/21/2025, 1:48 PMgpt4-1. To resolve the 404, I need a couple quick confirmations and one test run from your VPS.
Please provide or confirm:
1. The openai.LLM.with_azure(...) call (redact secrets) — show azure_deployment and azure_endpoint.
2. The AZURE_OPENAI_ENDPOINT and azure_deployment values you set (exact strings).
3. The OPENAI_API_VERSION value.
4. From the same VPS, run and paste the HTTP status + response body:
curl -v "https://<your-resource>.openai.azure.com/openai/deployments?api-version=<OPENAI_API_VERSION>" -H "api-key: $AZURE_OPENAI_API_KEY"
1. Confirm in the Azure portal that a deployment named exactly gpt4-1 exists (deployment names are case-sensitive and must match the azure_deployment you use).
If gpt4-1 is the model name but your deployment uses a different deployment name (common), tell me the deployment name shown in the Azure portal. Once you share the above, I’ll point out the exact mismatch and next steps.bitter-appointment-81509
11/21/2025, 1:48 PMtall-airline-16756
11/21/2025, 1:48 PMazure_deployment you’re passing to openai.LLM.with_azure(...)
• AZURE_OPENAI_ENDPOINT (exact string)
• OPENAI_API_VERSION value
• The deployment name shown in the Azure portal under your OpenAI resource (copy exact spelling/case)
• Output (status + body) of this run from the same VPS:
curl -v "https://<your-resource>.openai.azure.com/openai/deployments?api-version=<OPENAI_API_VERSION>" -H "api-key: $AZURE_OPENAI_API_KEY"
If your portal shows a deployment name different from gpt4-1 (or gpt-4.1), use that exact deployment name for azure_deployment. Once you share the values/output above, I’ll tell you the exact change to make.
Sources: Azure OpenAI LLM plugin guide | LiveKit docs | Azure OpenAI Realtime API and LiveKit | LiveKit Docs