picture book, storybook, children's book, illustrated story, bedtime story book, 绘本——create a complete picture book from a theme: write the paged story, gene...
---
name: dlazy-picture-book
version: 1.0.1
description: "picture book, storybook, children's book, illustrated story, bedtime story book, 绘本——create a complete picture book from a theme: write the paged story, generate style-consistent illustrations page by page with dlazy gpt-image-2, generate matching background music with dlazy elevenlabs-music, then assemble a self-contained HTML book with image-left / text-right spreads, page turning, and background music. Defaults to 10 pages. Use when the user wants a picture book / storybook / children's book / bedtime story, or says 'make me a picture book about ...'."
metadata:
{
'clawdbot':
{
'emoji': '📖',
'requires': { 'bins': ['npm', 'npx', 'python3', 'curl'] },
'install': 'npm install -g @dlazy/cli@latest',
'installAlternative': 'npx @dlazy/cli@latest',
'homepage': 'https://github.com/dlazyai/cli',
'source': 'https://github.com/dlazyai/cli',
'author': 'dlazyai',
'license': 'see-repo',
'npm': 'https://www.npmjs.com/package/@dlazy/cli',
'configLocation': '~/.dlazy/config.json',
'apiEndpoints': ['api.dlazy.com', 'files.dlazy.com'],
},
'openclaw':
{
'systemPrompt': "When making a picture book, follow this skill's workflow strictly: first confirm the theme and paged story, then generate illustrations page by page with dlazy gpt-image-2 (the first page establishes the character and art style; later pages pass the first page as a reference image via --images to stay consistent), generate background music with dlazy elevenlabs-music, and finally assemble book.json into index.html with this skill's scripts/build_book.py. Note: Windows PowerShell forbids `&` / `&&` to chain commands — run them one at a time; never batch-generate all images at once.",
},
}
---
# dlazy-picture-book
[English](./SKILL.md) · [中文](./SKILL-cn.md)
picture book, storybook, children's book, illustrated story, bedtime story book, 绘本——create a complete picture book from a theme: write the paged story, generate style-consistent illustrations page by page with dlazy gpt-image-2, generate matching background music with dlazy elevenlabs-music, then assemble a **self-contained HTML book with image-left / text-right spreads, page turning, and background music**. Defaults to 10 pages.
## Trigger Keywords
- picture book / storybook
- children's book / illustrated story
- bedtime story / story book
- 绘本 / 图画书
- make me a picture book about ...
## Authentication
All dlazy requests require a dLazy API key. The recommended way to authenticate is:
```bash
dlazy login
```
This runs a device-code flow (also works in remote shells) and **automatically saves your API key** to the local CLI config — no manual copy/paste required.
### Alternative: Set the Key Manually
```bash
dlazy auth set YOUR_API_KEY
```
The CLI saves the key in your user config directory (`~/.dlazy/config.json` on macOS/Linux, `%USERPROFILE%\.dlazy\config.json` on Windows), with file permissions restricted to your OS user account. You can also supply the key per-invocation via the `DLAZY_API_KEY` environment variable.
### Getting Your API Key Manually
1. Sign in or create an account at [dlazy.com](https://dlazy.com)
2. Go to [dlazy.com/dashboard/organization/api-key](https://dlazy.com/dashboard/organization/api-key)
3. Copy the key shown in the API Key section
Each key is scoped to your dLazy organization and can be **rotated or revoked at any time** from the same dashboard.
## About & Provenance
- **CLI source code**: [github.com/dlazyai/cli](https://github.com/dlazyai/cli)
- **Maintainer**: dlazyai
- **npm package**: `@dlazy/cli`
- **Homepage**: [dlazy.com](https://dlazy.com)
Run on demand without a global install:
```bash
npx @dlazy/cli@latest <command>
```
Review the GitHub source before installing.
## How It Works
Illustrations are generated by `dlazy gpt-image-2` and background music by `dlazy elevenlabs-music`; both are thin clients over the dLazy hosted API:
- Prompts and parameters are sent to the dLazy API (`api.dlazy.com`) for inference.
- Local reference images are uploaded to dLazy media storage (`files.dlazy.com`); result URLs are also hosted there.
The **story text, page composition, and HTML assembly** happen locally — you (the agent) write the story and call this skill's `scripts/build_book.py` to inject the content into `assets/template.html`, producing a self-contained HTML. Standard SaaS pattern; the skill does not access network or filesystem beyond what the dLazy CLI handles.
---
## What the output looks like
A folder you can open directly; `index.html` is the book:
```
<book-title>/
├── index.html ← the finished book (image-left/text-right, page turning, BGM)
├── book.json ← content data (title, per-page image+text, music)
├── images/ ← cover.png, page-01.png … page-10.png
└── music/ ← bgm.mp3
```
Reading experience: **cover** (large image + title + "Start reading") → **spreads** (illustration on the left in 3:4, story text on the right; turn pages with arrow keys / click left-right / bottom dots) → **end page**. A background-music toggle sits top-right. On mobile it becomes image-top / text-bottom.
Images and music are referenced by **relative paths**, so the whole folder is portable and works offline.
---
## Workflow
A picture book is story + image + sound as one whole; quality comes from keeping the three coordinated. Do the steps in order — each sets up the next.
### Step 0: Confirm the brief
Before starting, align on these (fill sensible defaults for anything unstated and say so — don't interrogate the user):
- **Theme / core**: what's the story, what does it convey (courage, sharing, friendship…)?
- **Page count**: defaults to **10**; the user may specify otherwise.
- **Audience age**: defaults to 3–6. Drives text difficulty and sentence length.
- **Art style**: defaults to warm, healing watercolor children's-book style. Could also be flat illustration, crayon, Pixar-style 3D, etc.
- **Protagonist**: give it a concrete look (e.g. "a little fox in a red scarf") — it must stay consistent on every page.
### Step 1: Write the paged story into book.json
Write the **whole book's text first**, then generate images, so the visuals follow one narrative thread.
- A full arc: **opening (introduce hero + world) → setting out / a wish → a problem → a turn → a warm ending.** Spread this across the 10 pages.
- **1–3 sentences per page**, spoken and vivid, good to read aloud. Shorter for younger readers.
- Also note a **visual description** for each page (what to draw) — you'll need it next.
Write `book.json` first (image/music paths as placeholders that will already be correct once generated):
```json
{
"title": "The Little Fox's Star Lantern",
"subtitle": "A warm story about sharing",
"cover_image": "images/cover.png",
"music": "music/bgm.mp3",
"pages": [
{ "image": "images/page-01.png", "text": "Deep in the forest lived a little fox in a red scarf…" },
{ "image": "images/page-02.png", "text": "…" }
]
}
```
### Step 2: Generate illustrations page by page (keep character + style consistent)
Consistency is where picture books fail — the same fox can't look different on every page. Use the **first page as a style anchor**:
1. **Generate page 1 first**, writing the character look, art style, palette, and composition in full detail. This sets the visual baseline for the whole book.
```bash
dlazy gpt-image-2 --quality low --size 1024x1536 \
--prompt "Children's book illustration, warm watercolor style, 3:4 portrait. An orange little fox in a red scarf lies on a windowsill gazing at the round moon outside, nighttime, soft warm lamplight, healing childlike mood, clean negative space."
```
2. **Pass page 1 as the reference image** via `--images` on every later page so the hero and style carry over; only the scene changes:
```bash
dlazy gpt-image-2 --quality low --size 1024x1536 \
--images images/page-01.png \
--prompt "Same orange fox in a red scarf, same watercolor style and palette. This page: the fox shoulders a small backpack and walks into the forest under the moonlight. 3:4 portrait."
```
3. The result URL is at `result.outputs[0].url`. **Download it into `images/` with curl:**
```bash
curl -L -o images/page-01.png "<returned url>"
```
On parameters: `--quality low` is low quality (fast, cheap, plenty for small book art); `--size 1024x1536` is the closest small portrait to 3:4 (gpt-image-2 has no exact 3:4 tier; the template crops to 3:4 so it looks right).
**Cover**: same idea — use page 1 as reference to generate a more atmospheric hero image into `images/cover.png`.
> **Execution discipline (important)**: run one generation command at a time — wait for it to return and download before the next — don't fire all 10 image commands at once or chain them with `&`/`&&`. This is both because later pages need the previous image as a reference and because `&`/`&&` error out under Windows PowerShell.
### Step 3: Generate background music
Write one music prompt from the story's mood; give it enough length to cover a read-through (60–90s for a bedtime story is fine, it loops):
```bash
dlazy elevenlabs-music --duration 75 \
--prompt "Gentle, soothing children's bedtime music, soft piano and music box, dreamy and warm, a background for reading a picture book aloud, no vocals."
```
Download the result into `music/bgm.mp3` with `curl` the same way.
### Step 4: Assemble the HTML
Make sure the paths in `book.json` match the files you actually downloaded, then run this skill's build script:
```bash
python3 <this-skill-dir>/scripts/build_book.py book.json -o index.html
```
It injects `book.json` into `assets/template.html` to produce a self-contained `index.html`. Keep `index.html` next to `images/` and `music/`.
### Step 5: Deliver
Tell the user the output folder path, that double-clicking `index.html` opens the book, and that the top-right button toggles the music. Share the cover image URL for a quick preview.
---
## Command cheatsheet
**Illustration · gpt-image-2** (full help: `dlazy gpt-image-2 -h`)
| Flag | Picture-book usage |
| --- | --- |
| `--prompt` | Scene description (character + scene + style + "3:4 portrait") |
| `--images` | Reference image (page-1 path) to keep character/style consistent, up to 5 |
| `--quality` | `low` (small book art, fast and cheap) |
| `--size` | `1024x1536` (closest small portrait to 3:4) |
**Background music · elevenlabs-music** (full help: `dlazy elevenlabs-music -h`)
| Flag | Picture-book usage |
| --- | --- |
| `--prompt` | Mood description (instruments, emotion, "no vocals", good for reading aloud) |
| `--duration` | Seconds; 60–90 is fine for a bedtime story, it loops |
Results are always at `result.outputs[0].url`; download with `curl -L -o <local path> "<url>"`.
## Error Handling
| Code | Error Type | Example Message |
| ---- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| 401 | Unauthorized (No API Key) | `ok: false, code: "unauthorized", message: "API key is missing or invalid"` |
| 501 | Missing required parameter | `error: required option '--prompt <prompt>' not specified` |
| 502 | Local file read error | `Error: Image file not found: C:\path\to\your\file` |
| 503 | API request failed (no balance) | `ok: false, code: "insufficient_balance"` |
| 503 | API request failed (server error) | `HTTP status code error (500 server crash)` |
| 504 | Asynchronous task execution failed | `=== Generation Failed ===` / `{Specific error reason returned by backend, e.g. "Prompt violates safety policy"}` |
> **AGENT CRITICAL INSTRUCTION**:
>
> 1. If the result returns `code: "insufficient_balance"`, you MUST explicitly tell the user their credits are insufficient and guide them to recharge: [https://dlazy.com/dashboard/organization/settings?tab=credits](https://dlazy.com/dashboard/organization/settings?tab=credits)
> 2. If the result returns `code: "unauthorized"` or indicates a missing API key, you MUST tell the user to get their API key from [https://dlazy.com/dashboard/organization/api-key](https://dlazy.com/dashboard/organization/api-key) and save it with `dlazy auth set <key>`, then resume.
> 3. If one image is rejected for violating the safety policy, rewrite that page's prompt (drop sensitive/violent/photoreal-person content) and retry — don't abandon the whole book.
## Tips
Visit https://dlazy.com for more information.
don't have the plugin yet? install it then click "run inline in claude" again.