image-generation

Generate base64-encoded images from text prompts using the z-ai-web-dev-sdk API and CLI.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/tmtgroupbot/lptracker-deploy --skill image-generation-tmtgroupbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: image-generation
Source: https://github.com/tmtgroupbot/lptracker-deploy/tree/main/skills/image-generation
Command: npx skills add https://github.com/tmtgroupbot/lptracker-deploy --skill image-generation-tmtgroupbot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires z-ai-web-dev-sdk, and includes scripts (resource) components.

What problem does it solve? Creating visual assets like hero banners, logos, and illustrations normally requires design tools or stock imagery. This Skill lets developers generate images directly from text prompts inside backend JavaScript/TypeScript applications or from the command line. ## Core Features & Use Cases - Text-to-Image API: Generate images via z-ai-web-dev-sdk with seven supported sizes (square, portrait, landscape, wide) returned as base64 data. - CLI Tool: Run z-ai image -p "prompt" -o output.png -s 1344x768 for quick one-off asset generation without writing code. - Batch & Service Patterns: Includes batch generation, caching, retry logic, and an Express.js endpoint example for production integration. - Use Case: Build a website and generate all visual assets—hero banner, team illustration, and logo—by running three CLI commands with tailored prompts and sizes. ## Quick Start Ask the AI to generate an image of a modern tech hero banner at 1440x720 and save it to ./assets/hero.png using the z-ai CLI.

Frequently Asked Questions about image-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an image from a text prompt in JavaScript?

Import ZAI from z-ai-web-dev-sdk, call ZAI.create(), then use zai.images.generations.create with a prompt and size. The response contains base64 image data that you decode with Buffer and write to a PNG file.

How to generate images from the command line with z-ai CLI?

Run z-ai image with the -p flag for your prompt, -o for the output path, and -s for size. For example: z-ai image -p "A sunset" -o ./sunset.png -s 1344x768.

What image sizes does z-ai-web-dev-sdk support?

Seven sizes are supported: 1024x1024 square, 768x1344 and 864x1152 portrait, 1344x768 and 1152x864 landscape, 1440x720 wide, and 720x1440 tall portrait. Other size values are rejected.

Can I use z-ai-web-dev-sdk in client-side browser code?

No. The SDK must run in backend code only, such as Node.js servers or Express endpoints. Calling it from client-side code will fail and is explicitly unsupported.

Why does image generation fail or return no data?

Failures occur when the API response lacks base64 data or when an unsupported size is passed. Validate the size against the supported list, check response.data[0].base64 exists, and add retry logic with backoff for transient errors.