HERMES + GROK IMAGINE

在 Hermes Agent 中使用 Grok Imagine。

Grok Imagine 是 xAI 的圖像和影片生成套件——文字轉圖片、圖片轉圖片、文字轉影片和圖片轉影片。Hermes Agent 透過與聊天相同的 RunAPI 自訂 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 設定檔中設定 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。如需影片,以 grok-imagine-text-to-video 使用 text_to_video。

text_to_image
3

取得結果

API 立即返回 task_id。輪詢 task status 端點直到狀態變為 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、產品預告或內容營銷。

創意項目角色生成

通過詳細文本提示,以寫實或動漫風格生成一致的角色設計,用於遊戲、故事或品牌項目。

FAQ

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 生成圖像和影片。