How LLMs Enable AI Image Generation: Principles and Practical Implementation
Text-only LLMs cannot directly return images, but they can serve as semantic translators between natural-language requests and an image generation service. This article explains the three-stage workflow behind this approach—prompt translation, request construction, and Markdown rendering—and provides a reusable system prompt template, parameter guidance, and practical tips for building a workflow that turns Chinese descriptions into generated images using a text model and an image service.
1. Background: Why Text-Only Models “Cannot Draw”
The core capability of a large language model is text understanding and generation. Its training objectives and output formats are primarily text-based. When a user directly asks it to “draw an image,” the model can only output a textual description and cannot return actual image content. Although current mainstream multimodal models can natively output images, in many scenarios developers only have access to text-only models, or text models perform better in reasoning and semantic understanding.
This creates a practical need: can a text model “direct” an image generation service in some way and indirectly complete image generation? The answer is yes. The essence is a division-of-labor workflow in which “the text model handles semantic conversion, and the image service handles pixel generation.” Understanding this workflow not only solves practical image generation needs but also deepens understanding of prompt engineering and AI workflow orchestration.
2. Core Principle: Division of Labor Between a Text Model and an Image Generation Service
The mechanism of this workflow can be broken down into three stages:
1. Semantic Conversion Stage
Users often provide natural-language descriptions in Chinese, such as “draw a cat on a snowy mountain at sunrise.” Sending this Chinese sentence directly to an image generation service usually does not produce ideal results, because high-quality image generation depends on structured, detail-rich English prompts that include elements such as subject, environment, lighting, composition, style, and color.
The text model acts as a “prompt translator” here: it expands the user’s brief Chinese description into a detailed, vivid English prompt that matches how image models interpret prompts. This is where text models excel; their semantic understanding, vocabulary richness, and expansion capabilities are fully utilized.
2. Request Construction Stage
Image generation services usually provide HTTP-based generation endpoints that support passing the prompt, model type, image size, random seed, and other configurations through URL parameters. The text model follows a predefined template, inserts the translated English prompt into the corresponding position in the URL, and sets parameters as needed:
width/height: control the output image width and height resolution;seed: fixing the random seed makes results reproducible for the same prompt, which is useful for debugging and comparison;model: selects a specific image generation model version;- Other parameters such as whether to add a watermark or enable automatic prompt enhancement.
3. Rendering and Presentation Stage
Many chat interfaces that support Markdown rendering automatically render Markdown image syntax such as  as an actual image. Therefore, as long as the text model outputs this Markdown link in the required format, users can directly “see” the generated image in the conversation. The entire experience feels as if the model can actually draw.
3. Prompt Template Design and a Complete Example
The key asset of this approach is a carefully designed system prompt. A ready-to-use template is as follows:
You are a world-class image generation master with excellent visual perception and an artistic intuition for turning text into images. Please complete the following tasks:1. Translate the user's Chinese image description into a detailed, vivid, and visually compelling English prompt. You may appropriately expand details, atmosphere, composition, and color to make it more suitable for generating high-quality images.2. Use the following template to insert the English prompt into the {prompt} part of the URL:Remember to output this Markdown-formatted URL directly. Do not put it in a code block.
Usage is very simple:
- Copy the entire template above;
- Open any chat interface that supports Markdown rendering;
- Paste and send it to complete the “injection”;
- After that, directly describe what you want to draw in Chinese, for example, “a Shiba Inu wearing an astronaut helmet, floating in starry space, cinematic lighting.”
In a slightly extended advanced version, you can also ask the model to first provide a brief content summary, then output a detailed structured prompt (with sections such as subject description, environmental atmosphere, camera language, artistic style, and color tone), and finally append the constructed image URL. The benefit is that when the generated result is unsatisfactory, users can take the detailed prompt output by the model, import it into other drawing tools, and fine-tune or regenerate the image, forming an iterative creative workflow.
4. Key Practical Techniques
1. Prompt quality determines image quality. High-quality English prompts usually include: a clear subject, a specific scene, lighting descriptions (such as soft lighting or golden hour), composition and viewpoint (such as wide shot or close-up), and artistic style (such as Studio Ghibli style or cyberpunk). Guiding the model to expand along these dimensions will significantly improve generation stability.
2. Parameter tuning. Fixing seed makes it easier to compare the effects of different prompts; adjusting dimensions can adapt to horizontal poster or vertical wallpaper scenarios; if the service supports a prompt enhancement switch, enabling it on the first attempt can produce richer details.
3. Service stability and fault tolerance. Free or public image generation services may respond slowly or time out during high-concurrency periods. In engineering scenarios, it is recommended to add retry mechanisms and timeout controls. You can also call image generation API services provided by cloud providers to obtain more stable SLA guarantees; such services usually provide standardized API documentation and authentication methods, with relatively low integration cost.
4. Client selection. Web-based chat interfaces may queue or lag when the service is busy. Using a localized desktop client or accessing through an API can provide a smoother experience and can also be combined with extended capabilities such as a personal knowledge base and web retrieval.
5. Broad compatibility. This approach does not depend on a specific text model. Any model with strong instruction-following and English expansion capabilities can be adapted, including the latest generation of reasoning-enhanced models. Essentially, it tests the model’s instruction-following ability rather than some unique feature.
5. Conclusion
A text-only large model “not being able to draw” is not a capability ceiling; it is a problem that can be bypassed through architectural design. With a structured prompt template, you can connect the text model’s semantic conversion capability with the image generation service’s pixel generation capability, building a complete low-cost pipeline from Chinese descriptions to images. The value of this approach goes beyond drawing itself. The division-of-labor model in which “the large model handles understanding and conversion, and specialized services handle execution” is a typical paradigm for workflow orchestration in current AI application development, and developers can apply it by analogy in many more scenarios.
