# shortapi/z-image/text-to-image > Developed by Tongyi Qianwen (Tongyi-MAI), Z-Image is an ultra-fast text-to-image model that features 6 billion parameters. ## Overview - **Endpoint**: `https://api.shortapi.ai/api/v1/job/create` - **Model ID**: `shortapi/z-image/text-to-image` - **Category**: text-to-image - **Kind**: inference ## Pricing Your request will cost $0.004 per megapixel. For more details, please check our pricing page. ## API Information This model can be used via our HTTP API or more conveniently via our client libraries. See the input and output schema below, as well as the usage examples. ### Input Schema The API accepts the following input parameters: - **`prompt`** (`string`, _required_): Text prompt - Examples: "An action shot of a black lab swimming..." - **`num_images`** (`int`, _optional_): The number of images to generate - Default: `1` - Options: "1", "2", "3", "4" - **`aspect_ratio`** (`string`, _required_): The aspect ratio of the generated image - Options: "1:1", "2:3", "3:2", "4:3", "3:4", "16:9", "9:16", "21:9" - **`resolution`** (`string`, _optional_): Output image resolution - Default: `1K` - Options: "1K", "1.5K" - **`enable_nsfw`** (`bool`, _optional_): Whether the generated image contains NSFW content. This property is not available in the Playground and can only be accessed through the API - Default: `false` - Options: "true", "false" ### Output Schema The API returns a JSON response with a `job_id` for tracking the request status. **Create Job Response:** ```json { "code": 0, "data": { "amount": "0.02", "job_id": "" } } ``` **Query Job Result (when status is 2, meaning succeeded):** ```json { "code": 0, "data": { "status": 2, "result": { "images": [{ "url": "https://..." }] } } } ``` ## Use Example To use this model, make an HTTP POST request to the API endpoint, then poll for results using the returned `job_id`. ### Bash (cURL) ```bash # Step 1: Create a job response=$(curl --request POST \ --url https://api.shortapi.ai/api/v1/job/create \ --header "Authorization: Bearer $SHORTAPI_KEY" \ --header "Content-Type: application/json" \ --data '{ "model": "shortapi/z-image/text-to-image", "args": { "prompt": "A richly detailed, magical miniature winter cityscape seems to leap from the pages of an ancient book. The book lies quietly on a wooden table, its spine slightly worn, its pages yellowed, scattered with coins, trinkets, and a vintage map. At the top of the visible pages, the word "[New York]" is elegantly written in a vintage font. Soft snowflakes fall, and warm winter sunlight streams through a nearby window, the gentle bokeh created by the snowflakes adding a dreamy quality to the scene. In the center of the image: iconic New York buildings are covered in snow, gleaming under warm festive lights. A miniature Christmas market twinkles under the lights, with wooden stalls, steaming drinks, a variety of food vendors, and footprints left by people in winter clothing, creating a dreamlike winter scene. Snow-covered trees further enhance the magical winter atmosphere. Soft golden light, cool diffused sunlight, and warm festive lights intertwine, creating a cinematic shallow depth of field effect, ultra-fine miniature textures, realistic snow effects, and sparkling snowflakes—all perfectly blended to form a photorealistic, miniature-scale image.", "aspect_ratio": "16:9" }, "callback_url": "CALLBACK_URL" }') JOB_ID=$(echo "$response" | grep -o '"job_id": *"[^"]*"' | sed 's/"job_id": *//; s/"//g') # Step 2: Poll for results curl --request GET \ --url "https://api.shortapi.ai/api/v1/job/query?id=$JOB_ID" \ --header "Authorization: Bearer $SHORTAPI_KEY" ``` ### JavaScript (Fetch API) ```javascript // Step 1: Create a job const response = await fetch(`https://api.shortapi.ai/api/v1/job/create`, { method: "POST", headers: { "Authorization": `Bearer ${SHORTAPI_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "model": "shortapi/z-image/text-to-image", "args": { "prompt": "A richly detailed, magical miniature winter cityscape seems to leap from the pages of an ancient book. The book lies quietly on a wooden table, its spine slightly worn, its pages yellowed, scattered with coins, trinkets, and a vintage map. At the top of the visible pages, the word "[New York]" is elegantly written in a vintage font. Soft snowflakes fall, and warm winter sunlight streams through a nearby window, the gentle bokeh created by the snowflakes adding a dreamy quality to the scene. In the center of the image: iconic New York buildings are covered in snow, gleaming under warm festive lights. A miniature Christmas market twinkles under the lights, with wooden stalls, steaming drinks, a variety of food vendors, and footprints left by people in winter clothing, creating a dreamlike winter scene. Snow-covered trees further enhance the magical winter atmosphere. Soft golden light, cool diffused sunlight, and warm festive lights intertwine, creating a cinematic shallow depth of field effect, ultra-fine miniature textures, realistic snow effects, and sparkling snowflakes—all perfectly blended to form a photorealistic, miniature-scale image.", "aspect_ratio": "16:9" }, "callback_url": "CALLBACK_URL" }) }); const data = await response.json(); const JOB_ID = data.job_id; // Step 2: Poll for results const result = await fetch(`https://api.shortapi.ai/api/v1/job/query?id=${JOB_ID}`, { method: "GET", headers: { "Authorization": `Bearer ${SHORTAPI_KEY}` } }); const resultData = await result.json(); console.log(resultData); ``` ### Python (Requests) ```python import requests # Step 1: Create a job url = "https://api.shortapi.ai/api/v1/job/create" payload = { "model": "shortapi/z-image/text-to-image", "args": { "prompt": "A richly detailed, magical miniature winter cityscape seems to leap from the pages of an ancient book. The book lies quietly on a wooden table, its spine slightly worn, its pages yellowed, scattered with coins, trinkets, and a vintage map. At the top of the visible pages, the word "[New York]" is elegantly written in a vintage font. Soft snowflakes fall, and warm winter sunlight streams through a nearby window, the gentle bokeh created by the snowflakes adding a dreamy quality to the scene. In the center of the image: iconic New York buildings are covered in snow, gleaming under warm festive lights. A miniature Christmas market twinkles under the lights, with wooden stalls, steaming drinks, a variety of food vendors, and footprints left by people in winter clothing, creating a dreamlike winter scene. Snow-covered trees further enhance the magical winter atmosphere. Soft golden light, cool diffused sunlight, and warm festive lights intertwine, creating a cinematic shallow depth of field effect, ultra-fine miniature textures, realistic snow effects, and sparkling snowflakes—all perfectly blended to form a photorealistic, miniature-scale image.", "aspect_ratio": "16:9" }, "callback_url": "CALLBACK_URL" } headers = { "Authorization": f"Bearer {SHORTAPI_KEY}", "Content-Type": "application/json" } response = requests.post(url, headers=headers, json=payload) data = response.json() JOB_ID = data.get("job_id") # Step 2: Poll for results result_url = f"https://api.shortapi.ai/api/v1/job/query?id={JOB_ID}" result = requests.get(result_url, headers={"Authorization": f"Bearer {SHORTAPI_KEY}"}) print(result.json()) ```