GPT Image 1 Edit Mini Serverless API
GPT Image 1 Mini generates and edits high-quality images seamlessly from text and visual inputs.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/gpt-image-1-edit-mini"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Use the reference airship scene. Make it larger scale and more dynamic, with multiple airships in the sky, steam trails, moving propellers, and adventurous characters posing heroically. Retain steampunk details and style.",
12 "image_urls": [
13 "https://segmind-resources.s3.amazonaws.com/input/be87b383-38d7-435e-a795-5ece083301e9-0f4a926b22d2b98cf40bf1e17385deed_0.jpeg"
14 ],
15 "mask": null,
16 "size": "auto",
17 "quality": "auto",
18 "background": "opaque",
19 "output_compression": 100,
20 "output_format": "png",
21 "moderation": "auto"
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/gpt-image-1-edit-mini"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Use the reference airship scene. Make it larger scale and more dynamic, with multiple airships in the sky, steam trails, moving propellers, and adventurous characters posing heroically. Retain steampunk details and style.",
12 "image_urls": [
13 "https://segmind-resources.s3.amazonaws.com/input/be87b383-38d7-435e-a795-5ece083301e9-0f4a926b22d2b98cf40bf1e17385deed_0.jpeg"
14 ],
15 "mask": null,
16 "size": "auto",
17 "quality": "auto",
18 "background": "opaque",
19 "output_compression": 100,
20 "output_format": "png",
21 "moderation": "auto"
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text)API Endpoint
https://api.segmind.com/v1/gpt-image-1-edit-miniParameters
image_urlsrequiredstring[]URLs of source images. Include multiple URLs for diverse image references.
maskrequiredstring (uri)Input Image for masking. Use when specific parts of the image need editing.
promptrequiredstringText input to generate the desired image. For a 3D action figure, describe clothing and accessories vividly.
backgroundoptionalstringChooses between transparent or opaque background. Use 'transparent' for standalone figures.
"opaque""transparent""opaque"moderationoptionalstringControls image generation moderation strictness. Opt for 'low' to reduce restrictions.
"auto""low""auto"output_compressionoptionalintegerSet compression level from 1-100. Use 100 for no compression and optimal quality.
100output_formatoptionalstringChoose image format: PNG for transparency, JPEG for smaller file size.
"png""png""jpeg""webp"qualityoptionalstringControls output image quality. 'Auto' suits most needs while 'high' is best for detailed outputs.
"auto""low""medium""high""auto"sizeoptionalstringImage resolution selection. Use 'auto' for default or 1024x1024 for quicker generation.
"auto""1024x1024""1536x1024""1024x1536""auto"Response Type
Returns: Image
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