---
title: &quot;通过 RunAPI 在爱马仕 (Hermes Agent) 中使用 Flux 2 — 图像 API 指南&quot;
url: &quot;https://runapi.ai/zh-CN/hermes-flux-2.md&quot;
canonical: &quot;https://runapi.ai/zh-CN/hermes-flux-2&quot;
locale: &quot;zh-CN&quot;
model: &quot;flux-2&quot;
---

# 在 Hermes Agent 中使用 Flux 2。

Black Forest Labs 的 Flux 2 提供两个质量层级——Pro 以每张 5 美分实现快速生成，Flex 以 14 美分提供更高保真度。两者都支持文生图和多源 remix，分辨率可选 1k 或 2k。Hermes Agent 通过 custom:runapi 提供商调用它——使用与聊天相同的密钥和 base URL。

## 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-2-pro-text-to-image&quot;,
    &quot;prompt&quot;: &quot;a ceramic vase with dried flowers on a linen tablecloth, natural window light, 35mm film grain&quot;,
    &quot;aspect_ratio&quot;: &quot;3:4&quot;,
    &quot;output_resolution&quot;: &quot;2k&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;flux-2-pro-text-to-image&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 Flux 2 image generation — no extra configuration needed.
2. **Call Flux 2** — Send a POST request to the text_to_image endpoint with model set to flux-2-pro-text-to-image. Include a prompt, and optionally set aspect_ratio (1:1, 4:3, 16:9, etc.) and output_resolution (1k or 2k). For multi-source remixing, use the remix_image endpoint with source_image_urls instead.
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. RunAPI SDKs and the CLI handle polling automatically.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. flux-2-pro-text-to-image, flux-2-flex-text-to-image, flux-2-pro-remix-image, or flux-2-flex-remix-image. |
| `prompt` | `string` | Text description of the image to generate. |
| `aspect_ratio` | `string` | Optional. Output aspect ratio: 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, or 2:3. Remix endpoints also accept auto. |
| `output_resolution` | `string` | Optional. 1k (default) or 2k. Higher resolution costs more per image. |
| `source_image_urls` | `array` | Required for remix_image. Array of source image URLs to blend or transform. |
| `callback_url` | `string` | Optional. Webhook URL for async completion notification. |

## FAQ

### What is the difference between Flux 2 Pro and Flux 2 Flex?

Pro is the faster, more affordable tier at 5 cents per 1k image. Flex produces higher-fidelity output at 14 cents per 1k image. Both share the same API parameters and support text_to_image and remix_image endpoints through the custom:runapi provider.

### What hardware does Flux 2 local inference require?

You do not need local hardware. Hermes Agent calls Flux 2 through the RunAPI API -- all GPU inference runs server-side. No VRAM requirements, no ComfyUI setup, no model downloads. The FP8 quantized local version needs 24GB+ VRAM, but the RunAPI endpoint removes that requirement entirely.

### Does Flux 2 output resolution affect pricing?

Yes. Each variant bills per image with resolution-based pricing. For example, Flux 2 Pro costs 5 cents at 1k and 7 cents at 2k. Flux 2 Flex costs 14 cents at 1k and 24 cents at 2k. Check the RunAPI pricing page for current rates.

### Do I need a separate provider config for Flux 2 image generation?

No. The custom:runapi provider you configured for chat already works for Flux 2 and all other RunAPI models. The same RUNAPI_API_KEY, base_url, and provider name handle LLM, image, video, and music requests.

### How does Flux 2 compare to Flux Kontext on RunAPI?

Flux Kontext specializes in text-guided editing with a single input image and character consistency. Flux 2 focuses on text-to-image generation and multi-source remixing with selectable Pro/Flex quality tiers and 1k/2k resolution options. Both are by Black Forest Labs and share the same RunAPI key and billing.

### How does Hermes Agent switch between Flux 2 Pro and Ultra tiers?

Set the model parameter to the Pro or Ultra slug in your request. Hermes Agent can dynamically select the tier based on task requirements — Pro for speed and cost, Ultra for maximum quality — through the same custom:runapi provider.

### Can Hermes Agent chain Flux 2 with editing or upscaling models?

Yes. Hermes Agent can generate an image with Flux 2, refine it with Flux Kontext for targeted edits, and upscale with Topaz or Recraft — all within a single agent workflow through the custom:runapi provider.


## Links

- [Hermes Agent 配置指南 →](https://runapi.ai/zh-CN/hermes-agent)
- [Flux 2 模型 →](https://runapi.ai/zh-CN/models/flux-2)
- [Model catalog](https://runapi.ai/zh-CN/models)
- [API docs](https://runapi.ai/zh-CN/docs)
