SKILL.md 2.8 KB


name: qwen-image-skill description: | Generate images through a configurable Qwen-compatible image generation API. This skill lets OpenClaw turn natural-language image requests into structured parameters, call the configured Qwen image model, and return downloaded image files.

Use this skill when: (1) The user wants to generate an image from text. (2) The user describes a scene, character, style, or composition and expects a rendered picture.

(3) The user asks to configure or verify the Qwen image generation model, API key, or endpoint.

Qwen Image Agent Skill

Core Execution Specification

As an OpenClaw agent equipped with this skill, your objective is to convert the user's natural-language image request into a structured argument payload, then hand it to the local Python client to generate images through the configured Qwen-compatible API.

Step 1: Query the Skill Registry

Before generating, inspect the currently exposed workflow and parameter surface:

python ./scripts/registry.py list --agent

Rules:

  • Treat prompt as required.
  • If the user did not specify size, n, quality, or negative_prompt, infer sensible defaults from the request.
  • Do not expose implementation details like endpoints, headers, or internal response fields unless the user explicitly asks.

Step 2: Assemble Parameters

Create a JSON object for the workflow qwen/text-to-image.

Expected arguments:

  • prompt: fully written image prompt.
  • size: optional output size, such as 1024x1024, 1280x720, or 720x1280.
  • n: optional image count.
  • quality: optional quality hint such as standard or hd.
  • negative_prompt: optional list of unwanted elements.
  • seed: optional deterministic seed.

If the user intent is vague, ask for the missing art direction only when necessary. Otherwise, refine the request yourself into a production-ready prompt.

Step 3: Execute Generation

Run the local client:

python ./scripts/qwen_image_client.py --workflow qwen/text-to-image --args '<JSON_ARGS>'

Requirements:

  • Pass strict JSON in --args.
  • If the API returns multiple images, keep all paths.
  • If generation fails due to config issues, guide the user to update config.json from config.example.json.

Step 4: Return Results

On success, return the generated local image paths and a concise summary of what was generated.

On failure:

  • Surface the actual error.
  • If the error is about credentials or endpoint configuration, tell the user to set provider.api_key, provider.base_url, and provider.model in config.json.

Configuration Notes

This skill reads runtime settings from config.json in the repository root. If that file does not exist yet, copy config.example.json to config.json and fill in the Qwen settings.