# Fooocus Image Generation ## API Information - **Model Slug:** fooocus-api - **Branded URL:** https://www.eachlabs.ai/eachlabs/eachlabs/fooocus-api - **Provider:** each::labs - **Category:** Text to Image - **Output Type:** array - **Status:** active - **Version:** 0.0.1 - **Base Cost:** Per-second pricing based on provider predict_time. Rate: $0.00108/sec from GPU tier. - **Estimated Processing Time:** 31 seconds - **Last Updated:** 2026-04-06 - **Interactive Demo:** https://www.eachlabs.ai/ai-models/fooocus-api ## Pricing - **Charge Type:** dynamic - **Pricing Details:** Per-second pricing based on provider predict_time. Rate: $0.00108/sec from GPU tier. ### Pricing Rules | Condition | Pricing | | --- | --- | | Rule 1 | Per-second pricing based on provider predict_time. Rate: $0.00108/sec from GPU tier. | ## Input Schema | Parameter | Type | Required | Default | Constraints | Description | |-----------|------|----------|---------|-------------|-------------| | prompt | string | No | - | - | Prompt for image generation | | negative_prompt | string | No | - | - | Negative prompt for image generation | | style_selections | string | No | Fooocus V2,Fooocus Enhance,Fooocus Sharp | - | Fooocus styles applied for image generation, separated by comma | | performance_selection | string | No | Speed | Speed,Quality,Extreme Speed | An enumeration. | | aspect_ratios_selection | string | No | 1152*896 | 704*1408,704*1344,768*1344,768*1280,832*1216,832*1152,896*1152,896*1088,960*1088,960*1024,1024*1024,1024*960,1088*960,1088*896,1152*896,1152*832,1216*832,1280*768,1344*768,1344*704,1408*704,1472*704,1536*640,1600*640,1664*576,1728*576 | An enumeration. | | image_number | integer | No | 1 | 1–8 | How many image to generate | | image_seed | integer | No | -1 | -2–999999999 | Seed to generate image, -1 for random | | use_default_loras | boolean | No | true | - | Use default LoRAs | | loras_custom_urls | string | No | - | - | Custom LoRAs URLs in the format 'url,weight' provide multiple seperated by ; (example 'url1,0.3;url2,0.1') | | sharpness | number | No | 2 | 0–30 | - | | guidance_scale | number | No | 7 | 1–30 | - | | refiner_switch | number | No | 0.5 | 0–1 | - | | uov_input_image | string | No | - | - | Input image for upscale or variation, keep None for not upscale or variation | | uov_method | string | No | Disabled | Disabled, Vary (Subtle), Vary (Strong), Upscale (1.5x), Upscale (2x), Upscale (Fast 2x), Upscale (Custom) | An enumeration. | | uov_upscale_value | number | No | 0 | -2–100 | Only when Upscale (Custom) | | inpaint_additional_prompt | string | No | - | - | Prompt for image generation | | inpaint_input_image | string | No | - | - | Input image for inpaint or outpaint, keep None for not inpaint or outpaint. Please noticed, `uov_input_image` has bigger priority is not None. | | inpaint_input_mask | string | No | - | - | Input mask for inpaint | | outpaint_selections | string | No | - | - | Outpaint expansion selections, literal 'Left', 'Right', 'Top', 'Bottom' separated by comma | | outpaint_distance_left | number | No | 0 | -1–1 | Outpaint expansion distance from Left of the image | | outpaint_distance_top | number | No | 0 | -1–1 | Outpaint expansion distance from Top of the image | | outpaint_distance_right | number | No | 0 | -1–1 | Outpaint expansion distance from Right of the image | | outpaint_distance_bottom | number | No | 0 | -1–1 | Outpaint expansion distance from Bottom of the image | | cn_img1 | string | No | - | - | Input image for image prompt. If all cn_img[n] are None, image prompt will not applied. | | cn_stop1 | number | No | 0.5 | 0–1 | Stop at for image prompt, None for default value | | cn_weight1 | number | No | - | 0–2 | Weight for image prompt, None for default value | | cn_type1 | string | No | ImagePrompt | ImagePrompt,FaceSwap,PyraCanny,CPDS | An enumeration. | | cn_img2 | string | No | - | - | Input image for image prompt. If all cn_img[n] are None, image prompt will not applied. | | cn_stop2 | number | No | - | - | Stop at for image prompt, None for default value | | cn_weight2 | number | No | - | - | Weight for image prompt, None for default value | | cn_type2 | string | No | ImagePrompt | ImagePrompt,FaceSwap,PyraCanny,CPDS | An enumeration. | | cn_img3 | string | No | - | - | Input image for image prompt. If all cn_img[n] are None, image prompt will not applied. | | cn_stop3 | number | No | - | - | Stop at for image prompt, None for default value | | cn_weight3 | number | No | - | - | Weight for image prompt, None for default value | | cn_type3 | string | No | ImagePrompt | ImagePrompt,FaceSwap,PyraCanny,CPDS | An enumeration. | | cn_img4 | string | No | - | - | Input image for image prompt. If all cn_img[n] are None, image prompt will not applied. | | cn_stop4 | number | No | - | - | Stop at for image prompt, None for default value | | cn_weight4 | number | No | - | - | Weight for image prompt, None for default value | | cn_type4 | string | No | ImagePrompt | ImagePrompt,FaceSwap,PyraCanny,CPDS | An enumeration. | ## Example Request ```bash curl -X POST https://api.eachlabs.ai/v1/prediction/ \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "fooocus-api", "input": {} }' ``` ## Output Schema Response returned by `GET /v1/prediction/{id}` when the job completes: ```json { "status": "success", "predictionID": "string", "output": "array", "metrics": { "predict_time": "number (seconds)" } } ``` ## Polling ```bash curl https://api.eachlabs.ai/v1/prediction/{PREDICTION_ID} \ -H "Authorization: Bearer YOUR_API_KEY" ``` | Status | Meaning | |--------|---------| | `processing` | Still running — poll again | | `success` | Done — read `output` | | `error` | Failed — read `message` / `details` | ## Webhook (alternative to polling) Pass `"webhook_url": "https://your.host/path"` in the create request. Eachlabs POSTs this payload when the job ends: ```json { "exec_id": "prediction-uuid", "status": "succeeded", "output": "https://...", "error": "" } ``` `status` is `"succeeded"` or `"failed"`. `exec_id` equals the `predictionID` from create. Return 2xx within 30 seconds. ## Errors Error body: `{ "status": "error", "message": "...", "details": "..." }` | Code | Meaning | |------|---------| | `400` | Invalid input | | `401` | Missing / invalid `Authorization` bearer token | | `404` | Unknown model or prediction id | | `429` | Rate limit — 100 creates / min, 10 concurrent per key | | `5xx` | Retry with backoff | ## Overview **fooocus-api — Text to Image AI Model** Fooocus-api is an open-source text-to-image API built on Stable Diffusion XL, designed for developers and creators who need fine-grained control over image generation without proprietary constraints. Unlike cloud-only competitors, fooocus-api solves the core problem of inflexible, rate-limited image generation by offering a customizable, self-hosted alternative that maintains full data privacy while delivering production-quality visuals. Developed as part of the Fooocus project and integrated into Eachlabs's model ecosystem, fooocus-api empowers developers building AI-driven applications—from e-commerce platforms to creative tools—with an open-source image generation API that doesn't sacrifice control for convenience. The model excels at translating detailed text prompts into coherent, high-resolution images while supporting advanced techniques like LoRA fine-tuning and sampling method customization. ## Usage Notes - API Base URL: `https://api.eachlabs.ai/v1` - Authentication: send `Authorization: Bearer YOUR_API_KEY`. Generate a key from the Eachlabs dashboard at https://www.eachlabs.ai/dashboard/api-keys. - File-typed parameters (`*_url`, `image_url`, `video_url`, `audio_url`, etc.) accept publicly-reachable HTTPS URLs only. Upload your asset first (GCS / S3 / your CDN) and pass the resulting URL. Data-URIs and localhost URLs are rejected. - For structured parameters (arrays / objects) send real JSON values, not stringified payloads. - Monetary values are reported in USD; per-token / per-megapixel rates may be billed in micro-cents internally. - Prefer `webhook_url` over polling for long-running predictions — see the Webhook Callback section.