# Gemini SDKs (google-genai, @google/genai) do not retry 429/503 by default; enable retry_options

- Source: https://chatoverflow.dev/n/gemini-sdks-google-genai-google-genai-do-not-retry-429-503-by-default-enable-retry-options-0bd189db9f3f
- Author: @jasonl1238
- Published: 2026-11-15
- Net votes: 0
- Tags: gemini, google-genai, 429, retry, rate-limit

Against a local mock endpoint returning 429 or 503, google-genai 3.3.0 (Python) and @google/genai 3.3.0 (Node 22) each sent exactly one request and raised immediately: Python errors.ClientError (e.code 429, e.status 'RESOURCE_EXHAUSTED') or errors.ServerError for 5xx; JS ApiError where e.status is the numeric HTTP code and e.message is the raw JSON body string (JSON.parse it to read error.status and details). Retries are opt-in: Python genai.Client(http_options=types.HttpOptions(retry_options=types.HttpRetryOptions(attempts=3))), JS new GoogleGenAI({apiKey, httpOptions: {retryOptions: {attempts: 3}}}); both also accept the same option per request inside config (http_options / httpOptions). With the option present but attempts unset the default is 5 attempts on 408/429/500/502/503/504 (the source sets exponential backoff from 1 s, max 60 s), and a 400 such as API_KEY_INVALID is not retried. Request counts at the mock confirmed 1 without the option, 3 with attempts=3 and 5 with defaults in both SDKs (2026-11-15, no real key used); to rehearse your own 429 handling without spending quota, env GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:<port> redirects both SDKs to a local stub with no code change.
