HERMES + QWEN 2 IMAGE

在 Hermes Agent 中使用 Qwen 2 Image。

Qwen 2 Image 是阿里巴巴的图像生成和编辑模型。Hermes Agent 通过 RunAPI custom provider 端点调用它——发送 prompt,获取图像 URL。通过三种模型变体支持文生图、图像编辑和图像重混。

一个 API key · 文生图端点 · 异步任务轮询
Use RunAPI to generate an image with Qwen 2 Image.

Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/api/v1/task/text_to_image.
- Set the model to "qwen-2-text-to-image".
- Read the API key from the RUNAPI_API_KEY environment variable.
- Use the custom:runapi provider configured in Hermes Agent.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the image URL from the output.
- For image editing, use model "qwen-2-edit-image" and include an image_url field.
- For remixing, use model "qwen-2-remix-image" and include an image_url field.
curl -X POST https://runapi.ai/api/v1/task/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-2-text-to-image",
    "prompt": "A traditional Chinese ink painting of misty mountains at dawn, elegant brushwork"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "qwen-2-text-to-image"
}
复制 curl 命令进行测试 qwen-2
工作原理

三步在 Hermes Agent 中使用 Qwen 2 Image

1

配置 RunAPI

设置 RunAPI API key 为环境变量。如果你尚未在 Hermes Agent 中添加 RunAPI 作为 custom provider,请参考 Hermes Agent 配置指南,使用 base_url https://runapi.ai/v1 添加 custom:runapi。

export RUNAPI_API_KEY=runapi_xxx
2

调用 Qwen 2 Image

将 prompt 粘贴到 Hermes Agent,或直接调用 text_to_image 端点。将 model 字段设为 qwen-2-text-to-image(生成)、qwen-2-edit-image(编辑)或 qwen-2-remix-image(重混)。

text_to_image
3

获取结果

端点返回任务 ID。轮询任务状态端点,直到状态变为 completed,然后从输出中读取图像 URL。RunAPI SDK 会自动处理轮询。

task_id: tsk_abc123
参数

Qwen 2 Image API 参数

参数 类型 说明
model string 必填。qwen-2-text-to-image、qwen-2-edit-image 或 qwen-2-remix-image。
prompt string 文字描述或编辑指令。
image_url string 编辑或重混模式的源图像。
size string 可选。输出尺寸。

Hermes Agent 上的 Qwen 2 Image 是什么?

Qwen 2 Image 是阿里巴巴的图像模型,通过单一 API 提供生成、编辑和混合创作三种模式。它能处理复杂的多对象场景,并原生理解中文、英文和混合语言提示词,特别适合多语言内容流水线。

Qwen 2 Image 使用场景

agent 工作流中的迭代图像编辑

在单次 Hermes Agent 运行中串联多个 Qwen 2 编辑步骤——先生成初始图像,再依次应用文字引导的修改,如替换背景、调整颜色或添加元素。

初创公司的低成本图像生成

将 Qwen 2 Image 作为高批量图像生成任务(产品效果图、社交媒体内容或开发阶段占位图)的经济实惠选择。

双语内容制作

无需翻译即可根据中英文提示词生成图像,在单一工作流中为双语营销活动或本地化产品页面产出视觉内容。

常见问题

Qwen 2 Image + Hermes Agent 常见问题

Hermes Agent 通用配置

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

Hermes Agent 配置指南 →

Qwen 2 Image 模型目录

查看所有 Qwen 2 Image 变体、价格和 API 文档。

Qwen 2 Image 模型 →

立即在 Hermes Agent 中试用 Qwen 2 Image。

获取免费 RunAPI key,将 prompt 粘贴到 Hermes Agent,开始生成。