Skip to main content
FLUX.1 Kontext [pro] is a context-aware image editing model from Black Forest Labs, available through AnyFast. It can edit existing images based on text instructions, or generate new images from text. The API is synchronous — it returns the generated image directly as base64-encoded data.

Key capabilities

  • Image editing — Modify existing images with text instructions (e.g. “change the red car to blue”)
  • Text-to-image — Generate images from text when no input image is provided
  • Context-aware — Understands and preserves context from the reference image
  • Reproducible — Use seed for deterministic generation

Quick example

Image editing

curl https://www.anyfast.ai/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-1-kontext-pro",
    "prompt": "Change the background to a sunset beach",
    "input_image": "https://example.com/photo.jpg",
    "size": "1024x1024"
  }'

Text-to-image

curl https://www.anyfast.ai/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"
  }'

Parameters

ParameterTypeRequiredDescription
modelstringYesMust be flux-1-kontext-pro
promptstringYesImage description or editing instructions
input_imagestringNoBase64 or URL of the reference image to edit. Required for editing mode
nintegerNoNumber of images (1–4). Default: 1
sizestringNoOutput size, e.g. 1024x1024
output_formatstringNojpeg or png
seedintegerNoRandom seed for reproducibility

Response

FieldDescription
data[].b64_jsonBase64-encoded image data
createdUnix timestamp

API Reference

View the interactive API playground for FLUX.1 Kontext [pro].