<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eren</title>
    <description>The latest articles on DEV Community by Eren (@cynora).</description>
    <link>https://dev.to/cynora</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4250013%2F0555f8cc-9265-4b66-9b70-7cd372f3141d.png</url>
      <title>DEV Community: Eren</title>
      <link>https://dev.to/cynora</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cynora"/>
    <language>en</language>
    <item>
      <title>Gemini API free tier 429: per-minute vs per-day limits, measured on four models</title>
      <dc:creator>Eren</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:19:42 +0000</pubDate>
      <link>https://dev.to/cynora/gemini-api-free-tier-429-per-minute-vs-per-day-limits-measured-on-four-models-mpc</link>
      <guid>https://dev.to/cynora/gemini-api-free-tier-429-per-minute-vs-per-day-limits-measured-on-four-models-mpc</guid>
      <description>&lt;p&gt;A Gemini API 429 on the free tier can mean two very different things: a per-minute limit that clears in seconds, or a per-day limit that clears at midnight Pacific. Most posts say "wait and retry" or "upgrade". That is true for one case and useless for the other. The error body already tells you which one it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read &lt;code&gt;quotaId&lt;/code&gt; and &lt;code&gt;retryDelay&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Per-minute: &lt;code&gt;GenerateRequestsPerMinutePerProjectPerModel-FreeTier&lt;/code&gt;. Safe to retry after &lt;code&gt;retryDelay&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Per-day: &lt;code&gt;GenerateRequestsPerDayPerProjectPerModel-FreeTier&lt;/code&gt;. Retrying is pointless until the reset.&lt;/li&gt;
&lt;li&gt;The limit is per project and per model, so a new key in the same project gives you nothing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The probe
&lt;/h2&gt;

&lt;p&gt;One tiny request, repeated until it fails. Each request asks for the single word &lt;code&gt;ok&lt;/code&gt; with output capped at 20 tokens, so only the request count matters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"contents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"parts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Reply with the single word: ok"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"generationConfig"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"maxOutputTokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"x-goog-api-key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlopen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HTTPError&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"raw"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"replace"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a 429, the useful parts are in &lt;code&gt;error.details&lt;/code&gt;: a &lt;code&gt;QuotaFailure&lt;/code&gt; entry (quota ID and value) and a &lt;code&gt;RetryInfo&lt;/code&gt; entry (&lt;code&gt;retryDelay&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Results (one free-tier key, one project, 25 October 2026, no pause between requests)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;gemini-3.5-flash-lite&lt;/td&gt;
&lt;td&gt;17 ok, then per-minute 429 (limit 15), retry 22 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gemini-3.1-flash-lite&lt;/td&gt;
&lt;td&gt;17 ok, then per-minute 429 (limit 15), retry 39 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gemini-3.5-flash&lt;/td&gt;
&lt;td&gt;7 ok, then per-minute 429 (limit 5), retry 36 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gemini-3.6-flash&lt;/td&gt;
&lt;td&gt;first request already per-day 429 (limit 20), retry 70236 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gemini-3.1-pro&lt;/td&gt;
&lt;td&gt;404, model name not found&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  The daily number is a clock
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;retryDelay&lt;/code&gt; was 70236 seconds, 19 h 30 min 36 s. I sent the request at 14:29:22 (UTC+3). Adding the delay lands at 06:59:58 UTC, one second before midnight Pacific daylight time. That matches Google's rate-limit page (daily quotas reset at midnight Pacific). It also means the reset hour on a wall clock shifts when daylight saving ends, so a cron job pinned to a fixed UTC hour will drift. Read the delay from the error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two traps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The model in the error was not the one I called.&lt;/strong&gt; My call to &lt;code&gt;gemini-3.5-flash&lt;/code&gt; failed on request 8, but the error's &lt;code&gt;quotaDimensions&lt;/code&gt; named &lt;code&gt;gemini-3.6-flash&lt;/code&gt;. Either the two names share counters or the key had already used its daily 20 on 3.6. I did not test which. Log the model from the error, not from your request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A 404 that looks like a limit.&lt;/strong&gt; &lt;code&gt;gemini-3.1-pro&lt;/code&gt; returned 404 because the name that exists is &lt;code&gt;gemini-3.1-pro-preview&lt;/code&gt;. If your logs show a failure before any 429, check the model name first.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this does not show
&lt;/h2&gt;

&lt;p&gt;Request counts for one project on one afternoon. I did not test token limits, paid tiers, concurrent processes, or whether the per-minute window is fixed or sliding. The per-minute models let 17 requests through against a stated limit of 15, which fits a sliding window or a different counting method. Google changes free-tier limits without notice, so treat these numbers as a snapshot and run the probe on your own key.&lt;/p&gt;

&lt;p&gt;More detail and the FAQ: &lt;a href="https://aiandsoftwarehub.com/blog/gemini-api-free-tier-429-per-minute-vs-per-day-measured" rel="noopener noreferrer"&gt;https://aiandsoftwarehub.com/blog/gemini-api-free-tier-429-per-minute-vs-per-day-measured&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>python</category>
      <category>debugging</category>
    </item>
    <item>
      <title>pgvector IVFFlat vs HNSW: what happens to recall when new data arrives (measured)</title>
      <dc:creator>Eren</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:13:25 +0000</pubDate>
      <link>https://dev.to/cynora/pgvector-ivfflat-vs-hnsw-what-happens-to-recall-when-new-data-arrives-measured-46lh</link>
      <guid>https://dev.to/cynora/pgvector-ivfflat-vs-hnsw-what-happens-to-recall-when-new-data-arrives-measured-46lh</guid>
      <description>&lt;p&gt;Most comparisons of pgvector's two index types quote one recall number from one dataset. I ran both on the same machine with three different data situations, because the answer flipped between them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup:&lt;/strong&gt; PostgreSQL 16.2, pgvector 0.6.2, Windows 11 laptop, 100,000 vectors of 128 dimensions, cosine distance, 100 query vectors, recall@10 measured against an exact scan of the same table. Index builds were single-threaded so the build times are comparable with each other, not with a tuned server. The data is synthetic (Gaussian clusters), so read the numbers as the shape of the behaviour, not as what your embeddings will score.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Easy, clustered data: IVFFlat wins on build cost
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Index and setting&lt;/th&gt;
&lt;th&gt;Recall@10&lt;/th&gt;
&lt;th&gt;Median latency&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Exact scan, no index&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;35.0 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IVFFlat lists=316, probes=10&lt;/td&gt;
&lt;td&gt;0.997&lt;/td&gt;
&lt;td&gt;1.05 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HNSW, ef_search=100&lt;/td&gt;
&lt;td&gt;0.953&lt;/td&gt;
&lt;td&gt;1.01 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HNSW, ef_search=400&lt;/td&gt;
&lt;td&gt;0.992&lt;/td&gt;
&lt;td&gt;2.23 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Build: IVFFlat took 4.6 to 5.3 seconds (about 53 MiB). HNSW took 67.4 seconds (79.4 MiB). That is roughly 13 times slower to build and about 50 percent larger.&lt;/p&gt;

&lt;p&gt;One trap: IVFFlat with &lt;code&gt;probes = lists&lt;/code&gt; scans every list. On the 100-list index the median query took 149 ms, four times slower than the exact scan (35 ms), because you pay for the index and read everything anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Hard data (barely clustered): close to a tie
&lt;/h2&gt;

&lt;p&gt;At about 5 ms the two were close: IVFFlat 0.807 at 5.27 ms against HNSW 0.839 at 4.98 ms.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. New data arrives: this is where they separate
&lt;/h2&gt;

&lt;p&gt;I built each index on the first 100,000 rows, then inserted 50,000 more from 20 clusters that did not exist when the index was built, and queried only that new region.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Recall@10&lt;/th&gt;
&lt;th&gt;Median latency&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;IVFFlat built before the new rows, probes=10&lt;/td&gt;
&lt;td&gt;0.473&lt;/td&gt;
&lt;td&gt;5.01 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IVFFlat after REINDEX, probes=10&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;4.47 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HNSW grown by inserts, ef_search=40&lt;/td&gt;
&lt;td&gt;0.834&lt;/td&gt;
&lt;td&gt;0.90 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HNSW built fresh on all rows, ef_search=40&lt;/td&gt;
&lt;td&gt;0.831&lt;/td&gt;
&lt;td&gt;0.84 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;IVFFlat picks its centroids once, at build time. The new clusters had no centroid of their own, so queries had to open many lists to find them. &lt;code&gt;REINDEX&lt;/code&gt; recomputed the centroids and recall went from 0.473 to 1.000. HNSW had no such step. The cost was time: inserting the 50,000 rows into the HNSW-indexed table took 100 seconds.&lt;/p&gt;

&lt;p&gt;Also worth knowing: creating an IVFFlat index on an empty table (or on 50 rows with lists=100) prints &lt;code&gt;ivfflat index created with little data&lt;/code&gt;. Build the index after loading the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing from these numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data loaded once or in rare batches, rebuild is acceptable:&lt;/strong&gt; IVFFlat. Same or better recall at the same latency, 5-second build, smaller index. Keep &lt;code&gt;probes&lt;/code&gt; well below &lt;code&gt;lists&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rows keep arriving, or new rows look different from old ones:&lt;/strong&gt; HNSW kept its recall without a rebuild. IVFFlat needs a scheduled &lt;code&gt;REINDEX&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insert speed matters most:&lt;/strong&gt; HNSW inserts were slow in my test. I did not measure IVFFlat insert time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this does not show
&lt;/h2&gt;

&lt;p&gt;Synthetic data, 128 dimensions, one machine, pgvector 0.6.2, 100 queries per setting, one run each. Small differences like 0.834 vs 0.831 are not meaningful. I did not test filtered queries, concurrent writers, parallel builds, larger tables or indexes that do not fit in memory.&lt;/p&gt;

&lt;p&gt;Full method, all tables and the FAQ are in the original write-up: &lt;a href="https://aiandsoftwarehub.com/blog/pgvector-ivfflat-vs-hnsw-recall-latency-build-time-new-data-measured" rel="noopener noreferrer"&gt;https://aiandsoftwarehub.com/blog/pgvector-ivfflat-vs-hnsw-recall-latency-build-time-new-data-measured&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>database</category>
      <category>ai</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
