How It Works

When you click Generate, a serverless pipeline processes your request through 7 steps โ€” no backend code required. Everything is configured as a BFFless pipeline.

POST/api/generate
โœ…
Validate InputValidate

Validates the request body, ensuring a text prompt is provided before proceeding.

๐ŸŒ
Check CreditsHTTP Request

Makes an authenticated request to the central Arcade API to fetch the user's current credit balance.

โš™๏ธ
Verify BalanceLogic

Runs custom logic to check the user has at least 1 credit. Returns an error if insufficient funds.

๐Ÿง 
Generate ImageAI Model

Sends the prompt to Black Forest Labs' FLUX 2 Klein model via Replicate, generating a high-quality image in seconds. FLUX 2 Klein is optimized for speed without sacrificing quality.

๐Ÿ’พ
Store ResultStore File

Downloads the generated image from Replicate and stores it in your connected storage bucket (S3, GCS, Azure Blob, or MinIO). BFFless handles the upload and creates a metadata record with the original prompt โ€” the image is yours, in your infrastructure.

๐ŸŒ
Deduct CreditHTTP Request

Calls the Arcade transaction API to deduct 1 credit from the user's balance. This only runs after successful generation.

๐Ÿ“จ
Return ResponseResponse

Returns the image ID, storage path, and updated credit balance to the client.

๐Ÿง 

FLUX 2 Klein 4B

by Black Forest Labs ยท View on Replicate โ†’

FLUX 2 Klein is a compact 4-billion parameter text-to-image model from Black Forest Labs. Despite its smaller size, it delivers impressive image quality with fast generation times. Built on the FLUX architecture, it excels at prompt adherence, text rendering, and producing detailed, coherent images across a wide range of styles.

Great for

Product mockupsConcept artSocial media contentGame assetsIllustrationsStoryboardingLogo explorationArchitectural visualization

Want to build something similar?

Import this JSON into any BFFless project

Built with BFFless Pipelines โ€” serverless backend workflows powered by configuration, not code.