Fooocus-API: Programmatic AI Image Generation Guide
A complete guide to Fooocus-API - the FastAPI-based REST API for Fooocus that lets you generate stunning AI images programmatically.
What Is Fooocus-API?
Fooocus-API is a FastAPI-powered REST API layer built on top of Fooocus, the wildly popular open-source image generation platform inspired by the ease of Midjourney combined with the power of Stable Diffusion. While Fooocus shines as an interactive Gradio-based web UI for individual users, Fooocus-API transforms it into a programmable image generation engine that can be integrated into any application, service, or workflow.
By wrapping Fooocus's Stable Diffusion capabilities in clean REST endpoints, Fooocus-API lets developers generate images programmatically using any programming language that can make HTTP requests.
Key Features
- Text-to-Image Generation - Generate images from text prompts with full control over style, quality, and dimensions
- Image-to-Image - Transform existing images using prompt-guided modifications
- Inpainting and Outpainting - Edit specific regions of images or seamlessly extend image boundaries
- Upscaling and Enhancement - Increase image resolution and quality with advanced upscaling methods
- ControlNet Integration - Apply precise structural controls using edge detection, depth maps, pose estimation
- Asynchronous Task Processing - Background generation tasks with progress tracking
How It Works
Fooocus-API loads the same model weights and configuration as the standard Fooocus UI. When started, it downloads the required Stable Diffusion models (SDXL) automatically. The API exposes endpoints for generating images, checking task status, enhancing results, and managing the generation queue.
Why Use Fooocus-API?
If you need to generate images as part of an automated pipeline, integrate with other tools, or build a product on top of AI image generation, the REST API is essential. Fooocus-API gives you all the same features as the web UI - accessible from any HTTP client.
Self-Hosted and Free
Fooocus-API is completely free and open-source under the GPL-3.0 license. Run it on your own GPU, keeping full control over data and costs. Available on Docker Hub and Replicate.
Conclusion
Fooocus-API bridges the gap between interactive AI image generation and programmatic integration. With comprehensive REST endpoints, Docker support, and a clean FastAPI architecture, it turns Fooocus from a personal creativity tool into a building block for next-generation AI applications.