HERMES + IMAGEN 4

在 Hermes Agent 中使用 Imagen 4。

Imagen 4 是 Google DeepMind 的图像生成模型,具有精准的文字渲染和高 prompt 保真度。Hermes Agent 通过与聊天相同的 RunAPI custom provider 端点调用它,无需 ComfyUI 或 GPU 配置。

一个 API key · 文生图端点 · 异步任务轮询
Use RunAPI to generate an image with Google Imagen 4 from Hermes Agent.

Requirements:
- Read the API key from RUNAPI_API_KEY. Do not hardcode the key.
- Use the custom:runapi provider already configured in Hermes Agent.
- Send a POST request to https://runapi.ai/v1/text_to_image.
- Set the model to imagen-4.
- Write a descriptive prompt for the image you want.
- The response returns a task_id. Poll the task status endpoint until the task completes.
- When the task is complete, retrieve the image URL from the response.
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "imagen-4",
    "prompt": "A ceramic coffee mug on a wooden table with morning light, the text HELLO printed on the side in serif font, photorealistic"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "imagen-4"
}
复制 curl 命令进行测试 imagen-4
工作原理

三步在 Hermes Agent 中使用 Imagen 4

1

配置 RunAPI

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

export RUNAPI_API_KEY=runapi_xxx
2

调用 Imagen 4

向 text_to_image 端点发送 POST 请求,将 model 设为 imagen-4,并附上描述性 prompt。按需添加 aspect_ratio 或 negative_prompt。

POST /v1/text_to_image
3

获取结果

响应包含一个 task_id。轮询任务状态端点,直到状态变为 completed。完成后的响应包含生成的图像 URL。

task_id: tsk_abc123
参数

Imagen 4 API 参数

参数 类型 说明
model string 必填。imagen-4、imagen-4-fast 或 imagen-4-ultra。
prompt string 对所需图像的文字描述。
aspect_ratio string 可选。例如 1:1、16:9、9:16。
negative_prompt string 可选。生成图像中需要避免的内容。

Hermes Agent 上的 Imagen 4 是什么?

Google DeepMind 的 Imagen 4 在横向对比中排名靠前,文字渲染更清晰,提示词遵从度优于多数竞品。其三档系统(Fast、Standard、Ultra)让你可以按图像选择成本与质量的权衡。Hermes Agent 通过 RunAPI custom provider 调用它——无需 Vertex AI 项目或 GCP 账户。

Imagen 4 使用场景

团队友好的图像生成

非技术团队成员可通过 Imagen 4 出色的提示词遵从性调整提示词并生成可用图像,无需提示词工程专业知识。

冒险与编辑风摄影

生成编辑质量的摄影作品——风景、美食、建筑、生活方式——光线、景深和自然色调调色精准。

成本优化的批量生成

在单一工作流中混合使用不同档位——起草阶段用 Fast(每张 $0.02),最终精选用 Ultra——在不牺牲最终输出质量的前提下控制批量成本。

常见问题

Imagen 4 + Hermes Agent 常见问题

Hermes Agent 通用配置

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

Hermes Agent 配置指南 →

Imagen 4 模型目录

查看所有 Imagen 4 变体、价格和 API 文档。

Imagen 4 模型 →

立即在 Hermes Agent 中试用 Imagen 4。

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