How to Build an AI Lyrics Generator (Workers AI)
Here’s how to add a lyrics generator to a website using Cloudflare Workers AI. I built a 🎰 Trot Vending Machine: pick a mood and a singer persona, pull the lever, and an AI writes a Korean trot title and an eight-line chorus on the spot. No separate server, no API key — it runs on the Workers AI that already lives in the site.
(Trot is Korea’s classic retro pop genre — I run a whole YouTube channel of AI-made trot.)
Ingredient — start with the songwriting rules
The key ingredient is the songwriting rules. I’d refined them running the Eolssigu Trot channel: titles of two to five words, an eight-line chorus with ten syllables or fewer per line, a hook phrase from the title repeated two or three times but never in the same position twice. Without these rules, a generator spits out bland “AI-ish” lyrics instead of a real trot chorus. Before you pick a model, write down what actually makes a good lyric.
Step 1 — Decide what the site can do
The site can’t run Suno (generating audio is off the table). But the front half of the recipe — writing the title and chorus = text generation — the site can do. So I drew the line at “lyrics,” not “songs.”
Step 2 — Plant the rules in Workers AI
Conveniently, an AI already lives in this site: the Cloudflare Workers AI model (a llama-family model) that writes the home page’s daily market briefings. I planted the songwriting rules into that same model as a system prompt and opened a new /api/trot endpoint. POST it a mood, singer, and theme; get back JSON with a title, chorus, and Suno-ready style tags. Workers AI just needs a binding on your Cloudflare account — no external API key.
Step 3 — The bug: fixing robotic choruses
The hardest part was turning the rules into prompt language. The model followed “eight lines” fine, but at first every line started with the same words — a broken record. Only after explicitly requiring the hook phrase to rotate positions — beginning, middle, end — did the choruses sound human. Lesson: models obey quantity rules like “how many lines” easily, but without explicit instruction on variety and placement, they collapse into repetition.
Step 4 — Wrap it in a UI
The output prints out like a receipt-style ticket, with a copy button on the style tags — so if you use Suno, you can paste them straight in and turn the ticket into a real song.
The result
Feed it “sorrowful ballad + middle-aged female singer + theme: night sea” and a different song comes out every time. The trap: after a few pulls you catch yourself taking the choices weirdly seriously.
What makes it fun is that it’s a toy and a billboard at once. Play long enough and you’ll spot the link saying “this exact recipe uploads real songs every week,” which leads to the Eolssigu Trot channel. Experiment → write-up → channel, all in one loop.