Flux Klein 4B

Lightweight and efficient text-to-image generation with excellent speed-to-quality ratio

Overview

flux-klein-4b is a compact 4 billion parameter model based on Flux architecture, optimized for fast inference while maintaining high image quality. It's ideal for applications requiring quick turnaround times without sacrificing visual fidelity.

Rate Limit: 150 requests per minute

Price: 0.0001$ / image

Category: Text-to-Image Generation

Quickstart

Asynchronous Request (Default)

curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: flux-klein-4b' \
  -d '{
    "input": {
      "prompt": "A serene mountain landscape at dawn with mist rolling through the valleys",
      "aspect_ratio": "16:9"
    }
  }'

Response:

{
  "id": "1zww7deyssrme0csqwr90phzzr",
  "model": "flux-klein-4b",
  "input": { ... },
  "get_url": "https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr"
}

Check status and get results:

curl -X GET 'https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr' \
  -H 'apikey: YOUR_API_KEY'

Synchronous Request (Try-Sync)

curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: flux-klein-4b' \
  -H 'Try-Sync: true' \
  -d '{
    "input": {
      "prompt": "A serene mountain landscape at dawn with mist rolling through the valleys",
      "aspect_ratio": "16:9"
    }
  }'

Response (if completed within 60 seconds):

{
  "status": "succeeded",
  "generation_url": "/v1/predictions/delivery/xezq/abc123.../output.jpg"
}

Parameters

Required Parameters

ParameterTypeDescription
promptstringText description of the image you want to generate

Optional Parameters

ParameterTypeDefaultDescription
aspect_ratiostring"1:1"Aspect ratio of output. Options: "1:1", "16:9", "21:9", "3:2", "2:3", "4:5", "5:4", "3:4", "4:3", "9:16", "9:21"
seedinteger-1Random seed for reproducible results. Use -1 for random
num_inference_stepsinteger20Number of inference steps. More steps = higher quality but slower
guidancenumber3.5How closely to follow the prompt. Higher values = more literal interpretation
output_formatstring"jpg"Output format: "png", "jpg", or "webp"
output_qualityinteger80Quality for jpg/webp (1-100)