We’ve partnered with Black Forest Labs (BFL) again to bring their optimized FLUX.2 [klein] 4B model to Workers AI! This distilled model offers faster generation and cost-effective pricing, while maintaining great output quality. With a fixed 4-step inference process, Klein 4B is ideal for rapid prototyping and real-time applications where speed matters.
Read the BFL blog to learn more about the model itself, or try it out yourself on our multi modal playground.
Pricing documentation is available on the model page or pricing page.
Workers AI Platform specifics
The model hosted on Workers AI is optimized for speed with a fixed 4-step inference process and supports up to 4 image inputs. Since this is a distilled model, the steps parameter is fixed at 4 and cannot be adjusted. Like FLUX.2 [dev], this image model uses multipart form data inputs, even if you just have a prompt.
With the REST API, the multipart form data input looks like this:
curl --request POST \ --url 'https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/black-forest-labs/flux-2-klein-4b' \ --header 'Authorization: Bearer {TOKEN}' \ --header 'Content-Type: multipart/form-data' \ --form 'prompt=a sunset at the alps' \ --form width=1024 \ --form height=1024With the Workers AI binding, you can use it as such:
const form = new FormData();form.append("prompt", "a sunset with a dog");form.append("width", "1024");form.append("height", "1024");
const formRequest = new Request("http://dummy", { method: "POST", body: form,});const formStream = formRequest.body;const formContentType = formRequest.headers.get("content-type") || "multipart/form-data";
const resp = await env.AI.run("@cf/black-forest-labs/flux-2-klein-4b", { multipart: { body: formStream, contentType: formContentType, },});const formStream = formRequest.body;const formContentType = formRequest.headers.get("content-type") || "multipart/form-data";
const resp = await env.AI.run("@cf/black-forest-labs/flux-2-klein-4b", { multipart: { body: formStream, contentType: formContentType, },});The parameters you can send to the model are detailed here:
JSON Schema for Model
Required Parametersprompt(string) – Text description of the image to generate
Optional Parameters
input_image_0(string) – Binary imageinput_image_1(string) – Binary imageinput_image_2(string) – Binary imageinput_image_3(string) – Binary imageguidance(float) – Guidance scale for generation. Higher values follow the prompt more closelywidth(integer) – Width of the image, default1024Range: 256-1920height(integer) – Height of the image, default768Range: 256-1920seed(integer) – Seed for reproducibility
Note: Since this is a distilled model, the steps parameter is fixed at 4 and cannot be adjusted.
## Multi-Reference Images
The FLUX.2 klein-4b model supports generating images based on reference images, just like FLUX.2 [dev]. You can use this feature to apply the style of one image to another, add a new character to an image, or iterate on past generated images. You would use it with the same multipart form data structure, with the input images in binary. The model supports up to 4 input images.
For the prompt, you can reference the images based on the index, like `take the subject of image 1 and style it like image 0` or even use natural language like `place the dog beside the woman`.
Note: you have to name the input parameter as `input_image_0`, `input_image_1`, `input_image_2`, `input_image_3` for it to work correctly. All input images must be smaller than 512x512.
```bashcurl --request POST \ --url 'https://api.cloudflare.com/client/v4/accounts/{ACCOUNT}/ai/run/@cf/black-forest-labs/flux-2-klein-4b' \ --header 'Authorization: Bearer {TOKEN}' \ --header 'Content-Type: multipart/form-data' \ --form 'prompt=take the subject of image 1 and style it like image 0' \ --form input_image_0=@/Users/johndoe/Desktop/icedoutkeanu.png \ --form input_image_1=@/Users/johndoe/Desktop/me.png \ --form width=1024 \ --form height=1024Through Workers AI Binding:
//helper function to convert ReadableStream to Blobasync function streamToBlob(stream: ReadableStream, contentType: string): Promise<Blob> { const reader = stream.getReader(); const chunks = [];
while (true) { const { done, value } = await reader.read(); if (done) break; chunks.push(value); }
return new Blob(chunks, { type: contentType });}
const image0 = await fetch("http://image-url");const image1 = await fetch("http://image-url");const form = new FormData();
const image_blob0 = await streamToBlob(image0.body, "image/png");const image_blob1 = await streamToBlob(image1.body, "image/png");form.append('input_image_0', image_blob0)form.append('input_image_1', image_blob1)form.append('prompt', 'take the subject of image 1 and style it like image 0')
const resp = await env.AI.run("@cf/black-forest-labs/flux-2-klein-4b", { multipart: { body: form, contentType: "multipart/form-data" }})Source: Cloudflare
Latest Posts
- (Updated) Improvements to meeting threads in Microsoft Teams channels [MC1217638]
![(Updated) Improvements to meeting threads in Microsoft Teams channels [MC1217638] 2 silhouette 4940445 1920](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==)
- Power Automate – Debug easily into condition actions at runtime [MC1218294]
![Power Automate - Debug easily into condition actions at runtime [MC1218294] 3 pexels elina araja 1743227 3377405](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==)
- (Updated) Microsoft 365 Copilot: Declarative agents model upgrade to GPT-5.1 [MC1194070]
![(Updated) Microsoft 365 Copilot: Declarative agents model upgrade to GPT-5.1 [MC1194070] 4 pexels alfonso escalante 1319242 2533092](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==)
- Amazon Connect now provides agent scheduling metrics in data lake

![Workers AI - Launching FLUX.2 [klein] 4B on Workers AI 1 Workers AI – Launching FLUX.2 [klein] 4B on Workers AI](https://mwpro.co.uk/wp-content/uploads/2025/06/pexels-digitalbuggu-171198-1024x683.webp)
![(Updated) Improvements to meeting threads in Microsoft Teams channels [MC1217638] 2 silhouette 4940445 1920](https://mwpro.co.uk/wp-content/uploads/2025/06/silhouette-4940445_1920-150x150.webp)
![Power Automate - Debug easily into condition actions at runtime [MC1218294] 3 pexels elina araja 1743227 3377405](https://mwpro.co.uk/wp-content/uploads/2024/08/pexels-elina-araja-1743227-3377405-150x150.webp)
![(Updated) Microsoft 365 Copilot: Declarative agents model upgrade to GPT-5.1 [MC1194070] 4 pexels alfonso escalante 1319242 2533092](https://mwpro.co.uk/wp-content/uploads/2025/06/pexels-alfonso-escalante-1319242-2533092-150x150.webp)

