Z Image Turbo Serverless API
Z-Image-Turbo generates photorealistic images in under one second with bilingual text support for global applications.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/z-image-turbo"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Create a vibrant and modern magazine cover for Hindi Farmer, themed for April 2025.\nThe main background is a cool magenta to deep-pink gradient with airy soft shadows that mirror the vivid color of ripe dragon fruit (ड्रैगन फ्रूट).\n\nCentered is a Hindi farmer, a middle-aged man with sun-tanned skin, short textured black hair, and a confident stance. He stands beside a freshly harvested pile of bright red dragon fruit arranged on geometric crates painted in matte dark teal.\nHe wears a lightweight dark grey field jacket, a maroon undershirt, and rugged work pants.\nHis expression is sharp and determined, representing precision farming and market growth in India.\n\nUse a new font direction featuring condensed sans-serif fonts for headlines and a bold serif for key title elements.\nBalance white, dark magenta, and citrus orange text across the layout with clean editorial spacing.\n\nText Layout (all updated to Hindi)\n\n• Top left:\n“प्रीमियम ड्रैगन फ्रूट” in bright orange\nSubtext in white: “कैसे भारतीय किसान निर्यात बाज़ार में कदम बढ़ा रहे हैं”\n\n• Top right:\n“शुष्क भूमि तकनीक” in bold dark magenta\nSubtext: “लंबे मौसम में ऊर्जा-सक्षम सिंचाई के नए तरीके”\n\n• Center right:\nLarge orange “18”\nText: “अधिकतम पैदावार के लिए 18 छंटाई रणनीतियाँ”\n\n• Bottom left:\n“मूल्य युद्ध” in dark magenta\nPale pink subtext: “सालभर ड्रैगन फ्रूट बाज़ार की बदलती गतिशीलता”\n\n• Bottom left corner (with an orange plus sign):\n“तेज़ वृद्धि देने वाला जैविक उर्वरक”\n\n• Bottom right (over the crates):\nIn elegant white serif: “लाल का लाभ”\nOrange subheading: “वे किसान जो लगातार बड़ी पैदावार ले रहे हैं”\n\nArt Direction\n\nDesign should look modern, clean, and forward-focused, emphasizing:\n\ntropical & semi-tropical horticulture\n\npremium produce\n\nthe rising value of dragon fruit cultivation in India\n\nLighting should be bright studio style with soft controlled shadows.",
12 "steps": 8,
13 "guidance_scale": 1,
14 "seed": -1,
15 "height": 1024,
16 "width": 1024,
17 "image_format": "webp",
18 "quality": 90,
19 "base_64": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/z-image-turbo"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Create a vibrant and modern magazine cover for Hindi Farmer, themed for April 2025.\nThe main background is a cool magenta to deep-pink gradient with airy soft shadows that mirror the vivid color of ripe dragon fruit (ड्रैगन फ्रूट).\n\nCentered is a Hindi farmer, a middle-aged man with sun-tanned skin, short textured black hair, and a confident stance. He stands beside a freshly harvested pile of bright red dragon fruit arranged on geometric crates painted in matte dark teal.\nHe wears a lightweight dark grey field jacket, a maroon undershirt, and rugged work pants.\nHis expression is sharp and determined, representing precision farming and market growth in India.\n\nUse a new font direction featuring condensed sans-serif fonts for headlines and a bold serif for key title elements.\nBalance white, dark magenta, and citrus orange text across the layout with clean editorial spacing.\n\nText Layout (all updated to Hindi)\n\n• Top left:\n“प्रीमियम ड्रैगन फ्रूट” in bright orange\nSubtext in white: “कैसे भारतीय किसान निर्यात बाज़ार में कदम बढ़ा रहे हैं”\n\n• Top right:\n“शुष्क भूमि तकनीक” in bold dark magenta\nSubtext: “लंबे मौसम में ऊर्जा-सक्षम सिंचाई के नए तरीके”\n\n• Center right:\nLarge orange “18”\nText: “अधिकतम पैदावार के लिए 18 छंटाई रणनीतियाँ”\n\n• Bottom left:\n“मूल्य युद्ध” in dark magenta\nPale pink subtext: “सालभर ड्रैगन फ्रूट बाज़ार की बदलती गतिशीलता”\n\n• Bottom left corner (with an orange plus sign):\n“तेज़ वृद्धि देने वाला जैविक उर्वरक”\n\n• Bottom right (over the crates):\nIn elegant white serif: “लाल का लाभ”\nOrange subheading: “वे किसान जो लगातार बड़ी पैदावार ले रहे हैं”\n\nArt Direction\n\nDesign should look modern, clean, and forward-focused, emphasizing:\n\ntropical & semi-tropical horticulture\n\npremium produce\n\nthe rising value of dragon fruit cultivation in India\n\nLighting should be bright studio style with soft controlled shadows.",
12 "steps": 8,
13 "guidance_scale": 1,
14 "seed": -1,
15 "height": 1024,
16 "width": 1024,
17 "image_format": "webp",
18 "quality": 90,
19 "base_64": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)API Endpoint
https://api.segmind.com/v1/z-image-turboParameters
promptrequiredstringText prompt describing the desired image
base_64optionalbooleanReturn image as base64 encoded string
falseguidance_scaleoptionalnumberClassifier-free guidance scale
1Range: 0 - 15heightoptionalintegerOutput image height in pixels
1024Range: 256 - 2048image_formatoptionalstringOutput image format
"webp""jpeg""png""webp"qualityoptionalintegerOutput image quality (1-100)
90Range: 1 - 100seedoptionalintegerRandom seed for reproducibility. Use -1 for random
-1Range: -1 - 92147483647stepsoptionalintegerNumber of inference steps
8Range: 1 - 75widthoptionalintegerOutput image width in pixels
1024Range: 256 - 2048Response Type
Returns: Text/JSON
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out