Skip to content

Images and Speech: Illustrate Your Content and Turn Articles into Speech ​

💡 One-sentence summary: Use OpenClaw to do AI image pairing for your content and turn articles into speech—generate covers, unify styles, and output voiceover, all in the same conversation.

What You'll Be Able to Do After This Lesson ​

  • Generate cover images and in-body illustrations for an article in specified aspect ratios (16:9, 3:4 switched per platform)
  • Edit images using reference images so the illustrations in a series share a unified art style
  • Convert an entire article to speech for podcasts, read-aloud versions, or commute audio
  • Check generation task status in chat and switch among 11 image providers as needed

Why OpenClaw instead of web-based AI? ​

CapabilityWeb-based AIOpenClaw
Text-image flow❌ Article and drawing live in two separate tabs, with constant copy-pasting back and forth✅ Claw reads your article and produces images directly, without losing context
Ratios and batching❌ Clicking through one image at a time, with ratios often mismatched to the platform✅ One instruction specifies aspectRatio and count
Model selection❌ Locked to a single vendor✅ OpenAI, MiniMax, Google, fal, and more—11 providers, switchable anytime
Style consistency❌ Re-describing from scratch is a matter of luck✅ Upload a reference image and edit in a "keep the subject, change the background" way
Article-to-speech❌ You have to find yet another TTS tool✅ Convert the article body to speech in the same conversation

Your Current Predicament ​

  • The article is done, but the images still require opening web-based AI: you write the prompt three times, tweak the ratio five times, and the style still doesn't match.
  • Want to add an audio version (podcast/read-aloud account)? That means registering yet another TTS tool, pasting the full text over, and downloading it.
  • Images, text, and audio live in three separate tools; every time the article gets a revision, the images and audio have to be exported all over again.

When to Use This Technique ​

  • WeChat Official Account/Toutiao articles need cover images and in-body illustrations
  • Xiaohongshu posts need multiple images with a unified art style
  • You want to turn long-form articles into speech to cover "can't-read-text" scenarios like commuting and driving
  • Prerequisite: Scenario Practice: Choose Your Route

🎒 Preparation Before You Start ​

  • OpenClaw is up and running (this tutorial is based on v2026.10.9), and you have completed Scenario Practice: Choose Your Route
  • At least one image provider has its API Key configured—pick any one of MINIMAX_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY; for users in mainland China, we recommend starting with connecting MiniMax (MiniMax provides both chat models and the image model image-01)
  • If no Key is configured, the image_generate tool won't appear; Step 1 will help you confirm this
  • Speech: no new registration needed—the OPENAI_API_KEY, GEMINI_API_KEY, MINIMAX_API_KEY configured in the image step also serve as the authentication for TTS providers (MiniMax speech uses the T2A v2 API, with default model speech-2.8-hd)
  • You can get audio output even without configuring a single Key: the built-in Microsoft option uses the public Edge neural network TTS (no Key required, best-effort with no SLA); when no voice is configured, text that is mainly Chinese automatically switches to a Chinese voice zh-CN-XiaoxiaoNeural
  • Auto-TTS is off by default and regular replies are all text; this lesson uses the /tts command to produce audio on demand, so there's no need to turn on Auto-TTS

Follow Along ​

Step 1: Check the models available for AI image pairing (action=list) ​

Why: OpenClaw handles image generation through the image_generate tool; which models you can use depends on which providers you have configured. Take a look at the list first, so you don't write a prompt only to discover no Key was configured.

Type this in the chat:

text
/tool image_generate action=list

You should see: the currently registered image providers, each one's default model, and hints about the required environment variables. If the list is empty, go back to "Preparation Before You Start" above, configure a Key, and come back.

Step 2: Have Claw generate the first image for your article ​

Why: paste an article paragraph directly to Claw and it can pick out the key imagery from the text to write the drawing prompt—much easier than racking your brain over prompts yourself.

Send the following to Claw (replace the content inside 【】 with your own):

text
Help me create a cover image for the article passage below, 16:9 landscape orientation, bright and clean composition:
【Paste the opening paragraph of your article】

You should see: Claw first replies with a task ID—image generation is asynchronous, and when the image is ready a completion message comes back with the image attached, along with a short caption. While waiting you can keep sending messages; no need to sit idle.

Step 3: Specify aspect ratio, count, and transparent background ​

Why: WeChat Official Account covers need 16:9, Xiaohongshu needs 3:4, and sticker icons need a transparent background. These parameters go directly after the command.

text
/tool image_generate action=generate model=openai/gpt-image-2 prompt="flat illustration of two orange cats lying on a desk looking at manuscript pages" aspectRatio=16:9 count=2

For transparent-background assets, write it like this:

text
/tool image_generate action=generate model=openai/gpt-image-1.5 prompt="a red circular sticker, transparent background" outputFormat=png background=transparent

You should see: images generated in the specified aspect ratio (or the closest available size) and count. Parameters the model doesn't support are ignored and reported in the result rather than causing an error.

💡 This is the unique value of OpenClaw

image_generate One tool covers all 11 providers: switching models only requires changing the model= parameter, and the rest of the command is reused as-is; with fallbacks configured, hitting a rate limit on one provider automatically switches to the next (see Advanced Tips).

Step 4: Edit images with a reference image to keep a consistent style across the whole illustration set ​

Why: Illustrations in an article series need a consistent style. Giving Claw a finalized image as a reference is far more reliable than describing the style in words.

text
/tool image_generate action=generate model=openai/gpt-image-2 prompt="keep the subject, replace the background with a bright photo studio" image=/path/to/reference.png size=1024x1536

You should see: a new image that keeps the subject of the reference image, with the background replaced per your request. For multiple reference images, use the images parameter: OpenAI and Google support up to 5 images, xAI up to 3, and MiniMax 1 subject reference.

Step 5: Turn an article into speech (AI text-to-speech) ​

Why: Readers on the road can't read text; converting an article to speech lets the same content cover commuting and driving scenarios.

If the article is right at hand, convert it in one go:

text
/tts audio 【paste the article text to be read aloud】

Was the article just written by Claw in the chat? Have it read its latest reply aloud:

text
/tts latest

You should see: a message with audio comes back—Feishu, Matrix, Telegram, and WhatsApp receive a native voice message, other channels receive an audio attachment. /tts audio only performs this one-time conversion and does not turn on the TTS switch; /tts status shows the current status at any time.

Long text has a hard limit: /tts audio synthesizes at most 4096 characters per call (the default value of maxTextLength). Within that limit, the text is synthesized in full—no summarizing, no truncation, and no prior command needed; exceeding 4096 characters fails directly with the message Text too long, so paste longer articles to /tts audio in segments, with each segment read aloud in full.

By the way: in voice call (Talk) stt-tts mode, voice output goes through this same TTS synthesis pipeline (talk.speak calls the same path); the provider's native realtime sessions synthesize speech inside the provider instead.

Step 6: Check task status and failure reasons ​

Why: Asynchronous generation can occasionally be slow or fail; check the status first, then decide whether to retry or switch models.

text
/tool image_generate action=status

You should see: the status of generation tasks in the current session. If all candidate providers fail, the error message includes details of every attempt—just follow it to add a key or switch models.

📋 Magic Prompts ​

📝 One-Click Illustrations ​

Expected result: paste an article, and Claw automatically produces a cover plus illustrations, with aspect ratio and count specified in one go.

text
Role: senior content illustrator.
Task: generate illustrations for the article I provide.
Input information:
### Required fields
【Article paragraph or full text】
【Publishing platform: WeChat Official Account / Xiaohongshu / other】
### Optional fields
【Preferred art style?】
【Dominant color palette?】
Output specification: first generate 1 cover image(s) at 16:9, then generate 2 in-text illustration(s) at 3:4; each with a one-line caption.
Constraints:
✅ All visual elements must come from the article content; do not add entities not present in the text
✅ Keep a consistent style and dominant color palette across all illustrations
❌ Do not produce text-heavy posters (leave text to layout)
❌ Do not use close-ups of real human faces

🔧 Style-Consistent Image Editing ​

Expected result: provide a finalized reference image, and new images automatically follow its art style and color palette.

text
Role: illustration style gatekeeper.
Task: generate a new-scene illustration based on the reference image.
Input information:
### Required fields
【Reference image path, e.g. /path/to/style.png】
【New scene description】
### Optional fields
【Output aspect ratio?】
Output specification: draw the new scene in the reference image's art style and color palette, with a clear subject.
Constraints:
✅ Match the composition, brushwork, and color palette to the reference image
✅ Leave room in the image for a caption
❌ Do not mix in materials or styles not present in the reference image
❌ Do not modify the reference image file itself

🚀 Article to Speech ​

Expected result: paste an article, Claw first rewrites it into an ear-friendly clean script, then converts it to speech and sends it back, splitting long texts into segments automatically.

text
Role: podcast producer.
Task: rewrite the article I provide into a clean script suitable for reading aloud, convert it to speech, and send it to me.
Input information:
### Required fields
【Full article text or file path】
### Optional fields
【Voice preference, e.g. a calm female voice?】
【Speaking rate, e.g. 1.1x?】
Output specification: output the clean script first, then convert it to speech; if the clean script exceeds 4096 characters, convert it in segments, with each segment read aloud in full.
Constraints:
✅ Rewrite markdown markers, links, and code blocks into phrasing that makes sense when spoken
✅ Stay faithful to the original viewpoints and information; do not add new content
❌ Do not read symbols like #, *, [] out loud
❌ Do not cram more than 4096 characters into a single audio segment

Checkpoint ✅ ​

  • /tool image_generate action=list can list at least one model
  • Cover image aspect ratio matches the publishing platform (e.g. 16:9 / 3:4)
  • Series illustrations use the same reference image, with a consistent style
  • The speech version reads the full text without truncation
  • You know where to check when generation fails (action=status + error details)

Pitfall Reminders ​

  • Tool doesn't appear: image_generate only appears after at least one image provider is configured. Configure an API key first, or log in with OpenAI ChatGPT/Codex OAuth.
  • Don't use gpt-image-2 for transparent backgrounds: the current gpt-image-2 API rejects background: "transparent"; for transparent backgrounds choose openai/gpt-image-1.5 and set outputFormat=png (or webp).
  • Don't sit idle waiting for async tasks: generation first returns a task ID, and the image arrives later; just keep chatting in the meantime, or use action=status to check progress.
  • Parameters aren't universal across models: for example, resolution is only supported by some providers; unsupported fields are ignored and reported in the result.
  • Reference image count has limits: OpenAI/OpenRouter/Google allow at most 5 images, xAI at most 3, and MiniMax, ComfyUI, and Microsoft Foundry 1 each.
  • Long text fails outright: /tts audio has a per-call limit of 4096 characters (the maxTextLength default); exceeding it fails with the message Text too long, so long text must be converted in segments. "Summarize first, then synthesize, for text over 1500 characters" is behavior exclusive to Auto-TTS (the automatic voiceover enabled by turning on tts.auto); the on-demand conversion via /tts used in this lesson always synthesizes the original text.
  • Feishu/WhatsApp voice notes require ffmpeg: When a channel needs audio converted to Ogg/Opus, ffmpeg must be installed on the Gateway host; if transcoding fails, Feishu downgrades the original audio to a file attachment, while WhatsApp simply fails to send.

Advanced Tips ​

Configure fallbacks for the image model, so that when one provider fails (rate limiting, auth errors) it automatically switches to the next:

json5
{
  agents: {
    defaults: {
      mediaModels: {
        image: {
          primary: "openai/gpt-image-2",
          timeoutMs: 180000,
          fallbacks: [
            "openrouter/google/gemini-3.1-flash-image-preview",
            "google/gemini-3.1-flash-image",
            "fal/fal-ai/flux/dev",
          ],
        },
      },
    },
  },
}

Note: when the instruction explicitly specifies model=, only that one model is tried and fallbacks are not involved; only requests that do not specify model= automatically chain in the order primary → fallbacks.

Batch image generation from the command line (ideal for scripting):

bash
openclaw infer image generate \
  --model openai/gpt-image-1.5 \
  --output-format png \
  --background transparent \
  --prompt "一个红色圆形贴纸,透明背景" \
  --json

Image editing corresponds to openclaw infer image edit; --output-format, --background, and --quality work there as well.

More than just images: OpenClaw also offers music and video generation tools (official docs: tools/music-generation, tools/video-generation); video providers include alibaba (Wan), minimax, and more.

Lesson Summary ​

  • AI illustration: image_generate one tool covers 11 providers; generate an image with a single sentence in chat, with parameters like aspectRatio, count, background appended directly after the instruction.
  • Consistent style: pass reference images (image= / images=) to do "keep the subject, change the background" style edits, giving the whole illustration set a unified look.
  • AI text-to-speech: /tts audio converts any text to speech in one go, and /tts latest reads aloud the previous reply directly; the per-call limit is 4096 characters, with longer text converted in segments. The stt-tts mode of voice calling (Talk) uses this same synthesis pipeline.
  • Troubleshooting: run action=status first to check status; configure fallbacks so providers automatically take over for each other.

Next Lesson Preview ​

In the next lesson Let Claw write code: exec, patches, and approvals: let Claw actually take action—running commands, applying patches, with important operations going through approval first.