getcat — A Tiny Cat Image API
getcat's output for ?label=works on my machine
getcat is a free HTTP API that returns a random cat photo. No keys, no signup. Ask it plainly and you get
JSON with a CDN URL; add a label parameter and you get the image itself back with
your text drawn onto it, meme-style. Every photo is a cat I know personally.
How It Works
The photos live in object storage as cats/1.jpg, cats/2.jpg, and so on, next to a count.txt holding the total. The server caches that count,
rolls a random number from one to N, and resolves the matching key with a single prefix lookup. In
plain mode the response is just a URL — the CDN serves the actual bytes, so the API stays out of the
hot path. In label mode the server fetches the image, draws the caption in Comic Neue Bold — white
fill, black outline, wrapped to fit — and re-encodes the result as JPEG on the fly.
?label=ship it
?label=lgtm
How It's Made
The whole thing is one small Go program — under a thousand lines across the server and an uploader CLI. It talks to S3-compatible object storage (DigitalOcean Spaces) through the AWS SDK, renders labels with fogleman/gg and an embedded font, and ships as a small non-root Docker container on App Platform, with a static landing page in front.
The part I care about most isn't the meme rendering — it's the boring production layer around it. Per-IP token-bucket rate limiting, real request timeouts, a health endpoint, a strict router that 404s scanner probes instead of paying for two storage calls per hit, a count cache so a value that changes once a month isn't fetched on every request, and error responses that log the real failure server-side while telling the client nothing about the bucket. A joke API is still a public API.
Take a Deeper Dive
The code is small enough to read in one sitting — server, uploader, and landing page. Check out the GitHub repo for the full tour, including how to self-host it against your own bucket.
TL;DR
I built a tiny, free cat-image API with a caption mode. Try it live at getcat.dev.
Additional Examples