<?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: Devanshu Biswas</title>
    <description>The latest articles on DEV Community by Devanshu Biswas (@dev48v).</description>
    <link>https://dev.to/dev48v</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3929385%2F75a3696c-143d-4252-ba59-6ed4083ca827.jpg</url>
      <title>DEV Community: Devanshu Biswas</title>
      <link>https://dev.to/dev48v</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dev48v"/>
    <language>en</language>
    <item>
      <title>I built a Stable Diffusion playground in 200 lines and zero API keys. Here's how.</title>
      <dc:creator>Devanshu Biswas</dc:creator>
      <pubDate>Fri, 15 May 2026 21:01:36 +0000</pubDate>
      <link>https://dev.to/dev48v/i-built-a-stable-diffusion-playground-in-200-lines-and-zero-api-keys-heres-how-40c0</link>
      <guid>https://dev.to/dev48v/i-built-a-stable-diffusion-playground-in-200-lines-and-zero-api-keys-heres-how-40c0</guid>
      <description>&lt;p&gt;The first time I generated an AI image, I expected the worst.&lt;/p&gt;

&lt;p&gt;A signup page. Email verification. A "free trial" with a credit card on file. A Python SDK that wouldn't install. CUDA. A Hugging Face account.&lt;/p&gt;

&lt;p&gt;None of that happened.&lt;/p&gt;

&lt;p&gt;I typed a URL into my browser, pressed Enter, and waited five seconds. An image of an astronaut riding a horse on Mars appeared. I had not given anyone an email address. I had not installed anything.&lt;/p&gt;

&lt;p&gt;That's the API I built Day 34 of &lt;a href="https://dev48v.infy.uk/techfromzero.php" rel="noopener noreferrer"&gt;TechFromZero&lt;/a&gt; around: a free, zero-auth gateway called &lt;a href="https://pollinations.ai" rel="noopener noreferrer"&gt;Pollinations.ai&lt;/a&gt; that hosts Stable Diffusion, FLUX, and a handful of other models behind a beautifully boring URL pattern.&lt;/p&gt;

&lt;p&gt;If you've been putting off learning generative AI because the setup looked like Day 1 of a Computer Science PhD, this is your skip-the-cutscene button.&lt;/p&gt;

&lt;h2&gt;
  
  
  The whole API, on one line
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://image.pollinations.ai/prompt/an+astronaut+cat?model=flux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hit that URL. You get an image. That is the entire integration.&lt;/p&gt;

&lt;p&gt;There is no JSON to parse. There is no SDK to install. There is no token to manage. The image flows from Pollinations' CDN straight into your browser's &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag, and your browser doesn't know or care that an AI generated it. As far as it's concerned, it loaded a picture.&lt;/p&gt;

&lt;p&gt;Compared to the way the same task usually feels — &lt;em&gt;npm install some-sdk; set ANTHROPIC_API_KEY; add billing; wait for the cold start&lt;/em&gt; — this is approximately 100% less ceremony.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;A single-page React app. You type a prompt, click Generate, and an image appears. The app remembers your last 50 generations in &lt;code&gt;localStorage&lt;/code&gt; (metadata only — the images live on Pollinations' CDN), lets you favorite the ones you like, lock the seed for reproducible variations, and download any image as a PNG.&lt;/p&gt;

&lt;p&gt;I deliberately kept the whole thing one React component (~200 lines). Splitting it across five files and a Redux store would have added zero clarity for the reader and a lot of noise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech:&lt;/strong&gt; Vite + React 19 + TypeScript + &lt;code&gt;localStorage&lt;/code&gt;. &lt;strong&gt;Backend:&lt;/strong&gt; none. &lt;strong&gt;API keys:&lt;/strong&gt; zero. &lt;strong&gt;Vercel deploy:&lt;/strong&gt; static SPA, ~10 seconds.&lt;/p&gt;

&lt;p&gt;📸 Try it: &lt;a href="https://stable-diffusion-from-zero.vercel.app" rel="noopener noreferrer"&gt;stable-diffusion-from-zero.vercel.app&lt;/a&gt;&lt;br&gt;
🧑‍💻 Code: &lt;a href="https://github.com/dev48v/stable-diffusion-from-zero" rel="noopener noreferrer"&gt;github.com/dev48v/stable-diffusion-from-zero&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The four parameters that matter
&lt;/h2&gt;

&lt;p&gt;Pollinations supports a fistful of query params. Four of them are the ones a beginner cares about:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;model&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Pick the generator. The defaults you'll actually want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;flux&lt;/code&gt; — fast, photorealistic, great default.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;flux-anime&lt;/code&gt; — illustration / stylised art.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sdxl&lt;/code&gt; — Stable Diffusion XL, the classic. Strong on composition.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sd3&lt;/code&gt; — Stable Diffusion 3. Specifically good at rendering legible text inside images. Yes, the AI can write the word "BAKERY" on a shop sign now.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dalle3&lt;/code&gt; — OpenAI's DALL·E 3 routed through Pollinations. Surreal, concept-art-friendly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;seed&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Same prompt + same seed = same image, byte for byte. This is the most important parameter beginners ignore.&lt;/p&gt;

&lt;p&gt;Why? Because once you find a composition you like, you want to &lt;em&gt;iterate&lt;/em&gt; — slightly different lighting, slightly different angle, but the same person. Lock the seed, change the prompt by one word at a time, and you can see what a single word does to the model's mental picture.&lt;/p&gt;

&lt;p&gt;In the playground, every generation rolls a new random seed automatically. If you find one you like, copy the number, paste it back into the seed input, and lock it for the next try.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;width&lt;/code&gt; + &lt;code&gt;height&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Pollinations accepts almost any pixel size, but the model was trained on 1024×1024-ish inputs, so it's best at square (1024×1024) and gentle aspect ratios (768×1152 portrait, 1152×768 landscape). Push past 2048 in either direction and you'll start to see weird artifacts — extra fingers, fractal hair, that AI-image uncanny-valley vibe.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;enhance&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Easily my favorite. With &lt;code&gt;enhance=true&lt;/code&gt;, Pollinations runs your prompt through a small LLM &lt;em&gt;first&lt;/em&gt;, expanding it into a more descriptive version before handing it to the image model.&lt;/p&gt;

&lt;p&gt;So when you type &lt;strong&gt;"astronaut cat"&lt;/strong&gt;, the LLM rewrites that to something like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"A highly detailed astronaut cat floating in zero gravity, photorealistic, cinematic lighting, 4k resolution, intricate space suit details, distant Earth in the background"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;…and &lt;em&gt;then&lt;/em&gt; the image model renders the expanded version. Your three-word prompt looks like it was written by someone who's been making Midjourney art for two years.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I learned (and that beginners should know)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Generated images aren't free in the legal sense.&lt;/strong&gt; Pollinations' terms permit personal use; many model licences (FLUX in particular) restrict commercial use. If you're shipping a product, read the licence of the specific model you're using before you sell anything you generated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The seed parameter is reproducibility, not randomness.&lt;/strong&gt; I used to think &lt;code&gt;seed=42&lt;/code&gt; was "the 42nd image". It's not. It's the random-number-generator's starting state. Different prompts with &lt;code&gt;seed=42&lt;/code&gt; produce wildly different images. The seed only "matches" when the prompt is also identical.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aspect ratio affects content.&lt;/strong&gt; Ask for "a portrait of a librarian" at 1024×1024 and you'll get the librarian centered with bookshelves around them. Ask for the same thing at 1152×768 and you'll get a wider shot — the librarian &lt;em&gt;plus&lt;/em&gt; a reading nook. The model uses the canvas shape as a hint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;enhance&lt;/code&gt; makes lazy prompts good.&lt;/strong&gt; Three words become twenty. The output looks 5× better. For 95% of users this is the right default, which is why my playground turns it on automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to extend this
&lt;/h2&gt;

&lt;p&gt;A few good next steps if you want to keep going:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Inpainting&lt;/strong&gt; — Pollinations supports a &lt;code&gt;mask=&lt;/code&gt; parameter for editing parts of an existing image. Add a brush tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image-to-image&lt;/strong&gt; — pass an existing image URL as a starting point. Useful for stylistic transfer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch generation&lt;/strong&gt; — fire off a 4×4 grid of variations on the same prompt with different seeds. Pollinations is happy to serve in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-host&lt;/strong&gt; — Pollinations is open source. You can run the inference stack yourself on a GPU and avoid even the implicit dependency on someone else's free infrastructure.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What's next in the series
&lt;/h2&gt;

&lt;p&gt;This is Day 34 of TechFromZero — one new technology every day, built from scratch with detailed commits. Day 35 picks up the AI thread with &lt;strong&gt;voice AI&lt;/strong&gt; (Whisper + Gemini + ElevenLabs).&lt;/p&gt;

&lt;p&gt;If you're learning AI from a beginner background and want a curriculum that's actually fun, &lt;a href="https://dev48v.infy.uk/techfromzero.php" rel="noopener noreferrer"&gt;follow along at dev48v.infy.uk/techfromzero&lt;/a&gt;. Each day stands alone — start anywhere.&lt;/p&gt;

&lt;p&gt;Generated AI images used to require a CS degree, a GPU, and a credit card. Now they require a browser tab. The barrier to creating with AI is gone. The only barrier left is curiosity.&lt;/p&gt;

&lt;p&gt;Try a weird prompt. See what happens.&lt;/p&gt;

</description>
      <category>stablediffusion</category>
      <category>ai</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
