OPENCLAW + FLUX KONTEXT

Use Flux Kontext in OpenClaw.

Flux Kontext by Black Forest Labs handles text-guided image editing and generation with character consistency. OpenClaw agents call it through RunAPI with the same API key used for chat — send a prompt, get an image URL back.

one API key · text to image endpoint · async task polling
Use RunAPI to generate an image with Flux Kontext Pro.

Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/v1/text_to_image
- Set model to "flux-kontext-pro"
- Use the RUNAPI_API_KEY environment variable for authorization
- The response is async — poll the task status endpoint until the task completes, then retrieve the image URL
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-kontext-pro",
    "prompt": "a matte-black water bottle on a beige stone surface, soft side light, studio photography"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "flux-kontext-pro"
}
Copy the curl command to test flux-kontext
HOW IT WORKS

Use Flux Kontext in OpenClaw in three steps

1

Configure RunAPI

Set the RUNAPI_API_KEY environment variable. If you already configured RunAPI as an OpenClaw provider for chat, the same key works for image generation — no extra setup needed.

export RUNAPI_API_KEY=runapi_xxx
2

Call Flux Kontext

Send a POST request to the text_to_image endpoint with model set to flux-kontext-pro. Include a text prompt describing the image you want. Optionally pass an image_url for in-context editing.

text_to_image
3

Get the result

The endpoint returns a task ID. Poll the task status endpoint until the status changes to completed, then retrieve the generated image URL from the response.

task_id: tsk_abc123
PARAMETERS

Flux Kontext API parameters

Parameter Type Description
model string Required. flux-kontext-pro or flux-kontext-max.
prompt string Text instruction for generation or editing.
image_url string Source image URL for in-context editing.
aspect_ratio string Optional. Output aspect ratio.

What is Flux Kontext on OpenClaw?

Flux Kontext by Black Forest Labs is a continuous image editing model that users say is "better than ChatGPT and Gemini" for precise modifications. You describe what to change in plain text, and it modifies that part while keeping everything else intact -- the face stays the same when you swap an outfit, the product stays in position when you replace the background. OpenClaw agents call it through the RunAPI text_to_image endpoint.

Flux Kontext use cases

Background replacement while keeping subjects

Swap product or portrait backgrounds while the subject stays in the exact same position -- no masking, no inpainting, just a text instruction.

Clothing and appearance changes

Change outfits, hair color, or accessories on a character while preserving facial identity, useful for fashion mockups and character design iteration.

Text replacement on signs and labels

Replace text on signs, product labels, or storefronts in existing images -- type the new text in the prompt and Flux Kontext renders it in place.

FAQ

Flux Kontext + OpenClaw questions

OpenClaw general setup

Not configured yet? Start with the RunAPI setup guide for OpenClaw.

OpenClaw setup guide →

Flux Kontext model catalog

See all Flux Kontext variants, pricing, and API docs.

Flux Kontext models →

Try Flux Kontext in OpenClaw today.

Get a free RunAPI key, paste the prompt into OpenClaw, and start generating images with Flux Kontext.