Skip to content

A Node.js server exposing two simple API endpoints for generating images using the Flux2.c library

Notifications You must be signed in to change notification settings

liucoj/Flux2.c-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Flux2c-API

A Node.js server exposing two simple API endpoints for generating images using the Flux2.c library (antirez/flux2.c).

flux_1769368286773_seed-1769368286 copia

Features

  • Flux2.c is optimized for Apple Silicon GPUs (fastest execution) but runs very well on other GPU's of course
  • Low memory footprint (~16GB peak), delivering high-quality results.

Prerequisites

Before proceeding, ensure you have:

  1. Installed Flux2.c and followed the official installation guide.
  • Apple Silicon users: Compile with make mps for MPS acceleration.
  • Run Flux for the first time to download the Klein model (~16GB).
  • Test a simple image generation to verify setup.

Installation

1. Clone & Set Up

git clone <https://github.com/your-repo/flux2c-api.git>

cd flux2c-api

2. Server Logic

Adjust the flux binary path in server.js or copy "server" content in flux2.c directory

3. Install Dependencies

npm install

4. Run the API

node server.js

The API will be available at:

🔗 http://0.0.0.0:3000


Usage

Web UI

  • Open your browser to <http://localhost:3000>.
  • Use the interface to generate images (default: 512x512px).
  • Performance Note: On an M2 Max MacStudio with 32GB RAM, generation may take ~3 minutes.
banana_web

OpenWeb UI Integration

Screenshot 2026-01-26 alle 16 43 24

Step-by-Step

  1. Copy Flux2c.py into your Tools section in OpenWeb UI and save it.

  2. Set you FLUX_API_PUBLIC in Valves, your public IP or domain or localhost.

Proxy Setup (Required for displaying/downloads)

To enable external downloads, configure a reverse proxy (e.g., Nginx) to forward /outputs requests to your Node server:

location /flux-outputs {

proxy_pass <http://localhost:3000>;

}

(Replace flux-outputs with your preferred path.)

Create a custom model

Create a custom model with these features:

  • Flux2 tool enabled by default
  • Disable citations if you don't want comments or log after image generation
  • Apply this system prompt or something similar:

"When the user requests an image, they will provide a description of the image to be generated. You must always use the Flux2 tool (generate_image) to generate the image. Your response must consist exclusively of the generated image. Do not include any additional text, explanations, comments, confirmations, or metadata. Do not ask questions. Do not provide alternative outputs. Only return the image produced by the tool."


About

A Node.js server exposing two simple API endpoints for generating images using the Flux2.c library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published