> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdn-fly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FLUX.1 Kontext [pro]

> Call the Black Forest Labs FLUX.1 Kontext [pro] image editing and generation model via the Starrise AI API.

FLUX.1 Kontext \[pro] is a context-aware image generation model from Black Forest Labs, available through Starrise AI. It can generate images from text descriptions or edit existing images using text instructions. Both endpoints use **synchronous calls** — they directly return Base64-encoded image data.

* **Text-to-image** — POST JSON to `/v1/images/generations`
* **Image editing** — POST multipart form to `/v1/images/edits`

## Key Capabilities

* **Image editing** — Modify existing images using text instructions (e.g., "Change the red car to blue")
* **Text-to-image** — Generate images from text descriptions
* **Context-aware** — Understands and preserves the context of reference images
* **Reproducible** — Use `seed` for deterministic generation

## Quick Example

### Text-to-image

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-1-kontext-pro",
    "prompt": "A cute baby polar bear",
    "size": "1024x1024"
  }'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://dayu.cdn-fly.com/v1/images/generations",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "flux-1-kontext-pro",
        "prompt": "A cute baby polar bear",
        "size": "1024x1024"
    }
)

result = response.json()
# result["data"][0]["b64_json"] contains the Base64-encoded image
```

### Image Editing

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/v1/images/edits \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "model=flux-1-kontext-pro" \
  -F "image=@/path/to/photo.jpg" \
  -F "prompt=Change the background to a sunset beach" \
  -F "size=1024x1024"
```

```python Python theme={null}
import requests

response = requests.post(
    "https://dayu.cdn-fly.com/v1/images/edits",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    files={"image": open("/path/to/photo.jpg", "rb")},
    data={
        "model": "flux-1-kontext-pro",
        "prompt": "Change the background to a sunset beach",
        "size": "1024x1024"
    }
)

result = response.json()
# result["data"][0]["b64_json"] contains the Base64-encoded image
```

## Text-to-image Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `model` | string | Yes | Fixed value: `flux-1-kontext-pro` |
| `prompt` | string | Yes | Image description. **⚠️ Prompt must be in English** |
| `n` | integer | No | Number of images to generate. Only `1` is supported |
| `size` | string | No | Output resolution, e.g. `1024x1024` |
| `output_format` | string | No | `jpeg` or `png` |
| `seed` | integer | No | Random seed for reproducibility |

## Image Editing Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `model` | string | Yes | Fixed value: `flux-1-kontext-pro` |
| `image` | file | Yes | Image file to edit (multipart upload) |
| `prompt` | string | Yes | Editing instruction. **⚠️ Prompt must be in English** |
| `n` | integer | No | Number of images to generate. Only `1` is supported |
| `size` | string | No | Output resolution, e.g. `1024x1024` |

## Response Fields

| Field | Description |
| - | - |
| `data[].b64_json` | Base64-encoded image data |
| `created` | Creation timestamp |

> **[API Reference](/en/api-reference/model-api/blackforestlabs/flux-1-kontext-pro)**
>
> View the interactive API Playground for FLUX.1 Kontext \[pro].


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.