# Qwen 2.1 Text to Image > AI model for generating image content ## Overview - **Model ID**: `qwen-edit-2.1` - **Category**: image - **Provider**: modelslab - **Source Type**: Open Source Model - **Status**: model_ready - **Screenshot**: `https://assets.modelslab.ai/generations/765f2d91-468d-4328-b9e0-229454ee00e4.png` ## API Information This model can be used via our HTTP API. See the API documentation and usage examples below. ### Endpoint - **URL**: `https://modelslab.com/api/v6/images/text2img` - **Method**: POST ### Parameters - **`prompt`** (required): Enter the text for the image you want to generate - Type: textarea - **`width`** (required): Width must be at least 512 px and at most 2048 px - Type: number (range: 512-2048) - **`height`** (required): Height must be at least 512 px and at most 2048 px - Type: number (range: 512-2048) - **`num_inference_steps`** (required): The number of denoising steps. Values range from 30 to 40, and any value above 40 will be capped at 40. - Type: number (range: 30-40) ## Usage Examples ### cURL ```bash curl --request POST \ --url https://modelslab.com/api/v6/images/text2img \ --header "Content-Type: application/json" \ --data '{ "key": "YOUR_API_KEY", "model_id": "qwen-edit-2.1", "prompt": "A surrealist editorial photograph in cinematic photorealism, featuring a woman sitting completely motionless and expressionless on a wooden swing above a grassy shoreline. She wears a teal terry-cloth robe, oversized white oval sunglasses, colorful hair curlers, and simple flip-flops, with a cigarette held naturally between her lips. The wooden swing seat and ropes are engulfed in vivid bright-orange flames, producing translucent gray smoke that rises into the overcast sky, while the woman remains calm and unaffected at the center of the composition. Cool, soft overcast daylight evenly illuminates the pale sea, cloudy sky, and grassy foreground, creating a strong contrast with the warm emissive glow of the fire and subtle specular highlights reflecting across the sunglasses. Dark leafy branches frame the upper edge of the image, calm hazy water fills the middle ground, and textured grass anchors the foreground. Capture the scene as a vertically composed full-body portrait using an eye-level camera angle and a 50mm lens, with a shallow depth of field, realistic skin and fabric textures, natural atmospheric haze, cinematic tonal range, detailed flames and smoke, and an unsettling yet elegant surreal fashion-editorial mood.", "width": "1024", "height": "1024", "num_inference_steps": "30" }' ``` ### Python ```python import requests response = requests.post( "https://modelslab.com/api/v6/images/text2img", headers={ "Content-Type": "application/json" }, json={ "key": "YOUR_API_KEY", "model_id": "qwen-edit-2.1", "prompt": "A surrealist editorial photograph in cinematic photorealism, featuring a woman sitting completely motionless and expressionless on a wooden swing above a grassy shoreline. She wears a teal terry-cloth robe, oversized white oval sunglasses, colorful hair curlers, and simple flip-flops, with a cigarette held naturally between her lips. The wooden swing seat and ropes are engulfed in vivid bright-orange flames, producing translucent gray smoke that rises into the overcast sky, while the woman remains calm and unaffected at the center of the composition. Cool, soft overcast daylight evenly illuminates the pale sea, cloudy sky, and grassy foreground, creating a strong contrast with the warm emissive glow of the fire and subtle specular highlights reflecting across the sunglasses. Dark leafy branches frame the upper edge of the image, calm hazy water fills the middle ground, and textured grass anchors the foreground. Capture the scene as a vertically composed full-body portrait using an eye-level camera angle and a 50mm lens, with a shallow depth of field, realistic skin and fabric textures, natural atmospheric haze, cinematic tonal range, detailed flames and smoke, and an unsettling yet elegant surreal fashion-editorial mood.", "width": "1024", "height": "1024", "num_inference_steps": "30" } ) print(response.json()) ``` ### JavaScript ```javascript fetch("https://modelslab.com/api/v6/images/text2img", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "key": "YOUR_API_KEY", "model_id": "qwen-edit-2.1", "prompt": "A surrealist editorial photograph in cinematic photorealism, featuring a woman sitting completely motionless and expressionless on a wooden swing above a grassy shoreline. She wears a teal terry-cloth robe, oversized white oval sunglasses, colorful hair curlers, and simple flip-flops, with a cigarette held naturally between her lips. The wooden swing seat and ropes are engulfed in vivid bright-orange flames, producing translucent gray smoke that rises into the overcast sky, while the woman remains calm and unaffected at the center of the composition. Cool, soft overcast daylight evenly illuminates the pale sea, cloudy sky, and grassy foreground, creating a strong contrast with the warm emissive glow of the fire and subtle specular highlights reflecting across the sunglasses. Dark leafy branches frame the upper edge of the image, calm hazy water fills the middle ground, and textured grass anchors the foreground. Capture the scene as a vertically composed full-body portrait using an eye-level camera angle and a 50mm lens, with a shallow depth of field, realistic skin and fabric textures, natural atmospheric haze, cinematic tonal range, detailed flames and smoke, and an unsettling yet elegant surreal fashion-editorial mood.", "width": "1024", "height": "1024", "num_inference_steps": "30" }) }) .then(response => response.json()) .then(data => console.log(data)); ``` ## Integration Options ### CLI Install: `curl -fsSL https://modelslab.sh/install.sh | sh` or `brew install modelslab/tap/modelslab` ```bash modelslab auth login # Authenticate modelslab models search "qwen-edit-2.1" # Find this model modelslab models detail --id qwen-edit-2.1 # Get model details modelslab generate image --prompt "..." --model qwen-edit-2.1 # Generate with model modelslab config set generation.default_model qwen-edit-2.1 # Set as default ``` - Website: https://modelslab.sh - GitHub: https://github.com/ModelsLab/modelslab-cli ### MCP Servers (Model Context Protocol) For Claude Code, Cursor, VS Code, Windsurf, and any MCP-compatible agent. - Generation: `https://modelslab.com/mcp/v7` (API key auth, 23 tools) - Agent Control Plane: `https://modelslab.com/mcp/agents` (Bearer token auth, 10 tools) Claude Code config (`~/.claude/settings.json`): ```json { "mcpServers": { "modelslab-v7": { "url": "https://modelslab.com/mcp/v7", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } } ``` - Documentation: https://docs.modelslab.com/mcp-web-api/overview ### Agent Skills Install skill files directly into AI coding agents: ```bash npx skills add modelslab/skills --all # All skills npx skills add modelslab/skills --skill image-generation # Specific skill npx skills add modelslab/skills --all -a claude-code -a cursor # Target agents ``` - GitHub: https://github.com/ModelsLab/skills - Documentation: https://docs.modelslab.com/agent-skills ### SDKs - Python: `pip install modelslab` - TypeScript: `npm install modelslab` - PHP: `composer require modelslab/modelslab` - Go: `go get github.com/modelslab/modelslab-go` - Dart: `dart pub add modelslab` ## Links - [Model Playground](https://modelslab.com/models/modelslab/qwen-edit-2.1) - [API Documentation](https://docs.modelslab.com) - [ModelsLab Platform](https://modelslab.com)