Fooocus

Fooocus enables high-quality image generation effortlessly, combining the best of Stable Diffusion and Midjourney.

~19.74s
~$0.061
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/fooocus"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "cinematic 3D caricature of a woman, smiling, looking happy",
12    "negative_prompt": "lowquality, badquality, sketches",
13    "steps": 30,
14    "samples": 1,
15    "styles": "V2,Enhance,Sharp",
16    "aspect_ratio": "1024*1024",
17    "seed": 1849415,
18    "guidance_scale": 4,
19    "scheduler": "DPM++ 2M SDE Karras",
20    "base_model": "protovisionxl",
21    "faceswap_img": "https://segmind-sd-models.s3.amazonaws.com/display_images/fooocus-face-image.jpg",
22    "faceswap_cn_stop": 0.9,
23    "faceswap_cn_weight": 0.8,
24    "imageprompt_img": "https://segmind-sd-models.s3.amazonaws.com/display_images/fooocus-image-prompt.png",
25    "imageprompt_cn_stop": 0.5,
26    "imageprompt_cn_weight": 0.6,
27    "pyracanny_cn_stop": 0.5,
28    "pyracanny_cn_weight": 1,
29    "cpds_cn_stop": 0.5,
30    "cpds_cn_weight": 1,
31    "base64": false
32}
33
34response = requests.post(url, headers=headers, json=data)
35
36if response.status_code == 200:
37    result = response.json()
38    print(json.dumps(result, indent=2))
39else:
40    print(f"Error: {response.status_code}")
41    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/fooocus

Parameters

promptrequired
string

Prompt to render

aspect_ratiooptional
string

output image aspect ratio

Default: "1024*1024"
Allowed values (28 total):
"704*1408""704*1344""768*1344""768*1280""832*1216""832*1152""896*1152""896*1088""960*1088""768*1024"+18 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
cpds_cn_stopoptional
number

image propmt

Default: 0.5Range: 0 - 1.5
cpds_cn_weightoptional
number

image propmt

Default: 1Range: 0 - 1.5
cpds_imgoptional
string (uri)

cpds_img

faceswap_cn_stopoptional
number

image propmt

Default: 0.9Range: 0 - 1.5
faceswap_cn_weightoptional
number

image propmt

Default: 0.8Range: 0 - 1.5
faceswap_imgoptional
string (uri)

faceswap_img

guidance_scaleoptional
number

Scale for classifier-free guidance

Default: 4Range: 1 - 25
imageprompt_cn_stopoptional
number

image prompt

Default: 0.5Range: 0 - 1.5
imageprompt_cn_weightoptional
number

image propmt

Default: 0.6Range: 0 - 1.5
imageprompt_imgoptional
string (uri)

faceswap_img

negative_promptoptional
string

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

pyracanny_cn_stopoptional
number

image propmt

Default: 0.5Range: 0 - 1.5
pyracanny_cn_weightoptional
number

image propmt

Default: 1Range: 0 - 1.5
pyracanny_imgoptional
string (uri)

pyracanny_img

samplesoptional
integer

Number images to generate.

Default: 1Range: 1 - 4
scheduleroptional
string

Type of scheduler.

Default: "DPM++ SDE"
Allowed values (29 total):
"DPM++ SDE Karras""DPM++ 2M Karras""DPM++ 2M SDE Karras""DPM++ 2M SDE Heun Karras""DPM++ 3M SDE Karras""LMS Karras""DPM2 Karras""DPM2 a Karras""DPM++ 2S a Karras""DPM++ 2M SDE Exponential"+19 more
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