HERMES + GROK IMAGINE

在 Hermes Agent 中使用 Grok Imagine。

Grok Imagine 是 xAI 的图像和视频生成套件——文生图、图生图、文生视频和图生视频。Hermes Agent 通过与聊天相同的 RunAPI custom provider 和 API key 调用它,无需安装额外插件。

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

Requirements:
- Use the RunAPI API at https://runapi.ai/v1/text_to_image.
- Read the API key from RUNAPI_API_KEY environment variable.
- Use the custom:runapi provider already configured in Hermes Agent.
- Set the model to "grok-imagine-text-to-image".
- Write a descriptive prompt for the image you want.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the output URL.
curl -X POST https://runapi.ai/v1/text_to_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-text-to-image",
    "prompt": "a robot hand placing a chess piece on a board, dramatic side lighting, slow motion feel"
  }'
{
  "task_id": "tsk_abc123",
  "status": "pending",
  "model": "grok-imagine-text-to-image"
}
复制 curl 命令进行测试 grok-imagine
工作原理

三步在 Hermes Agent 中使用 Grok Imagine

1

配置 RunAPI

在 shell profile 中设置 RUNAPI_API_KEY 环境变量。如果 Hermes Agent 中已配置 custom:runapi provider 用于聊天,同一个 key 也适用于 Grok Imagine,无需额外配置。

export RUNAPI_API_KEY=runapi_xxx
2

调用 Grok Imagine

向 text_to_image 端点发送 POST 请求,将 model 设为 grok-imagine-text-to-image,并附上描述图像的 prompt。视频生成请使用 text_to_video 和 grok-imagine-text-to-video。

text_to_image
3

获取结果

API 立即返回 task_id。轮询任务状态端点,直到状态变为 completed,然后从响应中获取输出图像或视频 URL。

task_id: tsk_abc123
参数

Grok Imagine API 参数

参数 类型 说明
model string 必填。例如 grok-imagine-text-to-image、grok-imagine-image-to-video。
prompt string 对所需输出的文字描述。
image_url string 图生图或图生视频的源图像 URL。
aspect_ratio string 可选。输出宽高比,例如 16:9、1:1。

Hermes Agent 上的 Grok Imagine 是什么?

Grok Imagine(Aurora)是 xAI 的图像和视频生成器,涵盖文生图、图像编辑以及带音频同步的文生视频。Hermes Agent 通过 custom:runapi provider 调用它,便于将 Grok Imagine 的输出与其他 RunAPI 模型组合——例如先生成产品图,再传给视频模型制作动态内容。

Grok Imagine 使用场景

AI 产品图

根据文字描述生成电商列表、产品目录或广告投放所需的产品摄影图,无需实体拍摄。

带同步音频的视频片段

根据文本提示生成带匹配音频的短视频,用于社交媒体 Reels、产品预告或内容营销。

创意项目角色生成

通过详细文本提示,以写实或动漫风格生成一致的角色设计,用于游戏、故事或品牌项目。

常见问题

Grok Imagine + Hermes Agent 常见问题

Hermes Agent 通用配置

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

Hermes Agent 配置指南 →

Grok Imagine 模型目录

查看所有 Grok Imagine 变体、价格和 API 文档。

Grok Imagine 模型 →

立即在 Hermes Agent 中试用 Grok Imagine。

获取免费 RunAPI key,配置 custom:runapi provider,开始使用 xAI Grok Imagine 生成图像和视频。