Fooocus Outpainting Serverless API

Fooocus Outpainting transforms ordinary images into extraordinary works of art by seamlessly expanding their boundaries.

~15.64s
~$0.025
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/focus-outpaint"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "Photo of man standing in a street",
12    "negative_prompt": "lowquality, badquality, sketches",
13    "steps": 30,
14    "samples": 1,
15    "styles": "V2,Enhance,Sharp",
16    "aspect_ratios": "1024*1024",
17    "seed": 354849415,
18    "guidance_scale": 4,
19    "scheduler": "karras",
20    "sampler": "dpmpp_2m_sde_gpu",
21    "base_model": "juggernaut_v8",
22    "input_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/focus-outpaint-input.png",
23    "outpaint_selections": "Right, Left, Top, Bottom",
24    "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30    result = response.json()
31    print(json.dumps(result, indent=2))
32else:
33    print(f"Error: {response.status_code}")
34    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/focus-outpaint

Parameters

input_imagerequired
string (uri)

input image

promptrequired
string

Prompt to render

aspect_ratiosoptional
string

output image aspect ratio

Default: "1024*1024"
Allowed values (26 total):
"704*1408""704*1344""768*1344""768*1280""832*1216""832*1152""896*1152""896*1088""960*1088""960*1024"+16 more
base_modeloptional
string

Model for inference

Default: "juggernaut_v8"
Allowed values :
"juggernaut_v8""Unstable_diffusers_v11""protovisionxl""realism_engine_v3""realVisXL""fluentlyXL"
base64optional
boolean

Base64 encoding of the output image.

Default: false
guidance_scaleoptional
number

Scale for classifier-free guidance

Default: 4Range: 1 - 25
negative_promptoptional
string

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

outpaint_selectionsoptional
string

Outpaint Selections

Default: "Right"
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"

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