FastAPI wrapper liberates Fooocus from its Gradio cage
Gives Fooocus a REST API so you can generate images programmatically without wrestling the Gradio client.

What it does Fooocus-API exposes the Fooocus image-generation engine—an opinionated Stable Diffusion/XL frontend—through a FastAPI REST layer. It turns the interactive Gradio UI into headless endpoints for text-to-image, image enhancement, inpainting, and upscaling. You can self-host it with standard Python tooling or GPU-backed Docker, and it can reuse model weights from an existing Fooocus install.
The interesting bit The author cites personal frustration: calling Fooocus through the Gradio client was “a terrible experience.” Instead of scraping the UI, the project bolts FastAPI directly onto the engine, adding webhooks, API-key gating, and a job queue.
Key highlights
- Exposes Fooocus generation features (txt2img, image enhance, inpaint, upscale/vary) as REST endpoints
- Can reuse an existing local Fooocus model directory instead of duplicating gigabytes of checkpoints
- Supports webhook notifications, API-key authentication, and queued job management
- Available as self-hosted Python service or pre-built Docker image with CUDA support
- Published Replicate presets for anime and realistic styles
Caveats
- Version bumps can be brittle; the README warns that Fooocus 2.5 upgraded most dependencies and that skipping the automatic pip install may break things
groundingdino-pymay fail to install on Chinese Windows environments, requiring a manual workaround- The
enhance_uov_prompt_typeparameter is admitted by the author to have an unclear function
Verdict Worth a look if you want to automate Fooocus workflows or integrate its image pipeline into a larger stack. Skip it if you are happy clicking inside the Gradio UI and don’t need programmatic access.
Frequently asked
- What is mrhan1993/Fooocus-API?
- Gives Fooocus a REST API so you can generate images programmatically without wrestling the Gradio client.
- Is Fooocus-API open source?
- Yes — mrhan1993/Fooocus-API is open source, released under the GPL-3.0 license.
- What language is Fooocus-API written in?
- mrhan1993/Fooocus-API is primarily written in Python.
- How popular is Fooocus-API?
- mrhan1993/Fooocus-API has 667 stars on GitHub.
- Where can I find Fooocus-API?
- mrhan1993/Fooocus-API is on GitHub at https://github.com/mrhan1993/Fooocus-API.