jonas.splinter
Search
Blog

Blog images from a free AI model: what I use and what it costs


A robotic arm with a paintbrush painting a green hillside landscape on a canvas on a wooden easel.

How I added generated header images to this blog with a free Cloudflare Workers AI model: the request, the free allowance, prompting, and automation.

Since 18 November 2026 posts on this blog can have a header image, made by an image model that costs me nothing. This post covers the model I picked, what the free allowance really buys, the request itself, the prompt mistake I made first and how images now arrive on posts without me. All numbers come from my own first day of use and from Cloudflare's published rates on that date, so you can check them yourself.

Where the images show up

A post can now have one hero image. It appears above the article, it is the share image when someone posts the link on a social network, and it is a small thumbnail on the post cards on the blog overview, the homepage and the tag pages. For the cards I make a 240 px wide WebP from the image: about 6 KB instead of about 280 KB.

On the same day posts also got share buttons for LinkedIn, X, Facebook, email and copying the link. They are plain links. Nothing loads from those networks until a reader clicks one.

Why a hosted model and not my own

An image model needs a graphics card to run at a reasonable speed. On an ordinary small server it would take minutes per image and need more memory than such a server has spare.

I use Cloudflare Workers AI, which runs models on Cloudflare's network and lets you call them over a plain HTTPS API. You do not need to write a Worker for this; a single request with an API token is enough. The model is FLUX.2 [klein] 9B by Black Forest Labs, model id @cf/black-forest-labs/flux-2-klein-9b. Cloudflare describes it as "a 9 billion parameter model that can generate images from text descriptions". The model page (opens in a new tab) lists it as a partner model, hosted by Cloudflare, with zero data retention.

What the free allowance buys

Workers AI counts usage in neurons. According to the Workers AI pricing page (opens in a new tab), 10,000 neurons per day are free, on both the free and the paid Workers plan. On the free plan you simply stop for the day when they run out. On the paid plan, usage beyond that costs $0.011 per 1,000 neurons. I use the free plan, so my images cost nothing.

What 10,000 neurons buy depends on the model. These are my own estimates from the published rates on 18 November 2026, for an image of around one megapixel:

  • FLUX.2 [klein] 9B: about 1,364 neurons per image (1,363.64 for the first megapixel, 181.82 for each further one), so about 7 images a day for free.
  • FLUX.1 [schnell]: about 58 neurons for a 1024x1024 image at 4 steps (4.80 per 512x512 tile plus 9.60 per step), so about 170 a day, at lower quality.
  • FLUX.2 [dev]: about 3,000 neurons for a 1024x1024 image at around 20 steps, so about 3 a day.

On the paid plan, a klein 9B image beyond the free allowance would cost about $0.015.

The request

The call is a POST with your account id in the address and a token in the header. This model takes multipart form data, not JSON. I ask for 1216x640 pixels, about 1.9:1, which is close to the 1.91:1 shape that social networks use for share images.

# The header comes from a process substitution: the token stays off
# the process list and is never written to disk
curl -s "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai/run/@cf/black-forest-labs/flux-2-klein-9b" \
  -H @<(printf 'Authorization: Bearer %s' "$CF_TOKEN") \
  -F 'prompt=A large magnifying glass over a grid of app icons. no text, no logos, no people' \
  -F width=1216 -F height=640 \
  | jq -r '.result.image' | base64 -d > hero.jpg

The answer is JSON in this shape, with the image as a Base64 string:

{"success": true, "result": {"image": "<base64 JPEG>"}}

My files were JPEGs of 160 to 290 KB, and one image took roughly ten seconds from request to file. In real code, check success before decoding: a wrong model name, for example, returns HTTP 400 with error code 7000, "No route for that URI".

The token

Create the token in the Cloudflare dashboard from the "Workers AI" API token template. Limit it to one account, and if one machine makes the calls, limit it to that machine's IP address as well. On a shared machine, keep it off the command line by passing the header through a process substitution, as above. Never put it in a repository.

How I write the prompt

My first prompt was for the post about vector search. I described the mechanism: softly glowing points in a dark space, clusters joined by lines, a beam coming from a search query. The model drew exactly that. The result looked like generic "space network" art that could belong to any post, and I found it weird.

The second prompt described a concrete, recognisable scene of what the post means to its reader: a large magnifying glass over a grid of app-style tool icons grouped by purpose, with the design tools inside the lens bright and the others muted. That one is on the post now. It is not perfect: the icons are not all neatly grouped, and the lens also holds a notebook and a chart. I accepted it.

What I took from that:

  • Concrete scene: describe something a reader recognises, not how the technology works inside.
  • One main subject: the image must still read as a 240 px thumbnail.
  • Fixed house style: the same style line on every prompt keeps the blog consistent.
  • Say what to avoid: image models tend to garble text, so I exclude it.

My house style line is "Clean flat vector illustration on a soft off-white background, deep navy outlines, teal and warm amber accents, generous whitespace, friendly modern editorial style." Every prompt ends with "no text, no logos, no people". So far the model has respected that in every image.

Images on posts without me

My projects already publish updates and posts on this site through an API, as I described in my projects post their own updates. Since 18 November 2026 a project can send an optional image prompt along with a post. This is how it works:

  1. The post goes live at once, and the prompt goes into a queue.
  2. A background job generates the image and attaches it to the post within seconds, with alt text.
  3. I get a notification on my phone with a link to the post, and I remove the image if it is bad.

At most 5 generated images a day are allowed for all projects together, which keeps me inside the free allowance. The Cloudflare token is available only to that background job, never to the web code that receives the posts. The prompt writing rules are served by the API itself, so every project follows the same rules.

The first automatic image arrived the same afternoon, on a VoucherAlarm post about setting the minimum TLS version: an open teal door with a browser window passing through, next to two old grey doors shut with amber padlocks. I kept it.

I chose automatic attaching over approving every image first. The risk is that an odd image is public before I have seen it, and social networks cache a share image for days. So getting the prompt right the first time matters more than fixing it afterwards. For my own automation I accept that trade-off.

What I do not know yet

I have only a handful of images so far, so I cannot say how consistent the quality stays over many posts. The free allowance and the rates above are as of 18 November 2026, and Cloudflare may change them. I also have not had the licence reviewed: the model page links to Black Forest Labs' terms of service (opens in a new tab), so read those yourself before you use the images commercially.

Frequently asked questions

Do I need a paid Cloudflare plan to generate images?

No. The free Workers plan includes 10,000 neurons a day, which is about 7 images a day with FLUX.2 [klein] 9B by my estimate from the rates of 18 November 2026. When they run out, you stop until the next day.

Why not use the cheapest model and make more images?

FLUX.1 [schnell] would give about 170 images a day for free, but at lower quality. A blog needs one good image per post, not many weak ones, so I chose quality over quantity.

How do I stop the model from putting garbled text in the image?

End every prompt with an explicit exclusion such as "no text, no logos, no people". In my images so far the model has followed it.

What to do first

  1. Create a Cloudflare API token from the "Workers AI" template, limited to one account.
  2. Run the curl request above with a test prompt and open the JPEG.
  3. Write one house style line and add it to every prompt, with a "no text" ending.
  4. Describe a concrete scene for your next post, and check how it looks as a small thumbnail.
  5. Only then automate it, with a daily cap that keeps you inside the free allowance.

For the prices behind these numbers, see the Workers AI pricing page (opens in a new tab), or read more posts about AI and design on this blog.

Related posts

More to read on the same topics

Related updates

Short notes on the same topics