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.
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"
}
Use Flux Kontext in OpenClaw in three steps
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
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
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
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.
Flux Kontext + OpenClaw questions
Yes. Configure RunAPI as an OpenAI-compatible provider in OpenClaw, then call the text_to_image endpoint with model set to flux-kontext-pro. The same RUNAPI_API_KEY you use for chat handles image generation.
No. The same RUNAPI_API_KEY works for all RunAPI models — LLM, image, video, and music. One key, one billing account.
Async. The API returns a task ID immediately. Poll the task status endpoint or use a webhook callback to receive the completed image URL.
Flux Kontext Pro starts at 2.5 cents per image. Flux Kontext Max costs more for higher fidelity. Check the RunAPI pricing page for current rates — billing is pay-as-you-go with no subscription.
Yes. You can replace text on signs, labels, and storefronts by describing the change in the prompt. Pass the original image as image_url and write something like "change the sign text to OPEN" in the prompt. The model renders the new text in the same position and style as the original.
Dev Pro is the faster, more affordable variant suitable for most editing tasks. Max produces higher-fidelity output with better detail preservation on complex edits. Both support the same editing features -- the difference is generation quality and cost per image.
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.