GPT Image 1 Mini Serverless API
GPT Image 1 Mini generates high-quality images from text descriptions, empowering efficient visual content creation.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/gpt-image-1-mini"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Design a pop-art urban street-inspired cover. Bright yellow, red, cyan with black/white contrast. Include graffiti textures, comic-style murals, playful stickers, and hand-drawn typography. Bold, energetic, and vibrant style, ideal for street festivals, concerts, or city cultural events.",
12 "size": "1024x1024",
13 "quality": "high",
14 "moderation": "auto",
15 "background": "opaque",
16 "output_compression": 100,
17 "output_format": "png"
18}
19
20response = requests.post(url, headers=headers, json=data)
21
22if response.status_code == 200:
23 result = response.json()
24 print(json.dumps(result, indent=2))
25else:
26 print(f"Error: {response.status_code}")
27 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/gpt-image-1-mini"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Design a pop-art urban street-inspired cover. Bright yellow, red, cyan with black/white contrast. Include graffiti textures, comic-style murals, playful stickers, and hand-drawn typography. Bold, energetic, and vibrant style, ideal for street festivals, concerts, or city cultural events.",
12 "size": "1024x1024",
13 "quality": "high",
14 "moderation": "auto",
15 "background": "opaque",
16 "output_compression": 100,
17 "output_format": "png"
18}
19
20response = requests.post(url, headers=headers, json=data)
21
22if response.status_code == 200:
23 result = response.json()
24 print(json.dumps(result, indent=2))
25else:
26 print(f"Error: {response.status_code}")
27 print(response.text)API Endpoint
https://api.segmind.com/v1/gpt-image-1-miniParameters
promptrequiredstringDescribe the image you want to generate. Try using descriptive keywords and context for creative imagery or straight-forward terms for clear visuals.
backgroundoptionalstringDecide if background should be see-through or solid. Transparent is best for overlays; opaque suits standalone images.
"opaque""transparent""opaque"moderationoptionalstringChoose moderation level for content. Use low for creative freedom, auto for balanced safety.
"auto""low""auto"output_compressionoptionalintegerSelect how compressed the output image is. A higher number preserves quality; lower numbers shrink file size.
100output_formatoptionalstringChoose the file type for saving. PNG is great for quality; jpeg for smaller files.
"png""png""jpeg""webp"qualityoptionalstringSet the image's visual quality. Use high for intricate details or medium for efficiency without much compromise.
"high""low""medium""high""auto"sizeoptionalstringChoose how big the image should be. Use square for fast results and larger sizes for detailed or wide visuals.
"1024x1024""1024x1024""1536x1024""1024x1536""auto"Response 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