---
title: &quot;Use Flux Kontext in OpenClaw via RunAPI — Image API Guide&quot;
url: &quot;https://runapi.ai/openclaw-flux-kontext.md&quot;
canonical: &quot;https://runapi.ai/openclaw-flux-kontext&quot;
locale: &quot;en&quot;
model: &quot;flux-kontext&quot;
---

# 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.

## API example

```bash
curl -X POST https://runapi.ai/v1/text_to_image \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;flux-kontext-pro&quot;,
    &quot;prompt&quot;: &quot;a matte-black water bottle on a beige stone surface, soft side light, studio photography&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;flux-kontext-pro&quot;
}

```

## How it works

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.
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.
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.

## 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. |

## FAQ

### Can I use Flux Kontext in OpenClaw?

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.

### Do I need a separate API key for Flux Kontext?

No. The same RUNAPI_API_KEY works for all RunAPI models — LLM, image, video, and music. One key, one billing account.

### Is Flux Kontext async or sync?

Async. The API returns a task ID immediately. Poll the task status endpoint or use a webhook callback to receive the completed image URL.

### What does Flux Kontext cost?

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.

### Can Flux Kontext edit text directly in images?

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 &quot;change the sign text to OPEN&quot; in the prompt. The model renders the new text in the same position and style as the original.

### What is the difference between Kontext Dev Pro and Max?

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.


## Links

- [OpenClaw setup guide →](https://runapi.ai/openclaw)
- [Flux Kontext models →](https://runapi.ai/models/flux-kontext)
- [Model catalog](https://runapi.ai/models)
- [API docs](https://runapi.ai/docs)
