<?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: Grain64</title>
    <description>The latest articles on DEV Community by Grain64 (@grain64).</description>
    <link>https://dev.to/grain64</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%2F4216062%2F71a2df10-0774-4b0a-9bfc-807377406ad4.png</url>
      <title>DEV Community: Grain64</title>
      <link>https://dev.to/grain64</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/grain64"/>
    <language>en</language>
    <item>
      <title>n8n "Error connecting to n8n. Could not connect to server" after an upgrade: read the first console line</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Tue, 24 Nov 2026 07:04:43 +0000</pubDate>
      <link>https://dev.to/grain64/n8n-error-connecting-to-n8n-could-not-connect-to-server-after-an-upgrade-read-the-first-console-50oo</link>
      <guid>https://dev.to/grain64/n8n-error-connecting-to-n8n-could-not-connect-to-server-after-an-upgrade-read-the-first-console-50oo</guid>
      <description>&lt;p&gt;You upgraded n8n, opened the editor, and a red box says &lt;code&gt;Error connecting to n8n. Could not connect to server. Refresh to try again.&lt;/code&gt; That box is the editor failing to reach its backend. It is not a diagnosis, and the cause is one line above it. Four GitHub issues from 2025 (n8n 1.88, 1.104, 1.109 and 1.120) show the same box with four different causes, and 226 comments between them. Run these checks in order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 1: open the browser console (F12) and read the first error
&lt;/h2&gt;

&lt;p&gt;What you see decides which of the four you are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;First console or log line&lt;/th&gt;
&lt;th&gt;Likely cause, per the thread&lt;/th&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[WebSocketClient] Connection lost, code=1008&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The push connection was refused: your reverse proxy sends n8n a different &lt;code&gt;Host&lt;/code&gt; or &lt;code&gt;Origin&lt;/code&gt; than the browser did&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://github.com/n8n-io/n8n/issues/14653" rel="noopener noreferrer"&gt;#14653&lt;/a&gt;, 1.88.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a request to &lt;code&gt;/undefinedrest/settings&lt;/code&gt; (404)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;N8N_PATH&lt;/code&gt; set, and &lt;code&gt;/rest/config.js&lt;/code&gt; served without the path prefix&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://github.com/n8n-io/n8n/issues/17817" rel="noopener noreferrer"&gt;#17817&lt;/a&gt;, 1.104.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;401&lt;/code&gt; on &lt;code&gt;/rest/events/session-started&lt;/code&gt;, &lt;code&gt;/rest/module-settings&lt;/code&gt; or &lt;code&gt;/rest/login&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;a release-specific regression; reporters went back a version&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://github.com/n8n-io/n8n/issues/19151" rel="noopener noreferrer"&gt;#19151&lt;/a&gt;, 1.109.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TypeError: Cannot read properties of undefined (reading 'ldap')&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a login-page error on 1.120.3 and 1.120.4; one reporter says it happens even with &lt;code&gt;N8N_SSO_*_ENABLED=false&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://github.com/n8n-io/n8n/issues/22063" rel="noopener noreferrer"&gt;#22063&lt;/a&gt;, 1.120.3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Check 2: if it is &lt;code&gt;code=1008&lt;/code&gt;, compare Origin with Host in your proxy
&lt;/h2&gt;

&lt;p&gt;In #14653 commenters traced it to a push-connection origin check added around 1.88. Fixes as posted in the thread:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;code&gt;/rest/push&lt;/code&gt; location block of its own with &lt;code&gt;proxy_set_header Host $http_host;&lt;/code&gt; and &lt;code&gt;proxy_set_header Origin $scheme://$http_host;&lt;/code&gt; (oilycn, 21 April 2025); later commenters quote it and say it fixed it ("Worked like charm", "this line was the real fix"). The full walkthrough is in &lt;a href="https://dev.to/grain64/n8n-connection-lost-code1008-behind-a-reverse-proxy-seven-ways-the-origin-check-failed-in-one-1dp2"&gt;the previous post&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;set &lt;code&gt;Host&lt;/code&gt; and &lt;code&gt;Origin&lt;/code&gt; explicitly instead of with &lt;code&gt;$host&lt;/code&gt; (adshrc, 16 April 2025);&lt;/li&gt;
&lt;li&gt;include the port in &lt;code&gt;Origin&lt;/code&gt; if you serve on a non-standard one: in the closing comment (15 August 2025) an n8n team member wrote that the port is optional on 80 and 443 and, on a non-standard port, "I would expect the port to be needed as well".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the n8n log, later versions print &lt;code&gt;Origin header does NOT match the expected origin&lt;/code&gt;; a commenter on 1.114.4 still reached it in October. Read that line before you change a header: it prints both sides of the comparison.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 3: if it is &lt;code&gt;/undefined…&lt;/code&gt;, look at N8N_PATH
&lt;/h2&gt;

&lt;p&gt;In #17817 the editor requested &lt;code&gt;/undefinedrest/settings&lt;/code&gt; because &lt;code&gt;/rest/config.js&lt;/code&gt; was served without the path prefix. Home Assistant add-on users were among those hit. A maintainer posted a test image the same day; a collaborator wrote that the fix had been left out of 1.104.2 and would ship in 1.105.1, and one reporter still saw it on 1.107.3. Check &lt;code&gt;curl -I https://&amp;lt;your-host&amp;gt;/&amp;lt;your-path&amp;gt;/rest/config.js&lt;/code&gt; returns the script, not an HTML page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 4: if it is a 401 or the &lt;code&gt;ldap&lt;/code&gt; TypeError, check the version before the config
&lt;/h2&gt;

&lt;p&gt;Reporters in #19151 and #22063 describe an unchanged &lt;code&gt;docker-compose.yml&lt;/code&gt;, and the fastest fix in both threads was another version number:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;#19151: reporters went back to 1.108.2 and it worked; the author's closing confirmation is 1.110.1, and four reporters confirm 1.111.0 or the latest (1.109.2 did not fix it).&lt;/li&gt;
&lt;li&gt;#22063: only 1.119.1 worked for the reporters; two say pinning 1.121.2 worked for them, while a contributor wrote on 26 November that no fix had been deployed, only extra logging. One reporter's console says the origin "was untrustworthy" over plain HTTP on a LAN address. On 1 December a reply says they could not reproduce it on current versions, and a reporter confirms rebuilding the container after pulling the latest fixed it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Check 5: before the next upgrade
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Pin the image tag instead of &lt;code&gt;latest&lt;/code&gt;, so the version you roll back to is written down.&lt;/li&gt;
&lt;li&gt;Search the open and recently closed issues for the version you are moving to before you pull.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The four threads, as evidence
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Opened&lt;/th&gt;
&lt;th&gt;Closed&lt;/th&gt;
&lt;th&gt;Comments&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;#14653 "Connection lost after upgrade to 1.88.0"&lt;/td&gt;
&lt;td&gt;2025-04-15&lt;/td&gt;
&lt;td&gt;2025-08-15, not planned&lt;/td&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#17817 "1.104.2: Error connecting to n8n"&lt;/td&gt;
&lt;td&gt;2025-07-30&lt;/td&gt;
&lt;td&gt;2025-08-08, completed&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#19151 "Error connecting to n8n Could not connect to server after update to 1.109.1"&lt;/td&gt;
&lt;td&gt;2025-09-03&lt;/td&gt;
&lt;td&gt;2025-09-08, completed&lt;/td&gt;
&lt;td&gt;67&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#22063 "Cannot Login to n8n after update to Version 1.120.3"&lt;/td&gt;
&lt;td&gt;2025-11-20&lt;/td&gt;
&lt;td&gt;2025-12-01, not planned&lt;/td&gt;
&lt;td&gt;47&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two of the four closed as completed; the other two closed as not planned, after 80 and 47 comments. For the two closed as completed the fix came in a later release than the one that broke it (1.105.1 and 1.111.0); the other two closed with no fix named.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;Every thread in the table links to its GitHub source. &lt;a href="https://friction.grain64.com/p/n8n/?utm_source=devto&amp;amp;utm_content=article-4" rel="noopener noreferrer"&gt;n8n's page on Friction&lt;/a&gt; holds 39 reports from 80 public threads, each linked to its source, and cites three of these four (#14653, #19151, #22063) in its Self-hosting &amp;amp; upgrades area. What is stored and how to dispute a report: the &lt;a href="https://friction.grain64.com/data/?utm_source=devto&amp;amp;utm_content=article-4" rel="noopener noreferrer"&gt;data page&lt;/a&gt;. Free with an account: &lt;a href="https://friction.grain64.com/p/n8n/?utm_source=devto&amp;amp;utm_content=article-4-watch" rel="noopener noreferrer"&gt;watch n8n&lt;/a&gt; and get an email when a new report is added.&lt;/p&gt;

&lt;p&gt;The one question the four threads leave open: in #19151 and #22063 reporters got back to working by changing a version number, not a setting, and neither thread says what changed in the release. If you moved between these versions, which console line did you get first, and what did you roll back to? Reply with your version pair and the line.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Friction, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>selfhosted</category>
      <category>docker</category>
      <category>n8n</category>
      <category>devops</category>
    </item>
    <item>
      <title>n8n "Connection lost" (code=1008) behind a reverse proxy: seven ways the Origin check failed in one 80-comment GitHub thread</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Tue, 17 Nov 2026 06:51:07 +0000</pubDate>
      <link>https://dev.to/grain64/n8n-connection-lost-code1008-behind-a-reverse-proxy-seven-ways-the-origin-check-failed-in-one-1dp2</link>
      <guid>https://dev.to/grain64/n8n-connection-lost-code1008-behind-a-reverse-proxy-seven-ways-the-origin-check-failed-in-one-1dp2</guid>
      <description>&lt;p&gt;After upgrading to n8n 1.88, the editor loads and then says &lt;code&gt;Connection lost&lt;/code&gt;. The browser console shows &lt;code&gt;[WebSocketClient] Connection lost, code=1008&lt;/code&gt;. That is the push connection (&lt;code&gt;/rest/push&lt;/code&gt;) being refused, and the reason is in n8n's log, not the browser: &lt;code&gt;Invalid origin!&lt;/code&gt;, or on later versions &lt;code&gt;Origin header does NOT match the expected origin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/n8n-io/n8n/issues/14653" rel="noopener noreferrer"&gt;n8n issue #14653&lt;/a&gt; collected 80 comments between April and December 2025 on exactly this. It was closed as not planned on 15 August 2025, and people kept posting fixes after that (one on 1.114.4 in October). Reading it end to end, there is not one fix. There are seven different ways the same check failed, six with a fix that worked for the person who posted it. Here they are, so you can find yours first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the check compares
&lt;/h2&gt;

&lt;p&gt;The push endpoint (&lt;code&gt;packages/cli/src/push/index.ts&lt;/code&gt;) compares the browser's &lt;code&gt;Origin&lt;/code&gt; header with the host n8n expects for the request, and closes the socket with 1008 when they differ. What "expected" means changed between the versions in this thread, so check yours:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1.88.0:&lt;/strong&gt; &lt;code&gt;Origin&lt;/code&gt; must equal &lt;code&gt;http://&lt;/code&gt; or &lt;code&gt;https://&lt;/code&gt; plus the &lt;code&gt;Host&lt;/code&gt; header.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1.98.1:&lt;/strong&gt; n8n strips the scheme from &lt;code&gt;Origin&lt;/code&gt; and compares what is left with the &lt;code&gt;X-Forwarded-Host&lt;/code&gt; header when it is a string, and with &lt;code&gt;Host&lt;/code&gt; otherwise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1.114.4:&lt;/strong&gt; the check moved to &lt;code&gt;origin-validator.ts&lt;/code&gt;. It reads the RFC 7239 &lt;code&gt;Forwarded&lt;/code&gt; header first, then &lt;code&gt;X-Forwarded-Host&lt;/code&gt;, then &lt;code&gt;Host&lt;/code&gt;, and drops default ports before comparing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Read at the tags &lt;code&gt;n8n@1.88.0&lt;/code&gt;, &lt;code&gt;n8n@1.98.1&lt;/code&gt; and &lt;code&gt;n8n@1.114.4&lt;/code&gt; in the n8n repository.) A reverse proxy sits in between and can change both sides: it can rewrite &lt;code&gt;Host&lt;/code&gt;, add or rewrite &lt;code&gt;X-Forwarded-Host&lt;/code&gt;, and rewrite or drop &lt;code&gt;Origin&lt;/code&gt;. Every failure mode below is a proxy handing n8n a different value than the browser sent.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. nginx: set Host and Origin on the push route, with the port the browser used
&lt;/h2&gt;

&lt;p&gt;An early answer in the thread (adshrc, 16 April) was to stop using &lt;code&gt;$host&lt;/code&gt; and set both headers explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="n"&gt;n8n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Origin&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//n8n.example.com;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Later in the thread two people posted configs that build the values from nginx variables instead, on the push location only, and said they worked (Ethonwu, 27 June, posted for Nginx Proxy Manager; SKisContent on 1.104.2, 2 August). Trimmed to the lines both posted:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;rest&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;push&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;proxy_pass&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//localhost:5678;&lt;/span&gt;
    &lt;span class="n"&gt;proxy_http_version&lt;/span&gt; &lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Upgrade&lt;/span&gt; $&lt;span class="n"&gt;http_upgrade&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Connection&lt;/span&gt; &lt;span class="s2"&gt;"upgrade"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt; $&lt;span class="n"&gt;http_host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Origin&lt;/span&gt; $&lt;span class="n"&gt;scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//$http_host;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference that matters is &lt;code&gt;$host&lt;/code&gt; versus &lt;code&gt;$http_host&lt;/code&gt;: in nginx &lt;code&gt;$host&lt;/code&gt; is the host name without a port, while &lt;code&gt;$http_host&lt;/code&gt; is the &lt;code&gt;Host&lt;/code&gt; request header as the browser sent it, port included. One caveat from the source above: on 1.98.1 and later, if your proxy also sends &lt;code&gt;X-Forwarded-Host&lt;/code&gt;, that header, not &lt;code&gt;Host&lt;/code&gt;, is the value &lt;code&gt;Origin&lt;/code&gt; is compared with.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. nginx: the same fix stops working, because it is the port
&lt;/h2&gt;

&lt;p&gt;One user (easyservices) fixed 1.88.0 with the port in both headers: &lt;code&gt;Host n8n.&amp;lt;myhost&amp;gt;.fr:&amp;lt;myport&amp;gt;&lt;/code&gt; and &lt;code&gt;Origin https://n8n.&amp;lt;myhost&amp;gt;.fr:&amp;lt;myport&amp;gt;&lt;/code&gt;. After upgrading to 1.95.2 it broke again, and the fix was the opposite for &lt;code&gt;Origin&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="n"&gt;proxy_set_header&lt;/span&gt; &lt;span class="nc"&gt;Origin&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//&amp;lt;my_public_host&amp;gt;;   # port number removed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;plus &lt;code&gt;N8N_PROXY_HOPS=1&lt;/code&gt; and &lt;code&gt;N8N_PUSH_BACKEND=websocket&lt;/code&gt; on the n8n side.&lt;/p&gt;

&lt;p&gt;The next day (3 June) the same author took it back: "Force the Origin header as I did above is finally a really bad idea, for security reasons." Their replacement, working on 1.95.3, sets no &lt;code&gt;Origin&lt;/code&gt; at all and gives &lt;code&gt;Host&lt;/code&gt; and &lt;code&gt;X-Forwarded-Host&lt;/code&gt; the host and port the client sees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="n"&gt;proxy_set_header&lt;/span&gt;   &lt;span class="nc"&gt;Host&lt;/span&gt;              &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;:&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;proxy_set_header&lt;/span&gt;   &lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Forwarded&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Host&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;:&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;proxy_set_header&lt;/span&gt;   &lt;span class="no"&gt;X&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Forwarded&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Port&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another commenter (actuallymentor, 2 July) inspected the logs and saw that n8n expects &lt;code&gt;Origin&lt;/code&gt; to include the port, at least with TLS, and posted &lt;code&gt;proxy_set_header Origin $host:$server_port;&lt;/code&gt; (no scheme). In the same comment they call that "NOT a good thing": the &lt;code&gt;Origin&lt;/code&gt; header should not enforce ports, it is browser-controlled, and they suggest that is why it breaks on Chrome but not Firefox. The 15 August closing comment from an n8n team member says that with an &lt;code&gt;Origin&lt;/code&gt; header the port is optional (http defaults to 80, https to 443), and that with a non-standard port the port would be needed as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Nginx Proxy Manager: you may need no custom config at all
&lt;/h2&gt;

&lt;p&gt;rialco (30 June, NPM 2.12.3, n8n 1.100.1) says you do not need any of the custom config in NPM, only the Websockets Support switch on the proxy host. The maintainer's closing comment says that with Nginx Proxy Manager there is no need for custom options. Check that box before you paste any of the above.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. IIS with ARR: the Host header you set is not the one n8n gets
&lt;/h2&gt;

&lt;p&gt;fernandobnog's IIS setup failed with fixed headers on every version above 1.86.0, until a chain of IIS, then nginx, then n8n worked. EJocys (IIS only, 1.88, downgraded to 1.86.1 first) then found why the &lt;code&gt;web.config&lt;/code&gt; header override did nothing: Application Request Routing ignored &lt;code&gt;&amp;lt;set name="HTTP_HOST" ...&amp;gt;&lt;/code&gt; and sent the host from the &lt;code&gt;&amp;lt;action&amp;gt;&lt;/code&gt; URL, so n8n received &lt;code&gt;Host: 127.0.0.1:5678&lt;/code&gt; even with &lt;code&gt;preserveHostHeader="true"&lt;/code&gt; in the site's &lt;code&gt;web.config&lt;/code&gt;. What fixed it, in EJocys's words: set &lt;code&gt;preserveHostHeader&lt;/code&gt; to True at the server level (IIS Manager, server node, Application Request Routing Cache, Configuration Editor, section &lt;code&gt;system.webServer/proxy&lt;/code&gt;). One more detail from the same comment: &lt;code&gt;N8N_LOG_LEVEL=debug&lt;/code&gt; did not say why the origin was invalid.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. CloudFront: the Origin header never arrives
&lt;/h2&gt;

&lt;p&gt;samadwar (17 April; Docker on Fargate behind an ALB and CloudFront) got &lt;code&gt;Connection lost&lt;/code&gt; and &lt;code&gt;Invalid origin!&lt;/code&gt; only through CloudFront. They found it by pointing the proxy at an echo server and looking at the headers n8n would see, and fixed it in the CloudFront settings; their guess, hedged in the comment, is the cache policy that allows the &lt;code&gt;Origin&lt;/code&gt; header through.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Other proxies in front: fixed headers did not help
&lt;/h2&gt;

&lt;p&gt;kamil256 (Ocelot) and ppisko (a plain nginx config on 1.88.0) both report that setting fixed &lt;code&gt;Host&lt;/code&gt; and &lt;code&gt;Origin&lt;/code&gt; made no difference, and RyonMB reports that 1.89 returns a 500 with &lt;code&gt;Invalid origin!&lt;/code&gt; instead of the 1008. This is the part of the thread with no answer: three reporters, no recorded fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Apache: the expected origin is computed twice
&lt;/h2&gt;

&lt;p&gt;CometDog (17 June, n8n 1.98.1, Apache to Docker) had a working WebSocket upgrade and still got the disconnect. Their log line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Origin header does NOT match the expected origin. (Origin: "myorigin.com", Expected: "myorigin.com, myorigin.com")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;n8n expected the origin as a comma-separated pair, and setting &lt;code&gt;N8N_ALLOWED_ORIGINS&lt;/code&gt; to one value, or a wildcard, changed nothing. What they did, in their words "duplicated on purpose to satisfy n8n":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LocationMatch&lt;/span&gt; &lt;span class="s2"&gt;"^/rest/push"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;RequestHeader&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="nc"&gt;Origin&lt;/span&gt; &lt;span class="s2"&gt;"myorigin.com, myorigin.com"&lt;/span&gt;
  &lt;span class="nc"&gt;RequestHeader&lt;/span&gt; &lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="s2"&gt;"myorigin.com"&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;LocationMatch&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In October another user on 1.114.4 (Apache on Windows, &lt;code&gt;N8N_PROXY_HOPS=1&lt;/code&gt;, &lt;code&gt;N8N_PROTOCOL=https&lt;/code&gt;, &lt;code&gt;WEBHOOK_URL&lt;/code&gt; and &lt;code&gt;N8N_EDITOR_BASE_URL&lt;/code&gt; set) posted a log with the same shape: &lt;code&gt;Expected: "mydomain.com, mydomain.com"&lt;/code&gt;. No one in the thread explains why the expected value is doubled.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one are you
&lt;/h2&gt;

&lt;p&gt;Read the line in the n8n log, not the red box: on 1.98.1 and 1.114.4, the two versions whose source I read, it prints both sides of the comparison, and a &lt;code&gt;headers&lt;/code&gt; object with &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;origin&lt;/code&gt; and &lt;code&gt;x-forwarded-host&lt;/code&gt;. If &lt;code&gt;Origin&lt;/code&gt; and &lt;code&gt;Expected&lt;/code&gt; differ only by a port, start with failures 1 and 2. Look at &lt;code&gt;x-forwarded-host&lt;/code&gt; before you edit &lt;code&gt;Host&lt;/code&gt;: on those versions it is what the origin is compared with when it is present. If your proxy is IIS, failure 4. If the expected value repeats itself, you are the case in failure 7.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;Everything above is from &lt;a href="https://github.com/n8n-io/n8n/issues/14653" rel="noopener noreferrer"&gt;one GitHub thread&lt;/a&gt;, linked to the comment authors' own words. It is the lead source of the theme "Editor websocket fails behind nginx reverse proxy after upgrade" (3 source threads) on &lt;a href="https://friction.grain64.com/p/n8n/?utm_source=devto&amp;amp;utm_content=article-5" rel="noopener noreferrer"&gt;n8n's page on Friction&lt;/a&gt;, which groups 39 recent reports from 80 public threads, each linked to its source. Free with an account: &lt;a href="https://friction.grain64.com/p/n8n/?utm_source=devto&amp;amp;utm_content=article-5-watch" rel="noopener noreferrer"&gt;watch n8n&lt;/a&gt; and get an email when a new report is added. What is stored and how to dispute a report: the &lt;a href="https://friction.grain64.com/data/?utm_source=devto&amp;amp;utm_content=article-5" rel="noopener noreferrer"&gt;data page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The one detail the thread leaves open: both doubled-origin logs (1.98.1 on Apache in June, 1.114.4 on Apache in October) show &lt;code&gt;Expected: "&amp;lt;host&amp;gt;, &amp;lt;host&amp;gt;"&lt;/code&gt;. In the source above, that string is the whole &lt;code&gt;X-Forwarded-Host&lt;/code&gt; value on 1.98.1, and the raw expected host on 1.114.4, so the value reached n8n doubled. In the October config the author sets &lt;code&gt;X-Forwarded-Host&lt;/code&gt; by hand in the vhost and has &lt;code&gt;ProxyPreserveHost On&lt;/code&gt;. The checkable question: in your n8n log, does &lt;code&gt;x-forwarded-host&lt;/code&gt; show the host once or twice, and what sits in front of n8n? If you run it behind Apache, nginx or Caddy, reply with your version, what is in front, and whether the log prints it once: that is what would show where the second copy comes from.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Friction, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>selfhosted</category>
      <category>nginx</category>
      <category>devops</category>
    </item>
    <item>
      <title>What a 12-row model test can and cannot tell you (with the interval code)</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Mon, 16 Nov 2026 06:01:04 +0000</pubDate>
      <link>https://dev.to/grain64/what-a-12-row-model-test-can-and-cannot-tell-you-with-the-interval-code-171d</link>
      <guid>https://dev.to/grain64/what-a-12-row-model-test-can-and-cannot-tell-you-with-the-interval-code-171d</guid>
      <description>&lt;p&gt;A twelve-example test is enough to catch a cheaper model that breaks on your data. It is not enough to prove it is as good as the one you run. The gap is easy to put a number on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Put an interval on the pass rate.&lt;/strong&gt; A model that gets 12 of 12 right has a 95% Wilson interval of 75.7% to 100%. 11 of 12 gives 64.6% to 98.5%. 10 of 12 gives 55.2% to 95.3%. For comparison, 290 right out of 300 gives 94.0% to 98.2%. Hold the lower edge, not the point estimate, against your bar.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;wilson&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.96&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;n&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;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;d&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Use a small sample to rule models out, not in.&lt;/strong&gt; If a candidate misses rows your current model passes, read those rows first. They show what the candidate does with your inputs, and that is worth the minute. A clean 12 of 12 only says it is worth a bigger run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Pick the rows that hurt.&lt;/strong&gt; A random twelve mostly measures the easy cases. Take rows from your logs where the answer was ambiguous, the label is rare, or a model has failed before.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Count every attempt in the price.&lt;/strong&gt; Cost per successful task is the money spent on all attempts, retries and failures included, divided by the tasks that passed. A model that sometimes answers with nothing gets retried, and the retries are on your invoice. On one public run of 300 function-calling tasks, Mistral Small (2603) returned an empty reply 58 times even after retries and passed 70.7%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Repeat on 100 or more rows before you switch.&lt;/strong&gt; The small test chooses which models earn the bigger run. The bigger run, with the interval from check 1, makes the decision.&lt;/p&gt;

&lt;p&gt;If you want checks 2 to 4 without writing the loop, the verdict pages on Clearbar have a box for it: paste 5 to 20 input =&amp;gt; expected pairs, pick up to three candidates next to your current model, and the run happens in your browser with your own OpenRouter key. The key goes to OpenRouter only and is not stored, and a run is capped at $0.50. You get pass rate and cost per successful task for each model: &lt;a href="https://clearbar.grain64.com/verdicts/sms-spam/?utm_source=devto&amp;amp;utm_campaign=devto-articles&amp;amp;utm_content=article" rel="noopener noreferrer"&gt;https://clearbar.grain64.com/verdicts/sms-spam/?utm_source=devto&amp;amp;utm_campaign=devto-articles&amp;amp;utm_content=article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is the smallest sample you have trusted before switching a model, and what did it miss?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Clearbar, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>openrouter</category>
      <category>testing</category>
    </item>
    <item>
      <title>GPT-6 Luna vs Claude Haiku 5.5: cost per correct answer on 4 tasks</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Sat, 14 Nov 2026 08:06:02 +0000</pubDate>
      <link>https://dev.to/grain64/gpt-6-luna-vs-claude-haiku-55-cost-per-correct-answer-on-4-tasks-g25</link>
      <guid>https://dev.to/grain64/gpt-6-luna-vs-claude-haiku-55-cost-per-correct-answer-on-4-tasks-g25</guid>
      <description>&lt;p&gt;Short answer from four public runs: on pass rate these two cannot be told apart on these rows, and neither is cheaper everywhere. GPT-6 Luna cost about 1.5x less per correct answer on 77-intent banking classification; Claude Haiku 5.5 cost about 1.2x less on SMS spam and the same within a hair on review sentiment; on JSON extraction both are borderline: pass rate at or above the bar, interval low edge under it. Haiku answered in about 250 ms at the median against about 390 ms for Luna on every task.&lt;/p&gt;

&lt;p&gt;Cost per correct answer here means total spend over every attempt, retries included, divided by the answers that matched the label. Prices are the 5 Nov 2026 snapshot, all calls at temperature 0.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task (rows, bar)&lt;/th&gt;
&lt;th&gt;Luna: pass, $ per success&lt;/th&gt;
&lt;th&gt;Haiku 5.5: pass, $ per success&lt;/th&gt;
&lt;th&gt;GPT-6.1 Terra: pass, $ per success&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Banking intent, 77 labels (150, 70%)&lt;/td&gt;
&lt;td&gt;82.0%, $0.000090&lt;/td&gt;
&lt;td&gt;80.0%, $0.000138&lt;/td&gt;
&lt;td&gt;84.0%, $0.000727&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Review sentiment (300, 88%)&lt;/td&gt;
&lt;td&gt;98.0%, $0.000024&lt;/td&gt;
&lt;td&gt;97.3%, $0.000023&lt;/td&gt;
&lt;td&gt;98.0%, $0.000165&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SMS spam (300, 90%)&lt;/td&gt;
&lt;td&gt;97.0%, $0.000026&lt;/td&gt;
&lt;td&gt;97.3%, $0.000021&lt;/td&gt;
&lt;td&gt;98.3%, $0.000163&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON extraction (136, 55%)&lt;/td&gt;
&lt;td&gt;55.1%, $0.000401&lt;/td&gt;
&lt;td&gt;61.0%, $0.000577&lt;/td&gt;
&lt;td&gt;51.8%, $0.003926&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can check any cell with a calculator: Luna on banking spent $0.011092 for 123 correct answers, $0.011092 / 123 = $0.00009. Haiku spent $0.016501 for 120, $0.016501 / 120 = $0.000138.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The pass rates overlap.&lt;/strong&gt; The 95% intervals for the two models overlap on all four tasks (banking: 75.1-87.3% vs 72.9-85.6%; spam: 94.4-98.4% vs 94.8-98.6%). Two points of pass rate on 150 or 300 rows is noise, so the choice between them is a price and speed choice, not a quality one, on classification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The price gap moves with the task.&lt;/strong&gt; If you pick by the rule "cheapest model whose interval's lower edge clears your bar", it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;clears&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;wilsonLow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;successes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clears&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;successes&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;successes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&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;Between these two, by that rule: banking goes to Luna ($0.00009 vs $0.000138), spam to Haiku ($0.000021 vs $0.000026), sentiment is a coin flip at $0.000024 vs $0.000023. Neither passes the low-edge rule on extraction: both come out borderline, with lower edges (46.8% and 52.6%) under the 55% bar. Haiku is higher on that task, 61.0% vs 55.1%, at about 1.4x the price per success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The one that costs more did not win extraction.&lt;/strong&gt; GPT-6.1 Terra cost 6 to 10 times Luna per correct answer on these runs and was lower than both on extraction (51.8%, below its bar). A bigger tier is not a safer default when the task is structured output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One other model in the same runs was cheaper still.&lt;/strong&gt; Mistral Small (2603) cleared sentiment at $0.000019 and spam at $0.000016. It was below the bar on banking intent (68.0% against 70%).&lt;/p&gt;

&lt;p&gt;The verdict page uses a different rule: the cheapest model that clears the bar and also matches the strongest model (GPT-6.1 Sol) on the same rows. That is why it names Terra for banking, and Luna for extraction, where it matches Sol within noise. Which rule fits depends on whether you need to match the top tier or just clear your own bar. Every row, prompt and price behind these tables is public, and the same run on your own examples, with a pass bar you set, is free during early access (3 runs a month, up to 100 examples, your own OpenRouter key): &lt;a href="https://clearbar.grain64.com/verdicts/?utm_source=devto&amp;amp;utm_campaign=devto-luna-vs-haiku" rel="noopener noreferrer"&gt;https://clearbar.grain64.com/verdicts/?utm_source=devto&amp;amp;utm_campaign=devto-luna-vs-haiku&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All four runs send each row as one short call with a short system prompt. If your calls share a long prefix that your provider caches, the cost order could change. Have you measured a cache hit rate on either model, and did it change which one came out cheaper per correct answer?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Clearbar, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>openrouter</category>
      <category>comparison</category>
    </item>
    <item>
      <title>Read your AWS Cost Explorer CSV in 19 lines of Node</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Sat, 14 Nov 2026 04:33:27 +0000</pubDate>
      <link>https://dev.to/grain64/read-your-aws-cost-explorer-csv-in-19-lines-of-node-4gln</link>
      <guid>https://dev.to/grain64/read-your-aws-cost-explorer-csv-in-19-lines-of-node-4gln</guid>
      <description>&lt;p&gt;Cost Explorer's charts answer "which service". The CSV answers the better question, "which line item, and when did it change". You can read it with a script short enough to paste into a terminal, and no AWS credentials are involved: you only read a file you already downloaded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the file
&lt;/h2&gt;

&lt;p&gt;In Cost Explorer, set the date range to the last 30 to 90 days, granularity &lt;strong&gt;Daily&lt;/strong&gt;, &lt;strong&gt;Group by: Usage type&lt;/strong&gt;, then &lt;strong&gt;Download CSV&lt;/strong&gt;. The file has one row per usage type, one column per day, and a final column with the total.&lt;/p&gt;

&lt;p&gt;Here is a tiny made-up file (synthetic, not from a real account), saved as &lt;code&gt;sample.csv&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csvs"&gt;&lt;code&gt;&lt;span class="s2"&gt;"Usage type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"2026-10-01"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"2026-10-02"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"2026-10-03"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;"Total costs($)"&lt;/span&gt;
&lt;span class="s2"&gt;"USE1-BoxUsage:m5.large"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;36.86&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;36.86&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;36.86&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;110.58&lt;/span&gt;
&lt;span class="s2"&gt;"USE1-NatGateway-Bytes"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;8.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;8.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;31.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;47.00&lt;/span&gt;
&lt;span class="s2"&gt;"USE1-NatGateway-Hours"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;2.16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;2.16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;2.16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;6.48&lt;/span&gt;
&lt;span class="s2"&gt;"USE1-DataTransfer-Regional-Bytes"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;12.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;12.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;12.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;36.00&lt;/span&gt;
&lt;span class="s2"&gt;"USE1-PublicIPv4:InUseAddress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;0.48&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;0.48&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;0.48&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;1.44&lt;/span&gt;
&lt;span class="s2"&gt;"Total costs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;59.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;59.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;82.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mf"&gt;201.50&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The script
&lt;/h2&gt;

&lt;p&gt;Save as &lt;code&gt;top.mjs&lt;/code&gt;. It needs Node 18 or newer and nothing from npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;readFileSync&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:fs'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Split one CSV line; commas inside "quotes" stay in the field.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cells&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"([^"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="s2"&gt;"|[^,]*)(,|$)/g)
  .map((c) =&amp;gt; c.replace(/,$/, '').replace(/^"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;"$/g, '').replace(/""/g, '"&lt;/span&gt;&lt;span class="s1"&gt;'))
  .slice(0, -1);

const [head, ...rows] = readFileSync(process.argv[2], '&lt;/span&gt;&lt;span class="n"&gt;utf8&lt;/span&gt;&lt;span class="s1"&gt;').replace(/^\uFEFF/, '').trim().split(/[\u000d\u000a]+/);
const days = cells(head).slice(1, -1);                        // the date columns
const items = rows.map(cells)
  .filter((r) =&amp;gt; !/^Total costs/.test(r[0]))
  .map((r) =&amp;gt; ({ type: r[0], first: +r[1], last: +r[r.length - 2], total: +r[r.length - 1] }))
  .sort((a, b) =&amp;gt; b.total - a.total);

console.log(`${days[0]} to ${days.at(-1)}`);
for (const i of items.slice(0, 10)) {
  const jump = i.first &amp;gt; 0 &amp;amp;&amp;amp; i.last / i.first &amp;gt;= 2 ? `  &amp;lt;- ${(i.last / i.first).toFixed(1)}x since day 1` : '';
  console.log(`${i.type.padEnd(34)} $${i.total.toFixed(2).padStart(8)}${jump}`);
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;node top.mjs sample.csv&lt;/code&gt; and you get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-10-01 to 2026-10-03
USE1-BoxUsage:m5.large             $  110.58
USE1-NatGateway-Bytes              $   47.00  &amp;lt;- 3.9x since day 1
USE1-DataTransfer-Regional-Bytes   $   36.00
USE1-NatGateway-Hours              $    6.48
USE1-PublicIPv4:InUseAddress       $    1.44
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That output was produced by running the script on the file above. It handles a byte-order mark, Windows line endings and quoted names that contain commas.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to look at in the output
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The biggest line is rarely the interesting one.&lt;/strong&gt; Compute is large and expected. The lines worth a question are the ones you cannot explain from your architecture: &lt;code&gt;NatGateway-Bytes&lt;/code&gt;, &lt;code&gt;DataTransfer-Regional-Bytes&lt;/code&gt;, &lt;code&gt;PublicIPv4:*&lt;/code&gt;, &lt;code&gt;DataProcessing-Bytes&lt;/code&gt; (CloudWatch Logs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The arrow is the whole point.&lt;/strong&gt; A line that ran at $8 a day and now runs at $31 a day did not drift. Something shipped, scaled or started looping on that date. Open the daily columns and find the first day it moved, then match it against your deploy history.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the price against the arithmetic.&lt;/strong&gt; In US East (N. Virginia) a NAT gateway processes data at $0.045 per GB, so $47.00 of &lt;code&gt;NatGateway-Bytes&lt;/code&gt; is about 1,044 GB. If that number surprises you, that is the thing to investigate. Prices differ by region; check yours on the AWS pricing page for the service.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Make it yours
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Change &lt;code&gt;slice(0, 10)&lt;/code&gt; to show more rows.&lt;/li&gt;
&lt;li&gt;Change the &lt;code&gt;&amp;gt;= 2&lt;/code&gt; ratio to catch smaller jumps.&lt;/li&gt;
&lt;li&gt;Lines that start at $0 are not flagged (the arrow needs a day-1 amount to divide by). To catch something that appeared mid-period, add a check for &lt;code&gt;first === 0 &amp;amp;&amp;amp; last &amp;gt; 0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Compare two files by building a map from usage type to total and printing the difference.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you would rather not maintain a script, the same kind of file can be dropped into &lt;a href="https://billtrim.grain64.com/" rel="noopener noreferrer"&gt;a browser-based reader&lt;/a&gt; that runs the line items against a table of known cost causes and shows the dollars for each, with the console steps for the fix. The file is read in your browser; only a compact summary of totals is sent.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Billtrim, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>cost</category>
    </item>
    <item>
      <title>Undoing what an AI agent did to your CRM: what a revert has to record</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Fri, 13 Nov 2026 00:41:23 +0000</pubDate>
      <link>https://dev.to/grain64/undoing-what-an-ai-agent-did-to-your-crm-what-a-revert-has-to-record-3old</link>
      <guid>https://dev.to/grain64/undoing-what-an-ai-agent-did-to-your-crm-what-a-revert-has-to-record-3old</guid>
      <description>&lt;p&gt;An agent that edits records will eventually edit the wrong ones: a bad merge, a field overwritten across a few hundred contacts, a cleanup that deleted what it should have kept. A log tells you what happened. It does not give you the records back.&lt;/p&gt;

&lt;p&gt;If you are about to give an agent write access to a CRM, here is what the undo has to do, and how to check it before you trust it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Log the before-image, not just the event
&lt;/h2&gt;

&lt;p&gt;"Agent X updated contact 412" is an audit line. "Contact 412 was {title: CTO, phase: lead}, now {title: CTO, phase: customer}" is something you can reverse. Every write needs the record as it was before and as it is after, stored with the actor, a run identifier and a request id. Append only: an edit to the history defeats the point of having one.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Group writes into runs
&lt;/h2&gt;

&lt;p&gt;Nobody wants to revert 300 individual changes. The unit that matters is the run: everything one agent did for one job. Two ways to get there: group calls that arrive close together automatically, and let the agent name its run so you can find it later. A header pair works well for this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;X-Run-Id: prospecting-2026-10-12
X-Run-Label: Seed-stage dev tools, batch 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When something goes wrong you search for the label, open the run and see every write in it.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A revert is a human action
&lt;/h2&gt;

&lt;p&gt;This is the rule that is easiest to skip. The credential that lets an agent write must not be able to revert. If an agent can undo its own work it can also undo the evidence, and "the agent fixed it" is the worst way to learn what the agent did. Reverting should need a person's session, and calling it with an agent key should fail with a clear error.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Never overwrite a newer edit
&lt;/h2&gt;

&lt;p&gt;Between the agent's write and your revert, a person may have fixed the record by hand. Restoring the before-image over their edit trades one mistake for another. A safe revert checks each record: if it changed again after the agent's entry, skip it, and report it with the reason. You finish with "47 reverted, 3 skipped, here is why" instead of a quiet overwrite.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A revert is also an entry
&lt;/h2&gt;

&lt;p&gt;The history has to stay complete: the agent changed it, the operator reverted it, both visible, in order. If a revert erases the original entries, you lose the ability to find out why it happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Know what undo cannot cover
&lt;/h2&gt;

&lt;p&gt;Records, imports and campaign changes can be restored. An email that has already left cannot be recalled. This is why the best undo story for outbound mail is upstream: drafts land in a queue, a person sends them, and a dry run shows what a campaign would send before any real delivery.&lt;/p&gt;

&lt;h2&gt;
  
  
  A ten-minute check
&lt;/h2&gt;

&lt;p&gt;On a throwaway workspace: let an agent upsert 20 contacts under a named run, edit two of them by hand, then revert the run. You want to see 18 restored, 2 skipped with a reason, the revert itself in the log under your name, and a refusal when you try the same call with the agent's key.&lt;/p&gt;

&lt;p&gt;If your CRM can do all of that, you can leave an agent running. If it cannot, decide what you are willing to lose before you hand it the key.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Deskhand, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>agents</category>
      <category>crm</category>
    </item>
    <item>
      <title>Five checks to run before you upgrade Umami (from 7 GitHub migration failures)</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Fri, 13 Nov 2026 00:03:00 +0000</pubDate>
      <link>https://dev.to/grain64/five-checks-to-run-before-you-upgrade-umami-from-7-github-migration-failures-6j5</link>
      <guid>https://dev.to/grain64/five-checks-to-run-before-you-upgrade-umami-from-7-github-migration-failures-6j5</guid>
      <description>&lt;p&gt;The Umami upgrade that fails ends the same way: the container boots, stops, and the log says &lt;code&gt;A migration failed to apply. New migrations cannot be applied before the error is recovered from&lt;/code&gt; (Prisma P3018) or &lt;code&gt;migrate found failed migrations in the target database&lt;/code&gt; (P3009). Seven GitHub issues between August 2022 and May 2025 are that message, on Postgres and on MariaDB, and the threads point to the same things to look at before you pull the new image. Five checks, each one you can start in a minute:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Do you already have a half-applied migration?&lt;/strong&gt; A failed migration blocks every later one, so a database that has one will fail the next upgrade at once. In the database Umami uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;migration_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;started_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;finished_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rolled_back_at&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;_prisma_migrations&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;finished_at&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;rolled_back_at&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any row means a migration started, did not finish and was not rolled back. Fix that first (check 5), not after the upgrade.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Which database engine and version are you on?&lt;/strong&gt; &lt;code&gt;SELECT version();&lt;/code&gt;. Two causes are about the database, not Umami: Postgres 12 or older (#1604: the 1.39.0 and 1.39.1 migrations did not run there) and MariaDB (#2645 and #2693: &lt;code&gt;05_add_visit_id&lt;/code&gt; calls &lt;code&gt;BIN_TO_UUID&lt;/code&gt;, which MariaDB does not have; reporters ran 10.4 to 11.2).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. How big is &lt;code&gt;website_event&lt;/code&gt;?&lt;/strong&gt; &lt;code&gt;SELECT COUNT(*) FROM website_event;&lt;/code&gt;. The threads that give a time give a rough scale: one commenter on Postgres reported several hours for about 1 GB of &lt;code&gt;website_event&lt;/code&gt; on &lt;code&gt;05_add_visit_id&lt;/code&gt; and wrote a batch script, while the same thread has 1.5 GB in about 30 minutes and 1 GB in a few minutes (#2645); about 2 GB took about 15 minutes on a small machine and another user waited 15+ minutes for &lt;code&gt;09_update_hostname_region&lt;/code&gt; (#3408); about three years of data took roughly an hour (#3408); a 16-million-row &lt;code&gt;website_event&lt;/code&gt; made &lt;code&gt;05_add_visit_id&lt;/code&gt; take "way longer than I expected" (#2206). Their hardware and versions differ, so read it as minutes to hours, not a formula.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Will something kill the container mid-migration?&lt;/strong&gt; In #3408 a commenter suspected a healthcheck on the Umami HTTP heartbeat (5 s interval, 5 retries, no start period, so about 25 s): the server is not up until the migration ends, so the check cannot pass and the container may be marked failed and killed mid-migration. Another user with the same problem removed the healthchecks and wrote that it upgraded in about 5 minutes. For the upgrade run: remove or lengthen the healthcheck, and set &lt;code&gt;restart: 'no'&lt;/code&gt; (a Swarm user in the same thread did) so nothing restarts the container halfway and leaves the state check 1 looks for. Then wait; do not restart it yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Do you know the recovery before you need it?&lt;/strong&gt; Back up first. Then, when a migration fails: read the migration name in the error (&lt;code&gt;05_add_visit_id&lt;/code&gt;, &lt;code&gt;09_update_hostname_region&lt;/code&gt;) and look at its SQL. Finish the SQL by hand, then &lt;code&gt;npx prisma migrate resolve --applied "&amp;lt;name&amp;gt;"&lt;/code&gt;. Marking it applied on its own records it as done without running it, and a #2645 commenter then hit &lt;code&gt;The column visit_id does not exist&lt;/code&gt;. If the migration never ran at all, &lt;code&gt;--rolled-back&lt;/code&gt; is the other option (#1406).&lt;/p&gt;

&lt;h2&gt;
  
  
  The seven threads, and how each one closed
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Opened&lt;/th&gt;
&lt;th&gt;Your upgrade path&lt;/th&gt;
&lt;th&gt;What the thread shows&lt;/th&gt;
&lt;th&gt;Closed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/1393" rel="noopener noreferrer"&gt;#1393&lt;/a&gt; "Update script fails with new version of umami"&lt;/td&gt;
&lt;td&gt;2022-08-10&lt;/td&gt;
&lt;td&gt;Docker, to 1.37.0&lt;/td&gt;
&lt;td&gt;A comment says the 1.37.0 migration script was updated and to pull the latest image; the reporter confirms that fixed it, and the same comment lists the &lt;code&gt;migrate resolve&lt;/code&gt; recovery.&lt;/td&gt;
&lt;td&gt;2022-08-12, completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/1406" rel="noopener noreferrer"&gt;#1406&lt;/a&gt; "Migration fails from 1.36.1 to 1.37.0"&lt;/td&gt;
&lt;td&gt;2022-08-10&lt;/td&gt;
&lt;td&gt;Postgres, 1.33.1 to 1.37.0&lt;/td&gt;
&lt;td&gt;Same release. The thread gives the recovery: &lt;code&gt;yarn prisma migrate resolve --rolled-back "02_add_event_data"&lt;/code&gt;, then &lt;code&gt;migrate deploy&lt;/code&gt;.&lt;/td&gt;
&lt;td&gt;2022-08-16, completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/1604" rel="noopener noreferrer"&gt;#1604&lt;/a&gt; "The column &lt;code&gt;account.account_uuid&lt;/code&gt; does not exist in the current database after upgrading to 1.39.2"&lt;/td&gt;
&lt;td&gt;2022-10-26&lt;/td&gt;
&lt;td&gt;Docker, Postgres 12 or older, to 1.39.x&lt;/td&gt;
&lt;td&gt;Maintainer: 1.39.0/1.39.1 migrations did not run on Postgres 12 and older; delete the &lt;code&gt;04_add_uuid&lt;/code&gt; row from &lt;code&gt;_prisma_migrations&lt;/code&gt; and rebuild. Another user fixed it by re-running &lt;code&gt;yarn update-db&lt;/code&gt;; a third wrote up moving to a newer Postgres by dump and restore.&lt;/td&gt;
&lt;td&gt;2022-12-07, completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/2206" rel="noopener noreferrer"&gt;#2206&lt;/a&gt; "[Docker] Upgrade from 2.4.1 to 2.5.0 fail"&lt;/td&gt;
&lt;td&gt;2023-08-18&lt;/td&gt;
&lt;td&gt;MySQL and Postgres, 2.4.1 to 2.5.0&lt;/td&gt;
&lt;td&gt;Still collecting comments in 2025: one user suspected the service timeout was reached before an index build finished, ran &lt;code&gt;03_metric_performance_index&lt;/code&gt; by hand and added its row to &lt;code&gt;_prisma_migrations&lt;/code&gt;; the next, &lt;code&gt;05_add_visit_id&lt;/code&gt;, was then taking "way longer than I expected" on 16 million &lt;code&gt;website_event&lt;/code&gt; rows (Postgres).&lt;/td&gt;
&lt;td&gt;2024-02-29, completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/2645" rel="noopener noreferrer"&gt;#2645&lt;/a&gt; "prisma migrate deploy Error: P3009"&lt;/td&gt;
&lt;td&gt;2024-04-04&lt;/td&gt;
&lt;td&gt;Fresh MySQL or MariaDB install&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;05_add_visit_id&lt;/code&gt; calls &lt;code&gt;BIN_TO_UUID&lt;/code&gt;, which MariaDB does not have (reporters ran MariaDB from 10.4 to 11.2). The title says P3009; the body shows P3018. Workaround in the thread: run a compatible version of the SQL by hand, then &lt;code&gt;npx prisma migrate resolve --applied "05_add_visit_id"&lt;/code&gt;. On Postgres, one reporter hit the same migration running several hours on a 1 GB &lt;code&gt;website_event&lt;/code&gt; table and wrote a batch script. A comment in September 2025 says it is still an issue on MariaDB.&lt;/td&gt;
&lt;td&gt;2025-01-11, completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/2693" rel="noopener noreferrer"&gt;#2693&lt;/a&gt; "Migration error P3018 with MySQL migration 05"&lt;/td&gt;
&lt;td&gt;2024-04-18&lt;/td&gt;
&lt;td&gt;Docker, MariaDB 11.2.2&lt;/td&gt;
&lt;td&gt;The same &lt;code&gt;05_add_visit_id&lt;/code&gt; migration and the same &lt;code&gt;FUNCTION umami.BIN_TO_UUID does not exist&lt;/code&gt;. Three commenters report &lt;code&gt;npx prisma migrate resolve --applied "05_add_visit_id"&lt;/code&gt; got them running (one notes their tables were empty); another replaced the failing &lt;code&gt;BIN_TO_UUID&lt;/code&gt; line and ran the migration by hand. A commenter on MariaDB 10.11.6 (no Docker) hit it too and notes that the #2645 author put P3009 in the title for a P3018 body, which is why they could not find that issue.&lt;/td&gt;
&lt;td&gt;2024-05-15, completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="https://github.com/umami-software/umami/issues/3408" rel="noopener noreferrer"&gt;#3408&lt;/a&gt; &lt;code&gt;ERROR: "check-db" exited with 1&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;2025-05-09&lt;/td&gt;
&lt;td&gt;Docker, 2.17 to 2.18&lt;/td&gt;
&lt;td&gt;P3009 on &lt;code&gt;09_update_hostname_region&lt;/code&gt;. One user's walkthrough: with about three years of data the migration ran for around an hour, after about an hour with no success message in the logs the container was restarted, &lt;code&gt;09&lt;/code&gt; then failed because its column already existed, and the migration had to be marked applied by editing its row.&lt;/td&gt;
&lt;td&gt;2025-08-09, closed as not planned (marked stale)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Six of the seven closed as completed, the quickest within two days, the slowest after about nine months. The newest closed without a fix (marked stale). What they share: a migration stops half-way, the recovery is manual, and size or database engine decides who gets hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;Every row above links to the GitHub thread it came from. Six of the seven are one report on &lt;a href="https://friction.grain64.com/p/umami/?utm_source=devto&amp;amp;utm_content=article-3b" rel="noopener noreferrer"&gt;Umami's page&lt;/a&gt;, in its Self-hosting &amp;amp; upgrades area next to 5 other recent upgrade and hosting reports, which groups 29 recent reports from 87 public threads. What is stored and how to dispute a report: the &lt;a href="https://friction.grain64.com/data/?utm_source=devto&amp;amp;utm_content=article-3b" rel="noopener noreferrer"&gt;data page&lt;/a&gt;. Upgrading soon? &lt;a href="https://friction.grain64.com/p/umami/?utm_source=devto&amp;amp;utm_content=article-3b-watch" rel="noopener noreferrer"&gt;Watch Umami&lt;/a&gt; to get an email when a new report is added.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The number the threads leave open:&lt;/strong&gt; they give migration times from about 5 minutes to several hours, but rarely a row count, a duration, the hardware and the version together. If you have run &lt;code&gt;05_add_visit_id&lt;/code&gt; or &lt;code&gt;09_update_hostname_region&lt;/code&gt; on Postgres, what were those four: your &lt;code&gt;website_event&lt;/code&gt; row count, how long the migration took, your CPU, RAM and disk, and the Umami versions you went from and to? Reply with them; a handful of full answers would give a self-hoster a real number to plan a maintenance window around.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Friction, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>selfhosted</category>
      <category>opensource</category>
      <category>docker</category>
      <category>database</category>
    </item>
    <item>
      <title>DataTransfer-Regional-Bytes: the AWS line that charges you for talking to yourself</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Wed, 11 Nov 2026 15:07:27 +0000</pubDate>
      <link>https://dev.to/grain64/datatransfer-regional-bytes-the-aws-line-that-charges-you-for-talking-to-yourself-gml</link>
      <guid>https://dev.to/grain64/datatransfer-regional-bytes-the-aws-line-that-charges-you-for-talking-to-yourself-gml</guid>
      <description>&lt;p&gt;Some of the traffic on your AWS bill never leaves AWS and never leaves your region, and you still pay for it. It appears as &lt;code&gt;DataTransfer-Regional-Bytes&lt;/code&gt;, and it is the line behind a lot of "my bill went up but my traffic did not" threads.&lt;/p&gt;

&lt;p&gt;Prices here are US East (N. Virginia) list prices, checked on 2026-11-04 against AWS's public price list and the &lt;a href="https://aws.amazon.com/ec2/pricing/on-demand/" rel="noopener noreferrer"&gt;EC2 on-demand pricing page&lt;/a&gt;. Other regions differ. The example numbers are made up to show the arithmetic, not taken from a real account.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the line is
&lt;/h2&gt;

&lt;p&gt;AWS documents the rate as &lt;strong&gt;$0.01 per GB in each direction&lt;/strong&gt; for data moving between availability zones in the same region. Because the sender and the receiver each pay one side, a gigabyte that crosses an AZ boundary costs &lt;strong&gt;$0.02&lt;/strong&gt; in total. The same page documents that traffic to or from a public or Elastic IPv4 address in the same region is charged at the same rate, even if both ends are in one AZ.&lt;/p&gt;

&lt;p&gt;The line is easy to miss because the unit price is small and the quantity is huge, and nothing about it says "something is crossing zones".&lt;/p&gt;

&lt;h2&gt;
  
  
  A made-up month
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DataTransfer-Regional-Bytes   25,000 GB x $0.01 = $250.00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now imagine one pair of chatty services where each side sends 3,000 GB a month to the other across zones: 6,000 GB crossing, and 6,000 x $0.02 = &lt;strong&gt;$120.00&lt;/strong&gt; a month. The line shows it as 12,000 GB, because each crossing is counted on the sending side and again on the receiving side. That is $120.00 from two services that look idle on a dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it comes from
&lt;/h2&gt;

&lt;p&gt;The pattern is usually not one big mistake but good practice applied everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-AZ everything.&lt;/strong&gt; Calls between your own services that land on a target or node in a different zone (a client reaching a network load balancer node, service to service by IP, a cross-zone NLB) pay on both sides. At high call volume, that share is billed. Check how your load balancer type is billed before you blame it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replicas in another AZ.&lt;/strong&gt; Databases and caches keep replicas in other zones for availability (worth keeping), and a client that reads from a replica in a different zone than the app pays on every read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Message and log pipelines.&lt;/strong&gt; Producers, consumers and log shippers that talk to a broker or node in another zone pay on every byte. Self-managed Kafka on EC2 also pays for its own cross-zone replication; check your managed service's pricing page before you count it, since MSK, for one, does not charge for replication between brokers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One NAT gateway shared across zones.&lt;/strong&gt; Private subnets in other AZs reach the single gateway across a zone boundary, so each byte pays regional transfer on top of the $0.045 per GB NAT processing charge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public or Elastic IPs used inside the region.&lt;/strong&gt; Services calling each other by public address pay both sides even in the same AZ. Private IPs avoid that.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to find which pair is responsible
&lt;/h2&gt;

&lt;p&gt;You cannot fix this by looking at the bill alone, so do not change topology blind. Things to try, in order of cost:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In Cost Explorer, daily granularity, usage type &lt;code&gt;DataTransfer-Regional-Bytes&lt;/code&gt;. A line that steps on a deploy day points at a new call pattern; a slope that follows traffic points at general chatter.&lt;/li&gt;
&lt;li&gt;If you have the Cost and Usage Report with resource IDs, group by resource to see which instance, load balancer or NAT gateway is on the line.&lt;/li&gt;
&lt;li&gt;VPC Flow Logs for a day on the suspect subnets, with the AZ and the addresses, show which pairs talk the most across zones. They cost money themselves, so keep the window short.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What to change, and what to leave alone
&lt;/h2&gt;

&lt;p&gt;Cross-AZ traffic is often the price of availability, so the goal is to remove the accidental share, not to put everything in one zone.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use private IPs for in-region calls between your own services instead of public or Elastic ones.&lt;/li&gt;
&lt;li&gt;Where your load balancer or client library supports zone-aware routing, keeping calls in the caller's zone removes most of the crossing for stateless services. Check how your stack does this and test it, because it changes load distribution.&lt;/li&gt;
&lt;li&gt;Give each AZ its own NAT gateway route (one per zone) so private subnets do not cross a zone to reach it. That adds hourly charges ($0.045 per gateway-hour, $32.85 a month), so compare the two with your own numbers.&lt;/li&gt;
&lt;li&gt;Keep read replicas in the same zone as the readers only if you accept the availability trade-off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make one change, watch the daily line for three days, then do the next.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;DataTransfer-Regional-Bytes&lt;/code&gt; is $0.01 per GB each direction, so $0.02 per GB crossing a zone. Find the pair of services responsible with the daily view and flow logs, remove the accidental crossings (public IPs, a shared NAT, unaware load balancing), and keep the crossings that buy you availability.&lt;/p&gt;

&lt;p&gt;The page for this line has the sources and the steps: &lt;a href="https://billtrim.grain64.com/learn/data-transfer-regional-bytes" rel="noopener noreferrer"&gt;DataTransfer-Regional-Bytes explained&lt;/a&gt;. It also has an upload box that reads your own Cost Explorer or CUR CSV in the browser and shows this line with the dollars for your account.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Billtrim, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>cost</category>
    </item>
    <item>
      <title>Five checks before you swap to a cheaper LLM (with the code for each)</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Wed, 11 Nov 2026 12:50:25 +0000</pubDate>
      <link>https://dev.to/grain64/five-checks-before-you-swap-to-a-cheaper-llm-with-the-code-for-each-3m5a</link>
      <guid>https://dev.to/grain64/five-checks-before-you-swap-to-a-cheaper-llm-with-the-code-for-each-3m5a</guid>
      <description>&lt;p&gt;A cheaper model that looks fine on ten examples can cost more per finished task than the one you have. These five checks take a few lines each. The worked numbers come from one public run: 150 banking questions with 77 possible labels, ten models, a 70% pass bar.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Add up every attempt, then divide by the successes.&lt;/strong&gt; Your bill includes the retries, and so should the price you compare.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;costPerSuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;successes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On that run DeepSeek V4.1 Flash made 32 retries and spent 31.3% of its money on them; 11 of its final answers were still unreadable. Mistral Large 4 made 106 retries (44.6% of its spend) and ended at $0.002274 per success, above the $0.001272 of the baseline, GPT-6.1 Sol.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Judge by the lower edge of the interval, not the pass rate.&lt;/strong&gt; On 150 rows, 77.3% is not "clears 70%".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;wilsonLow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.96&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;n&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;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// wilsonLow(116, 150) -&amp;gt; 0.7000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Qwen 3.8 Flash passed 116 of 150 (77.3%), and its interval's lower edge is exactly 70.0%, the bar: borderline. Gemini 3.5 Flash Lite (113 of 150) and Llama 4 Maverick (107 of 150) read the same way, above 70% as a point estimate and not clearly above it as an interval. GPT-6 Luna, at 123 of 150, has a lower edge of 75.1% and clears.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Count unreadable replies apart from wrong ones.&lt;/strong&gt; A reply you cannot parse is a different failure from a reply that parses to the wrong label: the first gets retried and billed, the second is final. Keep two counters (&lt;code&gt;invalid_final&lt;/code&gt;, wrong) and look at both. In the run above, DeepSeek V4.1 Flash had 11 unreadable finals, Qwen 3.8 Flash 8, Mistral Large 4 45; the other seven models had none.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Fix the bar before you look at any results.&lt;/strong&gt; Write the pass rate and the margin you need in a file, commit it, then run. If you pick the bar after seeing the table, it will land under whichever model you were already hoping for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Price the cheapest model that clears the bar against what you run today, on the same rows.&lt;/strong&gt; On this run GPT-6 Luna is the cheapest model that clears the bar, at $0.00009 per success against $0.001272 for Sol, about 14 times less. It passes 82.0% against Sol's 86.0%, and on the same rows it fails 8 that Sol passes and passes 2 that Sol fails. Whether that trade matters is your call, and only your own examples can answer it.&lt;/p&gt;

&lt;p&gt;All 150 rows, the prompt, the prices and the re-run script are on the verdict page, so you can repeat the run with your own OpenRouter key: &lt;a href="https://clearbar.grain64.com/verdicts/banking77-intent/?utm_source=devto&amp;amp;utm_campaign=devto-five-checks" rel="noopener noreferrer"&gt;https://clearbar.grain64.com/verdicts/banking77-intent/?utm_source=devto&amp;amp;utm_campaign=devto-five-checks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This run covers one case: 150 rows of single-label classification, where a row either matches its label or it does not. If your task is summarisation or free-text generation, where "pass" is a judge's call, would you still set the bar on the lower edge of the interval, or would you widen it for the judge's own disagreement with your labels, and by how much?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Clearbar, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>openrouter</category>
      <category>testing</category>
    </item>
    <item>
      <title>Cheapest LLM for product-review sentiment: Mistral Small at $0.000019 a success</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Tue, 10 Nov 2026 07:42:37 +0000</pubDate>
      <link>https://dev.to/grain64/cheapest-llm-for-product-review-sentiment-mistral-small-at-0000019-a-success-23j3</link>
      <guid>https://dev.to/grain64/cheapest-llm-for-product-review-sentiment-mistral-small-at-0000019-a-success-23j3</guid>
      <description>&lt;p&gt;On 300 Amazon product reviews, Mistral Small (2603) is the cheapest of nine models that clears an 88% pass bar and can be shown to match the baseline, GPT-6.1 Sol. It passes 97.7% of the tasks against 98.7% for Sol, at $0.000019 per successful task against $0.000319: 94.0% less.&lt;/p&gt;

&lt;p&gt;This is an easy task, and the table shows it: all nine models clear the bar, so the question is only which one costs least. Two near neighbours deserve a straight reading. Claude Haiku 5.5 costs $0.000023 per successful task and answers faster (p95 336 ms against 912 ms for Mistral Small). GPT-6 Luna costs $0.000024 and passes 98.0%. If latency or the last fraction of a point matters more than a few thousandths of a cent, those are the picks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The run.&lt;/strong&gt; 300 reviews drawn with a fixed seed from the Amazon Polarity test split (Apache-2.0). One task: reply with &lt;code&gt;positive&lt;/code&gt; or &lt;code&gt;negative&lt;/code&gt;. Temperature 0, up to 2 retries when the reply is not a valid label, every attempt's cost counted, prices read from OpenRouter on 2026-11-05. Total spend for all nine models: $0.22.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pass bar.&lt;/strong&gt; 88% correct. A model "clears" only if the lower end of its 95% Wilson interval is at or above the bar. "Matches" means an exact one-sided paired test of "no more than 5 points worse than the baseline" on the tasks both models answered.&lt;/p&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;Correct&lt;/th&gt;
&lt;th&gt;Pass rate&lt;/th&gt;
&lt;th&gt;95% interval&lt;/th&gt;
&lt;th&gt;$ per successful task&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;openai/gpt-6.1-sol (baseline)&lt;/td&gt;
&lt;td&gt;296/300&lt;/td&gt;
&lt;td&gt;98.7%&lt;/td&gt;
&lt;td&gt;96.6-99.5%&lt;/td&gt;
&lt;td&gt;$0.000319&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;openai/gpt-6.1-terra&lt;/td&gt;
&lt;td&gt;294/300&lt;/td&gt;
&lt;td&gt;98.0%&lt;/td&gt;
&lt;td&gt;95.7-99.1%&lt;/td&gt;
&lt;td&gt;$0.000165&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;openai/gpt-6-luna&lt;/td&gt;
&lt;td&gt;294/300&lt;/td&gt;
&lt;td&gt;98.0%&lt;/td&gt;
&lt;td&gt;95.7-99.1%&lt;/td&gt;
&lt;td&gt;$0.000024&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;anthropic/claude-haiku-5.5&lt;/td&gt;
&lt;td&gt;292/300&lt;/td&gt;
&lt;td&gt;97.3%&lt;/td&gt;
&lt;td&gt;94.8-98.6%&lt;/td&gt;
&lt;td&gt;$0.000023&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;google/gemini-3.5-flash-lite&lt;/td&gt;
&lt;td&gt;296/300&lt;/td&gt;
&lt;td&gt;98.7%&lt;/td&gt;
&lt;td&gt;96.6-99.5%&lt;/td&gt;
&lt;td&gt;$0.000041&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;deepseek/deepseek-v4.1-flash&lt;/td&gt;
&lt;td&gt;294/300&lt;/td&gt;
&lt;td&gt;98.0%&lt;/td&gt;
&lt;td&gt;95.7-99.1%&lt;/td&gt;
&lt;td&gt;$0.000043&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;qwen/qwen3.8-flash&lt;/td&gt;
&lt;td&gt;294/300&lt;/td&gt;
&lt;td&gt;98.0%&lt;/td&gt;
&lt;td&gt;95.7-99.1%&lt;/td&gt;
&lt;td&gt;$0.000054&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mistralai/mistral-small-2603&lt;/td&gt;
&lt;td&gt;293/300&lt;/td&gt;
&lt;td&gt;97.7%&lt;/td&gt;
&lt;td&gt;95.3-98.9%&lt;/td&gt;
&lt;td&gt;$0.000019&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;meta-llama/llama-4-maverick&lt;/td&gt;
&lt;td&gt;294/300&lt;/td&gt;
&lt;td&gt;98.0%&lt;/td&gt;
&lt;td&gt;95.7-99.1%&lt;/td&gt;
&lt;td&gt;$0.000042&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Where the retries went.&lt;/strong&gt; qwen3.8-flash needed 5 retries and Haiku 2, so their prices carry a small retry share (1.5% and 1.4% of what each spent). Mistral Small needed none. On an easy task the retry tax is small; on the 77-label banking-intent run, deepseek-v4.1-flash spent 31.3% of its money on retries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What a miss looks like.&lt;/strong&gt; Mistral Small got 7 of 300 wrong, and 3 of those 7 the baseline also missed. One is "I love mandatory fees. The regulatory cost recovery fee rocks!", a sarcastic review the data labels &lt;code&gt;positive&lt;/code&gt; and Mistral Small called &lt;code&gt;negative&lt;/code&gt;. Labels like that put a ceiling under every model, which is why a pass bar below 100% is not a lowered standard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check it or re-run it.&lt;/strong&gt; The 300 rows, the prompt, the prices and the re-run script are on the verdict page, so you can run the same comparison with your own OpenRouter key (the full nine-model run cost $0.22) and see where your numbers land. Prices move monthly; the page notes the day it was last re-checked: &lt;a href="https://clearbar.grain64.com/verdicts/amazon-sentiment/?utm_source=devto&amp;amp;utm_campaign=devto-sentiment" rel="noopener noreferrer"&gt;https://clearbar.grain64.com/verdicts/amazon-sentiment/?utm_source=devto&amp;amp;utm_campaign=devto-sentiment&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want the same verdict on your own data? Import 10-100 of your input/expected pairs, add your current model, and the workspace names the cheapest model that clears your bar, with cost per successful task, retries counted, and the failures it will have. Free during early access; you pay OpenRouter for the model calls with your own key.&lt;/p&gt;

&lt;p&gt;Which task should the next verdict cover: extraction, summarisation, or classification of your own labels? Say so in the comments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Clearbar, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>openrouter</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Three more tests before you let an AI agent write to your CRM</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Tue, 10 Nov 2026 07:40:06 +0000</pubDate>
      <link>https://dev.to/grain64/three-more-tests-before-you-let-an-ai-agent-write-to-your-crm-39od</link>
      <guid>https://dev.to/grain64/three-more-tests-before-you-let-an-ai-agent-write-to-your-crm-39od</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/grain64/five-tests-to-run-before-you-let-an-ai-agent-write-to-your-crm-2ef4"&gt;The earlier post&lt;/a&gt; listed five tests for an agent-ready CRM: revert in one action, pause one agent, an audit log that names who acted, a reply that stops the follow-up, and mail you can see before it leaves. Three readers came back with cases it missed. Each one is a better test than the five in that list, so here they are.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test 6: take the API key away (from &lt;a class="mentioned-user" href="https://dev.to/autenai"&gt;@autenai&lt;/a&gt;)
&lt;/h2&gt;

&lt;p&gt;Not every agent uses the API. Computer-use agents drive the web UI in a signed-in browser, so the key-based controls in tests 2 and 3 never come into play.&lt;/p&gt;

&lt;p&gt;Run it: sign in with a throwaway account, hand the browser to the agent, have it edit five records and delete one.&lt;/p&gt;

&lt;p&gt;Pass: the log says an agent did it, separate from you. You can cut that agent off mid-run without signing yourself out. The delete can be undone.&lt;/p&gt;

&lt;p&gt;Watch for: every action logged under the person whose session it is. Then pause, revoke and attribution all quietly assume the agent has a key. If the agent has to share your login, the honest scorecard answer is "not covered". The workaround is a second user (or browser profile) that exists only for the agent, so it can be told apart and switched off on its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test 7: hit the rate limit halfway through a bulk update (from &lt;a class="mentioned-user" href="https://dev.to/junfengzhou01"&gt;@junfengzhou01&lt;/a&gt;)
&lt;/h2&gt;

&lt;p&gt;Give the agent a key with a low limit and have it update 200 records in a loop.&lt;/p&gt;

&lt;p&gt;Pass: the call that hits the limit is refused with a status and a retry hint the agent can read, not a 500 or an HTML page. Nothing is half-applied inside a single record. Afterwards you can list exactly which records changed, by run, and revert only those. Retrying the whole loop with the same idempotency keys does not duplicate the ones that already went through.&lt;/p&gt;

&lt;p&gt;Watch for: a bulk endpoint that returns 200 while quietly skipping the tail, a limit that answers in a format the agent cannot parse and so retries in a tight loop, and a log with no run id, where "which ones changed" means diffing a spreadsheet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test 8: stop one agent of several (from @Considus on Mastodon)
&lt;/h2&gt;

&lt;p&gt;Considus built a stop file that halts an agent mid-run, and asked how a single server tells which agent to stop. Running one server instance per agent makes the switch easy, because the file belongs to one process. It also gives you N servers to keep in step.&lt;/p&gt;

&lt;p&gt;Run it: two agents, one server. Start both on a long job and stop one.&lt;/p&gt;

&lt;p&gt;Pass: the stopped agent's next call fails with a message that says why, and the other keeps going. Nothing restarts. The identity the server uses to decide is the credential on the call, not the process.&lt;/p&gt;

&lt;p&gt;Watch for: a stop that is a flag the assistant can read and set itself, and a stop that only takes effect when the agent next asks for confirmation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scorecard additions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An agent in the browser is told apart from the person, and can be cut off alone.&lt;/li&gt;
&lt;li&gt;A rate-limited agent gets a readable refusal, and you can list what changed.&lt;/li&gt;
&lt;li&gt;One agent of several can be stopped on its next call.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same rule as before: run them on a fresh workspace with throwaway data. A ninth test that caught something these did not is worth a comment.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Deskhand, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>crm</category>
      <category>mcp</category>
      <category>agents</category>
    </item>
    <item>
      <title>Mistral Small: 58 empty replies in 300 tool calls, and the retry loop</title>
      <dc:creator>Grain64</dc:creator>
      <pubDate>Sun, 08 Nov 2026 06:05:00 +0000</pubDate>
      <link>https://dev.to/grain64/mistral-small-58-empty-replies-in-300-tool-calls-and-the-retry-loop-22gh</link>
      <guid>https://dev.to/grain64/mistral-small-58-empty-replies-in-300-tool-calls-and-the-retry-loop-22gh</guid>
      <description>&lt;p&gt;On 300 public function-calling tasks, Mistral Small (2603) returned an empty reply 58 times, even after two retries. That is 19.3% of tasks with nothing to parse, and it is why a model priced at $0.15 per million input tokens ended up at $0.000098 per successful task against $0.000051 for GPT-6 Luna, which passes 93.0% with no retries at all.&lt;/p&gt;

&lt;p&gt;Here is the part of the harness that decides what a retry costs, because the number depends entirely on it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What counts as a failure, and what gets retried.&lt;/strong&gt; One rule: a reply that cannot be read is retried, a reply that can be read but is wrong is final. Production code cannot know an answer is wrong, so the harness doesn't either.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;parseJsonLoose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&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="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;empty output&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/``&lt;/span&gt;&lt;span class="err"&gt;`
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;(?:&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)?&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;?)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="s2"&gt;```/i);
  if (fence) t = fence[1].trim();
  const a = t.indexOf("{");
  const z = t.lastIndexOf("}");
  if (a === -1 || z &amp;lt;= a) return { ok: false, reason: "no JSON object in output" };
  ...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The loop.&lt;/strong&gt; Every attempt is billed and recorded; the loop stops on the first reply that parses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;retries&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;transport&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;maxTokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;extra&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;extra&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;extra&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;estimated&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;attemptCost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;prices&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="na"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;estimated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;cost_estimated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;estimated&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="c1"&gt;// (error-status branch omitted)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;judge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;row&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;valid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;valid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;valid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pass&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;pass&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wrong&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;invalid&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&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="nx"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;config.retries&lt;/code&gt; is 2 and the temperature is 0, so a task gets at most three identical requests. Cost per successful task is every attempt's cost divided by the tasks that passed, not by the attempts that did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it did to Mistral Small.&lt;/strong&gt; 434 attempts for 300 tasks: 134 retries. Fifty-eight tasks used all three attempts and still ended empty, so 116 of those 134 retries (58 tasks x 2; arithmetic on the stored counts) went to tasks that never recovered. Only 18 retries went to tasks that came back with something readable. Of the tasks that needed a retry, 58 never produced a readable reply and at most 18 did (18 retries on recovered tasks cannot cover more than 18 tasks), so at least three in four stayed unreadable (58 / (58 + 18) = 76.3%; arithmetic on the stored counts). Retries were 23.9% of the model's spend. Before them, its cost works out to $0.0000742 per success ($0.020673 x (1 - 0.239) / 212, a calculation on stored values), still above Luna's $0.000051: the retries are not the whole gap, but they are the part a first-attempt token count never shows.&lt;/p&gt;

&lt;p&gt;The other eight models in the run: six had no retries at all, DeepSeek V4.1 Flash had 2, Qwen 3.8 Flash had 5, and none ended on an unreadable reply. So this is not "tool calling is hard for cheap models"; it is one model's behaviour on this prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the empty replies look like.&lt;/strong&gt; Row &lt;code&gt;tc-2&lt;/code&gt;, the easiest kind in the set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tools: generate_random_number(min, max), calculate_loan_payment(loan_amount, interest_rate, loan_term)
user:  Hi, I need a random number between 1 and 100.
expected: {"name":"generate_random_number","arguments":{"min":1,"max":100}}
got:   (empty)   -- 3 attempts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;tc-10&lt;/code&gt;, &lt;code&gt;tc-19&lt;/code&gt;, &lt;code&gt;tc-21&lt;/code&gt; and &lt;code&gt;tc-37&lt;/code&gt; are empty in the same way: short conversations, one clearly matching tool. Mistral Small's other 30 misses are ordinary ones (14 right value in different words, 10 a different value, 5 a number written differently, 1 missing argument), and the other eight models make the same kinds of mistakes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run it yourself.&lt;/strong&gt; The 300 rows, the prompt, the script and the prices are on the verdict page. To test only the row above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'"id":"tc-2"'&lt;/span&gt; glaive-tool-call.jsonl &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; one.jsonl
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENROUTER_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;...
node rerun-glaive-tool-call.mjs &lt;span class="nt"&gt;--dataset&lt;/span&gt; ./one.jsonl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That sends one row to each of the nine models in the run for well under a cent (the whole run cost $0.503184 for 300 rows across nine models, about $0.0017 a row). Results at temperature 0 are not perfectly deterministic, so a second run is a result too.&lt;/p&gt;

&lt;p&gt;Want the same verdict on your own data? Import 10-100 of your input/expected pairs, add your current model, and the page names the cheapest model that clears your bar, with cost per successful task, retries counted, and the failures it will have. Free during early access, you pay OpenRouter for the calls with your own key. Tool-call verdict, failures and re-run files: &lt;a href="https://clearbar.grain64.com/verdicts/glaive-tool-call/?utm_source=devto&amp;amp;utm_campaign=devto-empty-reply" rel="noopener noreferrer"&gt;https://clearbar.grain64.com/verdicts/glaive-tool-call/?utm_source=devto&amp;amp;utm_campaign=devto-empty-reply&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The stored result keeps the reply text but not the finish reason, so the page does not say why these replies are empty. If you run &lt;code&gt;tc-2&lt;/code&gt; and get a readable call from Mistral Small, or you know what &lt;code&gt;finish_reason&lt;/code&gt; and &lt;code&gt;usage.completion_tokens&lt;/code&gt; an empty reply from this model shows on OpenRouter, put it in the comments: that is the missing piece.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From Clearbar, by Grain64.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>openrouter</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
