Gemini Not Working? Checklist and a Fallback API
When gemini not working shows up in your logs, the cause is usually one of six things, and four of them take under a minute to rule out. Below is a checklist in the order we suggest running it, followed by a small Python fallback so one provider's bad hour does not take your app down.
Last updated
Summary
- Read the HTTP status and error body first: 400, 403, 404, 429 and 5xx each point to a different fix.
- A reply that stops early or comes back empty can be a safety block, not an outage. Check the finish reason.
- Retry only what is safe to retry: timeouts, 429 and 5xx, with backoff. Never loop on a 400.
- A second OpenAI-compatible endpoint turns most outages into a slower answer instead of an error page.

Start with the error, not the model
Before you blame Gemini, find out what your client actually received. The status code narrows the problem faster than anything else. Log the status, the response body and any request ID the provider returns, for every failure.
| Symptom | Likely cause | First thing to try |
|---|---|---|
| 400 with a message about the request | Malformed body, unsupported parameter, prompt too long | Send a minimal request and add fields back one by one |
| 401 or 403 | Wrong, revoked or restricted key; unsupported location | Regenerate the key, check key restrictions and the supported regions |
| 404 | Model name retired or misspelled | List models from the API and compare the name |
| 429 | Quota or rate limit | Read the body, then back off |
| 500, 503 | Provider overload or incident | Retry with backoff, check the provider's status page |
| 200 but empty or cut short | Safety block, token cap or a stop sequence | Read the finish reason |
Most reports of gemini not working fit this table. The ones that do not are usually network issues on your side: a proxy that strips headers, a corporate firewall, or a DNS problem that only affects one machine.
The checklist, in order
- Check the provider's status page. If there is an incident, stop debugging and move to the fallback below.
- Test the key alone. Run one curl call with the simplest prompt you have, outside your application. If curl works, the bug is in your code or configuration.
- Check the model name. Provider model names change. A name that worked months ago can return 404 today. Ask the API for its model list instead of copying names from old tutorials.
- Check quota and billing. Free tiers have request and token caps, and a project can run out of paid quota. A 429 body normally says which.
- Check where requests come from. A location rule applies to the machine sending the call. If you moved your server to another region, your behavior may have changed with it.
- Update the SDK. An outdated client can send fields the API no longer accepts.
When the reply is empty or stops early
This is the case people mistake for an outage. The request returns 200, but the text is missing or truncated. Look at the finish reason in the response. A safety-related finish means the provider's filter intervened on the prompt or the output. A length-related finish means the output cap was reached, which also happens when a model spends part of its budget on internal reasoning before it writes anything visible.
You have three choices. Rewrite the prompt so it asks for something the model will answer. Raise the output cap if the cause is length. Or route that class of request to a model with a different policy. The third is a product decision, and it only makes sense for lawful content. Do not use a fallback as a way around rules you agreed to with another provider, and keep prompts within the terms of whichever service receives them.
Retry rules that do not make things worse
Retries fix transient failures and amplify permanent ones. Use these rules:
- Retry timeouts, connection errors, 429 and 5xx. Do not retry 400, 401, 403 or 404, because the same request will fail the same way.
- Back off with a growing delay and a little randomness, and respect a
Retry-Afterheader when the server sends one. - Cap the total attempts. Three is plenty for an interactive request.
- Set a client timeout. A request with no timeout can hold a worker for minutes.
Retries against the same provider do not help during a long incident. That is where a second endpoint earns its place.
Stop hammering a provider that is down
If every call to the primary fails for two minutes, sending the next hundred requests there first just adds latency to each of them. A small circuit breaker fixes this. Count consecutive failures, and after five in a row, skip the primary for a cooling-off period such as 60 seconds, then let one test request through. If it succeeds, resume normal routing. You need roughly fifteen lines for this, and it turns a bad hour from a slow app into a normal one.
Streaming changes the rules
Fail over before the first token arrives. Once a stream has started and sent text to the user, switching models mid-reply would splice two different voices together. Set a short timeout for the first chunk, and if it expires, cancel the request and start over on the fallback. If a stream breaks halfway, show an error and offer a retry instead of silently continuing.
Add a fallback endpoint in a few lines
If your code already uses the OpenAI SDK format, a second provider is another client object with a different base URL. This sketch tries the primary provider first and moves to the fallback only on errors that retries cannot fix quickly. The primary settings come from environment variables, so it works with whichever OpenAI-compatible service you use today.
import os
from openai import OpenAI, APIStatusError, APIConnectionError
primary = OpenAI(
base_url=os.environ["PRIMARY_BASE_URL"],
api_key=os.environ["PRIMARY_KEY"],
timeout=30,
max_retries=1,
)
fallback = OpenAI(
base_url="https://api.geminiunblocked.com/v1",
api_key=os.environ["FALLBACK_KEY"],
timeout=60,
)
PRIMARY_MODEL = os.environ["PRIMARY_MODEL"]
def ask(messages):
try:
r = primary.chat.completions.create(model=PRIMARY_MODEL, messages=messages)
return r.choices[0].message.content, "primary"
except APIConnectionError:
pass # includes timeouts
except APIStatusError as e:
if e.status_code not in (408, 429) and e.status_code < 500:
raise # a 400 or 403 will not improve on a second try
r = fallback.chat.completions.create(model="uncensored", messages=messages)
return r.choices[0].message.content, "fallback"
Return the second value to your logs so you can see how often the fallback fires. If it fires often, you have a quota or configuration problem on the primary side, not an outage.
What to expect from the fallback
The fallback is a different model, so answers will differ in style, length and strengths. Run your own prompts through it before an incident, not during one. The service runs one open-weight model, ID uncensored, operated by an independent provider. It is text only, with a 100,000-token context window, streaming, tool calling and JSON mode. It is not Gemini, so features that depend on image or audio input are not available.
Plan for its limits too. A full key allows 8 concurrent requests and 300 requests per minute. If you hit them, the API returns HTTP 429 with the code rate_limited or concurrency, and a Retry-After: 5 header on temporary overload. A streamed request holds its concurrency slot until the stream ends, so cap your parallel streams.
Cost is small enough to keep as a standby: $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit that never expires. A top-up starts at $20, so a fallback you rarely use costs close to nothing while idle. See the pricing page for the bonus tiers, the docs for parameters, and the API key page to claim the $0.50 trial and test the fallback today.
More guides
Frequently asked questions
Why does Gemini return an empty response with status 200?
Usually a safety block or a length cap. Check the finish reason in the response, then adjust the prompt or the output limit.
Should I retry a 429 from Gemini?
Yes, with a growing delay, after reading the error body. If it says you ran out of daily quota, retrying will not help until the quota resets or you raise it.
Will my existing OpenAI SDK code work with the fallback?
Yes for chat completions. Change the base URL to the fallback endpoint, use your key and set the model to uncensored.
How do I test the fallback without paying?
Sign up and claim the $0.50 trial credit on the API key page. It needs no card and is valid for 7 days.
Get your API key
Register, copy your key, and update the base URL. Simple.