# FLUX.1 Kontext \[dev]

## Overview

**FLUX.1 Kontext \[dev]** is the community-accessible variant of Kontext — an open‑weight, lightweight 12 B diffusion transformer distilled directly from FLUX.1 Kontext \[pro]. It preserves the high fidelity editing, regional prompt adherence, image semantics, and character consistency of the pro-grade model, while being significantly more efficient and customizable — ideal for adaptation, fine-tuning, and scientific exploration.

* **Pro-level editing fidelity**: Maintains precision in local edits and scene-wide modifications without finetuning, offering the same editing quality as the \[pro] model.
* **Character & semantic consistency**: Ensures subjects and styles remain coherent across iterative edits, avoiding drift or semantic errors.
* **Open weights & adaptability**: Released with fully open weights under a source-available license, enabling easy extension and research-driven experimentation.
* **Efficiency**: The 12B parameter design is optimized for fast inference on research hardware, supporting interactive editing workflows while keeping computational needs low.

Find out more about [FLUX.1 Kontext](https://bfl.ai/announcements/flux-1-kontext).

### **Getting Started**

Before generating images, make sure your account is ready to use the Inference API. Follow the [Getting Started](https://docs.verda.com/inference/getting-started) guide to create an account and top up your balance.

### Authorization

To access and use these API endpoints, authorization is required. Please visit our [Authorization page](https://docs.verda.com/inference/authorization) for detailed instructions on obtaining and using a bearer token for secure API access.

## Generating images

### Parameters

#### `prompt` (string)

The text description to generate an image from.\
This is the core input that drives the output.

***

#### `size` (string)

The resolution of the output image in `"width*height"` format.\
**Default:** `"1024*1024"`

***

#### `num_inference_steps` (integer)

How many denoising steps to run during generation.\
More steps may improve quality, at the cost of speed.\
**Default:** `28`

***

#### `seed` (integer)

A seed value for reproducibility.\
The same seed + prompt + model version = same image.\
Use `-1` to randomize.\
**Default:** `-1`

***

#### `guidance_scale` (float)

CFG (Classifier-Free Guidance) controls how closely the image follows the prompt.\
Higher values = stronger prompt adherence, but may reduce creativity.\
**Default:** `3.5`

***

#### `num_images` (integer)

How many images to generate per request.\
**Default:** `1`

***

#### `enable_safety_checker` (boolean)

If enabled, content will be checked for safety violations.\
**Default:** `true`

***

#### `output_format` (string)

The file format of the generated image.\
**Possible values:** `"jpeg"`, `"png"`, `"webp"`\
**Default:** `"jpeg"`

***

#### `output_quality` (integer)

Applies to `"jpeg"` and `"webp"` formats.\
Defines compression quality.\
**Range:** `1–100`\
**Default:** `95`

***

#### `enable_base64_output` (boolean)

If `true`, the API will return the image as a base64-encoded string in the response.\
**Default:** `false`

***

#### `image` (string, base64-encoded)

The input image for **image-to-image** generation.\
Must be provided as a **base64-encoded string.**

This image acts as the visual starting point for generation.\
The model will modify or transform this input based on your `prompt`

### Text to image

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request POST "https://inference.datacrunch.io/flux-kontext-dev/predict" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <your_api_key>" \
--data '{
    "input": {
        "prompt": "a scientist racoon eating icecream in a datacenter",
        "enable_base64_output": true
    }
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

token = "<your_api_key>"  # Replace with your actual key
bearer_token = f"Bearer {token}"

url = "https://inference.datacrunch.io/flux-kontext-dev/predict"
headers = {
    "Content-Type": "application/json",
    "Authorization": bearer_token
}
data = {
    "input": {
        "prompt": "a scientist racoon eating icecream in a datacenter",
        "enable_base64_output": True
    }
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

const token = '<your_api_key>'; // Replace with your actual token
const url = 'https://inference.datacrunch.io/flux-kontext-dev/predict';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': `Bearer ${token}`
};
const data = {
  input: {
    prompt: 'a scientist racoon eating icecream in a datacenter',
    enable_base64_output: true
  }
};

axios
  .post(url, data, { headers: headers })
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.error('Error:', error);
  });
```

{% endtab %}
{% endtabs %}

### Image to image

{% tabs %}
{% tab title="cURL" %}

```bash
# Encode the image
INPUT_BASE64=$(base64 -i palm.jpg)

# Write JSON payload to a file
cat > payload.json <<EOF
{
  "input": {
    "prompt": "Add a tresure chest on the beach",
    "image": "${INPUT_BASE64}",
    "enable_base64_output": true
  }
}
EOF

# Send the request
curl --request POST "https://inference.datacrunch.io/flux-kontext-dev/predict" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer <your_api_key>" \
  --data @payload.json
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import base64

# Load your image as base64 string
with open("palm.jpg", "rb") as image_file:
    input_base64 = base64.b64encode(image_file.read()).decode("utf-8")

token = "<your_api_key>"  # Replace with your actual key
bearer_token = f"Bearer {token}"

url = "https://inference.datacrunch.io/flux-kontext-dev/predict"
headers = {
    "Content-Type": "application/json",
    "Authorization": bearer_token
}
data = {
    "input": {
        "prompt": "Add a tresure chest on the beach",
        "image": input_base64,
        "enable_base64_output": True
    }
}

response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');
const fs = require('fs');

// Read image and convert to base64
const imageBase64 = fs.readFileSync('palm.jpg', { encoding: 'base64' });

const token = '<your_api_key>'; // Replace with your actual token
const url = 'https://inference.datacrunch.io/flux-kontext-dev/predict';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': `Bearer ${token}`
};

const data = {
  input: {
    prompt: 'Add a tresure chest on the beach',
    image: input_base64,
    enable_base64_output: true
  }
};

axios
  .post(url, data, { headers })
  .then((response) => {
    console.log('Response:', response.data);
  })
  .catch((error) => {
    console.error('Error:', error.response?.data || error.message);
  });
```

{% endtab %}
{% endtabs %}
