Segmind Beyond: Outpaint with Ease Serverless API
Effortlessly expand your visuals with AI Image Extend. Intelligently add pixels to any side of your image.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/seg-beyond"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "snow capped mountains",
12 "negative_prompt": "lowquality, badquality, sketches",
13 "steps": 30,
14 "samples": 1,
15 "styles": "V2,Enhance,Sharp",
16 "seed": 354849415,
17 "guidance_scale": 4,
18 "scheduler": "karras",
19 "sampler": "dpmpp_2m_sde_gpu",
20 "input_image": "https://segmind-resources.s3.amazonaws.com/input/f6c171a1-d4bb-4224-820a-c7c53994b145-outpaint-ip.png",
21 "left": 300,
22 "right": 100,
23 "top": 0,
24 "bottom": 0,
25 "base64": false
26}
27
28response = requests.post(url, headers=headers, json=data)
29
30if response.status_code == 200:
31 result = response.json()
32 print(json.dumps(result, indent=2))
33else:
34 print(f"Error: {response.status_code}")
35 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/seg-beyond"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "snow capped mountains",
12 "negative_prompt": "lowquality, badquality, sketches",
13 "steps": 30,
14 "samples": 1,
15 "styles": "V2,Enhance,Sharp",
16 "seed": 354849415,
17 "guidance_scale": 4,
18 "scheduler": "karras",
19 "sampler": "dpmpp_2m_sde_gpu",
20 "input_image": "https://segmind-resources.s3.amazonaws.com/input/f6c171a1-d4bb-4224-820a-c7c53994b145-outpaint-ip.png",
21 "left": 300,
22 "right": 100,
23 "top": 0,
24 "bottom": 0,
25 "base64": false
26}
27
28response = requests.post(url, headers=headers, json=data)
29
30if response.status_code == 200:
31 result = response.json()
32 print(json.dumps(result, indent=2))
33else:
34 print(f"Error: {response.status_code}")
35 print(response.text)API Endpoint
https://api.segmind.com/v1/seg-beyondParameters
input_imagerequiredstring (uri)input image
promptrequiredstringPrompt to render
base64optionalbooleanBase64 encoding of the output image.
falsebottomoptionalintegerNo of pixels to extend on bottom
0Range: 0 - 1024guidance_scaleoptionalnumberScale for classifier-free guidance
4Range: 1 - 25leftoptionalintegerNo of pixels to extend on left
0Range: 0 - 1024negative_promptoptionalstringPrompts to exclude, eg. bad anatomy, bad hands, missing fingers
rightoptionalintegerNo of pixels to extend on right
0Range: 0 - 1024sampleroptionalstringType of sampler.
"dpmpp_2m_sde_gpu""euler""euler_ancestral""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast""dpm_adaptive""dpmpp_2s_ancestral"+8 moresamplesoptionalintegerNumber images to generate.
1Range: 1 - 4scheduleroptionalstringType of scheduler.
"karras""normal""karras""exponential""sgm_uniform""simple""ddim_uniform"seedoptionalintegerSeed for image generation.
-1Range: -1 - 999999999999999stepsoptionalintegerNumber of denoising steps.
30Range: 20 - 100stylesoptionalstringStyle selection
"V2,Enhance,Sharp"topoptionalintegerNo of pixels to extend on top
0Range: 0 - 1024Response 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