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

# Use Flux Kontext in Hermes Agent.

Flux Kontext by Black Forest Labs handles text-guided image editing and generation with character consistency. Hermes Agent calls it through RunAPI using the custom:runapi provider — same key and base URL you configured for chat.

## 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 added RunAPI as a custom:runapi provider in Hermes Agent for chat, the same key and base_url work for image generation — no extra configuration 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 Hermes Agent?

Yes. Configure RunAPI as a custom:runapi provider in Hermes Agent, 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.

### How does Hermes Agent handle Flux Kontext&#39;s editing workflow?

Hermes Agent sends the source image URL and editing instructions to the RunAPI Flux Kontext endpoint. The agent can chain multiple edits in sequence, passing each output as input to the next step for iterative refinement.

### How do I maintain character identity when editing with Flux Kontext?

Pass the character image as image_url and describe only what you want to change in the prompt. Flux Kontext preserves facial features and proportions by default -- you do not need special tokens or reference IDs. For multi-step edits, pass the previous output as the new image_url each time.

### Can Flux Kontext replace text on signs and labels in existing images?

Yes. Pass the image containing the sign or label as image_url and describe the text change in the prompt -- for example, &quot;change the shop sign to read BAKERY.&quot; Flux Kontext renders the new text in the position and style of the original, which is useful for localization and mockup workflows.

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

Dev Pro is faster and cheaper, suitable for most editing and generation tasks. Max produces higher-fidelity output with better detail on complex compositions. Both share the same API parameters and editing capabilities through the custom:runapi provider.


## Links

- [Hermes Agent setup guide →](https://runapi.ai/hermes-agent)
- [Flux Kontext models →](https://runapi.ai/models/flux-kontext)
- [Model catalog](https://runapi.ai/models)
- [API docs](https://runapi.ai/docs)
