Dev.to AI ๐Ÿค– Ai ๐Ÿ‘ 0 ๐Ÿ“– 2 min read

I Built an AI Storybook Generator for My Kid With One CLI

It's summer break, and I wanted to make a personalized picture book for my 5-year-old. Every tool I tried fell short the same way: "AI storybook" apps generate images, but the hero's face changes every other page โ€” and t

I Built an AI Storybook Generator for My Kid With One CLI

It's summer break, and I wanted to make a personalized picture book for my 5-year-old. Every tool I tried fell short the same way: "AI storybook" apps generate images, but the hero's face changes every other page โ€” and there's no narration, no video, no way to make it an interactive, tappable book.

I ended up doing the whole thing with one command-line tool: Bailian CLI (bl). It writes the story, generates consistent illustrations, synthesizes narration, and I wrapped it into an interactive HTML book. Here's how.

Install

npm install -g bailian-cli   # needs Node.js >= 18
bl auth login --api-key sk-xxxxx

Grab a free key from the Model Studio console (free credits are enough to run all of this).

Step 1 โ€” Write the story

bl text chat --model qwen3.7-max \
  --system "You are a children's picture-book author. Warm, simple language for a 5-year-old." \
  --message "Write a 3-act short story 'Xiaoyu and the Firefly', 2-3 sentences per act."

Step 2 โ€” Consistent illustrations (the whole game)

The trick to keeping the same character across pages: bake the look into a fixed anchor you reuse in every prompt, plus the same --seed.

ANCHOR="A cute 5-year-old girl named Xiaoyu, round face, big eyes, short black bob hair with a red hairpin, yellow dress, white sneakers, soft watercolor picture book"

bl image generate --model qwen-image-2.0-pro --size 4:3 --seed 71 \
  --prompt "$ANCHOR, standing in a meadow at dusk holding a glowing lantern, one firefly nearby"

Only swap the scene; the hero stays put:

Picture book scene 1: Xiaoyu with a lantern meets a firefly at dusk

Picture book scene 2: Xiaoyu follows the firefly into the forest

Picture book scene 3: fireflies surround Xiaoyu and light up the night

Same Xiaoyu across all three. qwen-image-2.0-pro even renders in-image text well โ€” here's a 4-panel comic with speech bubbles:

Four-panel comic: a boy learns the yo-yo from failure to success

Step 3 โ€” Narration

bl speech synthesize --text "At dusk, Xiaoyu strolled across the meadow with a little lantern..." --voice <voice_id> --out voice1.mp3
# bl speech synthesize --list-voices  # to pick a voice

Step 4 โ€” Assemble the interactive book

Drop each act's {image, text, audio} into a small HTML template with page-flip + play buttons:

Interactive HTML storybook UI: title bar, illustration, narration, prev/play/next buttons

~200 lines of HTML; the images and audio are all bl output. From "write me a firefly story" to a tappable e-book โ€” without opening a single app.

Bonus: it's also a tutor

Same bl text chat, different persona:

bl text chat --system "You are an IELTS speaking examiner." --message "Score this answer on fluency, vocabulary, grammar, pronunciation and suggest fixes: 'I very like play basketball on weekend.'"

Honest limitations

  • Consistency isn't 100% โ€” generate a few, pick the best.
  • Video (video generate) is async; poll with bl video task get.
  • Assembling PDF/video/HTML is a separate step (template included).
  • Adults should vet the content โ€” AI is the pen, not the author.

Try it

All examples run on Bailian CLI (bl 1.4.2); illustrations, comic, and the book UI are real bl output. Model Studio pricing.

๐Ÿ“ฐ Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.