Z Image Turbo Serverless API

Z-Image-Turbo generates photorealistic images in under one second with bilingual text support for global applications.

~6.71s
~$0.031
 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

POSThttps://api.segmind.com/v1/z-image-turbo

Parameters

promptrequired
string

Text prompt describing the desired image

base_64optional
boolean

Return image as base64 encoded string

Default: false
guidance_scaleoptional
number

Classifier-free guidance scale

Default: 1Range: 0 - 15
heightoptional
integer

Output image height in pixels

Default: 1024Range: 256 - 2048
image_formatoptional
string

Output image format

Default: "webp"
Allowed values :
"jpeg""png""webp"
qualityoptional
integer

Output image quality (1-100)

Default: 90Range: 1 - 100
seedoptional
integer

Random seed for reproducibility. Use -1 for random

Default: -1Range: -1 - 92147483647
stepsoptional
integer

Number of inference steps

Default: 8Range: 1 - 75
widthoptional
integer

Output image width in pixels

Default: 1024Range: 256 - 2048

Response Type

Returns: Text/JSON

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out