WiozenAPI

Why does my AI API return a 429 error, and how do I fix it?

In short: A 429 means the request hit a limit, and the error message tells you which one. On the Wiozen API there are five: your balance doesn't cover this request (Quota exhausted), the key's spend limit is reached, too many requests in the last minute, the daily query limit is used up, or the service is busy right now. Waiting won't fix the first two. For the other three, wait for the retry-after time in the response and try again.

How do I tell which 429 I got?

The status code is the same every time. What tells them apart is the error.message field in the response body. If your tool hides that message, repeat the request once with curl or check the tool's log.

Error messageCauseWhat to do
Quota exhaustedBalance doesn't cover this request's estimated costTop up, or lower max_tokens
API key spend limit reachedThe key's spend limit is used upRaise or remove the limit on the Keys page
Rate limit exceeded: 120 requests per minuteToo many requests in the last 60 secondsWait for retry-after (30 s)
Günlük sorgu limitinize ulaştınız (…)The account's daily query limit is used upWait for the day to roll over
Servis şu an yoğun; …Model capacity is full at that momentWait for retry-after (2 s)

The last two messages are in Turkish; they mean "you've reached your daily query limit" and "the service is busy right now". A request that gets a 429 is not charged. If an amount was held from your balance it is released, so retrying costs nothing either.

I have balance left, so why do I get "Quota exhausted"?

This is the one that surprises people most. When a request starts, its estimated cost is held from your balance; when the answer finishes it's corrected to the real amount and the difference goes back. The estimate has two parts: the input, worked out from the size of the body you send, and the most output you asked for (max_tokens). If you don't set max_tokens, 4,096 tokens are assumed.

If your balance can't cover the price of both, the request doesn't start. Say you have a few cents left and send a long chat history with a large max_tokens to an expensive model: you get a 429, while the same request goes through on a cheaper model or with a smaller max_tokens.

The lasting fix is to top up. The guide how to calculate AI API cost shows how to work out what a request will cost before you send it.

How is the per-minute limit counted?

The limit is per account, not per key. Requests from every key on the same account in the last 60 seconds are counted together, so using three keys in three tools doesn't triple it. The default setting is 120 requests per minute, and the current number is always in the error message.

The limit is checked on the chat endpoints (/v1/chat/completions, /v1/messages, /v1/responses), and the response carries a retry-after: 30 header. If you run batch jobs, queue the requests and spread them over the minute; firing hundreds of parallel requests at once hits the limit in the first few seconds.

When does the daily query limit reset?

Not every account has a daily query limit. It applies only when a package that carries one is assigned to your account. If it does, the message shows how many queries you've made next to the limit. The count resets at the start of the UTC day (03:00 in Turkey).

Besides chat, this limit also covers image generation, embeddings, text to speech, web search and page fetch. Requests that ended in failure don't count.

What does the "service is busy" message mean?

When the number of model requests that can run at the same time is full, a new request waits in a queue first. If no slot opens within 60 seconds, you get a 429 with retry-after: 2. It has nothing to do with your account, only with total load at that moment; the same request goes through a few seconds later.

How do I add retries to my code?

The rule is simple: if a retry-after header came back, wait that long; if not, double the wait on each attempt. Don't retry the balance and key-limit messages, because they'll give the same answer until you change something.

retry.py
import time
import requests

URL = "https://api.wiozen.com/v1/chat/completions"
HEADERS = {"Authorization": "Bearer sk-gw-..."}
# 429s that waiting won't fix: balance or key limit
FATAL = ("Quota exhausted", "API key spend limit reached")

def ask(body, tries=5):
    for attempt in range(tries):
        r = requests.post(URL, json=body, headers=HEADERS, timeout=600)
        if r.status_code != 429:
            return r.json()
        message = r.json()["error"]["message"]
        if any(m in message for m in FATAL):
            raise RuntimeError(message)
        wait = int(r.headers.get("retry-after", 2 ** attempt))
        time.sleep(wait)
    raise RuntimeError("still getting 429")

The OpenAI and Anthropic SDKs already retry a 429 a few times on their own. If you use an SDK, don't wrap it in a second loop; just catch the balance and limit messages and show them to the user.

Frequently asked questions

Am I charged for a request that got a 429?

No. The request is turned away before it reaches a model, and nothing comes off your balance.

Can I get around the per-minute limit by creating another key?

No. The limit is per account; requests from all keys on the account are counted together.

My balance isn't zero, so why the 429?

The estimated cost is held when a request starts. If what's left doesn't cover the estimate, the request doesn't start. A smaller max_tokens or a cheaper model lowers the estimate.

When does the daily limit reset?

At the start of the UTC day, which is 03:00 in Turkey. If your account has no daily limit, you'll never see this 429.

Which 429s are worth waiting out?

The per-minute limit, the daily limit and the busy message. For Quota exhausted and the key spend limit you need to top up or change the limit.

Open the Keys page to see your balance and each key's limit. The full error table is in the docs.

Create your account

More guides: How can you use an AI API from Turkey without a credit card? · How do you connect an OpenAI-compatible API to a tool you already use? · How do you calculate the cost of an AI API? · What should I do if my AI API key has leaked? · How do you generate images with an AI API, and what does one image cost? · Why do long AI API requests time out: streaming or non-streaming? · Anthropic Messages API or OpenAI Chat Completions: which one should I use? · What is a context window, and what is a 1 million token context good for? · Which AI model should I choose: deciding by price, context and quality · Why does a reasoning model return an empty answer, and why are thinking tokens charged? · Why is my API balance running out faster than expected? Tracking spend request by request · How do you convert a web page to Markdown to feed it to an AI model? · How do you get AI to write and publish articles in WordPress automatically? · How do you find blog topics from RSS feeds and Google Trends? · Does AI-written content show up on Google and in AI answers? · How do you get internal links into AI-written WordPress articles? · How do you get AI to generate a different featured image for every WordPress post? · How do you write a content brief when an AI writes your blog posts? · What should you watch for when an AI writes recipes for your food blog? · How do you fix errors when connecting a WordPress plugin to your AI API account? · Why does my AI article bot stop halfway in WordPress? "Run is stuck" and LiteSpeed · Why are my scheduled WordPress posts late? WP-Cron and a real server cron · How do I get an AI article bot to write blog posts in English or another language? · What does "Content Bot cannot generate articles" mean? Reading the bot's log