Brave Leo now runs on NEAR AI Cloud
All models

FLUX.2-klein-4B

Private TEE
Verified
black-forest-labs/FLUX.2-klein-4B

The FLUX.2 [klein] model family are our fastest image models to date. FLUX.2 [klein] unifies generation and editing in a single compact architecture, delivering state-of-the-art quality with end-to-end inference in as low as under a second. Built for applications that require real-time image generation without sacrificing quality.

Input / 1M tokens
$1
Output / image
$0.012
Cache read / 1M tokens
—
Context window
128K tokens

Privacy & execution

This model supports private inference inside a hardware-isolated Trusted Execution Environment (TEE), protecting data while it is processed. HTTPS protects data in transit; client-to-model end-to-end encryption depends on the model and integration.

Attestation provides cryptographic evidence of the execution environment’s identity and configuration. Where response signatures are available, you can also verify the integrity of the request and response.

Verification documentation
01

Make your first request

Call /v1/images/generations over HTTPS.

Get an API key and replace the API key placeholder below.

curl --fail-with-body "https://cloud-api.near.ai/v1/images/generations" \ -H "Authorization: Bearer <YOUR-NEAR-AI-CLOUD-API-KEY>" \ -H "Content-Type: application/json" \ -d '{ "model": "black-forest-labs/FLUX.2-klein-4B", "prompt": "A mountain lake at sunrise", "n": 1 }'
02

Use the API

Use the dedicated endpoint for this model’s modality.

Example

const response = await fetch("https://cloud-api.near.ai/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer <YOUR-NEAR-AI-CLOUD-API-KEY>", "Content-Type": "application/json", }, body: JSON.stringify({ "model": "black-forest-labs/FLUX.2-klein-4B", "prompt": "A mountain lake at sunrise", "n": 1 }), }); if (!response.ok) throw new Error(await response.text()); console.log(await response.json());