Segmind Beyond: Outpaint with Ease Serverless API
Effortlessly expand your visuals with AI Image Extend. Intelligently add pixels to any side of your image.
POST /v2/seg-beyond · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "seg-beyond",
9 prompt="snow capped mountains",
10 negative_prompt="lowquality, badquality, sketches",
11 steps=30,
12 samples=1,
13 styles="V2,Enhance,Sharp",
14 seed=354849415,
15 guidance_scale=4,
16 scheduler="karras",
17 sampler="dpmpp_2m_sde_gpu",
18 input_image="https://segmind-resources.s3.amazonaws.com/input/f6c171a1-d4bb-4224-820a-c7c53994b145-outpaint-ip.png",
19 left=300,
20 right=100,
21 top=0,
22 bottom=0,
23 base64=False,
24)
25print(result["status"]) # COMPLETED
26print(result.get("output")) # model output (e.g. media URL)
27print(result["metrics"]["inference_time"]) # server compute seconds
28
29# --- Or submit + poll manually (track request_id, control the cadence) ---
30from segmind import SegmindClient, InferenceFailed, InferenceTimeout
31
32client = SegmindClient() # reads SEGMIND_API_KEY
33payload = {
34 "prompt": "snow capped mountains",
35 "negative_prompt": "lowquality, badquality, sketches",
36 "steps": 30,
37 "samples": 1,
38 "styles": "V2,Enhance,Sharp",
39 "seed": 354849415,
40 "guidance_scale": 4,
41 "scheduler": "karras",
42 "sampler": "dpmpp_2m_sde_gpu",
43 "input_image": "https://segmind-resources.s3.amazonaws.com/input/f6c171a1-d4bb-4224-820a-c7c53994b145-outpaint-ip.png",
44 "left": 300,
45 "right": 100,
46 "top": 0,
47 "bottom": 0,
48 "base64": False,
49}
50job = client.submit_async("seg-beyond", **payload)
51print(job.request_id) # available immediately
52try:
53 result = job.wait(timeout=600, interval=1.0)
54except InferenceTimeout as e:
55 print("still running:", e.request_id)
56except InferenceFailed as e:
57 print("failed:", e.detail) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "seg-beyond",
9 prompt="snow capped mountains",
10 negative_prompt="lowquality, badquality, sketches",
11 steps=30,
12 samples=1,
13 styles="V2,Enhance,Sharp",
14 seed=354849415,
15 guidance_scale=4,
16 scheduler="karras",
17 sampler="dpmpp_2m_sde_gpu",
18 input_image="https://segmind-resources.s3.amazonaws.com/input/f6c171a1-d4bb-4224-820a-c7c53994b145-outpaint-ip.png",
19 left=300,
20 right=100,
21 top=0,
22 bottom=0,
23 base64=False,
24)
25print(result["status"]) # COMPLETED
26print(result.get("output")) # model output (e.g. media URL)
27print(result["metrics"]["inference_time"]) # server compute seconds
28
29# --- Or submit + poll manually (track request_id, control the cadence) ---
30from segmind import SegmindClient, InferenceFailed, InferenceTimeout
31
32client = SegmindClient() # reads SEGMIND_API_KEY
33payload = {
34 "prompt": "snow capped mountains",
35 "negative_prompt": "lowquality, badquality, sketches",
36 "steps": 30,
37 "samples": 1,
38 "styles": "V2,Enhance,Sharp",
39 "seed": 354849415,
40 "guidance_scale": 4,
41 "scheduler": "karras",
42 "sampler": "dpmpp_2m_sde_gpu",
43 "input_image": "https://segmind-resources.s3.amazonaws.com/input/f6c171a1-d4bb-4224-820a-c7c53994b145-outpaint-ip.png",
44 "left": 300,
45 "right": 100,
46 "top": 0,
47 "bottom": 0,
48 "base64": False,
49}
50job = client.submit_async("seg-beyond", **payload)
51print(job.request_id) # available immediately
52try:
53 result = job.wait(timeout=600, interval=1.0)
54except InferenceTimeout as e:
55 print("still running:", e.request_id)
56except InferenceFailed as e:
57 print("failed:", e.detail)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
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/seg-beyondSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
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