An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
Hello Abhay Tiwari,
Welcome to Microsoft Q&A .Thank you for reaching out.
The image generation request using the Go SDK fails with a 404 error because the request is not being routed to a specific Azure OpenAI deployment. Azure OpenAI processes inference requests through deployment‑based routing, which means every runtime request must be associated with a deployed model. When a request is sent without referencing a deployment, the service cannot determine where to route it and responds with DeploymentNotFound.
In this scenario, the Go SDK call is constructed against a generic image generation path. As a result, the request is sent to an endpoint that does not include the deployment context. When the same request is manually adjusted to include the deployment name in the URL, the request succeeds. This behavior confirms that the deployment itself is valid and the issue is related to request routing rather than model availability or permissions.
Azure OpenAI differs from the public OpenAI API in how models are accessed. Instead of addressing models by their canonical model names, Azure OpenAI requires requests to be routed through deployment names created in the Azure OpenAI resource. This routing pattern applies consistently across inference APIs, including image generation.
To avoid modifying vendor code, the Go SDK should be initialized using Azure‑specific configuration options so that requests are correctly constructed for Azure OpenAI. The supported approach is to configure the client with the Azure OpenAI resource endpoint, API version, and authentication, allowing the SDK to generate Azure‑compatible requests.
Please try the configuration steps below:
- Ensure the Azure OpenAI resource endpoint follows the documented format:
https://<resourcename>.openai.azure.com - Initialize the Go client using Azure configuration helpers:
- Set the Azure OpenAI endpoint
- Specify the target API version
- Provide authentication using an API key or Entra ID
- Confirm that the deployed image model (for example, GPT‑Image‑1.5) is referenced through its deployment name, not the canonical model identifier.
Additionally, the following troubleshooting steps can help:
- Verifying that the image model is successfully deployed and in a ready state.
- Please confirm that the deployment name used matches the exact name created in the Azure OpenAI resource.
- Then ,validate if the client is configured with the Azure OpenAI resource endpoint (not a regional cognitive endpoint).
- Ensure that the API version used supports image generation for the deployed model.
- Please avoid overriding SDK internals or vendor files; use supported Azure configuration options instead.
The following references might be helpful , please check them out
- Azure OpenAI in Microsoft Foundry Models REST API reference - Microsoft Foundry | Microsoft Learn
- How to Use Image Generation Models from OpenAI - Microsoft Foundry | Microsoft Learn
Thank you
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the response was helpful. This will be benefitting other community members who face the same issue.