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.
/api/generateValidates the request body, ensuring a text prompt is provided before proceeding.
Makes an authenticated request to the central Arcade API to fetch the user's current credit balance.
Runs custom logic to check the user has at least 1 credit. Returns an error if insufficient funds.
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.
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.
Calls the Arcade transaction API to deduct 1 credit from the user's balance. This only runs after successful generation.
Returns the image ID, storage path, and updated credit balance to the client.