Segmind Beyond: Outpaint with Ease Serverless API

Effortlessly expand your visuals with AI Image Extend. Intelligently add pixels to any side of your image.

~25.34s
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)

API Endpoint

POSThttps://api.segmind.com/v1/seg-beyond

Parameters

input_imagerequired
string (uri)

input image

promptrequired
string

Prompt to render

base64optional
boolean

Base64 encoding of the output image.

Default: false
bottomoptional
integer

No of pixels to extend on bottom

Default: 0Range: 0 - 1024
guidance_scaleoptional
number

Scale for classifier-free guidance

Default: 4Range: 1 - 25
leftoptional
integer

No of pixels to extend on left

Default: 0Range: 0 - 1024
negative_promptoptional
string

Prompts to exclude, eg. bad anatomy, bad hands, missing fingers

rightoptional
integer

No of pixels to extend on right

Default: 0Range: 0 - 1024
sampleroptional
string

Type of sampler.

Default: "dpmpp_2m_sde_gpu"
Allowed values (18 total):
"euler""euler_ancestral""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast""dpm_adaptive""dpmpp_2s_ancestral"+8 more
samplesoptional
integer

Number images to generate.

Default: 1Range: 1 - 4
scheduleroptional
string

Type of scheduler.

Default: "karras"
Allowed values :
"normal""karras""exponential""sgm_uniform""simple""ddim_uniform"
seedoptional
integer

Seed for image generation.

Default: -1Range: -1 - 999999999999999
stepsoptional
integer

Number of denoising steps.

Default: 30Range: 20 - 100
stylesoptional
string

Style selection

Default: "V2,Enhance,Sharp"
topoptional
integer

No of pixels to extend on top

Default: 0Range: 0 - 1024

Response 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. 1
    POST /v2/seg-beyond

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • 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.

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