404 Resource not found when calling GPT-5-Chat via Azure AI Foundry inference endpoint

sagul jafarullah 0 Reputation points
2025-08-09T11:24:45.42+00:00

What I’ve tried:

Verified the endpoint is correct and ends with /v1.

Confirmed the key is from the Foundry inference deployment (not Azure OpenAI).

Tried both the OpenAI Python SDK and cURL.

Ensured the model name in the request is exactly gpt-5-chat.

Tested immediately after deployment and waited >10 minutes in case of propagation delay.

Attempted both Authorization: Bearer <key> and api-key: <key> headers.

Sample request (PowerShell):

powershell
Copy
$endpoint = "https://sagul-me43r8sb-swedencentral.services.ai.azure.com/v1/chat/completions"
$key      = "<FOUNDRY_INFERENCE_KEY>"

$body = @{
  model    = "gpt-5-chat"
  messages = @(
    @{ role = "system"; content = "You are helpful." },
    @{ role = "user";   content = "Say hello" }
  )
  max_tokens = 50
} | ConvertTo-Json -Depth 5

Invoke-RestMethod -Method Post -Uri $endpoint `
  -Headers @{ "api-key" = $key; "Content-Type" = "application/json" } `
  -Body $body

Error returned:

json
Copy
{"error":{"code":"404","message":"Resource not found"}}

I need guidance on:

Whether api-key authentication is supported for Foundry inference endpoints.

If there’s a configuration step required in Azure AI Foundry for the endpoint to be usable with the SDK.

  • Any known issues with gpt-5-chat in the Sweden Central region.What I’ve tried:
    • Verified the endpoint is correct and ends with /v1.
    • Confirmed the key is from the Foundry inference deployment (not Azure OpenAI).
    • Tried both the OpenAI Python SDK and cURL.
    • Ensured the model name in the request is exactly gpt-5-chat.
    • Tested immediately after deployment and waited >10 minutes in case of propagation delay.
    • Attempted both Authorization: Bearer <key> and api-key: <key> headers.
    Sample request (PowerShell):
      powershell
      Copy
      $endpoint = "https://sagul-me43r8sb-swedencentral.services.ai.azure.com/v1/chat/completions"
    

$key = "<FOUNDRY_INFERENCE_KEY>"

$body = @{ model = "gpt-5-chat" messages = @( @{ role = "system"; content = "You are helpful." }, @{ role = "user"; content = "Say hello" } ) max_tokens = 50 } | ConvertTo-Json -Depth 5

Invoke-RestMethod -Method Post -Uri $endpoint -Headers @{ "api-key" = $key; "Content-Type" = "application/json" } -Body $body

  
  **Error returned:**
  
  ```yaml
  json
  Copy
  {"error":{"code":"404","message":"Resource not found"}}

I need guidance on:

  • Whether api-key authentication is supported for Foundry inference endpoints.
  • If there’s a configuration step required in Azure AI Foundry for the endpoint to be usable with the SDK.
  • Any known issues with gpt-5-chat in the Sweden Central region.
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.