HERMES + FLUX KONTEXT

在 Hermes Agent 中使用 Flux Kontext。

Flux Kontext 由 Black Forest Labs 出品,支持文字引导的图像编辑和生成,并保持角色一致性。Hermes Agent 通过 RunAPI 的 custom:runapi provider 调用它,与聊天使用相同的 key 和 base URL。

一个 API key · 文生图端点 · 异步任务轮询
Use RunAPI to generate an image with Flux Kontext Pro through Hermes Agent.

Requirements:
- Use the custom:runapi provider already configured in Hermes Agent
- Call the RunAPI text_to_image endpoint at https://runapi.ai/v1/text_to_image
- Set model to "flux-kontext-pro"
- The RUNAPI_API_KEY environment variable provides 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"
}
复制 curl 命令进行测试 flux-kontext
工作原理

三步在 Hermes Agent 中使用 Flux Kontext

1

配置 RunAPI

设置 RUNAPI_API_KEY 环境变量。如果你已经在 Hermes Agent 中将 RunAPI 配置为 custom:runapi provider 用于聊天,同一个 key 和 base_url 也适用于图像生成,无需额外配置。

export RUNAPI_API_KEY=runapi_xxx
2

调用 Flux Kontext

向 text_to_image 端点发送 POST 请求,将 model 设为 flux-kontext-pro,并附上描述所需图像的文字 prompt。如需上下文内编辑,可选填 image_url。

text_to_image
3

获取结果

端点返回一个任务 ID。轮询任务状态端点,直到状态变为 completed,然后从响应中获取生成的图像 URL。

task_id: tsk_abc123
参数

Flux Kontext API 参数

参数 类型 说明
model string 必填。flux-kontext-pro 或 flux-kontext-max。
prompt string 用于生成或编辑的文字指令。
image_url string 用于上下文内编辑的源图像 URL。
aspect_ratio string 可选。输出宽高比。

Hermes Agent 上的 Flux Kontext 是什么?

Flux Kontext 是 Black Forest Labs 基于 120 亿参数整流流变换器构建的指令式图像编辑器,支持多轮编辑——可以依序进行多次修改,模型在每一步都保留上一步的上下文。Hermes Agent 通过 RunAPI 自定义 provider 端点调用它,便于构建多步骤编辑流水线。

Flux Kontext 使用场景

多轮编辑工作流

依次链接多个编辑步骤——生成图像、调整光线、替换背景、添加文字——每一步在上一步结果的基础上继续。

风格转换流水线

在保留被摄对象构图的前提下将照片转换为油画、素描或动漫风格,用于同一内容的风格变体创作。

天气与光线调整

无需从头重新生成整个场景,即可修改现有照片中的时间、天气或光线设置。

常见问题

Flux Kontext + Hermes Agent 常见问题

Hermes Agent 通用配置

还没配置?从 Hermes Agent 的 RunAPI 配置指南开始。

Hermes Agent 配置指南 →

Flux Kontext 模型目录

查看所有 Flux Kontext 变体、价格和 API 文档。

Flux Kontext 模型 →

立即在 Hermes Agent 中试用 Flux Kontext。

获取免费 RunAPI key,配置 custom:runapi provider,开始使用 Flux Kontext 生成图像。