Hermes Agent で Grok Imagine を使う。
Grok Imagine は xAI の画像・動画生成スイートです。テキストから画像、画像から画像、テキストから動画、画像から動画に対応しています。Hermes Agent はチャットで使用している RunAPI カスタムプロバイダーと API キーを通じて呼び出します。追加プラグインは不要です。
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"
}
3 ステップで Hermes Agent で Grok Imagine を使う
RunAPI を設定する
シェルプロファイルに RUNAPI_API_KEY 環境変数を設定します。Hermes Agent でチャット用に custom:runapi プロバイダーが設定済みであれば、同じキーで Grok Imagine が使えます。追加セットアップは不要です。
export RUNAPI_API_KEY=runapi_xxx
Grok Imagine を呼び出す
model を grok-imagine-text-to-image に設定してプロンプトを含めた POST リクエストを text_to_image エンドポイントに送ります。動画の場合は grok-imagine-text-to-video で text_to_video を使います。
text_to_image
結果を取得する
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生成プロダクト写真
テキスト説明からECサイトのリスト・カタログ・広告キャンペーン向けのプロダクト写真を生成し、実物撮影が不要になります。
同期音声付き動画クリップ
テキストプロンプトからマッチした音声付きの短編動画を生成し、SNS Reels・プロダクトティーザー・コンテンツマーケティングに活用します。
クリエイティブプロジェクト向けキャラクター生成
詳細なテキストプロンプトからリアルまたはアニメスタイルで一貫したキャラクターデザインを生成し、ゲーム・物語・ブランドプロジェクトに使用します。
Grok Imagine + Hermes Agent よくある質問
はい。Hermes Agent に RunAPI がカスタムプロバイダー(custom:runapi)として設定済みであれば、同じ API キーと base_url で Grok Imagine が使えます。model を grok-imagine-text-to-image に設定して text_to_image エンドポイントを呼び出します。
いいえ。チャットや他のモデルで使用している RUNAPI_API_KEY が Grok Imagine でもそのまま使えます。1 つのキーで RunAPI カタログの 113 以上のモデルすべてを利用できます。
非同期です。API は即座に task_id を返します。タスクが完了するまでタスクステータスエンドポイントをポーリングします。RunAPI SDK と CLI は自動的にポーリングを処理します。
Grok Imagine は RunAPI 経由でタスクごとの課金です。現在の料金は RunAPI 料金ページで確認してください。生成に失敗した場合は課金されません。
Hermes Agent 全般セットアップ
まだ設定していませんか?Hermes Agent の RunAPI セットアップガイドから始めてください。
Hermes Agent セットアップガイド →今すぐ Hermes Agent で Grok Imagine を試す。
無料の RunAPI キーを取得し、custom:runapi プロバイダーを設定して、xAI Grok Imagine で画像・動画生成を始めましょう。