EN ▾

Gemini Rate Limit on the Free Tier: A Prepaid Fix

Developers who search gemini rate limit free are usually staring at a 429 error in a script that worked an hour ago. This guide shows how limits work on a prepaid, OpenAI-compatible API, with retry code you can paste in.

Updated

Data cubes flowing through eight lanes and a valve, illustrating concurrency and rate limits on an API

Key points

  • Free allowances are set by each vendor and can change. Check Google's current documentation for Gemini's numbers.
  • This API publishes its limits: full key 8 concurrent and 300 requests per minute, trial key 2 and 60.
  • HTTP 429 means two different things here: <code>rate_limited</code> and <code>concurrency</code>. Fix each differently.
  • A streamed request holds its concurrency slot until the stream ends.

Why free-tier limits bite

A free tier has to protect the provider from abuse, so it comes with tight caps on requests per minute, requests per day, or tokens. The exact numbers for Gemini live in Google's documentation and may change, so look them up there rather than copying a figure from a forum thread. The pattern is the same everywhere: a prototype fits inside the cap, then a loop, a second user or a batch job pushes past it and you get errors.

The painful part is that the cap is not yours to control. You cannot buy your way past it by wanting to. You wait for the window to reset, or you move to a paid plan on the same provider, or you change provider. This article covers the third path for text workloads: an independent API with published limits and prepaid credit, where reaching a limit means slowing down briefly, not hitting a wall for the day.

The limits on this API

Full keyTrial key
Concurrent requests82
Requests per minute30060
Max body8 MB8 MB
Context window100,000 tokens100,000 tokens

Responses include the headers X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. The first helps when you contact support, the second shows your remaining credit on every call, and the last two tell your client what ceiling it is working under.

There is no daily cap in the limits above. The ceilings are per minute and per moment, and credit never expires, so a quiet day does not waste anything.

Two kinds of 429

When you go over a limit, the API returns HTTP 429. The error code tells you which limit.

  • rate_limited: too many requests in the minute. Wait for the window to move, or spread requests more evenly.
  • concurrency: too many requests at once. Finish some before starting others.

There is also a third case. On temporary overload the API returns 429 with a Retry-After: 5 header. Treat that one as an instruction: wait five seconds and try again. Do not hammer the endpoint, since immediate retries only keep the queue full.

A subtle point on streaming: a streamed request occupies its concurrency slot until the stream ends. If a user opens a chat and walks away from a stream you never close, that slot stays taken. Cancel abandoned streams on the client side, and always read a stream to completion or close the connection.

Retry code that behaves

The Python below caps concurrency with a semaphore, so you never trigger concurrency errors in the first place, and retries on 429 using Retry-After when present, otherwise exponential backoff. Set MAX_PARALLEL to 8 for a full key or 2 for the trial.

import asyncio
import random
from openai import AsyncOpenAI, RateLimitError

client = AsyncOpenAI(base_url="https://api.uncensoredgemini.cc/v1", api_key="YOUR_KEY", max_retries=0)
MAX_PARALLEL = 8
sem = asyncio.Semaphore(MAX_PARALLEL)

async def ask(prompt: str) -> str:
    delay = 1.0
    for attempt in range(6):
        async with sem:
            try:
                r = await client.chat.completions.create(
                    model="uncensored",
                    messages=[{"role": "user", "content": prompt}],
                )
                return r.choices[0].message.content
            except RateLimitError as e:
                retry_after = e.response.headers.get("Retry-After")
                wait = float(retry_after) if retry_after else delay
        await asyncio.sleep(wait + random.random())
        delay = min(delay * 2, 30)
    raise RuntimeError("still rate limited after 6 attempts")

async def main():
    prompts = [f"Write a one-line tagline, variant {i}." for i in range(40)]
    results = await asyncio.gather(*(ask(p) for p in prompts))
    print(len(results), "done")

asyncio.run(main())

The sleep happens outside the semaphore on purpose. A waiting request should not hold a slot while it waits. Setting max_retries=0 on the client keeps retry logic in one place, so you can see what happens.

The same idea in Node

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.uncensoredgemini.cc/v1", apiKey: process.env.API_KEY, maxRetries: 0 });
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function ask(prompt) {
  let delay = 1000;
  for (let i = 0; i < 6; i++) {
    try {
      const r = await client.chat.completions.create({
        model: "uncensored",
        messages: [{ role: "user", content: prompt }],
      });
      return r.choices[0].message.content;
    } catch (e) {
      if (e.status === 429) {
        const ra = Number(e.headers?.["retry-after"]);
        await sleep((ra ? ra * 1000 : delay) + Math.random() * 500);
        delay = Math.min(delay * 2, 30000);
        continue;
      }
      throw e;
    }
  }
  throw new Error("still rate limited");
}

How much throughput you really get

The 300 requests per minute ceiling is rarely the one you hit first. Concurrency usually is. Suppose a typical reply takes 10 seconds to generate (an assumption for the sake of the math; your prompts will differ). With 8 requests in flight, you finish 8 every 10 seconds, which is 48 per minute. To reach 300 per minute at that speed you would need about 50 in flight, which the limit does not allow. With replies that take 2 seconds, 8 slots give you 240 per minute, close to the cap.

So for batch work, shorter outputs raise your effective throughput more than any retry tweak does. Set max_tokens when you only need a short answer, and use stop sequences to end a reply early. For the trial key the same logic applies with 2 slots: at 10 seconds per reply, that is 12 per minute, well under the 60 cap.

Habits that keep you under the limits

Retry code is a safety net. The better fix is to send fewer wasted requests in the first place.

  • Queue on your side. Put jobs in a queue and let a fixed number of workers pull from it. The worker count is your concurrency, and you choose it below the limit.
  • Do not retry on a 4xx you caused. A malformed body or an oversized request will fail every time. Only retry 429 and network errors.
  • Add jitter. If ten workers all wait exactly five seconds, they all return at once and collide again. A random extra half second spreads them out.
  • Cache repeated prompts. If your app sends the same classification prompt many times, store the answer. With a fixed seed and low temperature, repeats are cheap to detect and skip.
  • Watch the balance header. X-Balance-USD arrives with every response. Alert when it drops below a threshold, so a drained balance does not look like a mysterious outage.
  • Trim history. Long prompts take longer to process, and slow replies hold concurrency slots longer. Summarise old turns instead of resending them.

For a chat product with many users, count how many people can be mid-reply at the same moment. With 8 slots and replies that take about 10 seconds, you can serve 48 replies a minute before queueing begins. Past that, show a short typing indicator while the queue drains, rather than failing the request.

What prepaid changes

On a prepaid account you decide how much capacity you fund. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, with no subscription. A batch of 10,000 requests at 1,000 input and 300 output tokens each uses 10M input tokens ($1.50) and 3M output tokens ($1.50), so $3.00 in total. That batch, at 48 requests per minute from the earlier example, takes about 208 minutes, and the time is set by your concurrency, not by a daily quota.

New users can claim $0.50 of trial credit on the API key page, valid 7 days, one per person. Top-ups run from $20 to $500 in whole amounts, with +5% from $50, +10% from $100 and +15% from $200, and are paid in crypto (USDT on TRC20 or USDC on Base). See pricing and the docs.

One honest limit: this service is text only and runs a single open-weight model. If you rely on Gemini features beyond text, keep using Gemini for those calls and send the text traffic here.

Questions and answers

What are the free-tier limits for Gemini?

They are set by Google and can change, so check Google's current documentation for the exact numbers.

What are the limits on this API?

A full key allows 8 concurrent requests and 300 per minute. A trial key allows 2 concurrent and 60 per minute.

What does a 429 from this API mean?

You went over a limit. The error code is rate_limited for requests per minute or concurrency for too many at once. On temporary overload you also get a Retry-After: 5 header.

Do rate-limited requests cost money?

No. Failed or refused requests are not charged.

Does a stream count against concurrency?

Yes. A streamed request holds its slot until the stream ends.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key