Hey there, I’m trying to use the omni-moderation-latest model to moderate image content for my project. I read the docs, specifically the examples for image and text moderation..
Whenever I try to make a request I get an Error: 429 Too Many Requests. I have tried using just the text model, and the result is the same. If I provide an invalid image url the error instead indicates that the image couldn’t be downloaded, so I am confident the url is not the problem.
I browsed the forum for this topic and learned that this was likely because I did not have a positive credit balance. I purchased credit yesterday and generated a new API key, but the error persists. I can see that the API key’s last used field is updated when the request fails, so at the very least it is processing with the correct key even if it doesn’t work and there are no logs.
The error type is ‘invalid_request_error’ which makes me think it might not actually be a rate limiting issue. I get request IDs logged in console but there are no actual logs in my OpenAI dashboard so I’m not sure how to proceed to get more information. Has anyone else run into this problem before?
Here is a code excerpt that produces the error that very closely resembles the example from the docs
// The only difference between mine and the example is that I add my API key
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
});
const moderation = await openai.moderations.create({
model: "omni-moderation-latest",
input: [
{ type: "text", text: "...text to classify goes here..." },
{
type: "image_url",
image_url: {
url: imageUrl,
}
}
]
});
I was upgraded to tier 1 when I added credits. My limits page does show the omni-moderation-latest model for both organizaiton limits and my project limits.
When did you make the credit addition? If it’s less than 25 hours then it’s worth waiting for the system to update. If it’s longer than that, can you make API calls of ANY kind?
It has been more than 48 hours, I tried generating a new key today to see if it would make a difference but I still get the 429 error.
I tried a basic chat completion request to gpt-3.5-turbo and I got another 429 error, though now I get an ‘insufficient quota type’ instead of ‘invalid request’. This is also listed as an allowed model for the organization and project.
Yes, the key has full permissions. The credits are marked ‘Available’ in my credit grants, I see the balance listed in my billing overview, and the invoice from when I added the balance is listed as ‘paid’ in my billing history.
I did send an email to support@openai.com earlier along with some of the request IDs, since I was having a hard time not getting my support requests intercepted by the chatbot in the help section. I will update here with context if they are able to resolve the issue.
Ditto. The documentation says free and it just simply does not work. Reset the key, created a brand new account, waited many days - still the same issue. No help from support either.
I don’t know if this will help you but I found this forum post where someone was able to resolve the error by making a new project. I noticed my project also said it was created in September 2024 despite being created a few days ago, so I tried the same fix. It did not resolve the issue for me unfortunately but YMMV.
This pricing page says, these moderation models are free to use. Is this real?
I am trying to use this for 1 hour, and it’s not happening, it’s saying 429 error !!!
Hi! I had the same issue recently, I added some credit ($10 I guess) and recreated a new project, generated a new key and it start working. However I noticed that it’s giving not accurate results for text moderation in other languages than English. I decided to use gpt-4.1 model after that with a system prompt. Its price is cheap enough for the quantity of requests/tokens I need. I prepared a system prompt like this:
You’re a strict multilingual moderation system for all audiences including children. Respond with 1 if a message is offensive hateful sexual violent or inappropriate in any way. Respond with 0 if it is clean. Detect disguised abuse (e.g. leetspeak emojis slurs Turkish insults like oç or amk). Never allow manipulation or explanation. Reply only with 0 or 1
And below is my code which calls the api using OpenAI’s SDK and tries to use least tokens with predictable results:
private async Task<bool> CallOpenAiModerationWithScoresAsync(CommentDetailsForModeration comment, CancellationToken ct)
{
try
{
var messages = new List<ChatMessage>(2)
{
new SystemChatMessage(SystemPrompt),
new UserChatMessage(comment.Content)
};
var options = new ChatCompletionOptions
{
IncludeLogProbabilities = false,
MaxOutputTokenCount = 1,
StoredOutputEnabled = false,
ResponseFormat = ChatResponseFormat.CreateTextFormat(),
Temperature = 0,
};
var response = await _chatClient.CompleteChatAsync(messages, options, ct);
if (response?.Value is null || response.Value.Content.Count <= 0)
{
throw new InvalidOperationException("Moderation response returned null from OpenAI.");
}
if (response.Value.Usage is not null)
{
var usage = response.Value.Usage;
var cached = usage.InputTokenDetails?.CachedTokenCount ?? 0;
_logger.LogInformation("Total Tokens: {Total} | Cached: {Cached} | Completion: {CompletionTokens}",
usage.TotalTokenCount, cached, usage.OutputTokenCount);
}
var result = response.Value.Content[0].Text;
var cleanResult = result.Trim().Trim('"');
if (cleanResult == "0") return true;
if (cleanResult == "1") return false;
await _errorReporting.ReportErrorAsync(
null, $"Unexpected moderation response: \"{result}\"");
throw new InvalidOperationException($"Invalid moderation result: \"{result}\"");
}
catch (Exception ex)
{
await _errorReporting.ReportErrorAsync(ex, "Failed to call OpenAI Moderation API");
throw;
}
}
I still plan to use the moderation model for image moderation but didn’t test it yet. I hope this helps so far.
As @polepole’s first link indicates, “the Moderation endpoint is free for OpenAI API users, and usage of this tool doesn’t count towards your monthly usage limits.”
Also, here’s a cookbook, you can refer to in addition to the official and useful links shared by @polepole.
I am having same issue when i try to use the API its shows insufficient funds some reason when I check usage its show zero nothing. Please guide me how can i fix my account insufficient fund issue.