GPT Image 1 Mini Serverless API

GPT Image 1 Mini generates high-quality images from text descriptions, empowering efficient visual content creation.

~42.03s
~$0.037
 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

POSThttps://api.segmind.com/v1/gpt-image-1-mini

Parameters

promptrequired
string

Describe the image you want to generate. Try using descriptive keywords and context for creative imagery or straight-forward terms for clear visuals.

backgroundoptional
string

Decide if background should be see-through or solid. Transparent is best for overlays; opaque suits standalone images.

Default: "opaque"
Allowed values :
"transparent""opaque"
moderationoptional
string

Choose moderation level for content. Use low for creative freedom, auto for balanced safety.

Default: "auto"
Allowed values :
"low""auto"
output_compressionoptional
integer

Select how compressed the output image is. A higher number preserves quality; lower numbers shrink file size.

Default: 100
output_formatoptional
string

Choose the file type for saving. PNG is great for quality; jpeg for smaller files.

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

Set the image's visual quality. Use high for intricate details or medium for efficiency without much compromise.

Default: "high"
Allowed values :
"low""medium""high""auto"
sizeoptional
string

Choose how big the image should be. Use square for fast results and larger sizes for detailed or wide visuals.

Default: "1024x1024"
Allowed values :
"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.

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