Incorrectly getting error 429 (1015) with Dall-E 3

I am running a deployment on vercel which is using the Dalle-3 and completions APIs. The completion API works correctly, but ever since last morning, I have been getting error 429 (1015) with dalle-3 generation from my vercel deployment. Using the same key however, I can generate images on my development server.

I definitely have enough money in my account and I am only making a couple requests per day. Trying a new API key did not work either.

This is very similar to Error 429 (1015) with Dall-E 3, but quota/rate not reached (Bubble related?) but I am not using any third party in this case.

Here’s fun:

Insert into your code, right before the API call, a printout or log of the environment variable OPENAI_API_KEY, and then also a dump of api_key from the client of the library module.

See if the same results are reported between working environment and failing deployment.

I’m not sure exactly what you mean, but yes, both on my development server and deployed vercel app, both are logged as the same key.

"use server";

import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.OPENAI_KEY,
});

async function generateImage(prompt: string): Promise<string> {
  console.log(process.env.OPENAI_KEY); // the same
  console.log(openai.apiKey); // the same
  const imageResponse = await openai.images.generate({
    prompt,
    model: "dall-e-3",
    quality: "standard",
    response_format: "b64_json",
    size: "1024x1024",
    style: "vivid",
    n: 1,
  });

  return imageResponse.data[0].b64_json as string;
}