Google Gemini · HTTP 503 · UNAVAILABLE

Gemini API: 503 UNAVAILABLE

503 UNAVAILABLE from the Gemini API is a temporary overload or outage on Google’s side, not your limit. Retry after a few seconds with a growing delay. If it persists, send the request to another model.

Updated: · based on the official documentation of Google Gemini

What Google documents

Google’s error reference describes 503 as the service being temporarily overloaded or down and recommends exponential backoff with jitter; the official SDK retries 5xx errors itself.

The text “The model is overloaded. Please try again later.” is not in the official docs — it is quoted on the Google developer forum. Rely on the status and the UNAVAILABLE code.

503 versus 429

429 RESOURCE_EXHAUSTED means you exceeded your own limit (requests, tokens or the project’s daily quota). 503 means the service itself is overloaded, regardless of your limit.

What to do

Retry with 1, 2, 4, 8 second delays and a cap on attempts. Do not fire hundreds of retries at once — that prolongs the overload.

Keep a fallback model: on a 503 from one Gemini version, send the request to another. Through API429 this uses the same key and base URL — only the model field changes.

Retrying with Retry-After: Python example

import email.utils, os, random, time, requests

URL = "https://gateway.api429.com/v1/chat/completions"
HEADERS = {"Authorization": "Bearer " + os.environ["API429_API_KEY"]}
TRANSIENT = {429, 500, 503, 529}

def retry_after(value):
    if not value:
        return None
    if value.isdigit():
        return int(value)
    return max(0, email.utils.parsedate_to_datetime(value).timestamp() - time.time())

def chat(payload, attempts=5):
    for attempt in range(attempts):
        r = requests.post(URL, headers=HEADERS, json=payload, timeout=120)
        if r.status_code not in TRANSIENT:
            r.raise_for_status()
            return r.json()
        wait = retry_after(r.headers.get("Retry-After"))
        time.sleep(wait if wait is not None else min(60, 2 ** attempt) + random.random())
    r.raise_for_status()

Frequently asked questions

Is it a problem with my key?

No. 503 UNAVAILABLE means the service is overloaded or unavailable, not a key or quota error.

How long should I wait?

Usually seconds to minutes. Retry with a growing delay and a cap on attempts.

Do 503s count against quota?

The official docs do not say so; such claims appear only on forums.

Can I switch to another model?

Yes. Through API429, change the model field and keep the same key.

Sources

Next steps

Other API errors

Telegram