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.35s
~$0.036
 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

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

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