<?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: Cuelark</title>
    <description>The latest articles on DEV Community by Cuelark (@cuelark).</description>
    <link>https://dev.to/cuelark</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%2F4215121%2F2a5a2efe-8caa-40ce-9173-c868ae339dbf.png</url>
      <title>DEV Community: Cuelark</title>
      <link>https://dev.to/cuelark</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cuelark"/>
    <language>en</language>
    <item>
      <title>Gemini 4 Neon in a React chat: going past 64K output without breaking your token meter</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Sat, 21 Nov 2026 04:49:55 +0000</pubDate>
      <link>https://dev.to/cuelark/gemini-4-neon-in-a-react-chat-going-past-64k-output-without-breaking-your-token-meter-3497</link>
      <guid>https://dev.to/cuelark/gemini-4-neon-in-a-react-chat-going-past-64k-output-without-breaking-your-token-meter-3497</guid>
      <description>&lt;p&gt;&lt;em&gt;By the Cuelark Team. Every model detail below comes from Google's launch post and Gemini API docs, and the SDK details come from the Vercel AI SDK's release notes and published package, all checked on 21 November 2026. The code ran on our machine against a local mock of the documented &lt;code&gt;streamGenerateContent&lt;/code&gt; stream. We had no Gemini API key for this test, so read it as a wiring test, not a quality review.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Google released &lt;strong&gt;Gemini 4 Neon&lt;/strong&gt; (&lt;code&gt;gemini-4-neon&lt;/code&gt;) on November 18. It sits between Hydrogen and Carbon in the Gemini 4 family and is aimed at complex coding, knowledge work and science. The launch post leads with benchmark rankings. We didn't check those, so we'll skip them.&lt;/p&gt;

&lt;p&gt;The part that matters for a chat UI is quieter. Neon can produce up to 1M tokens in a single answer, but changing the model ID alone doesn't enable that. Any one request still stops at 65,536 tokens of thinking plus output. Here's how the longer answers work with the AI SDK, and two things we only noticed once we ran it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the docs say
&lt;/h2&gt;

&lt;p&gt;From &lt;a href="https://aistudio.google.com/docs/whats-new-gemini-4-neon" rel="noopener noreferrer"&gt;What's new in Gemini 4 Neon&lt;/a&gt; and the &lt;a href="https://ai.google.dev/gemini-api/docs/changelog" rel="noopener noreferrer"&gt;release notes&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Price:&lt;/strong&gt; $3.00 per 1M input tokens and $15.00 per 1M output tokens, thinking included, flat across the window. Cached input is $0.15 per 1M (a 95% discount from implicit caching).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paid tier only.&lt;/strong&gt; Unlike Hydrogen, there's no free tier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Thinking levels:&lt;/strong&gt; &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt; (the default) and &lt;code&gt;xhigh&lt;/code&gt;. &lt;code&gt;minimal&lt;/code&gt; is rejected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One shared window:&lt;/strong&gt; input, thinking and output share 1,048,576 tokens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://ai.google.dev/gemini-api/docs/long-decode" rel="noopener noreferrer"&gt;long decode guide&lt;/a&gt; explains the rest. Generation runs in hops of up to 64K tokens. If a hop hits that cap and budget is left, the response ends with &lt;code&gt;finishReason: CONTINUATION&lt;/code&gt; and an encrypted &lt;code&gt;continuationToken&lt;/code&gt;. You send the same request again with that token and don't add the partial output to &lt;code&gt;contents&lt;/code&gt;, because the token carries the state. When the whole &lt;code&gt;max_output_tokens&lt;/code&gt; budget is used, the response ends with &lt;code&gt;MAX_TOKENS&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;Google is also clear about when this is worth it. Chat, Q&amp;amp;A and summaries finish well under 32K tokens and don't need it. It's for hard reasoning and "write the whole thing" jobs like a full migration spec. So we made it a per-message toggle, not the default.&lt;/p&gt;

&lt;h2&gt;
  
  
  SDK support
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fgoogle%404.0.123" rel="noopener noreferrer"&gt;&lt;code&gt;@ai-sdk/google&lt;/code&gt; 4.0.123&lt;/a&gt; (November 20) added the &lt;code&gt;gemini-4-neon&lt;/code&gt; ID with &lt;code&gt;xhigh&lt;/code&gt;. Long decode support itself landed earlier, in &lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fgoogle%404.0.95" rel="noopener noreferrer"&gt;4.0.95&lt;/a&gt;: the provider continues &lt;code&gt;CONTINUATION&lt;/code&gt; hops for you, sums usage, and exposes &lt;code&gt;initialPromptTokenCount&lt;/code&gt;. We used &lt;code&gt;ai@7.0.179&lt;/code&gt; and &lt;code&gt;@ai-sdk/google@4.0.124&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The route
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/api/chat/route.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;convertToModelMessages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;UIMessage&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;'ai'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;google&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;'@ai-sdk/google'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;maxDuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;900&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// hops can take minutes; check your host's limit&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ChatMeta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;finishReason&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;contextTokens&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// what the conversation actually occupies&lt;/span&gt;
  &lt;span class="n"&gt;billedInputTokens&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// summed over every hop, for cost only&lt;/span&gt;
  &lt;span class="n"&gt;continuationToken&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&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;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Request&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;continuationToken&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="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UIMessage&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="n"&gt;long&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;continuationToken&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&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="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;google&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'gemini-4-neon'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;convertToModelMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// Above 65,536 the provider runs the 64K hops for you&lt;/span&gt;
    &lt;span class="n"&gt;maxOutputTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;262_144&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;providerOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;google&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;thinkingConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;thinkingLevel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'high'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'medium'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;includeThoughts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;continuationToken&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;continuationToken&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;toUIMessageStreamResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;UIMessage&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ChatMeta&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sendReasoning&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messageMetadata&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="n"&gt;part&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'finish-step'&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;providerMetadata&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;google&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;initialPromptTokenCount&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;continuationToken&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&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;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inputTokens&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;outputTokens&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;finishReason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;finishReason&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;billedInputTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;contextTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;initialPromptTokenCount&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;continuationToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;continuationToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What the test showed
&lt;/h2&gt;

&lt;p&gt;Our mock replaces &lt;code&gt;fetch&lt;/code&gt; and streams SSE chunks shaped like the docs' examples. It isn't a captured Gemini response. We drove the route the way &lt;code&gt;useChat&lt;/code&gt; does.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Without &lt;code&gt;maxOutputTokens&lt;/code&gt;, the answer just stops.&lt;/strong&gt; One request, &lt;code&gt;finishReason: 'length'&lt;/code&gt;, half a spec. The UI shows it as finished unless you check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;With 262,144, the hops are invisible.&lt;/strong&gt; Three requests went out. The second and third carried the previous &lt;code&gt;continuationToken&lt;/code&gt;, and &lt;code&gt;contents&lt;/code&gt; was identical each time. The first hop was all thinking with empty text, which the docs call normal. The client got one reasoning block and one text block, as if it were a single response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;usage.inputTokens&lt;/code&gt; is not your context size.&lt;/strong&gt; It came back as 199,608, the sum of each hop's input (1,000 + 66,536 + 132,072), because every hop re-reads everything generated so far. The real context was 162,072. The docs warn about this. If your app trims or summarises history when a token count gets close to the limit, feed it &lt;code&gt;initialPromptTokenCount&lt;/code&gt; plus output, not &lt;code&gt;inputTokens&lt;/code&gt;, or it'll compact far too early.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the cut-off case we added a Continue button. It sends the original prompt plus the token and a bigger budget. &lt;code&gt;regenerate&lt;/code&gt; already drops the partial answer from the request, which is what Google asks for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'ready'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;finishReason&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'length'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;continuationToken&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt; &lt;span class="n"&gt;onClick&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="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setCarry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;carry&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;textOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;last&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="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// the new message holds only the rest&lt;/span&gt;
    &lt;span class="nf"&gt;regenerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;continuationToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;continuationToken&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nc"&gt;Hit&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Continue&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;The rest of the component is a normal &lt;code&gt;useChat&lt;/code&gt; list with a &lt;code&gt;details&lt;/code&gt; block for reasoning. We type-checked it and ran this flow through the AI SDK &lt;code&gt;Chat&lt;/code&gt; class: one user message went out, the token reached Gemini, and the displayed text joined up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;We didn't call the real API.&lt;/strong&gt; Before you ship, run one real long request and compare the hop count and usage with what you log.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dropped streams don't resume from checkpoints.&lt;/strong&gt; After the first 64K on Neon, the stream sends a checkpoint token about every 5,000 tokens, and Google's REST loop resumes from the last one. In our test, a stream cut after a checkpoint ended as &lt;code&gt;finishReason: 'interrupted'&lt;/code&gt; with no token in the metadata, and the text after the checkpoint stayed in the message. With this SDK version you resend the request instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The resumed message is only the tail.&lt;/strong&gt; Our &lt;code&gt;carry&lt;/code&gt; fixes the display, but the stored history holds just the second part. Merge them before the next turn.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time limits.&lt;/strong&gt; Google suggests HTTP timeouts of at least 15 minutes, and the server closes a stream after 20. Check your host's function time limit before relying on &lt;code&gt;maxDuration&lt;/code&gt;. For truly long jobs, Google recommends background execution on the Interactions API, which this route doesn't use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost.&lt;/strong&gt; Every hop is billed, including thinking-only hops. Repeated input in each hop gets the 95% cache discount, but if the model uses the whole 262,144-token budget, that's about $3.90 of output for one answer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-4-neon/" rel="noopener noreferrer"&gt;Introducing Gemini 4 Neon, Google&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aistudio.google.com/docs/whats-new-gemini-4-neon" rel="noopener noreferrer"&gt;What's new in Gemini 4 Neon&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ai.google.dev/gemini-api/docs/changelog" rel="noopener noreferrer"&gt;Gemini API release notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://ai.google.dev/gemini-api/docs/long-decode" rel="noopener noreferrer"&gt;Long decode&lt;/a&gt; and &lt;a href="https://ai.google.dev/gemini-api/docs/long-decode?generate-content=true" rel="noopener noreferrer"&gt;long decode with generateContent&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fgoogle%404.0.123" rel="noopener noreferrer"&gt;@ai-sdk/google 4.0.123&lt;/a&gt; and &lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fgoogle%404.0.95" rel="noopener noreferrer"&gt;4.0.95&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd rather not hand-build the reasoning block and message list, &lt;a href="https://ui.cuelark.com" rel="noopener noreferrer"&gt;Cuelark UI&lt;/a&gt; has shadcn-style components for AI chat that work with this setup.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>react</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>How to Convert WebP to JPG (Windows, Mac, Browser, or Python)</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Thu, 19 Nov 2026 06:33:59 +0000</pubDate>
      <link>https://dev.to/cuelark/how-to-convert-webp-to-jpg-windows-mac-browser-or-python-b08</link>
      <guid>https://dev.to/cuelark/how-to-convert-webp-to-jpg-windows-mac-browser-or-python-b08</guid>
      <description>&lt;p&gt;To convert a WebP image to JPG, open it in an app that can read WebP and save or export a copy as JPEG: Paint on Windows, Preview on a Mac, a browser-based converter, or a three-line Python script. The one thing to watch is transparency, because JPG has no alpha channel, so transparent areas have to be filled with a solid color first.&lt;/p&gt;

&lt;p&gt;You usually hit this when you right-click an image on a website, save it, and get a &lt;code&gt;.webp&lt;/code&gt; file that an upload form, an older Office version or an image editor refuses to take. Here is how to fix it on each platform, plus what you lose along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you end up with WebP files
&lt;/h2&gt;

&lt;p&gt;WebP is Google's image format with both lossy and lossless compression. Google's own FAQ says WebP is typically about 30% smaller than JPEG at the same quality, which is why so many sites now serve it. Every current major browser displays it: Chrome, Edge, Firefox, Opera, and Safari 14 or later on iOS 14 and macOS Big Sur (&lt;a href="https://developers.google.com/speed/webp/faq" rel="noopener noreferrer"&gt;Google WebP FAQ&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The catch is outside the browser. Plenty of forms and desktop apps still accept only JPG and PNG. JPG is still the most widely used format for still photos (&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Formats/Image_types" rel="noopener noreferrer"&gt;MDN image format guide&lt;/a&gt;), so converting to JPG is the safest bet for compatibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 1: Windows (Paint)
&lt;/h2&gt;

&lt;p&gt;Windows reads WebP through Microsoft's free &lt;a href="https://apps.microsoft.com/detail/9pg2dk419drg" rel="noopener noreferrer"&gt;WebP Image Extension&lt;/a&gt;, which lets File Explorer, Photos and other Windows apps view WebP images. If double-clicking a &lt;code&gt;.webp&lt;/code&gt; file already shows the image, you're set.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Right-click the &lt;code&gt;.webp&lt;/code&gt; file and choose &lt;strong&gt;Open with &amp;gt; Paint&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;File &amp;gt; Save as &amp;gt; JPEG picture&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pick a name and folder, then click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This works one file at a time, so it's best for a quick one-off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 2: Mac (Preview)
&lt;/h2&gt;

&lt;p&gt;Apple documents the export path in its &lt;a href="https://support.apple.com/guide/preview/prvw1012/mac" rel="noopener noreferrer"&gt;Preview user guide&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the WebP file in Preview.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;File &amp;gt; Export&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;Format&lt;/strong&gt; to &lt;strong&gt;JPEG&lt;/strong&gt; and use the &lt;strong&gt;Quality&lt;/strong&gt; slider.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To convert several files at once, Apple's tip is to open them all in one Preview window, select them in the sidebar, and then export. If Preview won't open a particular file on an older macOS version, use the browser method below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 3: In the browser, without uploading
&lt;/h2&gt;

&lt;p&gt;If you have a batch of files, or you're on a machine you don't control, a browser-based converter is the fastest route. Make sure it runs the conversion locally, so your images never leave your computer.&lt;/p&gt;

&lt;p&gt;Our free &lt;a href="https://tools.cuelark.com/webp-to-jpg" rel="noopener noreferrer"&gt;WebP to JPG converter&lt;/a&gt; works that way. Drop in as many &lt;code&gt;.webp&lt;/code&gt; files as you want, adjust the quality slider, and download each JPG or a ZIP of all of them. Transparent areas are filled with white, and a toggle lets you keep or strip photo metadata (date, camera, location). You can check in your browser's network panel that nothing is uploaded while a file converts. One limit: very large images (roughly over 16,000 px on a side) can exceed the browser's canvas limit.&lt;/p&gt;

&lt;p&gt;A good alternative is Google Chrome Labs' &lt;a href="https://squoosh.app" rel="noopener noreferrer"&gt;Squoosh&lt;/a&gt;. Its README says it doesn't send your image to a server and does all processing locally (&lt;a href="https://github.com/GoogleChromeLabs/squoosh" rel="noopener noreferrer"&gt;source&lt;/a&gt;). Squoosh is built for tuning one image at a time with a before-and-after view, so it's the better choice when you want to fine-tune a single hero image. For dozens of files, a batch tool saves clicks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option 4: Python (Pillow), for scripts and bulk jobs
&lt;/h2&gt;

&lt;p&gt;If you're a developer with a folder of WebP files, &lt;a href="https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html" rel="noopener noreferrer"&gt;Pillow&lt;/a&gt; handles it. Here's the trap. Pillow writes JPEG files only from L (grayscale), RGB or CMYK data, so a transparent WebP (mode &lt;code&gt;RGBA&lt;/code&gt;) fails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="no"&gt;PIL&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Image&lt;/span&gt;

&lt;span class="nc"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"logo.webp"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"logo.jpg"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# OSError: cannot write mode RGBA as JPEG&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The common fix, &lt;code&gt;.convert("RGB")&lt;/code&gt;, just throws away the alpha channel. Whatever color sits underneath the transparent pixels shows up. In our test file, that was black. To get a clean result, paste the image onto a white background first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pathlib&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="no"&gt;PIL&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Image&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"images"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"*.webp"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;im&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mode&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"RGBA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"LA"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;"transparency"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;im&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"RGBA"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;bg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"RGB"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;bg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;paste&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getchannel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"A"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;im&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bg&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;im&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"RGB"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;im&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;with_suffix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;".jpg"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;85&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyakxtr3bjo5a6p2qa8v7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyakxtr3bjo5a6p2qa8v7.png" alt="Transparent WebP compared with a JPG where alpha was dropped (black background) and a JPG flattened on white" width="798" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The same 600×340 logo three ways, made with Pillow 13. The middle version is what you get from &lt;code&gt;.convert("RGB")&lt;/code&gt; alone.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pillow's JPEG &lt;code&gt;quality&lt;/code&gt; runs from 0 to 95, defaults to 75, and the docs say to avoid values above 95, because 100 makes files much larger for almost no visible gain. For photos, 80–90 is a sensible range.&lt;/p&gt;

&lt;p&gt;Animated WebP is another limit. In our test, Pillow opened a 3-frame animated WebP and the saved JPG held only the first frame. JPG can't store animation, so if you need the motion, convert to GIF or MP4 instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you lose when converting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Quality, a little.&lt;/strong&gt; A lossy WebP is already compressed, and saving it as JPG compresses it a second time. At quality 85–90, the difference is hard to see. If you need an exact copy, export PNG instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File size, often.&lt;/strong&gt; JPG is usually bigger than the WebP it came from. Our test logo grew from 6.9 KB (WebP) to 15.6 KB (JPG at quality 85). If the form has a size cap, compress the JPG afterward.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transparency, always.&lt;/strong&gt; Logos and stickers get a solid background. Use PNG if you need to keep transparency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Don't just rename the file
&lt;/h2&gt;

&lt;p&gt;Changing &lt;code&gt;photo.webp&lt;/code&gt; to &lt;code&gt;photo.jpg&lt;/code&gt; doesn't convert anything. The data inside is still WebP. Some apps sniff the real format and open it anyway, but upload validators that check file contents will reject it or break later. Do a real conversion.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is WebP better than JPG?&lt;/strong&gt;&lt;br&gt;
For the web, usually yes: Google measures WebP at about 30% smaller than JPEG at the same quality, and it supports transparency and animation. JPG wins on compatibility with older software and upload forms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will converting WebP to JPG reduce quality?&lt;/strong&gt;&lt;br&gt;
Slightly, because the image gets re-encoded with lossy compression. At quality 85 or higher, most people can't tell.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I convert WebP to JPG without software?&lt;/strong&gt;&lt;br&gt;
Use a browser-based converter that processes files locally. Nothing to install, and on a good tool, nothing gets uploaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is my converted JPG black where the image was transparent?&lt;/strong&gt;&lt;br&gt;
The converter dropped the alpha channel without filling it. Flatten the image onto white (or any color) before saving, as in the Python example above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I convert WebP to JPG on an iPhone or Android phone?&lt;/strong&gt;&lt;br&gt;
A browser-based converter that runs locally works in mobile browsers too. Very large images may hit the phone's canvas memory limit.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cuelark Team&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webp</category>
      <category>python</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>GPT-6.2 in a React chat: get the timestamp out of your system prompt</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Thu, 19 Nov 2026 04:52:42 +0000</pubDate>
      <link>https://dev.to/cuelark/gpt-62-in-a-react-chat-get-the-timestamp-out-of-your-system-prompt-1hb7</link>
      <guid>https://dev.to/cuelark/gpt-62-in-a-react-chat-get-the-timestamp-out-of-your-system-prompt-1hb7</guid>
      <description>&lt;p&gt;&lt;em&gt;By the Cuelark Team. Every model detail below comes from OpenAI's own announcement and API docs, and the SDK details come from the Vercel AI SDK's release notes and published package, all checked on 19 November 2026. The code ran on our machine against a local mock of the documented Responses stream. We had no OpenAI API key for this test, so read it as a wiring test, not a quality review.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;OpenAI released &lt;code&gt;gpt-6.2-astra&lt;/code&gt; and &lt;code&gt;gpt-6.2-sol&lt;/code&gt; on November 17. The headline numbers are about price and benchmarks. For anyone running a chat UI, though, the more important line is in the migration guide: starting with GPT-6.2, the Responses API &lt;strong&gt;drops reasoning items&lt;/strong&gt; when you edit anything that came before them. A very common chat pattern, putting today's date and the current page into the system prompt, counts as that kind of edit. Nothing errors. The model just loses its earlier reasoning on every turn.&lt;/p&gt;

&lt;p&gt;Here's what changed, what we saw in a two-turn test with the AI SDK, and the small fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the docs say
&lt;/h2&gt;

&lt;p&gt;From the &lt;a href="https://openai.com/index/introducing-gpt-6-2-astra-sol" rel="noopener noreferrer"&gt;announcement&lt;/a&gt; and the model pages for &lt;a href="https://developers.openai.com/api/docs/models/gpt-6.2-astra" rel="noopener noreferrer"&gt;Astra&lt;/a&gt; and &lt;a href="https://developers.openai.com/api/docs/models/gpt-6.2-sol" rel="noopener noreferrer"&gt;Sol&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Price per 1M tokens:&lt;/strong&gt; Astra costs $8 input, $0.40 cached input and $40 output. Sol costs $2, $0.10 and $10, the same rates as GPT-6.1 Sol. Requests over 272K input tokens cost more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context:&lt;/strong&gt; a 1,050,000-token window, up to 922,000 input tokens, and 128,000 max output tokens. Input is text and images, output is text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Endpoints:&lt;/strong&gt; both models work with Responses and Chat Completions, but tool calling needs the Responses API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Removed settings:&lt;/strong&gt; a reasoning effort of &lt;code&gt;none&lt;/code&gt; is rejected, and &lt;code&gt;temperature&lt;/code&gt; and &lt;code&gt;top_p&lt;/code&gt; should be dropped. Flex processing isn't supported. Instead, background mode now has discounted two-hour and eight-hour completion windows (public beta).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://developers.openai.com/api/docs/guides/latest-model/gpt-6.2-astra" rel="noopener noreferrer"&gt;Using GPT-6.2 guide&lt;/a&gt; lists two behaviour changes that matter for chat apps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Prefix edits drop reasoning.&lt;/strong&gt; If you edit earlier history, the API drops the reasoning items that came after the edit. It does the same when you switch to certain other models or when the end user changes. The guide warns that "answer quality can decline and the model may use more tokens to repeat earlier work."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Top-level &lt;code&gt;instructions&lt;/code&gt; moved.&lt;/strong&gt; GPT-6.2 appends &lt;code&gt;instructions&lt;/code&gt; &lt;em&gt;after&lt;/em&gt; &lt;code&gt;input&lt;/code&gt;. Reusable instructions should go in a &lt;code&gt;developer&lt;/code&gt; message at the start of &lt;code&gt;input&lt;/code&gt;. Top-level &lt;code&gt;instructions&lt;/code&gt; are now meant for guidance that applies to the current request only.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href="https://developers.openai.com/api/docs/guides/reasoning" rel="noopener noreferrer"&gt;reasoning guide&lt;/a&gt; also lists &lt;code&gt;end_user_mismatch&lt;/code&gt;. If the &lt;code&gt;safety_identifier&lt;/code&gt; changes between requests, or is sent on only one of them, earlier reasoning is removed too.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened with the AI SDK
&lt;/h2&gt;

&lt;p&gt;We used &lt;code&gt;ai@7.0.177&lt;/code&gt; and &lt;code&gt;@ai-sdk/openai@4.0.121&lt;/code&gt;. &lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fopenai%404.0.120" rel="noopener noreferrer"&gt;4.0.120&lt;/a&gt; added the GPT-6.2 model IDs. &lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fopenai%404.0.121" rel="noopener noreferrer"&gt;4.0.121&lt;/a&gt; started returning &lt;code&gt;input_transformations&lt;/code&gt; in provider metadata, which is how you can see dropped reasoning at all.&lt;/p&gt;

&lt;p&gt;Our mock uses &lt;code&gt;fetch&lt;/code&gt;, streams the documented SSE events, and applies the documented checks: &lt;code&gt;prefix_mismatch&lt;/code&gt; and &lt;code&gt;end_user_mismatch&lt;/code&gt;. It's built from the docs. It isn't a captured OpenAI response.&lt;/p&gt;

&lt;p&gt;The "before" route is one you've probably written:&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="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`You are Acme's support assistant. Today is ${new Date().toISOString()}. The user is on the ${user.page} page.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AI SDK sends &lt;code&gt;system&lt;/code&gt; as the first &lt;code&gt;developer&lt;/code&gt; item in &lt;code&gt;input&lt;/code&gt;. That's the right place for stable text, but this text isn't stable. On turn two, &lt;code&gt;input[0]&lt;/code&gt; had a new timestamp and page, so it no longer matched what came before the turn-one reasoning item. The response reported:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"rs_1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"removed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"prefix_mismatch"&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;The &lt;a href="https://developers.openai.com/api/docs/guides/prompt-caching" rel="noopener noreferrer"&gt;prompt caching guide&lt;/a&gt; gives the same advice for cache hits: move timestamps and user-specific content to the end, not the beginning.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: a static system prompt, per-turn context in &lt;code&gt;instructions&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/api/chat/route.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;convertToModelMessages&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;'ai'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;openai&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;'@ai-sdk/openai'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createHash&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:crypto'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;SYSTEM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"You are Acme's support assistant. Answer from the order data you are given."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="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="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'gpt-6.2-sol'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;SYSTEM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// never changes, so it stays a stable, cacheable prefix&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;convertToModelMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;providerOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;openai&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;reasoningSummary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'auto'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;// GPT-6.2 appends this after input, so it can change every turn&lt;/span&gt;
        &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Today is ${new Date().toISOString()}. The user is on the ${user.page} page.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;// send it on every request, with the same value for the whole conversation&lt;/span&gt;
        &lt;span class="n"&gt;safetyIdentifier&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;createHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'sha256'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sessionId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'hex'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&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="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUIMessageStreamResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sendReasoning&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messageMetadata&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="n"&gt;part&lt;/span&gt; &lt;span class="p"&gt;}&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;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'finish-step'&lt;/span&gt;
        &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dropped&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;providerMetadata&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;openai&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inputTransformations&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="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We drove both routes the way &lt;code&gt;useChat&lt;/code&gt; does: post the UI messages, rebuild the assistant message with &lt;code&gt;readUIMessageStream&lt;/code&gt;, append it, and ask a follow-up. With the fixed route, &lt;code&gt;input[0]&lt;/code&gt; was byte-identical on both turns, the new page name arrived in top-level &lt;code&gt;instructions&lt;/code&gt;, and &lt;code&gt;dropped&lt;/code&gt; was empty. The turn-one reasoning went back as an &lt;code&gt;item_reference&lt;/code&gt; and was kept.&lt;/p&gt;

&lt;p&gt;One detail we got wrong at first: &lt;code&gt;inputTransformations&lt;/code&gt; is on the &lt;code&gt;finish-step&lt;/code&gt; part's provider metadata, not on &lt;code&gt;finish&lt;/code&gt;. Read it there, or you'll see nothing.&lt;/p&gt;

&lt;p&gt;On the client, your shadcn chat stays the same. Show &lt;code&gt;reasoning&lt;/code&gt; parts in a collapsible block and &lt;code&gt;text&lt;/code&gt; parts as the answer. In development, it helps to log &lt;code&gt;message.metadata.dropped&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;We didn't call the real API.&lt;/strong&gt; The checks in our mock follow the docs. Before you ship, run one real two-turn request and look at &lt;code&gt;input_transformations&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signing in mid-chat still drops reasoning.&lt;/strong&gt; If the identifier goes from a session hash to a user hash, that's an &lt;code&gt;end_user_mismatch&lt;/code&gt;, and our fixed route hit it too. Decide whether a conversation keeps the identifier it started with.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;instructions&lt;/code&gt; aren't cached.&lt;/strong&gt; OpenAI bills those tokens at the uncached input rate on every request, so keep them short.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;History trimming counts as an edit.&lt;/strong&gt; Rewriting or shortening old tool outputs, or summarising old turns at the front, changes the prefix. The &lt;a href="https://developers.openai.com/api/docs/guides/keep-prefix-unchanged" rel="noopener noreferrer"&gt;keep-the-prefix guide&lt;/a&gt; suggests compaction, or placing summaries at the end. Deleting whole items without editing the rest doesn't trigger &lt;code&gt;prefix_mismatch&lt;/code&gt; on its own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changing settings mid-chat.&lt;/strong&gt; Changing &lt;code&gt;reasoning.effort&lt;/code&gt;, &lt;code&gt;tools&lt;/code&gt; or &lt;code&gt;text.format&lt;/code&gt; between requests can also change the prefix. The docs suggest appending &lt;code&gt;configuration_update&lt;/code&gt; or &lt;code&gt;additional_tools&lt;/code&gt; items instead. We didn't test those here.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://openai.com/index/introducing-gpt-6-2-astra-sol" rel="noopener noreferrer"&gt;Introducing GPT-6.2 Astra and Sol, OpenAI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/changelog" rel="noopener noreferrer"&gt;OpenAI API changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/latest-model/gpt-6.2-astra" rel="noopener noreferrer"&gt;Using GPT-6.2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.openai.com/api/docs/models/gpt-6.2-astra" rel="noopener noreferrer"&gt;GPT-6.2 Astra model page&lt;/a&gt; and &lt;a href="https://developers.openai.com/api/docs/models/gpt-6.2-sol" rel="noopener noreferrer"&gt;GPT-6.2 Sol model page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/keep-prefix-unchanged" rel="noopener noreferrer"&gt;Keep the prefix unchanged&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/reasoning" rel="noopener noreferrer"&gt;Reasoning models: reasoning item removal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/prompt-caching" rel="noopener noreferrer"&gt;Prompt caching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fopenai%404.0.120" rel="noopener noreferrer"&gt;@ai-sdk/openai 4.0.120&lt;/a&gt; and &lt;a href="https://github.com/vercel/ai/releases/tag/%40ai-sdk%2Fopenai%404.0.121" rel="noopener noreferrer"&gt;4.0.121&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd rather not hand-build the reasoning block and message list, &lt;a href="https://ui.cuelark.com" rel="noopener noreferrer"&gt;Cuelark UI&lt;/a&gt; has shadcn-style components for AI chat that work with this setup.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>react</category>
      <category>nextjs</category>
      <category>openai</category>
    </item>
    <item>
      <title>Qwen4-Max in a React chat: keep the encrypted reasoning, or your history quietly loses it</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Tue, 17 Nov 2026 04:52:49 +0000</pubDate>
      <link>https://dev.to/cuelark/qwen4-max-in-a-react-chat-keep-the-encrypted-reasoning-or-your-history-quietly-loses-it-1oaf</link>
      <guid>https://dev.to/cuelark/qwen4-max-in-a-react-chat-keep-the-encrypted-reasoning-or-your-history-quietly-loses-it-1oaf</guid>
      <description>&lt;p&gt;&lt;em&gt;By the Cuelark Team. Every model detail below comes from Alibaba Cloud Model Studio's own docs, checked on 17 November 2026. The code ran on our machine against a local mock of the documented stream. We had no Qwen API key for this test, so read it as a wiring test, not a quality review.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Alibaba's Model Studio added &lt;code&gt;qwen4-max&lt;/code&gt; to its release notes on November 16 for the International deployment scope. It's the new flagship of the Qwen family. If you already run a chat UI on the Vercel AI SDK, switching looks like a one-line model change, since the model speaks the OpenAI Chat Completions protocol. That mostly holds. But one feature, encrypted reasoning, doesn't survive the trip through the standard OpenAI-compatible provider. Here's what changed, what broke in our test, and the small fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the docs say
&lt;/h2&gt;

&lt;p&gt;From the &lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/qwen4-max" rel="noopener noreferrer"&gt;qwen4-max model page&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input and output:&lt;/strong&gt; text, image and video in, text out. Streaming, function calling, parallel tool calls, web search, structured output (JSON Object and JSON Schema) and explicit plus implicit caching are all supported.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protocols:&lt;/strong&gt; OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and DashScope.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not supported:&lt;/strong&gt; batch inference, fine-tuning and model deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context:&lt;/strong&gt; 1,000,000 tokens. Output goes up to 131,072 tokens without thinking and 262,144 with thinking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Defaults:&lt;/strong&gt; thinking is on (&lt;code&gt;enable_thinking: true&lt;/code&gt;), &lt;code&gt;preserve_thinking: true&lt;/code&gt;, and &lt;code&gt;reasoning_effort: high&lt;/code&gt;. The supported effort values are &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt; and &lt;code&gt;xhigh&lt;/code&gt;. Other values get mapped: &lt;code&gt;minimal&lt;/code&gt; becomes &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt; becomes &lt;code&gt;high&lt;/code&gt;, and &lt;code&gt;max&lt;/code&gt; becomes &lt;code&gt;xhigh&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price:&lt;/strong&gt; $1.50 per million input tokens and $4.50 per million output tokens (thinking plus answer) in the International scope, and $1.413 / $4.24 in the Global scope. The same rate applies with or without thinking. Cache prices are on the linked caching page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Base URLs have also changed format. The &lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/compatibility-of-openai-with-dashscope" rel="noopener noreferrer"&gt;OpenAI-compatible docs&lt;/a&gt; now use a workspace host, such as &lt;code&gt;https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1&lt;/code&gt; for Singapore. They tell you to move away from &lt;code&gt;dashscope-intl.aliyuncs.com&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that matters for chat UIs: thinking summaries and ciphertext
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/cot-summary" rel="noopener noreferrer"&gt;thinking summary and encryption page&lt;/a&gt; describes an opt-in mode for &lt;code&gt;qwen4-max&lt;/code&gt;. Send &lt;code&gt;thinking_display: "summarized"&lt;/code&gt; and you no longer get the raw reasoning. You get a summary you can show the user, plus the full reasoning in encrypted form.&lt;/p&gt;

&lt;p&gt;The streaming order on Chat Completions is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Summary deltas arrive in &lt;code&gt;choices[i].delta.reasoning_content&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;One separate frame carries the complete &lt;code&gt;encrypted_content&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Text or tool calls arrive, then completion.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The docs say this explicitly: to restore the model's reasoning on later turns, send this ciphertext back unchanged with its assistant message, in every request. They also warn you not to drop the encrypted frame just because its text is empty.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened with the AI SDK
&lt;/h2&gt;

&lt;p&gt;We used &lt;code&gt;ai@7.0.173&lt;/code&gt; and &lt;code&gt;@ai-sdk/openai-compatible@3.0.92&lt;/code&gt;, and pointed them at a mock server that sends frames in the documented order. The mock is built from the docs. It isn't a captured Qwen response.&lt;/p&gt;

&lt;p&gt;Streaming worked. The summary came through as &lt;code&gt;reasoning-delta&lt;/code&gt; parts and the answer as &lt;code&gt;text-delta&lt;/code&gt;. Then we looked at what the second request actually sent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"17 × 23 = 391"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"reasoning_content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Breaking the product into 17×20 + 17×3."&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's no &lt;code&gt;encrypted_content&lt;/code&gt;. The provider keeps fields it knows about and drops the rest. Nothing errors, so it's easy to miss. Your chat keeps working, but the model never gets its earlier reasoning back, which is exactly what the docs say the ciphertext is for.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: one extractor, one field on the way back
&lt;/h2&gt;

&lt;p&gt;The OpenAI-compatible provider has two hooks that solve this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;code&gt;metadataExtractor&lt;/code&gt; reads raw stream chunks, and&lt;/li&gt;
&lt;li&gt;anything under &lt;code&gt;providerOptions.openaiCompatible&lt;/code&gt; on a message gets spread into that message in the request body.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// lib/qwen.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createOpenAICompatible&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;'@ai-sdk/openai-compatible'&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;encryptedReasoning&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;extractMetadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;parsedBody&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;qwen&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;encrypted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;parsedBody&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&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="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="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encrypted_content&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;createStreamExtractor&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;encrypted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&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="nf"&gt;processChunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&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;e&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&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="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="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encrypted_content&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;encrypted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&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="n"&gt;buildMetadata&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;qwen&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;encrypted&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;qwen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createOpenAICompatible&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'qwen'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;QWEN_BASE_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1&lt;/span&gt;
  &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;DASHSCOPE_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;metadataExtractor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;encryptedReasoning&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;thinking&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;qwen&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;enable_thinking&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;thinking_display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'summarized'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;preserve_thinking&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the route, attach the ciphertext to the assistant message's metadata so &lt;code&gt;useChat&lt;/code&gt; stores it with that message. When the history comes back on the next request, put it back:&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="c1"&gt;// app/api/chat/route.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;convertToModelMessages&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;'ai'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;qwen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;thinking&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;'@/lib/qwen'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="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="n"&gt;messages&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;modelMessages&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="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&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="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&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;mm&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;convertToModelMessages&lt;/span&gt;&lt;span class="p"&gt;(&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="p"&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="n"&gt;enc&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="n"&gt;role&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'assistant'&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="n"&gt;metadata&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encrypted&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;modelMessages&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="n"&gt;enc&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;providerOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;openaiCompatible&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;encrypted_content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;enc&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;qwen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;chatModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'qwen4-max'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;modelMessages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;providerOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;thinking&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUIMessageStreamResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sendReasoning&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messageMetadata&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="n"&gt;part&lt;/span&gt; &lt;span class="p"&gt;}&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;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'finish-step'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;encrypted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;providerMetadata&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qwen&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encrypted&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the client, your existing shadcn chat doesn't change. Show the &lt;code&gt;reasoning&lt;/code&gt; parts in a collapsible "Thinking" block and the &lt;code&gt;text&lt;/code&gt; parts as the answer. After this change, our two-turn test sent the assistant message back with &lt;code&gt;"encrypted_content": "ENC-TURN-1"&lt;/code&gt; and passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;We didn't call the real API.&lt;/strong&gt; The stream shape comes from the docs. Before you ship, run one real two-turn request and check the second request body.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool loops need more work.&lt;/strong&gt; The docs say to store each encrypted segment with its own assistant message, including tool-call turns. Our extractor keeps one value per step, which is fine for plain chat. A multi-step tool agent needs one value per step mapped onto the matching assistant message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summaries can be incomplete.&lt;/strong&gt; The docs say the summary may be missing or partial, and raw reasoning isn't available in this mode. Don't build UI that depends on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The ciphertext lives in the client.&lt;/strong&gt; &lt;code&gt;useChat&lt;/code&gt; holds it in message metadata. If you store chats, store the metadata too, or the next session starts without it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No batch or fine-tuning.&lt;/strong&gt; If your pipeline relies on either, this model isn't a drop-in swap.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/qwen4-max" rel="noopener noreferrer"&gt;qwen4-max model page, Alibaba Cloud Model Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/cot-summary" rel="noopener noreferrer"&gt;Thinking summary and encryption&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/compatibility-of-openai-with-dashscope" rel="noopener noreferrer"&gt;OpenAI compatible: Chat&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.modelstudio.console.alibabacloud.com/en/model-studio/newly-released-models" rel="noopener noreferrer"&gt;Model releases and updates&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/vercel/ai/releases/tag/ai%407.0.173" rel="noopener noreferrer"&gt;vercel/ai release ai@7.0.173&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd rather not hand-build the thinking block and message list, &lt;a href="https://ui.cuelark.com" rel="noopener noreferrer"&gt;Cuelark UI&lt;/a&gt; has shadcn-style components for AI chat that work with this setup.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>react</category>
      <category>nextjs</category>
      <category>llm</category>
    </item>
    <item>
      <title>Which free online PDF tools upload your file? We tested 13 (Nov 2026)</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:24:01 +0000</pubDate>
      <link>https://dev.to/cuelark/which-free-online-pdf-tools-upload-your-file-we-tested-13-nov-2026-2nao</link>
      <guid>https://dev.to/cuelark/which-free-online-pdf-tools-upload-your-file-we-tested-13-nov-2026-2nao</guid>
      <description>&lt;p&gt;&lt;em&gt;By the Cuelark Team. Tested on 16 November 2026, between about 10:50 and 11:25 PM IST. Disclosure: we make Cuelark Tools, one of the 13 tools in this test. It was measured with the same script as everyone else.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most free PDF sites promise your files are "secure" or "deleted after an hour". Fewer say plainly whether the file leaves your computer at all. You can check that yourself: open the browser's network panel and watch for a request about the size of your file.&lt;/p&gt;

&lt;p&gt;We did that check with a script for 13 popular free tools, using one merge and one compress per tool and a harmless dummy PDF. This post gives the results, the method, what "upload" does and doesn't mean, and the limits of the test.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F127s5g8ombhd0pxysyik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F127s5g8ombhd0pxysyik.png" alt="Results: which tools sent the test PDF to a server" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sent the file to a server in every test we completed:&lt;/strong&gt; iLovePDF, Smallpdf, PDF24 Tools, Sejda (web), Adobe Acrobat online, PDF2Go, Soda PDF, and Stirling PDF's hosted app (compress only, see below).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixed, depending on the task:&lt;/strong&gt; Xodo and iHatePDF (ihatepdf.com) merged the two files inside the browser but uploaded the file for compression.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kept the file in the browser for both tasks:&lt;/strong&gt; ihatepdf.cv, BentoPDF and Cuelark Tools. Each produced a downloadable result, and none of the requests these pages made carried bytes from the test file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In most of the tools that upload, the upload started &lt;strong&gt;as soon as the file was picked&lt;/strong&gt;, before we pressed Merge or Compress. That was true for iLovePDF, Smallpdf, PDF24, Sejda, Adobe, PDF2Go and Soda PDF.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results table
&lt;/h2&gt;

&lt;p&gt;"Uploaded" means bytes from our test file appeared in a request after we picked the file (see the method below). The MB figure is the total sent to the host that received the file.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Merge (2 files, 1.42 MB)&lt;/th&gt;
&lt;th&gt;Compress (1 file, 0.71 MB)&lt;/th&gt;
&lt;th&gt;Host that received the file&lt;/th&gt;
&lt;th&gt;What the tool says (official page)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.ilovepdf.com/merge_pdf" rel="noopener noreferrer"&gt;iLovePDF&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 1.42 MB&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;api70.ilovepdf.com&lt;/td&gt;
&lt;td&gt;"all files processed within our platform are automatically and permanently deleted within two hours of being processed" (&lt;a href="https://www.ilovepdf.com/help/security" rel="noopener noreferrer"&gt;security page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://smallpdf.com/merge-pdf" rel="noopener noreferrer"&gt;Smallpdf&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 1.42 MB¹&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;Smallpdf's Cloudflare R2 storage bucket&lt;/td&gt;
&lt;td&gt;"Your PDFs are encrypted using TLS and automatically deleted from our servers after one hour." (&lt;a href="https://smallpdf.com/merge-pdf" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://tools.pdf24.org/en/merge-pdf" rel="noopener noreferrer"&gt;PDF24 Tools&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 1.42 MB&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;filetools0 / filetools26.pdf24.org&lt;/td&gt;
&lt;td&gt;"Files are automatically deleted from the PDF24 server after one hour" (&lt;a href="https://tools.pdf24.org/en/merge-pdf" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;); "Servers are located in Germany"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.sejda.com/merge-pdf" rel="noopener noreferrer"&gt;Sejda (web)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 1.42 MB²&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB²&lt;/td&gt;
&lt;td&gt;&lt;a href="http://www.sejda.com" rel="noopener noreferrer"&gt;www.sejda.com&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;"Files stay private. Automatically deleted after 2 hours." (&lt;a href="https://www.sejda.com/merge-pdf" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;). Sejda's desktop app is described as one where "the files never leave your computer".&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.adobe.com/acrobat/online/merge-pdf.html" rel="noopener noreferrer"&gt;Adobe Acrobat online&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 1.42 MB&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;Adobe blob storage (adobe.io)&lt;/td&gt;
&lt;td&gt;"Your file will be securely handled by Adobe servers and deleted unless you sign in to save it." (&lt;a href="https://www.adobe.com/acrobat/online/merge-pdf.html" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.pdf2go.com/merge-pdf" rel="noopener noreferrer"&gt;PDF2Go&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 2.84 MB³&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;www3 / www11 / www14 / www27.pdf2go.com&lt;/td&gt;
&lt;td&gt;"The generated file can be downloaded a maximum of 10 times. Access is automatically blocked after 24 hours … At the latest, the files are physically deleted after 72 hours." (&lt;a href="https://www.pdf2go.com/privacy-policy" rel="noopener noreferrer"&gt;privacy policy, section 12&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.sodapdf.com/pdf-merge/" rel="noopener noreferrer"&gt;Soda PDF&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Uploaded, 1.42 MB&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;api-gw.sodapdf.com&lt;/td&gt;
&lt;td&gt;"Your files remain private and will be deleted from our servers within 24 hours." (&lt;a href="https://www.sodapdf.com/pdf-merge/" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://stirling.com/app/" rel="noopener noreferrer"&gt;Stirling PDF (hosted app, guest)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Not tested⁴&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;api.stirling.com&lt;/td&gt;
&lt;td&gt;Privacy policy covers hosted file content "per the retention settings you configure". We found no stated retention period for guest use (&lt;a href="https://stirling.com/privacy" rel="noopener noreferrer"&gt;privacy policy&lt;/a&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://xodo.com/merge-pdf" rel="noopener noreferrer"&gt;Xodo&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB&lt;/td&gt;
&lt;td&gt;Amazon S3 bucket "pdf-online-temp-storage" (us-west-2)&lt;/td&gt;
&lt;td&gt;Merge page: "Easily combine PDFs into one file in your browser". Compress page: "permanently deleted after 1h" (&lt;a href="https://xodo.com/compress-pdf" rel="noopener noreferrer"&gt;compress page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://ihatepdf.com/merge" rel="noopener noreferrer"&gt;iHatePDF (ihatepdf.com)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;Uploaded, 0.71 MB⁵&lt;/td&gt;
&lt;td&gt;ihatepdf.com&lt;/td&gt;
&lt;td&gt;"When you merge smaller PDF files, the whole job runs in your browser and nothing is uploaded." "Browser mode compresses on your device; files sent to our servers are deleted within an hour." (&lt;a href="https://ihatepdf.com/merge" rel="noopener noreferrer"&gt;merge&lt;/a&gt;, &lt;a href="https://ihatepdf.com/compress" rel="noopener noreferrer"&gt;compress&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.ihatepdf.cv/merge-pdf" rel="noopener noreferrer"&gt;ihatepdf.cv&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;"The merge runs inside your browser using pdf-lib, so your documents are never uploaded to a server." (&lt;a href="https://www.ihatepdf.cv/merge-pdf" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.bentopdf.com/merge-pdf" rel="noopener noreferrer"&gt;BentoPDF&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;"all file processing happens locally in your browser and we never collect or transmit your files to any server" (&lt;a href="https://www.bentopdf.com/" rel="noopener noreferrer"&gt;home page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://tools.cuelark.com/merge-pdf" rel="noopener noreferrer"&gt;Cuelark Tools&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;Stayed in browser&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;"Nothing is sent to a server; you can confirm it in your browser's network panel while a file converts." (&lt;a href="https://tools.cuelark.com/merge-pdf" rel="noopener noreferrer"&gt;merge page&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Our script didn't press Smallpdf's final merge button. Both files had already been uploaded when they were picked, and that upload is what we recorded.&lt;/li&gt;
&lt;li&gt;Sejda sends the file as a multipart upload labelled &lt;code&gt;application/zip&lt;/code&gt;, so the raw PDF bytes don't appear as-is. The request was a single POST to &lt;code&gt;/api/files/upload&lt;/code&gt; with filename &lt;code&gt;test-a.pdf&lt;/code&gt;, about the size of the file. We count that as an upload.&lt;/li&gt;
&lt;li&gt;PDF2Go sent each file to one server and both files to another during the merge, which is why the total is about twice the input.&lt;/li&gt;
&lt;li&gt;Stirling's hosted app kept the two files in its in-browser file library when we added them, and no file bytes were sent at that point. Our script couldn't open the merge tool past the guest sign-up prompt, so we have no result for the merge step.&lt;/li&gt;
&lt;li&gt;iHatePDF's compress page offers a "Browser mode". We tested the page as it loaded, without changing any settings, and that run went to the server.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How we tested
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flhxt4wbjggyw8y1a2izr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flhxt4wbjggyw8y1a2izr.png" alt="Method: headless browser, logging proxy, tool servers" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Test files.&lt;/strong&gt; Two dummy PDFs we generated: 3 pages each, a line of text and a block of random pixels per page, 709,713 and 710,145 bytes. They contain no personal data. The random pixels make the files impossible to compress much, so an upload shows up clearly by size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser.&lt;/strong&gt; Chromium (Playwright) on a cloud Linux machine. Adobe's site refused the headless browser ("Access Denied"), so Adobe was tested in a regular, visible Chrome window instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proxy.&lt;/strong&gt; All traffic went through mitmproxy, which logged every request: host, path, body size, and whether the body contained any of 14 short (24-byte) samples taken from the test files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flow.&lt;/strong&gt; Open the tool page, pick the file(s), wait 15 seconds, press Merge or Compress, wait 25 seconds, and press Download if a button appeared. A tool counts as "uploaded" if any request after the file was picked contained the file's bytes. Sejda (note 2) is the one exception, where we went by a same-size upload of the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default settings only.&lt;/strong&gt; No account and no sign-in. Cookie banners were accepted or declined only where they blocked the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-runs.&lt;/strong&gt; We ran most tools at least twice. The tools that kept files in the browser were re-run with WebSocket logging turned on, and no WebSocket messages were sent from the page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We kept the sanitized request logs (host, path without query strings, size, match count), screenshots and the test scripts. Ask and we'll share them.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Uploaded" is not the same as "unsafe"
&lt;/h2&gt;

&lt;p&gt;A server-side tool isn't automatically worse. Servers can do things a browser tab struggles with: OCR on scanned pages, high-quality conversion of Office files, heavy compression with tools like Ghostscript, very large files on weak phones, and saving work to an account. Most of the uploading tools mention an encrypted connection on the pages we read, and most give a deletion window from one hour (Smallpdf, PDF24, iHatePDF, Xodo compress) to two hours (iLovePDF, Sejda), 24 hours (Soda PDF), or 72 hours at the latest (PDF2Go). We didn't verify deletion, and nobody outside these companies can.&lt;/p&gt;

&lt;p&gt;In-browser tools have trade-offs too. They depend on your device's memory and speed. Some features, like OCR and Office conversion, are harder to do well in the browser. And a page that processes files locally today can change tomorrow. If a document really matters (contracts, medical records, ID scans), the simplest rule is: either use a tool that doesn't upload and check the network panel yourself, or use desktop software.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check any PDF tool yourself in 60 seconds
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the tool, then open developer tools (F12, or Cmd+Option+I on a Mac) and go to the &lt;strong&gt;Network&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Pick a file larger than about 1 MB.&lt;/li&gt;
&lt;li&gt;Sort by &lt;strong&gt;Size&lt;/strong&gt;, or look for POST/PUT requests. An upload shows up as a request roughly the size of your file going to the tool's domain or a storage domain (&lt;code&gt;*.amazonaws.com&lt;/code&gt;, &lt;code&gt;*.r2.cloudflarestorage.com&lt;/code&gt;, and so on).&lt;/li&gt;
&lt;li&gt;For extra certainty, load the page, turn on airplane mode, then run the tool. If it still works, the processing happened on your device. Some in-browser tools load their PDF engine only when you pick a file, though, so they can fail offline even though they never upload anything.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Update, 17 November 2026:&lt;/em&gt; Cuelark Tools was one of those. Its merge and compress pages failed this airplane-mode test because the PDF engine only loaded once a file was picked. We confirmed this again on a copy of the old version. We changed the pages to fetch the engine quietly after the page finishes loading. We then re-ran the same script against the live site on 17 November at about 6:20 AM IST, going offline before picking files. Merge produced the merged PDF (1,417,040 bytes) and compress produced the 500 KB version (451,755 bytes). The engine files came from the browser's cache. The upload results in the table don't change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits of this test
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One day, one network, default settings.&lt;/strong&gt; Results are from 16 November 2026, from a cloud server, with no account. Sites change often, and signed-in, paid, mobile app or desktop versions may behave differently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two tasks only.&lt;/strong&gt; We tested merge and compress. The same site can upload for other tools (OCR, PDF to Word, e-sign) even if it merges locally, as Xodo and iHatePDF show.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Byte matching has blind spots.&lt;/strong&gt; We search request bodies for raw samples of the file. A file that is compressed, encrypted or re-encoded before it's sent won't match (which is why Sejda needed a manual check), so we also looked at request sizes. Several sites sent analytics or error-monitoring requests during the tasks (Microsoft Clarity, Facebook, Reddit, Sentry). None of them contained matching file bytes. The largest was a 2.47 MB compressed payload to a Sentry host during the Adobe compress test. We don't know what was in it and we're not claiming it contained the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;We don't check what happens after upload.&lt;/strong&gt; Deletion windows are each company's own statement, quoted above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No result for one test.&lt;/strong&gt; Stirling's merge (note 4).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;We're not neutral by birth.&lt;/strong&gt; We build one of the tools in the table. That's why we published the method and kept the raw logs, so anyone can repeat the test and correct us.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you run this test and get a different result, tell us and we'll update the table with the date.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cuelark Team&lt;/em&gt;&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>pdf</category>
      <category>webdev</category>
      <category>security</category>
    </item>
    <item>
      <title>How to Split a PDF into Separate Pages (or Page Ranges)</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Mon, 16 Nov 2026 06:30:13 +0000</pubDate>
      <link>https://dev.to/cuelark/how-to-split-a-pdf-into-separate-pages-or-page-ranges-2h0d</link>
      <guid>https://dev.to/cuelark/how-to-split-a-pdf-into-separate-pages-or-page-ranges-2h0d</guid>
      <description>&lt;p&gt;To split a PDF, you need a tool that copies the pages you pick into one or more new PDF files. On a Mac you can drag pages out of Preview, on Windows you can print a page range to PDF, and on any system &lt;code&gt;qpdf --split-pages file.pdf out.pdf&lt;/code&gt; writes every page to its own file.&lt;/p&gt;

&lt;p&gt;Below are the steps for each option, a worked example, and the limits you should know before you pick one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The example file
&lt;/h2&gt;

&lt;p&gt;For this guide we made a six-page Letter-size PDF called &lt;code&gt;report.pdf&lt;/code&gt;: a cover letter, two invoices, a receipt and a two-page contract. The goal is to pull the invoices out as one file, and also to break the whole thing into smaller files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3kjm0giub8t2th1r1n0e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3kjm0giub8t2th1r1n0e.png" alt="A six-page PDF before splitting, pages numbered 1 to 6" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Mac: Preview
&lt;/h2&gt;

&lt;p&gt;Preview comes with macOS and can make a new PDF from any pages you drag out of it. Apple's guide to &lt;a href="https://support.apple.com/guide/preview/add-delete-or-move-pdf-pages-prvw11793/mac" rel="noopener noreferrer"&gt;adding, deleting, or moving PDF pages&lt;/a&gt; describes it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the PDF in Preview.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;View &amp;gt; Thumbnails&lt;/strong&gt; (or &lt;strong&gt;View &amp;gt; Contact Sheet&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Select the pages you want. Command-click to pick pages that aren't next to each other.&lt;/li&gt;
&lt;li&gt;Drag the thumbnails to the desktop. Preview creates a new PDF that contains just those pages.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Repeat for each part you need. One caution from Apple's &lt;a href="https://support.apple.com/guide/preview/combine-pdfs-prvw43696/mac" rel="noopener noreferrer"&gt;combine PDFs guide&lt;/a&gt;: Preview saves changes automatically, so use &lt;strong&gt;File &amp;gt; Duplicate&lt;/strong&gt; first if you plan to delete or move pages inside the original.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Windows (and any browser): print a page range to PDF
&lt;/h2&gt;

&lt;p&gt;This uses nothing beyond Windows and a browser, and it gives you one new file per print job.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the PDF in Microsoft Edge (or Chrome) and press &lt;strong&gt;Ctrl+P&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Pages&lt;/strong&gt;, choose &lt;strong&gt;Custom&lt;/strong&gt; and type a range like &lt;code&gt;1-5&lt;/code&gt; or a list like &lt;code&gt;3, 6, 8&lt;/code&gt;. Microsoft's &lt;a href="https://support.microsoft.com/en-us/edge/print-in-microsoft-edge" rel="noopener noreferrer"&gt;Print in Microsoft Edge&lt;/a&gt; page documents both formats.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Printer&lt;/strong&gt; list, pick &lt;strong&gt;Microsoft Print to PDF&lt;/strong&gt;, the Windows printer Microsoft uses for &lt;a href="https://support.microsoft.com/en-us/office/print-notes-in-onenote-for-windows-10-45edbbc5-fbb8-453f-99c7-aaadebe5c06a" rel="noopener noreferrer"&gt;exporting to PDF&lt;/a&gt;. In Chrome, choose &lt;strong&gt;Save as PDF&lt;/strong&gt; as the destination (&lt;a href="https://support.google.com/chrome/answer/1069693?hl=en" rel="noopener noreferrer"&gt;Print from Chrome&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Print&lt;/strong&gt; or &lt;strong&gt;Save&lt;/strong&gt;, then name the new file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For our example, &lt;code&gt;2-3&lt;/code&gt; gives a two-page invoices file. You can't split the whole document in one pass this way: ten parts means ten print jobs. The file is also created by printing rather than by copying pages, so open it and check that the text, links and form fields you need are still there.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Adobe Acrobat: free online tool vs. paid desktop app
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Acrobat online (free with sign-in).&lt;/strong&gt; Adobe's &lt;a href="https://acrobat.adobe.com/tools/split-pdf" rel="noopener noreferrer"&gt;Split PDF tool&lt;/a&gt; asks you to sign in after you upload. You then click divider lines between page thumbnails and save. According to that page, it takes files of up to 1,500 pages and 1 GB, and makes up to 20 files (19 divider lines). Adobe's &lt;a href="https://helpx.adobe.com/acrobat/web/edit-pdfs/organize-documents/split-pdfs.html" rel="noopener noreferrer"&gt;help article&lt;/a&gt; says you can select up to 22 divider lines, depending on page count, so expect a limit of roughly 20 parts. The split files go into Adobe cloud storage, and you download them from there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Acrobat desktop (paid).&lt;/strong&gt; Adobe's &lt;a href="https://helpx.adobe.com/acrobat/desktop/edit-documents/organize-pages/split-pdfs.html" rel="noopener noreferrer"&gt;desktop split guide&lt;/a&gt; lists these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the PDF and select &lt;strong&gt;All tools &amp;gt; Organize pages&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the left pane, select &lt;strong&gt;Split&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Split by&lt;/strong&gt;, choose &lt;strong&gt;Number of pages&lt;/strong&gt;, &lt;strong&gt;File Size&lt;/strong&gt; or &lt;strong&gt;Top level bookmarks&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Output options&lt;/strong&gt; to set the folder and file names, then select &lt;strong&gt;Split&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It can also split several PDFs at once with &lt;strong&gt;Split multiple files&lt;/strong&gt;. Splitting at bookmarks is the main thing the other options here don't do. The desktop app comes with a paid Acrobat plan: Adobe's &lt;a href="https://www.adobe.com/acrobat/pricing.html" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; lists "edit and organize PDFs" in Acrobat Standard, and the online tool page offers a 7-day Acrobat Pro trial.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Command line: qpdf or pdfseparate
&lt;/h2&gt;

&lt;p&gt;Use this if you split files often or need to script it. qpdf is free and has builds for Windows, macOS and Linux on its &lt;a href="https://github.com/qpdf/qpdf/releases" rel="noopener noreferrer"&gt;GitHub releases page&lt;/a&gt;. Here is what happened when we ran it on &lt;code&gt;report.pdf&lt;/code&gt; with qpdf 12.4.2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ qpdf --split-pages report.pdf page.pdf
$ ls page-*.pdf
page-1.pdf  page-2.pdf  page-3.pdf  page-4.pdf  page-5.pdf  page-6.pdf

$ qpdf --split-pages=2 report.pdf part.pdf
$ ls part-*.pdf
part-1-2.pdf  part-3-4.pdf  part-5-6.pdf

$ qpdf report.pdf --pages . 2-3 -- invoices.pdf
$ pdfinfo invoices.pdf &lt;span class="o"&gt;|&lt;/span&gt; grep Pages
Pages:           2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5v4rmlrzgkc9dt2mo9ev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5v4rmlrzgkc9dt2mo9ev.png" alt="The same PDF after splitting every 2 pages: three files with pages 1-2, 3-4 and 5-6" width="799" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://qpdf.readthedocs.io/en/stable/cli.html" rel="noopener noreferrer"&gt;qpdf manual&lt;/a&gt; covers &lt;code&gt;--split-pages[=n]&lt;/code&gt; and the page-range syntax. &lt;code&gt;z&lt;/code&gt; means the last page, &lt;code&gt;r3-r1&lt;/code&gt; means the last three pages, and &lt;code&gt;1-10,x3-4&lt;/code&gt; means pages 1 to 10 except 3 and 4. The manual also notes that &lt;code&gt;--split-pages&lt;/code&gt; doesn't keep outlines (bookmarks) and other document-level data. If you need those, use &lt;code&gt;--pages&lt;/code&gt; once for each output file.&lt;/p&gt;

&lt;p&gt;On Linux, &lt;code&gt;pdfseparate&lt;/code&gt; from poppler-utils is often already installed. Its &lt;a href="https://manpages.debian.org/trixie/poppler-utils/pdfseparate.1.en.html" rel="noopener noreferrer"&gt;man page&lt;/a&gt; uses &lt;code&gt;-f&lt;/code&gt; and &lt;code&gt;-l&lt;/code&gt; for the first and last page, and &lt;code&gt;%d&lt;/code&gt; in the output name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ pdfseparate -f 5 -l 6 report.pdf contract-%d.pdf
$ ls
contract-5.pdf  contract-6.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It only writes single pages, and the man page says the input should not be encrypted.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. In the browser without uploading
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://tools.cuelark.com/split-pdf" rel="noopener noreferrer"&gt;Cuelark Split PDF tool&lt;/a&gt; runs in the browser tab. The page says the PDF is processed on your device and nothing is sent to a server. It accepts ranges such as &lt;code&gt;1-3, 5, 8-10&lt;/code&gt; and can also save every page separately, split every N pages, separate odd and even pages, or split by a maximum file size (for example 24 MB for email). Pages are copied rather than re-rendered. It doesn't split by bookmarks, and it won't open password-protected PDFs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other online options
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.ilovepdf.com/split_pdf" rel="noopener noreferrer"&gt;iLovePDF&lt;/a&gt; and &lt;a href="https://smallpdf.com/split-pdf" rel="noopener noreferrer"&gt;Smallpdf&lt;/a&gt; both have split tools that work on uploaded files. iLovePDF's &lt;a href="https://www.ilovepdf.com/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; lists a free plan with "limited document processing" and Premium at $9 a month, or $60 billed annually. These tools are fine for routine documents. For anything sensitive, use an option that keeps the file on your machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one to use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two or three pages, once:&lt;/strong&gt; Preview on a Mac, or print to PDF on Windows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every page as its own file, or every N pages:&lt;/strong&gt; qpdf, Acrobat desktop, or a browser tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split at chapters or bookmarks:&lt;/strong&gt; Acrobat desktop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch jobs or scripts:&lt;/strong&gt; qpdf.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can I split a PDF for free without installing anything?&lt;/strong&gt;&lt;br&gt;
Yes. Print the page range to PDF from Edge or Chrome, or drag thumbnails out of Preview on a Mac. Both give you one new file per job.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does splitting a PDF reduce quality?&lt;/strong&gt;&lt;br&gt;
Not with qpdf, pdfseparate, Acrobat's Split, or tools that copy pages. In our test, &lt;code&gt;pdftotext&lt;/code&gt; still read the text in &lt;code&gt;invoices.pdf&lt;/code&gt;. Printing to PDF creates the file through the print path, so check the result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I extract a few non-consecutive pages into one PDF?&lt;/strong&gt;&lt;br&gt;
With qpdf, list them: &lt;code&gt;qpdf in.pdf --pages . 1,4,7-9 -- out.pdf&lt;/code&gt;. In Preview, Command-click the thumbnails and drag them out together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I split a large PDF so it fits as an email attachment?&lt;/strong&gt;&lt;br&gt;
Acrobat desktop has a &lt;strong&gt;File Size&lt;/strong&gt; option under &lt;strong&gt;Split by&lt;/strong&gt;. qpdf can split by page count (&lt;code&gt;--split-pages=n&lt;/code&gt;). Try different numbers until each part is small enough.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I split a password-protected PDF?&lt;/strong&gt;&lt;br&gt;
You need the password. qpdf accepts it with &lt;code&gt;--password&lt;/code&gt; (see the &lt;a href="https://qpdf.readthedocs.io/en/stable/cli.html" rel="noopener noreferrer"&gt;manual&lt;/a&gt;). pdfseparate expects an unencrypted file.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cuelark Team&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pdf</category>
      <category>productivity</category>
      <category>tutorial</category>
      <category>cli</category>
    </item>
    <item>
      <title>AI updates for developers, Nov 9–16 2026: Fable 5.2, Gemini 4 Carbon, decision models, and what breaks</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:02:14 +0000</pubDate>
      <link>https://dev.to/cuelark/ai-updates-for-developers-nov-9-16-2026-fable-52-gemini-4-carbon-decision-models-and-what-14j1</link>
      <guid>https://dev.to/cuelark/ai-updates-for-developers-nov-9-16-2026-fable-52-gemini-4-carbon-decision-models-and-what-14j1</guid>
      <description>&lt;p&gt;&lt;em&gt;By the Cuelark Team. Every release, price and date below comes from the vendor's own blog, docs or changelog, checked on 16 November 2026. The Reddit section links every thread we used.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This week was busy for anyone shipping on top of model APIs. Anthropic and Google both put out new frontier models. Two vendors now sell "decision" models that answer closed questions instead of writing text. DeepSeek turned its API into a full application stack. And GitHub put a date on retiring six Copilot models. Here is what changed, what it costs, and which parts can break existing code.&lt;/p&gt;

&lt;p&gt;We covered Gemini 4 Hydrogen separately in &lt;a href="https://dev.to/cuelark/gemini-4-hydrogen-in-a-react-chat-the-migration-details-that-actually-matter-56lh"&gt;our React chat migration post&lt;/a&gt;, so it only comes up here where it touches other changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmqjzvwp6e3spvl3x84vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmqjzvwp6e3spvl3x84vb.png" alt="Timeline of AI releases Nov 9–16 2026 and upcoming dates" width="800" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Date (2026)&lt;/th&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Why a developer should care&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Nov 9&lt;/td&gt;
&lt;td&gt;Claude Fable 5.2 and Mythos 5.2&lt;/td&gt;
&lt;td&gt;$8/$40 per 1M tokens. &lt;strong&gt;Preserved thinking now applies to all accounts&lt;/strong&gt;, which can 400 your requests if you edit history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 9&lt;/td&gt;
&lt;td&gt;Meta Muse Ember on the Meta Model API&lt;/td&gt;
&lt;td&gt;$0.10 / $0.50 per 1M tokens, also on Google Cloud, Oracle Cloud and Vercel AI Gateway&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 10&lt;/td&gt;
&lt;td&gt;Gemini 4 Carbon generally available to developers&lt;/td&gt;
&lt;td&gt;Intro price $2/$10 until Nov 30, then $4/$20. Sampling params ignored, explicit caching unsupported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 11&lt;/td&gt;
&lt;td&gt;Gemini Decisions API (&lt;code&gt;gemini-decision-1&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Up to 1,000 yes/no, choice or rubric questions per call. $0.10 per 1M input, output free&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 11&lt;/td&gt;
&lt;td&gt;Qwen4-Max-Preview&lt;/td&gt;
&lt;td&gt;Two-week preview on Token Plan only. &lt;code&gt;max_tokens&lt;/code&gt; now covers thinking plus answer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 12&lt;/td&gt;
&lt;td&gt;Inkling 2 Small weights&lt;/td&gt;
&lt;td&gt;594B total / 17B active MoE, Apache 2.0, runs in vLLM and SGLang&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 13&lt;/td&gt;
&lt;td&gt;DeepSeek application API suite&lt;/td&gt;
&lt;td&gt;Built-in web search, URL reading, file input, OCR, ASR, TTS. A safety parameter required for public apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nov 13&lt;/td&gt;
&lt;td&gt;GitHub Copilot deprecations&lt;/td&gt;
&lt;td&gt;Six models removed from Copilot on &lt;strong&gt;Dec 14&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Claude Fable 5.2 and Mythos 5.2: cheaper, faster, and one API change to check
&lt;/h2&gt;

&lt;p&gt;Anthropic released &lt;a href="https://www.anthropic.com/claude-fable-and-mythos-5-2" rel="noopener noreferrer"&gt;Claude Fable 5.2 and Mythos 5.2&lt;/a&gt; on November 9.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Price:&lt;/strong&gt; $8 per million input tokens and $40 per million output, lower than 5.1. An optional fast mode generates up to 2.5× faster for $16/$80.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed:&lt;/strong&gt; output is up to 30% faster than 5.1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability:&lt;/strong&gt; Fable 5.2 is on every platform, including AWS, Google Cloud and Azure, as &lt;code&gt;claude-fable-5-2&lt;/code&gt;. Mythos 5.2's cyber capabilities go through Anthropic's Cyber Verification Program.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Which model to start with:&lt;/strong&gt; Anthropic still tells most teams to start on Opus 5.5 and move up to Fable only for the hardest work. Its own numbers are the main reason to look anyway: on FrontierCode 2.0, Fable 5.2 at High effort scored about level with Opus 5.5 at Max effort (45.3% vs 45.5%) for roughly half the cost per task. That's Anthropic's benchmark, not ours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advisor and orchestrator roles:&lt;/strong&gt; the post describes using Fable 5.2 as an advisor that cheaper Haiku, Sonnet or Opus models consult, or as an orchestrator that hands simpler work down to them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deliberate limits:&lt;/strong&gt; during training, Anthropic took steps to hold two research skills, accelerator kernel optimisation and improving LLM architectures, at about Opus 5.5's level. It says agentic coding and general ML work weren't affected.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The breaking change: preserved thinking for everyone
&lt;/h3&gt;

&lt;p&gt;One line in the launch post matters more for integrations than any benchmark: "preserved thinking now applies to all accounts". Anthropic frames it as an anti-distillation measure. The &lt;a href="https://platform.claude.com/docs/en/build-with-claude/preserved-thinking" rel="noopener noreferrer"&gt;preserved thinking docs&lt;/a&gt; explain the practical side:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A thinking block is bound to everything before it: &lt;code&gt;system&lt;/code&gt;, &lt;code&gt;tools&lt;/code&gt; and every earlier message. If any of those change between requests, the block fails a prefix check and the request &lt;strong&gt;can get a 400 error&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;prefix_mismatch_behavior&lt;/code&gt; lets you choose between that 400 and having the API drop the failing blocks. The response's &lt;code&gt;input_transformations&lt;/code&gt; field tells you which blocks were dropped.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;thinking: {"type": "enabled"}&lt;/code&gt; is now a 400 on these models. Send &lt;code&gt;"adaptive"&lt;/code&gt; or leave &lt;code&gt;thinking&lt;/code&gt; out.&lt;/li&gt;
&lt;li&gt;Thinking blocks from Fable 5.2, Mythos 5.2, Sonnet 5.5 and Haiku 5.5 only work in the account (or linked account) that produced them. Anywhere else they're silently dropped.&lt;/li&gt;
&lt;li&gt;Switching models is fine. The docs say to keep sending the whole history: blocks a model can't read are dropped for that request without an error, and read again when you switch back.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqln0vz5v9lxrcy28ohvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqln0vz5v9lxrcy28ohvc.png" alt="How preserved thinking's prefix check works" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What tends to trip this in real apps: a timestamp or user-specific value injected into the system prompt on every turn, a tool list rebuilt in a different order, or "context management" code that trims or summarises old messages. If your chat backend does any of these, audit it before your traffic moves to the new models. Anthropic ships a helper for Claude Code users: run &lt;code&gt;claude update&lt;/code&gt;, then &lt;code&gt;/claude-api preserved-thinking-migration&lt;/code&gt; in the repo that builds your requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gemini 4 Carbon: generally available, with migration rules
&lt;/h2&gt;

&lt;p&gt;Google announced Gemini 4 Carbon on October 28 and &lt;a href="https://blog.google/innovation-and-ai/technology/developers-tools/gemini-4-carbon-developers/" rel="noopener noreferrer"&gt;made it available to developers on November 10&lt;/a&gt;. The &lt;a href="https://aistudio.google.com/docs/whats-new-gemini-4-carbon" rel="noopener noreferrer"&gt;What's new in Gemini 4 Carbon&lt;/a&gt; page is the one to read before switching:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model and thinking:&lt;/strong&gt; &lt;code&gt;gemini-4-carbon&lt;/code&gt;, with thinking levels low, medium and high. Medium is the default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price:&lt;/strong&gt; $2 input / $10 output per 1M tokens (cached input $0.10) through November 30, rising to $4/$20 from December 1. Carbon isn't on the free tier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context:&lt;/strong&gt; one unified 1,048,576-token window. Outputs over 65,536 tokens need &lt;code&gt;background=True&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Migration notes from Google:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Raise &lt;code&gt;max_output_tokens&lt;/code&gt; to at least 32,768.&lt;/li&gt;
&lt;li&gt;Explicit context caching isn't supported.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;temperature&lt;/code&gt;, &lt;code&gt;top_p&lt;/code&gt; and &lt;code&gt;top_k&lt;/code&gt; are ignored.&lt;/li&gt;
&lt;li&gt;Allow request timeouts of at least 15 minutes.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;previous_interaction_id&lt;/code&gt; to chain turns.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The sampling-parameter change is the same one we hit with Hydrogen. If a shared config sets &lt;code&gt;temperature&lt;/code&gt; for every model, Carbon will ignore it, so don't rely on it for determinism in tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decision models: Google's Decisions API
&lt;/h2&gt;

&lt;p&gt;Google's &lt;a href="https://blog.google/innovation-and-ai/technology/developers-tools/gemini-decisions-api/" rel="noopener noreferrer"&gt;Gemini Decisions API&lt;/a&gt; (Nov 11) is a new kind of endpoint. &lt;code&gt;gemini-decision-1&lt;/code&gt; doesn't generate prose. It scores options for up to &lt;strong&gt;1,000 closed questions in one request&lt;/strong&gt;, over inputs of up to 256K tokens that can include text, images, audio, video and PDFs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Question types:&lt;/strong&gt; &lt;code&gt;noul&lt;/code&gt; (yes/no), &lt;code&gt;choice&lt;/code&gt; (2 to 255 options) and &lt;code&gt;score&lt;/code&gt; (rubric-based).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Call shape:&lt;/strong&gt; &lt;code&gt;client.decisions.create(model=..., input=[...], questions={...})&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price:&lt;/strong&gt; $0.10 per million input tokens, nothing for output, plus a no-cost tier. Google quotes 150–250 ms end to end.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrations:&lt;/strong&gt; OpenRouter, LangChain, Vercel and LiteLLM are among those listed at launch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the same idea as OpenAI's Decisions API, which went GA on October 22 alongside &lt;code&gt;gpt-6-luna&lt;/code&gt; according to &lt;a href="https://developers.openai.com/api/docs/changelog" rel="noopener noreferrer"&gt;OpenAI's changelog&lt;/a&gt;. For app developers the use cases are moderation flags, routing ("which tool should handle this?"), extraction checks and eval rubrics. Those are the jobs people currently do by prompting a chat model to "answer only yes or no" and parsing the reply.&lt;/p&gt;

&lt;h2&gt;
  
  
  DeepSeek turns its API into an application platform
&lt;/h2&gt;

&lt;p&gt;DeepSeek's &lt;a href="https://api-docs.deepseek.com/updates" rel="noopener noreferrer"&gt;Nov 13 changelog&lt;/a&gt; adds a lot at once.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model:&lt;/strong&gt; &lt;code&gt;deepseek-flash&lt;/code&gt;, which now points at DeepSeek-V4.1-Flash-1017. It works across the Messages, Responses and Chat Completions formats.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built-in tools:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;deepseek_web_search&lt;/code&gt;, which switches to a deeper thinking search when thinking mode is on.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;deepseek_read_url&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;File input.&lt;/li&gt;
&lt;li&gt;A safety-check parameter that DeepSeek says is &lt;strong&gt;required for public-facing services&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standalone APIs:&lt;/strong&gt; Search/Fetch, OCR, ASR and TTS, plus an open-source demo chat client.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prices from the &lt;a href="https://api-docs.deepseek.com/quick_start/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Item&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;deepseek-flash&lt;/code&gt; input (cache miss)&lt;/td&gt;
&lt;td&gt;$0.30 per 1M tokens peak, $0.15 off-peak&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;deepseek-flash&lt;/code&gt; output&lt;/td&gt;
&lt;td&gt;$1.20 per 1M tokens peak, $0.60 off-peak&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search or fetch&lt;/td&gt;
&lt;td&gt;$0.75 per 1,000 calls each&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OCR / parsing&lt;/td&gt;
&lt;td&gt;$0.225 per 1,000 pages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TTS&lt;/td&gt;
&lt;td&gt;$0.45 per 10K characters ($0.225 during the promotion)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ASR&lt;/td&gt;
&lt;td&gt;$0.116 per hour ($0.058 during the promotion)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Peak hours are 01:00–04:00 and 06:00–10:00 UTC on weekdays (6:30–9:30 am and 11:30 am–3:30 pm IST). Everything else, including weekends, bills at half price. For batch jobs, scheduling around those windows is an easy 50% saving. The legacy &lt;code&gt;deepseek-v4-flash&lt;/code&gt; names still work but are now served by the new model at the Flash price.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open weights and other launches
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inkling 2 Small&lt;/strong&gt; (&lt;a href="https://thinkingmachines.ai/news/inkling-2-small/" rel="noopener noreferrer"&gt;Thinking Machines&lt;/a&gt;, Nov 12)

&lt;ul&gt;
&lt;li&gt;A 594B-parameter MoE with 17B active and image input, released under Apache 2.0 &lt;a href="https://huggingface.co/thinkingmachines/Inkling-2-Small" rel="noopener noreferrer"&gt;on Hugging Face&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Day-one support in vLLM, SGLang, Unsloth and TokenSpeed. Hosted APIs on NVIDIA, Fireworks, Together, Baseten, Nebius, Modal and Cloudflare.&lt;/li&gt;
&lt;li&gt;Thinking Machines lists the limits itself: it isn't succinct, chat presentation is weaker, and there's no audio.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meta Muse Ember&lt;/strong&gt; (&lt;a href="https://research.meta.ai/blog/muse-ember" rel="noopener noreferrer"&gt;Meta&lt;/a&gt;, Nov 9)

&lt;ul&gt;
&lt;li&gt;A closed-weights model on the Meta Model API at $0.10 input / $0.50 output per 1M tokens for prompts up to 200K tokens. Longer prompts cost $0.30 input, $0.012 cached and $1.50 output.&lt;/li&gt;
&lt;li&gt;Also on Google Cloud, Oracle Cloud and the Vercel AI Gateway.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Qwen4-Max-Preview&lt;/strong&gt; (&lt;a href="https://help.aliyun.com/en/model-studio/qwen4-max-preview" rel="noopener noreferrer"&gt;Alibaba Cloud Model Studio&lt;/a&gt;, Nov 11)

&lt;ul&gt;
&lt;li&gt;Available on the Token Plan only, with no pay-as-you-go. The preview runs until November 25 (24:00 UTC+8), then the model is retired.&lt;/li&gt;
&lt;li&gt;1M context and up to 393,216 output tokens.&lt;/li&gt;
&lt;li&gt;Two API details catch people out. In Chat Completions, &lt;code&gt;max_tokens&lt;/code&gt; now equals &lt;code&gt;max_completion_tokens&lt;/code&gt;, so thinking and answer share one budget and a low limit can cut the answer off. &lt;code&gt;preserve_thinking&lt;/code&gt; is on by default, so you're expected to send &lt;code&gt;reasoning_content&lt;/code&gt; back.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reasoning_effort&lt;/code&gt; accepts low, medium and xhigh, with xhigh as the default.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI:&lt;/strong&gt; quiet week for the API. The &lt;a href="https://developers.openai.com/api/docs/changelog" rel="noopener noreferrer"&gt;API changelog&lt;/a&gt; has no entries between November 6 and 16. ChatGPT Wallet (Nov 13) is a consumer feature.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsxdcyhy6w292df16djek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsxdcyhy6w292df16djek.png" alt="List prices of models released Nov 9–16" width="799" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub: Copilot model retirements and two December dates
&lt;/h2&gt;

&lt;p&gt;From the &lt;a href="https://github.blog/changelog/month/11-2026/" rel="noopener noreferrer"&gt;GitHub changelog&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fable 5.2 (Nov 9), Gemini 4 Carbon (Nov 10) and Gemini 4 Hydrogen (Nov 13) arrived in Copilot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;December 14:&lt;/strong&gt; &lt;a href="https://github.blog/changelog/2026-11-13-upcoming-deprecation-of-selected-github-copilot-models-in-december/" rel="noopener noreferrer"&gt;six models leave every Copilot experience&lt;/a&gt;. Each has a suggested replacement:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Removed&lt;/th&gt;
&lt;th&gt;Suggested replacement&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Fable 5&lt;/td&gt;
&lt;td&gt;Fable 5.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;Haiku 5.5 (annual individual plans keep 4.5)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.8 Flash&lt;/td&gt;
&lt;td&gt;Gemini 4 Hydrogen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon&lt;/td&gt;
&lt;td&gt;Gemini 4 Carbon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4.6&lt;/td&gt;
&lt;td&gt;Grok 4.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kimi K3&lt;/td&gt;
&lt;td&gt;Replacement to be announced&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;December 8:&lt;/strong&gt; &lt;a href="https://github.blog/changelog/2026-11-12-actions-for-arm32-linux-windows-retirement/" rel="noopener noreferrer"&gt;hosted Actions runners stop running ARM32 jobs&lt;/a&gt; on Linux and Windows. GitHub ties this to the move to Node 24, which doesn't support ARM32.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Also December 8:&lt;/strong&gt; &lt;a href="https://github.blog/changelog/2026-11-10-dependabot-alerts-will-pause-on-inactive-repositories/" rel="noopener noreferrer"&gt;Dependabot alerts switch off on most repositories with no activity in the past year&lt;/a&gt;. Alerts are archived, not deleted, and any push turns them back on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preview:&lt;/strong&gt; &lt;a href="https://github.blog/changelog/2026-11-09-secret-scanning-detects-secrets-in-github-actions-workflow-logs/" rel="noopener noreferrer"&gt;secret scanning now checks Actions workflow logs&lt;/a&gt;, for GitHub Enterprise Cloud customers with Secret Protection or Advanced Security.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your team pins a model name in a Copilot setting, a custom agent or an extension, search for those six names now.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Reddit made of it
&lt;/h2&gt;

&lt;p&gt;We read the main threads on each launch. These are the recurring arguments in our own words, with one short quote at most per thread.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fable 5.2's training limits&lt;/strong&gt; (&lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1xsjfwo/fable_52_not_only_has_guardrails_against_ai/" rel="noopener noreferrer"&gt;r/LocalLLaMA&lt;/a&gt;). The original poster thought the deliberate cap on AI-research skills went too far, calling it "yet another reason" for open-weight models. In the comments, some doubted that Anthropic would hold back its internal models in the same way. Others argued the limit reads like a justification written after the fact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fable 5.2 and usage limits&lt;/strong&gt; (&lt;a href="https://www.reddit.com/r/ClaudeCode/comments/1xusayn/fable_52_uses_so_much_usage_its_basically/" rel="noopener noreferrer"&gt;r/ClaudeCode&lt;/a&gt;). The thread's title says it: "Fable 5.2 uses so much usage it's basically pointless to use". A large part of the discussion was about whether the $20 plan was ever meant for the top model. The most practical replies matched Anthropic's own suggestion: let Fable plan or review and let cheaper models write most of the code. One commenter claimed their weighted-token quota had effectively halved. That's a single unverified report, not something Anthropic has said.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Preserved thinking&lt;/strong&gt; (&lt;a href="https://www.reddit.com/r/ClaudeAI/comments/1wnxe0v/the_preserve_thinking_feature_breaks_context/" rel="noopener noreferrer"&gt;r/ClaudeAI&lt;/a&gt;). This thread is from September 23, when preserved thinking applied only to new API accounts (&lt;a href="https://support.claude.com/en/articles/16761192-preserved-thinking-changing-how-the-messages-api-handles-thinking-blocks-to-protect-against-distillation" rel="noopener noreferrer"&gt;Claude Help Center&lt;/a&gt;), but it's the clearest statement of the developer complaint: preserved thinking gets in the way of trimming or rewriting context. With the feature now on every account, that complaint applies to everyone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inkling 2 Small&lt;/strong&gt; (&lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1xuqplg/thinkingmachinesinkling2small_is_released/" rel="noopener noreferrer"&gt;r/LocalLLaMA&lt;/a&gt;). People joked that 594B parameters is "small" only by lab standards and won't fit most home rigs. Several made a more useful point: an Apache-licensed US model matters for companies in the US and EU that aren't allowed to use Chinese open-weight models. Early impressions put it a little behind recent DeepSeek and Haiku models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gemini Decision 1&lt;/strong&gt; (&lt;a href="https://www.reddit.com/r/GeminiAI/comments/1xtwzdf/google_introduces_their_first_decision_model/" rel="noopener noreferrer"&gt;r/GeminiAI&lt;/a&gt;). The first replies were "magic 8-ball" jokes. Other commenters then explained that it picks among the options you give it, which makes it a classifier, not a chatbot.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do this week
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Anthropic users:&lt;/strong&gt; grep your request builder for anything that mutates &lt;code&gt;system&lt;/code&gt;, &lt;code&gt;tools&lt;/code&gt; or earlier messages between turns. Decide what &lt;code&gt;prefix_mismatch_behavior&lt;/code&gt; should do and log &lt;code&gt;input_transformations&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini users moving to Carbon:&lt;/strong&gt; raise &lt;code&gt;max_output_tokens&lt;/code&gt;, set timeouts to 15 minutes or more, and drop explicit caching and sampling params. If cost matters, test before the December 1 price change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Classification prompts:&lt;/strong&gt; try a decision endpoint for any prompt that ends with "answer only yes or no". It's cheaper and you get a structured answer back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Copilot admins:&lt;/strong&gt; remove the six model names before December 14, and check for ARM32 jobs and long-idle repos before December 8.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you're showing these models' reasoning and tool calls in a React chat UI, our &lt;a href="https://ui.cuelark.com/agents" rel="noopener noreferrer"&gt;agent UI components&lt;/a&gt; render reasoning, tool and message parts from a streaming response. They pair well with keeping history append-only, which is what preserved thinking now needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;Vendor sources (all checked 16 November 2026):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Anthropic, &lt;a href="https://www.anthropic.com/claude-fable-and-mythos-5-2" rel="noopener noreferrer"&gt;Introducing Claude Fable 5.2 and Claude Mythos 5.2&lt;/a&gt; (Nov 9)&lt;/li&gt;
&lt;li&gt;Anthropic docs, &lt;a href="https://platform.claude.com/docs/en/build-with-claude/preserved-thinking" rel="noopener noreferrer"&gt;Preserved thinking&lt;/a&gt;, and Claude Help Center, &lt;a href="https://support.claude.com/en/articles/16761192-preserved-thinking-changing-how-the-messages-api-handles-thinking-blocks-to-protect-against-distillation" rel="noopener noreferrer"&gt;Preserved thinking: changing how the Messages API handles thinking blocks&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Google, &lt;a href="https://blog.google/innovation-and-ai/technology/developers-tools/gemini-4-carbon-developers/" rel="noopener noreferrer"&gt;Gemini 4 Carbon is now available for developers&lt;/a&gt; (Nov 10)&lt;/li&gt;
&lt;li&gt;Google AI Studio docs, &lt;a href="https://aistudio.google.com/docs/whats-new-gemini-4-carbon" rel="noopener noreferrer"&gt;What's new in Gemini 4 Carbon&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Google, &lt;a href="https://blog.google/innovation-and-ai/technology/developers-tools/gemini-decisions-api/" rel="noopener noreferrer"&gt;Gemini Decisions API&lt;/a&gt; (Nov 11)&lt;/li&gt;
&lt;li&gt;OpenAI, &lt;a href="https://developers.openai.com/api/docs/changelog" rel="noopener noreferrer"&gt;API changelog&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;DeepSeek, &lt;a href="https://api-docs.deepseek.com/updates" rel="noopener noreferrer"&gt;API change log&lt;/a&gt; (Nov 13) and &lt;a href="https://api-docs.deepseek.com/quick_start/pricing" rel="noopener noreferrer"&gt;Models &amp;amp; pricing&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Meta, &lt;a href="https://research.meta.ai/blog/muse-ember" rel="noopener noreferrer"&gt;Muse Ember&lt;/a&gt; (Nov 9)&lt;/li&gt;
&lt;li&gt;Thinking Machines, &lt;a href="https://thinkingmachines.ai/news/inkling-2-small/" rel="noopener noreferrer"&gt;Inkling 2 Small&lt;/a&gt; (Nov 12) and the &lt;a href="https://huggingface.co/thinkingmachines/Inkling-2-Small" rel="noopener noreferrer"&gt;Hugging Face model card&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Alibaba Cloud Model Studio, &lt;a href="https://help.aliyun.com/en/model-studio/qwen4-max-preview" rel="noopener noreferrer"&gt;Qwen4-Max-Preview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub changelog: &lt;a href="https://github.blog/changelog/2026-11-09-claude-fable-5-2-in-github-copilot/" rel="noopener noreferrer"&gt;Claude Fable 5.2 in Copilot&lt;/a&gt;, &lt;a href="https://github.blog/changelog/2026-11-10-gemini-4-carbon-in-github-copilot/" rel="noopener noreferrer"&gt;Gemini 4 Carbon in Copilot&lt;/a&gt;, &lt;a href="https://github.blog/changelog/2026-11-13-gemini-4-hydrogen-in-github-copilot/" rel="noopener noreferrer"&gt;Gemini 4 Hydrogen in Copilot&lt;/a&gt;, &lt;a href="https://github.blog/changelog/2026-11-13-upcoming-deprecation-of-selected-github-copilot-models-in-december/" rel="noopener noreferrer"&gt;Copilot deprecations in December&lt;/a&gt;, &lt;a href="https://github.blog/changelog/2026-11-12-actions-for-arm32-linux-windows-retirement/" rel="noopener noreferrer"&gt;ARM32 runner retirement&lt;/a&gt;, &lt;a href="https://github.blog/changelog/2026-11-10-dependabot-alerts-will-pause-on-inactive-repositories/" rel="noopener noreferrer"&gt;Dependabot alerts on inactive repositories&lt;/a&gt;, &lt;a href="https://github.blog/changelog/2026-11-09-secret-scanning-detects-secrets-in-github-actions-workflow-logs/" rel="noopener noreferrer"&gt;Secret scanning in Actions logs&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Reddit threads:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;r/LocalLLaMA, &lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1xsjfwo/fable_52_not_only_has_guardrails_against_ai/" rel="noopener noreferrer"&gt;Fable 5.2 not only has guardrails against AI...&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;r/ClaudeCode, &lt;a href="https://www.reddit.com/r/ClaudeCode/comments/1xusayn/fable_52_uses_so_much_usage_its_basically/" rel="noopener noreferrer"&gt;Fable 5.2 uses so much usage it's basically pointless to use&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;r/ClaudeAI, &lt;a href="https://www.reddit.com/r/ClaudeAI/comments/1wnxe0v/the_preserve_thinking_feature_breaks_context/" rel="noopener noreferrer"&gt;The 'preserve thinking' feature breaks context management and degrades Claude's performance&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;r/LocalLLaMA, &lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1xuqplg/thinkingmachinesinkling2small_is_released/" rel="noopener noreferrer"&gt;thinkingmachines/Inkling-2-Small is released&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;r/GeminiAI, &lt;a href="https://www.reddit.com/r/GeminiAI/comments/1xtwzdf/google_introduces_their_first_decision_model/" rel="noopener noreferrer"&gt;Google introduces their first decision model&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Prices are list prices at the time of writing and can change. Benchmark figures are the vendors' own.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>webdev</category>
      <category>news</category>
    </item>
    <item>
      <title>Passport photo sizes by country (2027): mm, inches, pixels and the rules that get photos rejected</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:00:28 +0000</pubDate>
      <link>https://dev.to/cuelark/passport-photo-sizes-by-country-2027-mm-inches-pixels-and-the-rules-that-get-photos-rejected-3n8k</link>
      <guid>https://dev.to/cuelark/passport-photo-sizes-by-country-2027-mm-inches-pixels-and-the-rules-that-get-photos-rejected-3n8k</guid>
      <description>&lt;p&gt;&lt;em&gt;By the Cuelark Team. Every spec below was checked against the issuing authority's own page in November 2026, for applications going in during 2027.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;"Passport size" means at least five different things depending on whose passport it is. A US photo is a 2-inch square. A Canadian one is 50 × 70 mm. Most of Europe and a lot of Asia use 35 × 45 mm, but the head-size window, the background colour and the glasses rule still change from one country to the next. France bans a white background, while the US, China and Singapore ask for one.&lt;/p&gt;

&lt;p&gt;This guide covers 18 countries. For each one we list the printed size in millimetres and inches, any pixel or file rule for online applications, how big the head has to be, and what the authority says about background and glasses. Where a country no longer accepts photos from applicants at all (more do every year), we say so.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;About "2027".&lt;/strong&gt; Passport photo rules don't reset every January. We checked every spec in November 2026 against the authority's current page. None of the official pages we read announces a change for 2027. If one does change, the official link in the Sources section is where it will show up first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick comparison table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt;
&lt;th&gt;Printed size (mm)&lt;/th&gt;
&lt;th&gt;Inches&lt;/th&gt;
&lt;th&gt;Head height (chin to crown)&lt;/th&gt;
&lt;th&gt;Digital / pixel rule&lt;/th&gt;
&lt;th&gt;Background&lt;/th&gt;
&lt;th&gt;Glasses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;United States&lt;/td&gt;
&lt;td&gt;51 × 51&lt;/td&gt;
&lt;td&gt;2 × 2&lt;/td&gt;
&lt;td&gt;25–35 mm (1–1⅜ in)&lt;/td&gt;
&lt;td&gt;Online renewal: JPG/PNG/HEIC/HEIF, 54 KB–10 MB. DV lottery: 600 × 600 px JPEG, ≤240 KB&lt;/td&gt;
&lt;td&gt;White or off-white&lt;/td&gt;
&lt;td&gt;Not allowed (medical exception with signed note)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;United Kingdom&lt;/td&gt;
&lt;td&gt;35 × 45&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;29–34 mm&lt;/td&gt;
&lt;td&gt;≥600 × 750 px, 50 KB–10 MB, don't crop&lt;/td&gt;
&lt;td&gt;Printed: plain cream or light grey. Digital: plain, light-coloured&lt;/td&gt;
&lt;td&gt;Only if you must; no tint, glare or frames over eyes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Canada&lt;/td&gt;
&lt;td&gt;50 × 70&lt;/td&gt;
&lt;td&gt;2 × 2¾&lt;/td&gt;
&lt;td&gt;31–36 mm (1¼–1 7⁄16 in)&lt;/td&gt;
&lt;td&gt;Online renewal: JPEG, 3:2, 1200 × 1800 to 3000 × 4500 px, 200 KB–5 MB&lt;/td&gt;
&lt;td&gt;Plain white or light-coloured&lt;/td&gt;
&lt;td&gt;Allowed if eyes are clear, no glare, no tint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Australia&lt;/td&gt;
&lt;td&gt;35–40 × 45–50&lt;/td&gt;
&lt;td&gt;~1.38–1.57 × 1.77–1.97&lt;/td&gt;
&lt;td&gt;32–36 mm&lt;/td&gt;
&lt;td&gt;— (printed photos)&lt;/td&gt;
&lt;td&gt;Plain white or light grey&lt;/td&gt;
&lt;td&gt;Not allowed unless medically required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;India (in India)&lt;/td&gt;
&lt;td&gt;35 × 45 (only applicants under 4 bring one)&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Adults are photographed at the Passport Seva Kendra&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;India (via missions abroad)&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Face ~85% of the image&lt;/td&gt;
&lt;td&gt;630 × 810 px, ≤250 KB&lt;/td&gt;
&lt;td&gt;Uniform, preferably white&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Germany&lt;/td&gt;
&lt;td&gt;35 × 45&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;32–36 mm (70–80%)&lt;/td&gt;
&lt;td&gt;Digital only since 1 May 2025, taken at the office or sent by a certified photographer&lt;/td&gt;
&lt;td&gt;Plain, preferably light grey&lt;/td&gt;
&lt;td&gt;Eyes visible, no reflections, no tint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;France&lt;/td&gt;
&lt;td&gt;35 × 45&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;32–36 mm, hair excluded&lt;/td&gt;
&lt;td&gt;Taken by an approved photographer or booth&lt;/td&gt;
&lt;td&gt;Plain and light (e.g. light blue, light grey). &lt;strong&gt;White is not allowed&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Optional; thin frames, no tint, no reflection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;China (visa)&lt;/td&gt;
&lt;td&gt;33 × 48&lt;/td&gt;
&lt;td&gt;1.30 × 1.89&lt;/td&gt;
&lt;td&gt;28–33 mm tall, 15–22 mm wide&lt;/td&gt;
&lt;td&gt;354 × 472 to 420 × 560 px&lt;/td&gt;
&lt;td&gt;White or near-white&lt;/td&gt;
&lt;td&gt;No thick frames, no tint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Japan&lt;/td&gt;
&lt;td&gt;35 × 45&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;32–36 mm (34 ± 2)&lt;/td&gt;
&lt;td&gt;Online application via app&lt;/td&gt;
&lt;td&gt;Plain, no shadow; white recommended&lt;/td&gt;
&lt;td&gt;Removing them recommended; no tint or glare&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brazil&lt;/td&gt;
&lt;td&gt;50 × 70 (only applicants under 5 bring one)&lt;/td&gt;
&lt;td&gt;2 × 2¾&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Adults photographed at the Polícia Federal office&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mexico&lt;/td&gt;
&lt;td&gt;35 × 45*&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;Not allowed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Malaysia&lt;/td&gt;
&lt;td&gt;35 × 50 (only applicants under 4 bring one)&lt;/td&gt;
&lt;td&gt;1.38 × 1.97&lt;/td&gt;
&lt;td&gt;Face 25–30 mm&lt;/td&gt;
&lt;td&gt;Others photographed live at the office&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;No glasses or contact lenses at capture&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Philippines&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Photo captured at the appointment&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nigeria&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;600 × 800 px, under 2 MB&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UAE&lt;/td&gt;
&lt;td&gt;35 × 45 (width 35–40)&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;Face 70–80%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;No dark tint, no flash reflection, avoid heavy frames&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saudi Arabia (eVisa)&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Face 70–80%&lt;/td&gt;
&lt;td&gt;200 × 200 px, 5–100 KB&lt;/td&gt;
&lt;td&gt;White&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Singapore&lt;/td&gt;
&lt;td&gt;35 × 45&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;25–35 mm (≥70%)&lt;/td&gt;
&lt;td&gt;400 × 514 px; JPG/JPEG/HEIC/HEIF/PNG up to 8 MB&lt;/td&gt;
&lt;td&gt;Plain white&lt;/td&gt;
&lt;td&gt;No sunglasses; glasses OK without reflection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;South Africa (applying abroad)&lt;/td&gt;
&lt;td&gt;35 × 45&lt;/td&gt;
&lt;td&gt;1.38 × 1.77&lt;/td&gt;
&lt;td&gt;29–34 mm (70–80%)&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Light grey or plain cream&lt;/td&gt;
&lt;td&gt;No reflection, dark tint or heavy frames&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;* Mexico's foreign ministry (SRE) only says "passport size". The 45 × 35 mm figure comes from the sample sheet published by the Consulate of Mexico in Frankfurt.&lt;/p&gt;

&lt;p&gt;A dash means the official page we checked doesn't set that value. It doesn't mean anything goes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F30arjqe6ltq66j0r3fhn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F30arjqe6ltq66j0r3fhn.png" alt="Printed passport photo sizes drawn to the same scale" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The baseline: what ICAO actually says
&lt;/h2&gt;

&lt;p&gt;Almost every country in this list points back to ICAO Doc 9303, the international standard for machine-readable travel documents. Part 3 has a section on portraits supplied by applicants, and it is more specific than most people expect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Submitted portraits &lt;strong&gt;should be 45 × 35 mm&lt;/strong&gt;, and no narrower than 35 mm.&lt;/li&gt;
&lt;li&gt;The distance between the eyes should be at least 10 mm in the print.&lt;/li&gt;
&lt;li&gt;The photo should have been taken within the last six months, and one older than three months "should not be accepted".&lt;/li&gt;
&lt;li&gt;It must not be digitally altered beyond what's needed to meet the standard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That explains why 35 × 45 mm is the most common size in the table. The US (2 × 2 in) and Canada (50 × 70 mm) are the big holdouts. Doc 9303 also describes the head as filling a set share of the frame, and that is where the national "70–80%" rules come from.&lt;/p&gt;

&lt;p&gt;The other trend is less obvious. Many countries now refuse paper photos completely. Germany, Brazil (for anyone 5 or older), Malaysia (4 or older), the Philippines and India's in-country passport offices all take your photo at the counter. In those countries a perfect home print is useless, and the only thing you need to think about is what you wear and whether you have glasses on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Country by country
&lt;/h2&gt;

&lt;h3&gt;
  
  
  United States: 2 × 2 inches
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; 2 × 2 in (51 × 51 mm).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Head:&lt;/strong&gt; 1 to 1⅜ in (25–35 mm) from the bottom of the chin to the top of the head.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; white or off-white, with no shadows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Age of photo:&lt;/strong&gt; taken in the last six months.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; not allowed. The only exception is a medical one, such as recent eye surgery, and it needs a signed statement from a medical professional sent with the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editing:&lt;/strong&gt; no filters and no software or AI enhancement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digital:&lt;/strong&gt; online renewal takes a digital photo (JPG, PNG, HEIC or HEIF, 54 KB to 10 MB). The Diversity Visa lottery has its own rule: a 600 × 600 pixel JPEG of no more than 240 KB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Glasses are worth a moment. The US Embassy in France says that in one year more than 200,000 applications were put on hold because of poor-quality photos, and that glasses were the main reason. If you remember one US rule, remember that one.&lt;/p&gt;

&lt;h3&gt;
  
  
  United Kingdom: 35 × 45 mm, and the rules differ online and on paper
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Printed:&lt;/strong&gt; 45 mm tall by 35 mm wide. Head 29–34 mm from chin to crown. Plain cream or light grey background. The print must not be cut down from a larger photo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digital:&lt;/strong&gt; at least 600 × 750 pixels, 50 KB to 10 MB. GOV.UK explicitly says "Do not crop your photo – it will be done for you". The background only needs to be plain and light-coloured.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Age of photo:&lt;/strong&gt; taken in the last month. That is much stricter than ICAO's six months.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; avoid them unless you need them. If you do wear them, no sunglasses or tinted lenses, and the frames, glare or shadows must not cover your eyes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editing:&lt;/strong&gt; must not be altered by software.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Canada: 50 × 70 mm from a commercial photographer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; 50 × 70 mm (2 × 2¾ in).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face:&lt;/strong&gt; 31–36 mm (1¼ to 1 7⁄16 in) from chin to crown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; plain white or light-coloured. Colour or black-and-white photos are both accepted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who takes it:&lt;/strong&gt; a commercial photographer. Canada does not accept photos printed at home.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; allowed if your eyes are clearly visible with no glare. Tinted lenses are not allowed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editing:&lt;/strong&gt; any alteration gets the photo rejected, and Canada names AI tools specifically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Online renewal:&lt;/strong&gt; JPEG in 3:2 portrait. At least 1200 × 1800 and at most 3000 × 4500 pixels, 200 KB to 5 MB, with chin to crown at 45–50% of the photo height.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Australia: a size range, and inkjet is out
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; Australia gives a range rather than one size: 35–40 mm wide by 45–50 mm tall.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face:&lt;/strong&gt; 32–36 mm from chin to crown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; plain white or light grey.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Print:&lt;/strong&gt; high-quality glossy paper of at least 200 gsm, printed by dye sublimation, not inkjet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Age:&lt;/strong&gt; taken in the last six months.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; not allowed unless there's a medical reason. Needing glasses to see doesn't count as one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Australian Passport Office also advises against online photo services and apps. In practice, Australia is a "get it done at a shop" country.&lt;/p&gt;

&lt;h3&gt;
  
  
  India: depends on where you apply
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inside India:&lt;/strong&gt; adults are photographed at the Passport Seva Kendra. The Passport Seva portal asks only applicants under four to bring a recent 4.5 × 3.5 cm photo on a white background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Through missions abroad:&lt;/strong&gt; applications go through the global Passport Seva portal, which has been mandatory at missions since 1 December 2025. You upload an ICAO-compliant photo of &lt;strong&gt;630 × 810 pixels, no larger than 250 KB&lt;/strong&gt;, on a uniform (preferably white) background, with the face covering about 85% of the image. The Embassy of India in Bern says you can use simple paint tools to fix the background and crop, which is unusually relaxed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're resizing a photo to that spec, our free &lt;a href="https://tools.cuelark.com/passport-seva-photo-630x810" rel="noopener noreferrer"&gt;630 × 810 Passport Seva photo tool&lt;/a&gt; does the crop and the file-size squeeze in the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  Germany: no more paper photos
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; 35 × 45 mm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face:&lt;/strong&gt; 32–36 mm, or 70–80% of the height. Children up to age 10 may have a smaller face, 22–36 mm (50–80%).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; plain, preferably light grey.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; eyes clearly visible, no reflections, no tinted lenses, and frames must not cover the eyes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Biggest change:&lt;/strong&gt; since &lt;strong&gt;1 May 2025&lt;/strong&gt;, German passport and ID offices only accept digital photos. They must be taken at the office or sent through the secure cloud of a certified photographer (BSI TR-03170). Paper prints are no longer accepted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Schengen visa is a separate case. German missions still take printed 35 × 45 mm visa photos, and the Embassy in Dublin asks for a white background, so check the mission you're applying through.&lt;/p&gt;

&lt;h3&gt;
  
  
  France: 35 × 45 mm, and white is banned
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; 35 × 45 mm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face:&lt;/strong&gt; 32–36 mm (70–80%), measured from the chin to the top of the skull with hair excluded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; plain and light, light blue or light grey for example. Service-public.fr says a white background is not allowed. That catches out people who reuse a photo from a US or Chinese application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; optional. If you wear them, the frames must be thin and the lenses can't be tinted or reflective.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who takes it:&lt;/strong&gt; an approved professional photographer or an approved photo booth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  China (visa): 33 × 48 mm
&lt;/h3&gt;

&lt;p&gt;China's visa photo is an unusual size and has a two-way head limit.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Printed:&lt;/strong&gt; 33 × 48 mm. The head must be 28–33 mm tall and 15–22 mm wide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digital:&lt;/strong&gt; 354 × 472 to 420 × 560 pixels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; white or near-white.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; no thick frames and no tinted lenses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pose:&lt;/strong&gt; ears visible. The embassy also sets maximum tilts of 20° left or right and 25° up or down.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Japan: 35 × 45 mm, 34 ± 2 mm face
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; 45 × 35 mm with no border.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face:&lt;/strong&gt; 34 ± 2 mm from the top of the head to the chin. If the proportions are hard to keep, MOFA says to prioritise the width.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; plain with no shadows, white recommended. Colour or black-and-white both work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; MOFA recommends taking them off. Tinted lenses, glare and frames over the eyes are listed as unacceptable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Online:&lt;/strong&gt; Japan accepts online applications with a photo taken in its app.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Brazil: photographed at the Federal Police
&lt;/h3&gt;

&lt;p&gt;Applicants aged five and over are photographed at the Polícia Federal appointment. For children under five, the Federal Police asks for a recent 5 × 7 cm colour photo on a white background.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mexico: white background, no glasses, 30 days old
&lt;/h3&gt;

&lt;p&gt;Mexico's foreign ministry (SRE) captures data at the appointment but says that, as an extraordinary measure, it may ask for two passport photos. They must be in colour on a white background, facing forward, with the head uncovered and no glasses, and no more than 30 days old. SRE doesn't give a size. The Consulate of Mexico in Frankfurt's sample sheet gives 45 × 35 mm.&lt;/p&gt;

&lt;h3&gt;
  
  
  Malaysia: live capture, with one exception
&lt;/h3&gt;

&lt;p&gt;The Immigration Department photographs applicants at the passport office with a Facial Live Capture device. You can't wear glasses or contact lenses during capture. Children under four bring a 35 × 50 mm photo on a white background with the face 25–30 mm tall.&lt;/p&gt;

&lt;h3&gt;
  
  
  Philippines: captured at the appointment
&lt;/h3&gt;

&lt;p&gt;The DFA captures applicants' photos at the consular office, so you don't bring one. The DFA's guidance covers what to wear and which accessories to remove. Plan your top, glasses and hair rather than worrying about a print.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nigeria: an upload spec, not a print size
&lt;/h3&gt;

&lt;p&gt;The Nigeria Immigration Service portal checks uploads for compliance. It wants 600 × 800 pixels, under 2 MB, on a white background, with hair off the face and ears and no headphones or masks. It gives no millimetre size.&lt;/p&gt;

&lt;h3&gt;
  
  
  UAE: 35 × 45 mm, ICAO-conformant
&lt;/h3&gt;

&lt;p&gt;The ICP services guide lists a 3.5 × 4.5 cm colour photo (width 35–40 mm) on a white background, conforming to ICAO. ICP's photo specification sets the face at 70–80% of the frame. It rules out dark-tinted lenses and flash reflection, and says to avoid heavy frames.&lt;/p&gt;

&lt;h3&gt;
  
  
  Saudi Arabia (tourist eVisa): 200 × 200 pixels
&lt;/h3&gt;

&lt;p&gt;The visit-visa portal wants a 200 × 200 pixel image between 5 and 100 KB, with the face covering 70–80% of it, on a white background, taken in the last six months. That is far smaller than most digital specs. If your upload fails, the usual cause is a file that's too big, not one that's too small.&lt;/p&gt;

&lt;h3&gt;
  
  
  Singapore: 35 × 45 mm and a precise 400 × 514 pixels
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; 35 × 45 mm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Face:&lt;/strong&gt; 25–35 mm from chin to crown, and at least 70% of the photo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background:&lt;/strong&gt; plain white (light grey if you wear a white head covering).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Print:&lt;/strong&gt; matte or semi-matte finish.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digital:&lt;/strong&gt; exactly 400 × 514 pixels for e-Services, in JPG, JPEG, HEIC, HEIF or PNG, up to 8 MB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glasses:&lt;/strong&gt; no sunglasses. Glasses are fine if they don't reflect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editing:&lt;/strong&gt; ICA allows resizing in editing software but no other alteration, filters included. It suggests asking someone else to take the photo because selfies usually fail.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  South Africa (applying abroad): 35 × 45 mm
&lt;/h3&gt;

&lt;p&gt;The DHA photo specification (published through South African missions) asks for 35 × 45 mm with the face at 70–80% and the head 29–34 mm. The background is light grey or plain cream, and the photo must be no more than a month old. Glasses must have no flash reflection, dark tint or heavy frames.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Funlyawoytg3ng754qpsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Funlyawoytg3ng754qpsk.png" alt="Allowed head height ranges by country" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Head position: what the millimetre numbers actually mean
&lt;/h2&gt;

&lt;p&gt;"Head height" in nearly all these rules means &lt;strong&gt;from the bottom of the chin to the crown, the top of the head&lt;/strong&gt;. Germany and France say outright that hair is excluded and you measure to the top of the skull. Japan measures to the top of the head and asks for wider framing if your hair is very full.&lt;/p&gt;

&lt;p&gt;On a 45 mm tall photo, a 32–36 mm head leaves only a few millimetres above the crown and below the chin. That's why "the face is too small" is such a common rejection: a normal phone portrait has far too much background.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feh6vm6mwv4jlgt0aer4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feh6vm6mwv4jlgt0aer4e.png" alt="Head position in a 35 × 45 mm photo, illustration" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The other rules that show up again and again:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Face the camera square-on with your head level. China even sets maximum tilt angles.&lt;/li&gt;
&lt;li&gt;Neutral expression, mouth closed, eyes open.&lt;/li&gt;
&lt;li&gt;Even light with no shadows on the face or behind the head.&lt;/li&gt;
&lt;li&gt;No hair across the eyes, and the edges of the face visible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The most common reasons photos get rejected
&lt;/h2&gt;

&lt;p&gt;Each of these is named on at least one of the official pages we checked.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Glasses.&lt;/strong&gt; Glare, shadows or frames over the eyes. This is the main reason in the US, which now bans glasses outright. Australia, Mexico and Malaysia (at capture) also say no.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong head size.&lt;/strong&gt; Too small is the classic phone-photo mistake. Too large happens when people crop tightly to "fill the frame".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong background.&lt;/strong&gt; White for France, or a busy or shadowed background anywhere. UK paper photos want cream or light grey. US, Chinese and Singapore photos want white.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editing.&lt;/strong&gt; Canada rejects any alteration and names AI tools. The UK, US, Singapore, Australia and ICAO all forbid changes beyond what's needed to meet the spec. Singapore allows resizing only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Old photos.&lt;/strong&gt; The UK and South Africa want one taken in the last month, Mexico 30 days, most others six months.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong process.&lt;/strong&gt; A home print in Canada, an inkjet print in Australia, a paper photo in Germany, or a cropped upload for the UK's digital service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cut-down prints.&lt;/strong&gt; The UK doesn't accept a photo cut down from a larger one.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Taking one at home: when it works and how
&lt;/h2&gt;

&lt;p&gt;First check whether a home photo is allowed at all:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Can you use a home photo?&lt;/th&gt;
&lt;th&gt;Countries&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Yes, if it meets the spec&lt;/td&gt;
&lt;td&gt;United States, UK digital applications, Singapore (an app or another person recommended), India via missions (self-edit allowed)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Professional or approved booth required&lt;/td&gt;
&lt;td&gt;Canada, France, Germany (certified photographer or the office)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Professional strongly advised&lt;/td&gt;
&lt;td&gt;Australia (dye-sublimation prints only, no apps)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Doesn't matter, they photograph you&lt;/td&gt;
&lt;td&gt;India in-country (adults), Brazil (5+), Malaysia (4+), Philippines&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If home photos are allowed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Background.&lt;/strong&gt; Stand about half a metre in front of a plain wall or a hung sheet in the right colour for your country. Leaving that gap keeps your shadow off the wall.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Light.&lt;/strong&gt; Face a window or use two lamps at 45°, so neither side of your face is darker. Don't use direct flash, because it causes glare and red-eye.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Camera.&lt;/strong&gt; Have someone else stand 1–1.5 m away at eye level and use the main camera, not the selfie lens. Wide selfie lenses distort faces.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pose.&lt;/strong&gt; Shoulders square, chin level, neutral face, glasses off, hair behind the shoulders or ears.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crop without editing.&lt;/strong&gt; Crop to the exact aspect ratio, then check the head height against your country's range: about 71–80% of the height for a 32–36 mm head on a 45 mm photo. Don't retouch, filter, change the background with AI, or "fix" anything else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Print at the real size.&lt;/strong&gt; Lay out several copies at true size on one 4 × 6 in (10 × 15 cm) print and get it printed at a photo lab. Most photo labs print 4 × 6 at true size if you turn off any "fit" or "fill" option.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before you print, measure one copy with a ruler. Phone print dialogs that say "fit to page" are the most common reason a print comes out 2–3 mm off.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is 35 × 45 mm the same as "passport size" everywhere?&lt;/strong&gt;&lt;br&gt;
No. It's the most common size and matches ICAO's recommendation. But the US uses 2 × 2 in, Canada 50 × 70 mm, China's visa 33 × 48 mm and Australia a 35–40 × 45–50 mm range. Within the 35 × 45 group, head size, background and glasses rules still differ.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use my US photo for a UK or Schengen application?&lt;/strong&gt;&lt;br&gt;
Not as-is. It's the wrong shape, and cropping a 2 × 2 print down to 35 × 45 usually leaves the head the wrong size. The UK also won't take a photo cut down from a larger one. Retake it or print a new one from the original file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need a white background?&lt;/strong&gt;&lt;br&gt;
Only for some countries. The US, China visa, Singapore, the UAE, Mexico, Nigeria and Saudi eVisa ask for white. France forbids white. UK paper photos want cream or light grey, and South Africa light grey or cream. Germany prefers light grey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I wear glasses?&lt;/strong&gt;&lt;br&gt;
In the US, Australia, Mexico and Malaysia, no, except for documented medical reasons. In the UK, Canada, Germany, France, Japan, Singapore, South Africa and the UAE, glasses can be allowed if there's no tint, glare or frame over the eyes, but taking them off is always the safer choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What pixel size should a digital passport photo be?&lt;/strong&gt;&lt;br&gt;
It depends on the system: India via missions 630 × 810, Singapore 400 × 514, Nigeria 600 × 800, UK at least 600 × 750, Canada 1200 × 1800 to 3000 × 4500, the US DV lottery 600 × 600, Saudi eVisa 200 × 200. There is no universal number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use AI or an app to change the background?&lt;/strong&gt;&lt;br&gt;
Canada says AI-altered photos get rejected, and the UK, US, Singapore and ICAO all forbid alteration beyond basic resizing or cropping. India's mission guidance is the rare one that allows simple background fixes. If in doubt, shoot against the right background to start with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will these rules change in 2027?&lt;/strong&gt;&lt;br&gt;
None of the official pages we checked in November 2026 announces a 2027 change. Germany's 2025 switch to digital-only photos shows how quickly a process can change, so check the official link below in the week you apply.&lt;/p&gt;

&lt;p&gt;For a shorter, print-focused version of the main sizes, see our &lt;a href="https://tools.cuelark.com/guides/passport-photo-size-by-country" rel="noopener noreferrer"&gt;passport photo size by country guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;All checked 16 November 2026 unless noted.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ICAO, &lt;a href="https://www.icao.int/sites/default/files/publications/DocSeries/9303_p3_cons_en.pdf" rel="noopener noreferrer"&gt;Doc 9303 Part 3, Specifications Common to all MRTDs (8th ed., 2021)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;U.S. Embassy in Qatar, &lt;a href="https://qa.usembassy.gov/passport-photo-requirements/" rel="noopener noreferrer"&gt;Passport photo requirements&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;U.S. Department of State, &lt;a href="https://travel.state.gov/en/passports/apply/help/photos.html" rel="noopener noreferrer"&gt;Passport photos&lt;/a&gt; (read via the Internet Archive copy of 10 July 2026, because the live page blocked automated access) and &lt;a href="https://travel.state.gov/en/passports/renew-replace/online/upload-digital-photo.html" rel="noopener noreferrer"&gt;Upload a digital photo for online renewal&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;U.S. Embassy in France, &lt;a href="https://fr.usembassy.gov/passports/passport-photos/" rel="noopener noreferrer"&gt;Passport photos&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;U.S. Department of State, &lt;a href="https://travel.state.gov/content/travel/en/us-visas/visa-information-resources/photos.html" rel="noopener noreferrer"&gt;Photo requirements for visas and the Diversity Visa&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GOV.UK, &lt;a href="https://www.gov.uk/photos-for-passports" rel="noopener noreferrer"&gt;Photos for passports&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Government of Canada, &lt;a href="https://www.canada.ca/en/immigration-refugees-citizenship/services/canadian-passports/photos.html" rel="noopener noreferrer"&gt;Passport photo requirements&lt;/a&gt; (includes the online-renewal section)&lt;/li&gt;
&lt;li&gt;Australian Passport Office, &lt;a href="https://www.passports.gov.au/getting-passport-how-it-works/photo-guidelines" rel="noopener noreferrer"&gt;Photo guidelines&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Passport Seva (Ministry of External Affairs, India), &lt;a href="https://passportindia.gov.in/psp/apply" rel="noopener noreferrer"&gt;Apply for passport&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Embassy of India, Bern, &lt;a href="https://www.indembassybern.gov.in/page/notice-reg-icao-photo-requirements/" rel="noopener noreferrer"&gt;Notice regarding ICAO photo requirements&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Bundesdruckerei / BMI, &lt;a href="https://www.bundesdruckerei-gmbh.de/files/dokumente/pdf/lichtbildschablone.pdf" rel="noopener noreferrer"&gt;Lichtbild-Schablone (July 2025)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;German Federal Foreign Office, Embassy Lima, &lt;a href="https://lima.diplo.de/pe-de/konsularservice/2663976-2663976" rel="noopener noreferrer"&gt;Passfotos / biometrische Lichtbilder&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;German Embassy Dublin, &lt;a href="https://dublin.diplo.de/ie-en/schengen-visa-aplications-faqs-2565772" rel="noopener noreferrer"&gt;Schengen visa applications FAQs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Service-Public.fr, &lt;a href="https://www.service-public.gouv.fr/particuliers/vosdroits/F10619" rel="noopener noreferrer"&gt;Photo d'identité (F10619)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Embassy of the PRC in Timor-Leste, &lt;a href="https://tl.china-embassy.gov.cn/eng/lsfw/vep/202607/t20260723_11990209.htm" rel="noopener noreferrer"&gt;visa photo guidance&lt;/a&gt;, and Embassy of the PRC in Morocco, reminder on visa photo specifications (April 2025)&lt;/li&gt;
&lt;li&gt;Ministry of Foreign Affairs of Japan, &lt;a href="https://www.mofa.go.jp/mofaj/toko/passport/ic_photo.html" rel="noopener noreferrer"&gt;Passport photo standards&lt;/a&gt; (updated 3 March 2025) and the MOFA photo-standard leaflet (March 2025)&lt;/li&gt;
&lt;li&gt;Polícia Federal (Brazil), &lt;a href="https://www.gov.br/pf/pt-br/assuntos/passaporte/ajuda/duvidas_/documentacao/documentacao-fotografia-5x7-o-que-preciso" rel="noopener noreferrer"&gt;5×7 photo for children: what you need&lt;/a&gt; and &lt;a href="https://www.gov.br/pf/pt-br/assuntos/passaporte/documentacao/formulario/pagar-taxa/agendamento/atendimento-presencial/instrucoes-de-atendimento" rel="noopener noreferrer"&gt;in-person service instructions&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Secretaría de Relaciones Exteriores (Mexico), &lt;a href="https://sre.gob.mx/tramites-y-servicios/pasaportes/253" rel="noopener noreferrer"&gt;Pasaporte ordinario mexicano&lt;/a&gt; and Consulate of Mexico in Frankfurt, photo sample sheet&lt;/li&gt;
&lt;li&gt;Immigration Department of Malaysia, &lt;a href="https://www.imi.gov.my/" rel="noopener noreferrer"&gt;Malaysian international passport&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Department of Foreign Affairs (Philippines), &lt;a href="https://consular.dfa.gov.ph/" rel="noopener noreferrer"&gt;Passport appointment guidance&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Nigeria Immigration Service, &lt;a href="https://passport.immigration.gov.ng/image-compliance" rel="noopener noreferrer"&gt;Image compliance&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;UAE ICP, &lt;a href="https://icp.gov.ae/wp-content/themes/ica_v3/assets/images/servicesGuideEN2024.pdf" rel="noopener noreferrer"&gt;Services guide 2024&lt;/a&gt; and ICP ICAO photo specification&lt;/li&gt;
&lt;li&gt;Saudi visit visa portal, &lt;a href="https://visa.visitsaudi.com/Home/PhotoSpecifications" rel="noopener noreferrer"&gt;Photo specifications&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ICA Singapore, &lt;a href="https://www.ica.gov.sg/photo-guidelines" rel="noopener noreferrer"&gt;Photo guidelines&lt;/a&gt; (updated 30 October 2026), and &lt;a href="https://sso.agc.gov.sg/SL/IA1959-RG1" rel="noopener noreferrer"&gt;Immigration Regulations, Second Schedule&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Department of Home Affairs (South Africa), photo specification, published via DIRCO / South African Embassy Copenhagen (November 2025)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Not included:&lt;/strong&gt; Indonesia. Its official immigration FAQ only gives an e-visa upload rule (JPG/JPEG/PNG up to 200 KB). We couldn't find an official page with a print size, head size or background rule for passports, so we left it out rather than guess.&lt;/p&gt;

</description>
      <category>travel</category>
      <category>passport</category>
      <category>photography</category>
      <category>guide</category>
    </item>
    <item>
      <title>Gemini 4 Hydrogen in a React chat: the migration details that actually matter</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Sun, 15 Nov 2026 04:47:26 +0000</pubDate>
      <link>https://dev.to/cuelark/gemini-4-hydrogen-in-a-react-chat-the-migration-details-that-actually-matter-56lh</link>
      <guid>https://dev.to/cuelark/gemini-4-hydrogen-in-a-react-chat-the-migration-details-that-actually-matter-56lh</guid>
      <description>&lt;p&gt;Google released &lt;strong&gt;Gemini 4 Hydrogen&lt;/strong&gt; (&lt;code&gt;gemini-4-hydrogen&lt;/code&gt;) on November 12, 2026. It's the fast, cheaper model in the Gemini 4 family, sitting below Carbon and Argon. It's on the &lt;strong&gt;free and paid tiers&lt;/strong&gt; of the Gemini API and AI Studio, and the paid price is flat across the whole context window: &lt;strong&gt;$1.50 per 1M input tokens and $7.50 per 1M output tokens&lt;/strong&gt; (thinking tokens count as output).&lt;/p&gt;

&lt;p&gt;Google's launch post says that compared with Gemini 3.8 Flash it finishes tasks 2.5x faster at its default setting and more than triples Terminal-Bench 4.1 scores (57% vs. 18.2%). Those are Google's numbers. I haven't benchmarked them myself.&lt;/p&gt;

&lt;p&gt;What I did test is the boring part: wiring Hydrogen into a streaming React chat with the Vercel AI SDK, and checking what actually goes over the wire. A few details in the migration guide are easy to miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed for developers
&lt;/h2&gt;

&lt;p&gt;From the official "What's new in Gemini 4 Hydrogen" guide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Four thinking levels:&lt;/strong&gt; &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt; (the default) and a new &lt;code&gt;xhigh&lt;/code&gt;. &lt;code&gt;minimal&lt;/code&gt; is rejected with an error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One unified window:&lt;/strong&gt; input, thinking and output share 1,048,576 tokens. A single request still caps at 65,536 output tokens, streaming or not. To go longer you use background execution or client-side continuation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sampling params are gone:&lt;/strong&gt; remove &lt;code&gt;temperature&lt;/code&gt;, &lt;code&gt;top_p&lt;/code&gt; and &lt;code&gt;top_k&lt;/code&gt;. In-range values are ignored, and out-of-range values return a &lt;code&gt;400&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No explicit caching:&lt;/strong&gt; &lt;code&gt;cachedContents&lt;/code&gt; / &lt;code&gt;caches.create&lt;/code&gt; aren't supported. Implicit caching runs automatically on prompts of at least 4,096 tokens and discounts cached input by 95%.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Thought signatures matter:&lt;/strong&gt; if you manage history yourself with &lt;code&gt;generateContent&lt;/code&gt;, send prior model turns and thought signatures back unchanged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The guide also suggests running your evals at all four levels and picking the &lt;strong&gt;lowest level that meets your quality bar&lt;/strong&gt;. That's good advice for a chat UI, where latency is most of the user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  SDK support
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;@ai-sdk/google&lt;/code&gt; 4.0.119 added the &lt;code&gt;gemini-4-hydrogen&lt;/code&gt; model ID and the &lt;code&gt;xhigh&lt;/code&gt; thinking level (see the package changelog). I used &lt;code&gt;ai@7.0.173&lt;/code&gt; with &lt;code&gt;@ai-sdk/google@4.0.121&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The route handler
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/api/chat/route.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;convertToModelMessages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;UIMessage&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;'ai'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;google&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;'@ai-sdk/google'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;maxDuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'low'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'medium'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'high'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'xhigh'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Request&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'medium'&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="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UIMessage&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="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="nc"&gt;Level&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;streamText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;google&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'gemini-4-hydrogen'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;convertToModelMessages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// No temperature/topP: Hydrogen ignores them (out-of-range values return a 400).&lt;/span&gt;
    &lt;span class="n"&gt;providerOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;google&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;thinkingConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;thinkingLevel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;includeThoughts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="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="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUIMessageStreamResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;sendReasoning&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I default to &lt;code&gt;medium&lt;/code&gt; because Google's own table recommends it for responsive chat and interactive coding. &lt;code&gt;high&lt;/code&gt; is the API default, though, so if you omit the level you pay for more thinking than a chat turn usually needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The client
&lt;/h2&gt;

&lt;p&gt;A plain &lt;code&gt;useChat&lt;/code&gt; component that shows reasoning in a collapsible block and lets the user pick the thinking level for each message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="s1"&gt;'use client'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useState&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;'react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useChat&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;'@ai-sdk/react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Chat&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setInput&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&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="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setLevel&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'low'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'medium'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'high'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'xhigh'&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'medium'&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sendMessage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useChat&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"mx-auto flex max-w-2xl flex-col gap-4 p-4"&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;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&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;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&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;role&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'self-end'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'self-start'&lt;/span&gt;&lt;span class="p"&gt;}&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;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&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;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'reasoning'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;details&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"text-sm text-muted-foreground"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;summary&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Thinking&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;summary&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"whitespace-pre-wrap"&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;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'text'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"whitespace-pre-wrap"&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;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&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="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;
        &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"flex gap-2"&lt;/span&gt;
        &lt;span class="n"&gt;onSubmit&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;input&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="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="nf"&gt;sendMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;input&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="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="nf"&gt;setInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;onChange&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"low"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"medium"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;medium&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"xhigh"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;xhigh&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"flex-1 border px-2"&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;onChange&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setInput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&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;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'streaming'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"button"&lt;/span&gt; &lt;span class="n"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Stop&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"submit"&lt;/span&gt; &lt;span class="n"&gt;disabled&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'submitted'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Send&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;form&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swap the raw elements for shadcn &lt;code&gt;Button&lt;/code&gt;, &lt;code&gt;Select&lt;/code&gt; and &lt;code&gt;Collapsible&lt;/code&gt; if that's your stack. The data flow stays the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I tested it (and what I didn't)
&lt;/h2&gt;

&lt;p&gt;To be upfront: I didn't call the live API for this post. I ran the code above on Node 24 with a custom &lt;code&gt;fetch&lt;/code&gt; that records the outgoing request and replies with a fake SSE stream. That checks the wiring, not the model's quality or speed. Here's what it showed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The request is right.&lt;/strong&gt; It hits &lt;code&gt;models/gemini-4-hydrogen:streamGenerateContent?alt=sse&lt;/code&gt; with &lt;code&gt;thinkingConfig: { thinkingLevel, includeThoughts: true }&lt;/code&gt;. The UI stream comes back as &lt;code&gt;reasoning-start / reasoning-delta / reasoning-end&lt;/code&gt; followed by &lt;code&gt;text-*&lt;/code&gt; parts, which is exactly what the &lt;code&gt;details&lt;/code&gt; block renders.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;temperature&lt;/code&gt; is still forwarded, with no warning.&lt;/strong&gt; Passing &lt;code&gt;temperature: 0.2&lt;/code&gt; put &lt;code&gt;"temperature": 0.2&lt;/code&gt; in &lt;code&gt;generationConfig&lt;/code&gt;, and &lt;code&gt;result.warnings&lt;/code&gt; was empty. Per Google's guide the server ignores in-range values, so this won't break anything. But if your shared config sets something out of range, you'll get a &lt;code&gt;400&lt;/code&gt; and the SDK won't have warned you. I'd strip sampling params for Hydrogen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;thinkingLevel: 'minimal'&lt;/code&gt; passes through unchanged.&lt;/strong&gt; The provider's types still allow it for older models, so a config copied from a Gemini 3 app will type-check and then fail at the API. Search your code for &lt;code&gt;minimal&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The portable &lt;code&gt;reasoning&lt;/code&gt; option maps correctly.&lt;/strong&gt; &lt;code&gt;reasoning: 'xhigh'&lt;/code&gt; became &lt;code&gt;thinkingLevel: 'xhigh'&lt;/code&gt; on Hydrogen. On &lt;code&gt;gemini-4-argon&lt;/code&gt;, the SDK downgraded it to &lt;code&gt;high&lt;/code&gt; and raised a compatibility warning, which matches the changelog note that &lt;code&gt;xhigh&lt;/code&gt; maps only for Hydrogen.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The speed and benchmark figures above are Google's, not mine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;xhigh&lt;/code&gt; costs more and responds more slowly, and Google warns it can overthink simple prompts. Don't make it the default in a chat box.&lt;/li&gt;
&lt;li&gt;Thinking tokens are billed as output at $7.50/1M, so &lt;code&gt;includeThoughts&lt;/code&gt; plus &lt;code&gt;high&lt;/code&gt; on every turn adds up. Log &lt;code&gt;usage.outputTokenDetails.reasoningTokens&lt;/code&gt;, which the SDK exposes, and watch it.&lt;/li&gt;
&lt;li&gt;If you rely on explicit context caching for a big system prompt, that path is gone. Check whether implicit caching (prompts of 4,096+ tokens) covers your case.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Google: &lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-4-hydrogen/" rel="noopener noreferrer"&gt;Introducing Gemini 4 Hydrogen&lt;/a&gt; (Nov 12, 2026)&lt;/li&gt;
&lt;li&gt;Google AI Studio docs: &lt;a href="https://aistudio.google.com/docs/whats-new-gemini-4-hydrogen" rel="noopener noreferrer"&gt;What's new in Gemini 4 Hydrogen&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Vercel AI SDK: &lt;a href="https://github.com/vercel/ai/blob/main/packages/google/CHANGELOG.md" rel="noopener noreferrer"&gt;@ai-sdk/google changelog&lt;/a&gt; (4.0.119)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you'd rather not hand-roll the reasoning, tool-call and message components, &lt;a href="https://ui.cuelark.com" rel="noopener noreferrer"&gt;Cuelark UI&lt;/a&gt; has shadcn-style ones built for this kind of stream.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>react</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Building an AI agent chat UI with shadcn/ui components</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Sun, 08 Nov 2026 03:38:56 +0000</pubDate>
      <link>https://dev.to/cuelark/building-an-ai-agent-chat-ui-with-shadcnui-components-3pe3</link>
      <guid>https://dev.to/cuelark/building-an-ai-agent-chat-ui-with-shadcnui-components-3pe3</guid>
      <description>&lt;p&gt;A basic chatbot can look like a list of messages and an input field. An agent interface needs to explain more: whether work is in progress, whether a tool failed, and whether an action is waiting for the user's approval.&lt;/p&gt;

&lt;p&gt;Those are interaction and state-management problems, not just styling problems. This walkthrough outlines a component plan using &lt;a href="https://ui.cuelark.com/" rel="noopener noreferrer"&gt;Cuelark UI&lt;/a&gt;, an open-source library of 107 shadcn/ui components. I work on Cuelark. The aim here is to explain the interface structure, not promise that installing a component gives you a working agent backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the conversation loop
&lt;/h2&gt;

&lt;p&gt;Begin with three pieces from the catalog: &lt;strong&gt;Conversation&lt;/strong&gt;, &lt;strong&gt;Message&lt;/strong&gt; and &lt;strong&gt;Prompt Input&lt;/strong&gt;. Use them as the starting points for the conversation area, individual entries and user input.&lt;/p&gt;

&lt;p&gt;Before wiring a model, define your application states. At minimum, distinguish an empty conversation, a request in progress, a completed response and a failed request. Decide whether users can submit another prompt while work is running, and what cancelling actually does on the server.&lt;/p&gt;

&lt;p&gt;Keep user input if submission fails. Avoid showing a confident-looking completed response when the backend has only delivered part of it. These decisions live in your application's logic; the visual components don't establish them for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install source, then inspect it
&lt;/h2&gt;

&lt;p&gt;Cuelark follows the shadcn model: its homepage says components install through the shadcn CLI into your codebase, rather than requiring a Cuelark runtime package. Start at the current &lt;a href="https://ui.cuelark.com/" rel="noopener noreferrer"&gt;Cuelark UI documentation&lt;/a&gt; and use the installation instructions for your chosen component.&lt;/p&gt;

&lt;p&gt;Inspect the generated source and dependencies before integrating it. Check how its props, exports and styles fit your project. This article intentionally avoids an invented CLI command or undocumented component API: copy the current command from the component's own page.&lt;/p&gt;

&lt;p&gt;Bring in the smallest useful slice first. A readable conversation with reliable input behavior is a better foundation than a screen full of agent activity that isn't connected to real state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give tool activity a clear state
&lt;/h2&gt;

&lt;p&gt;Next, consider &lt;strong&gt;Tool&lt;/strong&gt; for displaying tool activity. In your application model, distinguish requested, running, succeeded and failed operations. Use stable identifiers so that an update changes the correct activity rather than appending a duplicate.&lt;/p&gt;

&lt;p&gt;Show a concise label that explains what is happening. When a tool fails, explain what the user can do next without dumping raw internal errors or credentials into the conversation.&lt;/p&gt;

&lt;p&gt;Do not label an operation successful merely because the model described an intention. The UI should reflect the actual tool result. Where a result is uncertain or incomplete, say so.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat reasoning as a user-facing explanation
&lt;/h2&gt;

&lt;p&gt;The catalog also includes &lt;strong&gt;Reasoning&lt;/strong&gt;. Plan this area around useful, permitted progress summaries: what the agent is checking, what information is missing and why it needs a decision.&lt;/p&gt;

&lt;p&gt;A component named Reasoning is not a reason to expose hidden model reasoning, raw prompts or private intermediate data. Send only information your application is allowed to show. Keep explanations short enough that users can tell whether anything requires their attention.&lt;/p&gt;

&lt;p&gt;If no progress summary is available, a clear working state is better than fabricated step-by-step activity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make approvals real, not decorative
&lt;/h2&gt;

&lt;p&gt;Use &lt;strong&gt;Confirmation&lt;/strong&gt; as the visual starting point for an approval step when an operation needs consent. Explain the proposed action, destination and consequences before offering a choice.&lt;/p&gt;

&lt;p&gt;The server must enforce that approval. A button in the interface is not a security boundary. Bind consent to the exact pending operation, reject stale approvals, and make repeated clicks safe. If the action changes after approval, require a new decision.&lt;/p&gt;

&lt;p&gt;For external actions such as sending a message, show the recipient and content. Don't treat a general chat instruction as permission for every later operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test transitions before adding polish
&lt;/h2&gt;

&lt;p&gt;Exercise empty messages, long replies, interrupted streams, failed tools and expired approvals. Check keyboard navigation and visible focus in the integrated application, not just an isolated demo. Test narrow screens and reduced-motion preferences too.&lt;/p&gt;

&lt;p&gt;Cuelark's homepage describes keyboard support, accessible primitives and reduced-motion handling, but your composition still needs testing. Custom wrappers and event handlers can introduce problems even when the starting pieces are sound.&lt;/p&gt;

&lt;p&gt;The useful outcome is a UI where users know what they asked, what the agent actually did and what still needs their decision. Explore &lt;a href="https://ui.cuelark.com/" rel="noopener noreferrer"&gt;Cuelark UI&lt;/a&gt; for the components, then connect them to explicit application states and backend checks. That's the difference between an attractive chat mockup and an agent interface people can understand.&lt;/p&gt;

</description>
      <category>react</category>
      <category>shadcn</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to compress a photo or signature to 20 KB for Indian exam and government forms (no upload)</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Sun, 08 Nov 2026 03:37:22 +0000</pubDate>
      <link>https://dev.to/cuelark/how-to-compress-a-photo-or-signature-to-20-kb-for-indian-exam-and-government-forms-no-upload-43hi</link>
      <guid>https://dev.to/cuelark/how-to-compress-a-photo-or-signature-to-20-kb-for-indian-exam-and-government-forms-no-upload-43hi</guid>
      <description>&lt;p&gt;An application form asks for a small image, but your phone photo is several megabytes. You reduce it once, and the portal still rejects it. Reduce it again, and the signature becomes hard to read.&lt;/p&gt;

&lt;p&gt;The challenge is not simply making a file smaller. It is meeting the particular portal's rules while keeping the important detail clear. A 20 KB limit is one possible requirement, not a universal rule for Indian exams or government applications.&lt;/p&gt;

&lt;p&gt;This guide explains a browser-only workflow using &lt;a href="https://tools.cuelark.com/" rel="noopener noreferrer"&gt;Cuelark Tools&lt;/a&gt;. I work on Cuelark, so this is also a walkthrough of our tool, not an independent review.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Read the current form instructions first
&lt;/h2&gt;

&lt;p&gt;Before editing anything, find the upload instructions for your exact application and year. Record the accepted format, minimum and maximum file size, required dimensions, background rules and any restrictions on editing.&lt;/p&gt;

&lt;p&gt;Check the photo and signature instructions separately. They may have different limits. Some applications use a live photograph workflow rather than accepting an existing photo. Compressing an old image does not replace that requirement.&lt;/p&gt;

&lt;p&gt;If the portal asks for a range, your output must stay inside it. A file below 20 KB could still be invalid if it falls below the portal's minimum. This article does not assert current SSC, UPSC, IBPS, passport, PAN or NEET specifications; use the relevant official instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Start with a clean original
&lt;/h2&gt;

&lt;p&gt;Keep a copy of your original image. For a photograph, use a clear, well-lit source with the framing and background the application requests. Avoid trying to rescue a blurred image through repeated compression.&lt;/p&gt;

&lt;p&gt;For a signature, capture dark, readable strokes on the background required by the form. Remove unnecessary empty space only if cropping is permitted. Do not change the signature itself or crop so tightly that parts of the strokes disappear.&lt;/p&gt;

&lt;p&gt;A better starting image usually gives you more room to reduce file size without making the result unreadable.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Choose the appropriate tool
&lt;/h2&gt;

&lt;p&gt;Open &lt;a href="https://tools.cuelark.com/" rel="noopener noreferrer"&gt;Cuelark Tools&lt;/a&gt; and select &lt;strong&gt;Compress to 20 KB&lt;/strong&gt; for an image with that maximum. For a signature, select &lt;strong&gt;Compress signature&lt;/strong&gt;, which can crop blank margins and target sizes including 20 KB.&lt;/p&gt;

&lt;p&gt;If the instructions specify another limit, use the relevant size tool or the general &lt;strong&gt;Compress image&lt;/strong&gt; tool instead. Don't force every application into the same preset.&lt;/p&gt;

&lt;p&gt;The image tools process files inside the browser tab rather than uploading them to a conversion server. They require no account and add no watermark. Loading the website still involves network activity; the local-processing claim concerns your selected file.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Check the output, not just the number
&lt;/h2&gt;

&lt;p&gt;After processing, inspect the saved result. Confirm that the file is in the required format and below the maximum size, while also meeting any minimum. A size target does not automatically establish the correct dimensions.&lt;/p&gt;

&lt;p&gt;Open the image at normal size and zoom in. Is the face recognizable? Are thin signature strokes intact? Does the background still satisfy the instructions? If not, return to the original rather than repeatedly recompressing a damaged copy.&lt;/p&gt;

&lt;p&gt;If dimensions must change, use an appropriate editor and follow the portal's instructions; a compressor alone should not be treated as a complete application-photo preparation service.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Upload and review the portal preview
&lt;/h2&gt;

&lt;p&gt;Upload the processed copy, leaving your original untouched. If the portal provides a preview, inspect it before submitting the application. Confirm that you selected the right file and that nothing appears stretched, rotated or cut off.&lt;/p&gt;

&lt;p&gt;If it is rejected, read the exact error. A wrong extension, unsupported format, dimension mismatch or file-size minimum will not necessarily be fixed by stronger compression. Don't rename a file extension to pretend it is another format; perform an actual conversion if the instructions permit it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the workflow private and practical
&lt;/h2&gt;

&lt;p&gt;File size is only one part of a valid submission. Start with the current official rules, preserve a good original, compress once, and check the saved result and portal preview.&lt;/p&gt;

&lt;p&gt;For more on the local-processing approach, see &lt;a href="https://dev.to/cuelark/compress-images-without-uploading-how-browser-only-tools-protect-your-files-24eo"&gt;our earlier explanation of browser-only compression&lt;/a&gt;. If you only need the utility, go straight to &lt;a href="https://tools.cuelark.com/" rel="noopener noreferrer"&gt;Cuelark Tools&lt;/a&gt;. No tool can promise acceptance by an examination body or government portal.&lt;/p&gt;




</description>
      <category>productivity</category>
      <category>privacy</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building an AI chat UI with React and shadcn: start with the awkward states</title>
      <dc:creator>Cuelark</dc:creator>
      <pubDate>Sat, 07 Nov 2026 05:51:10 +0000</pubDate>
      <link>https://dev.to/cuelark/building-an-ai-chat-ui-with-react-and-shadcn-start-with-the-awkward-states-3dlp</link>
      <guid>https://dev.to/cuelark/building-an-ai-chat-ui-with-react-and-shadcn-start-with-the-awkward-states-3dlp</guid>
      <description>&lt;p&gt;&lt;em&gt;By Alex, who builds Cuelark. The components linked here are ours.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A chat screen looks finished long before it behaves properly. Put a few bubbles above a textarea and it photographs well. Then somebody presses Enter twice, cancels a response, or pastes a file they did not mean to attach.&lt;/p&gt;

&lt;p&gt;That is where I would start a React AI chat interface. Not the gradient. The state transitions.&lt;/p&gt;

&lt;p&gt;We built Cuelark components for this layer of the application: a message layout and a composer you can adapt in your own project. They are UI source, not an AI backend. They do not choose a model, protect a secret API key, or make your data handling private by themselves.&lt;/p&gt;

&lt;p&gt;This walkthrough focuses on the boundary between those pieces. Getting that boundary right makes the rest of the interface much less surprising.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use source you can change
&lt;/h2&gt;

&lt;p&gt;The shadcn approach is useful here because a chat interface rarely stays generic. Your application may need approval buttons, citations, a retry action or a warning before a file leaves the device. Owning the component source makes those changes straightforward to inspect.&lt;/p&gt;

&lt;p&gt;Start with Cuelark's &lt;a href="https://ui.cuelark.com/components/message" rel="noopener noreferrer"&gt;Message component&lt;/a&gt; and &lt;a href="https://ui.cuelark.com/components/prompt-input" rel="noopener noreferrer"&gt;Prompt Input component&lt;/a&gt;. Use the installation instructions on those pages, then check the copied files and their dependencies in your project. Do not assume an example import path matches the aliases in your application.&lt;/p&gt;

&lt;p&gt;For this article I checked the current component source rather than guessing from a screenshot. I also checked both documentation destinations over HTTP: two requests, two 200 responses. That confirms that the links resolve, not that an entire production chat application has passed a browser test suite.&lt;/p&gt;

&lt;p&gt;There is no latency benchmark hidden in those numbers. Performance depends on your app, network and model service, and I have not measured those here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give messages stable identities
&lt;/h2&gt;

&lt;p&gt;Store conversation turns as data. At minimum, each needs an ID, a role and its content. Give IDs to turns when you create them, not each time React renders.&lt;/p&gt;

&lt;p&gt;A compact shape could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Turn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assistant&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pending&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;complete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;failed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cancelled&lt;/span&gt;&lt;span class="dl"&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;That is an application design suggestion, not a type exported by Cuelark. The actual Message component takes a &lt;code&gt;from&lt;/code&gt; value of &lt;code&gt;user&lt;/code&gt; or &lt;code&gt;assistant&lt;/code&gt;. Your application maps its own turn data into that presentation API.&lt;/p&gt;

&lt;p&gt;Avoid using the array index as the key if you might retry, insert or remove turns. A stable ID also gives you something sensible to attach feedback and analytics to later, without treating message text as an identifier.&lt;/p&gt;

&lt;p&gt;For a streaming assistant response, create one turn and update its text. Do not append a new message for every chunk. Otherwise copy actions, focus and screen-reader output become a mess surprisingly quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decide what belongs in a bubble
&lt;/h2&gt;

&lt;p&gt;Cuelark's Message layout makes user turns right-aligned bubbles. Assistant turns read as a wider document on the left. That distinction is intentional: long answers and code are harder to read when squeezed into a decorative bubble.&lt;/p&gt;

&lt;p&gt;The source limits user content to 80% width. Assistant content uses the available space. Those are layout choices you can edit, not a requirement of a chat protocol.&lt;/p&gt;

&lt;p&gt;Keep plain text rendering as the default while you assemble the application. React text content is a safer starting point than injecting generated HTML. If you add Markdown later, decide explicitly how you sanitize HTML, handle links and render code blocks.&lt;/p&gt;

&lt;p&gt;A model response is untrusted input. A nice message component does not change that. The same applies to text returned by a search tool or imported from a document.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand the composer's actual contract
&lt;/h2&gt;

&lt;p&gt;PromptInput calls &lt;code&gt;onSubmit&lt;/code&gt; with an object containing &lt;code&gt;text&lt;/code&gt; and &lt;code&gt;files&lt;/code&gt;. The text is trimmed. The files are browser File objects, not uploaded URLs.&lt;/p&gt;

&lt;p&gt;It supports two UI statuses: &lt;code&gt;idle&lt;/code&gt; and &lt;code&gt;streaming&lt;/code&gt;. While streaming, the send control becomes a stop control. The callback for that control is &lt;code&gt;onStop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There is an important implementation detail: after it calls &lt;code&gt;onSubmit&lt;/code&gt;, the composer clears its local text and files. It does not wait for your server to accept the request. If you want to restore a failed draft, save that submitted payload in application state before starting the network request.&lt;/p&gt;

&lt;p&gt;I would rather show a plainly failed message with a retry button than quietly lose someone's draft. A polished animation cannot compensate for missing text.&lt;/p&gt;

&lt;p&gt;Also note that an attachment alone can make a submission valid. If your backend only accepts text, turn attachments off instead of displaying an attachment button that leads nowhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep request state outside the component
&lt;/h2&gt;

&lt;p&gt;Your application should own the request lifecycle. When submission starts, mark the request active, create the assistant placeholder and pass &lt;code&gt;status="streaming"&lt;/code&gt; to the composer. On completion or failure, return to idle.&lt;/p&gt;

&lt;p&gt;Protect the handler against a second submission while a request is already active. The composer changes its controls based on props, but your backend and application state still need a duplicate-request policy. A disabled button is not a server-side safety mechanism.&lt;/p&gt;

&lt;p&gt;Choose how partial output behaves after an error. Keeping it with a visible failure note is often more helpful than deleting it. Make retry an explicit action so a temporary connection problem does not silently produce duplicate work or duplicate charges.&lt;/p&gt;

&lt;p&gt;If your system uses a paid model, keep billing and limits on the backend too. None of that belongs in the visual component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stop should really stop
&lt;/h2&gt;

&lt;p&gt;Wiring &lt;code&gt;onStop&lt;/code&gt; to hide a spinner is not cancellation. Use it to cancel the browser request where possible, commonly through an AbortController, and connect that to your server's cancellation behavior.&lt;/p&gt;

&lt;p&gt;Do not promise that aborting a browser request always stops upstream generation or billing. That depends on your backend and provider. Test it with the actual service you use.&lt;/p&gt;

&lt;p&gt;The component listens for Escape while streaming. That is convenient, but it is also a global keyboard listener. If your app has a modal or editor that uses Escape, check how those interactions overlap.&lt;/p&gt;

&lt;p&gt;Keep the partial answer visible and mark it cancelled. Otherwise the user can mistake an unfinished sentence for a completed response. Small wording choices matter here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attachments need a policy, not just a paperclip
&lt;/h2&gt;

&lt;p&gt;The current composer accepts files through a picker, paste and drag-and-drop when attachments are enabled. It also shows removable file chips. It does not enforce your application's file-type or size policy for you.&lt;/p&gt;

&lt;p&gt;Validate files before upload. Validate them again on the server. Decide where files are stored, how long they remain there, and whether a model provider receives them. Put that explanation near the attachment interaction rather than burying it in a vague privacy slogan.&lt;/p&gt;

&lt;p&gt;For a text-only prototype, my preference is &lt;code&gt;attachments={false}&lt;/code&gt;. It removes a whole set of misleading expectations. Add the feature when the backend and privacy explanation are ready.&lt;/p&gt;

&lt;p&gt;Cuelark's browser-only file tools and an AI chat application are different products with different data paths. Do not borrow a “files stay local” claim for a chat interface that sends files to your server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the keyboard before the screenshots
&lt;/h2&gt;

&lt;p&gt;Enter sends; Shift+Enter inserts a line break. The source also checks composition state before treating Enter as submission, which matters for people using input methods to compose text.&lt;/p&gt;

&lt;p&gt;Build a small acceptance checklist around actual behavior. Try an empty message, a message containing only spaces and a long paragraph. Try sending during an active response. Cancel, then submit again. If attachments are enabled, paste one and remove it before sending.&lt;/p&gt;

&lt;p&gt;These are proposed acceptance cases, not claims of tests I have already executed in your project. Run them with keyboard navigation and on a touch device. Message actions that appear on hover also need a usable focus path; this source includes focus-within and touch visibility styles, but your integration can still break them.&lt;/p&gt;

&lt;p&gt;Finally, decide how new output is announced to assistive technology. Announcing every token is usually unpleasant. A restrained status announcement is a better starting point to test.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does this include a model backend?
&lt;/h3&gt;

&lt;p&gt;No. You supply request handling, credentials, conversation storage and any model integration. Keep secret credentials off the client.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the composer upload attachments automatically?
&lt;/h3&gt;

&lt;p&gt;No. Its submission callback receives File objects. Your application decides what happens next.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I change the styling?
&lt;/h3&gt;

&lt;p&gt;Yes. The source-copying approach is meant for local adaptation. Check dependencies and the project license before shipping.&lt;/p&gt;

&lt;h3&gt;
  
  
  What should I build first?
&lt;/h3&gt;

&lt;p&gt;A text-only conversation with visible failure and working cancellation. Add richer formatting and attachments after those paths behave properly. It is less exciting in a screenshot, and considerably better to use.&lt;/p&gt;

</description>
      <category>react</category>
      <category>shadcn</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
