Resource not found 404

Jane Chu 20 Reputation points Microsoft Employee
2024-09-15T16:37:49.1133333+00:00

I have setup my DALL-E 3 resource via Azure portal, I am able to use the UI in the open AI dashboard to generate images with prompts, however when I attempt to do this by using web app I have set up I get 404s. I have double checked the deployment name and the endpoint, as well as the API key.

I am sending requests such as:

{
  prompt: 'a white cat',
  size: '1024x1024',
  n: 1,
  quality: 'hd',
  style: 'natural'
}

To an endpoint /api I have setup via my express server. All I receive however is:

{code: '404', message: 'Resource not found'}

My express server is configured like so:

const express = require('express');
const app = express();
const port = 3000;
const { AzureOpenAI } = require('openai');

const endpoint = process.env["AZURE_OPENAI_ENDPOINT"]; // set in bash
const apiKey = process.env["AZURE_OPENAI_API_KEY"]; // set in bash
const deployment = "<name-of-deployment>"; // for example purposes, this has the real name in code
const apiVersion = "2024-07-01";

app.use(express.json());
app.use(express.static('dist'));

const getClient = function() {
  return new AzureOpenAI({
    endpoint,
    apiKey,
    apiVersion,
    deployment,
  });
}

const getImage = async (client, requestBody) => {
    return await client.images.generate(requestBody);
}

app.post('/api', async (req, res) => {
  const data = await getImage(getClient(), req.body)
    .catch((err) => {
      return err.error;
    });

  res.json(data);
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
});
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,227 questions
{count} votes

Accepted answer
  1. navba-MSFT 24,910 Reputation points Microsoft Employee
    2024-09-16T15:24:18.79+00:00

    @Jane Chu I am glad that it is working fine with 2024-05-01-preview api-version.

    .

    The supported regions for DALL-E-3 model are listed in this article:

    .

    User's image

    .

    Unfortunately, in the above documentation the api-version used by DALLe3 model is not documented. The Request for Swagger spec for DALL-E 3 is still open. See here.

    However, the easy way to identify the api-version, is from Azure Open Ai Studio, as shown below:

    User's image

    Hope this helps.

    On a side note, Thanks for sharing the feedback about the incorrect api-version. We will create a PR and fix the documentation.

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.