Hermes Agent で Imagen 4 を使う。
Imagen 4 は Google DeepMind の画像生成モデルで、正確なテキスト描画と高いプロンプト忠実度を誇ります。Hermes Agent はチャットで使用している RunAPI カスタムプロバイダーエンドポイントを通じて呼び出します。ComfyUI や GPU セットアップは不要です。
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"
}
3 ステップで Hermes Agent で Imagen 4 を使う
RunAPI を設定する
RUNAPI_API_KEY 環境変数を設定します。Hermes Agent でチャット用に RunAPI を custom:runapi プロバイダーとして設定済みであれば、同じキーと base_url で画像生成が可能です。
export RUNAPI_API_KEY=runapi_xxx
Imagen 4 を呼び出す
model を imagen-4 に設定して text_to_image エンドポイントに POST リクエストを送ります。説明的なプロンプトを含め、必要に応じて aspect_ratio や negative_prompt を追加します。
POST /v1/text_to_image
結果を取得する
レスポンスには 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は横断比較でトップクラスにランクされ、テキストレンダリングがクリアで多くの競合製品よりプロンプト追従性が高いです。3段階システム(Fast・Standard・Ultra)により画像ごとにコストと品質のトレードオフを選択できます。Hermes AgentはRunAPI custom provider経由で呼び出し、Vertex AIプロジェクトやGCPアカウントは不要です。
Imagen 4の活用例
チームに優しい画像生成
Imagen 4の高いプロンプト追従性により、非技術系メンバーがプロンプトを調整して使える画像を生成でき、プロンプトエンジニアリングの専門知識は不要です。
冒険的・エディトリアル写真
正確なライティング・被写界深度・自然な色調でエディトリアル品質の写真——風景・料理・建築・ライフスタイル——を生成します。
コスト最適化されたバッチ生成
単一ワークフロー内でティアを混在させ——下書きラウンドはFast(1枚$0.02)、最終選択はUltra——最終出力品質を犠牲にせずバッチコストを抑えます。
Imagen 4 + Hermes Agent よくある質問
はい。Hermes Agent は RunAPI の text_to_image エンドポイントを通じて Imagen 4 を呼び出します。model フィールドを imagen-4 に設定し、custom:runapi プロバイダーに設定済みの RUNAPI_API_KEY でリクエストを送ります。ComfyUI や GPU レンタルは不要です。
いいえ。同じ RUNAPI_API_KEY でチャット、画像、動画、音楽を含む 113 以上のモデルすべてが利用できます。1 つのキー、1 つの請求アカウントです。
Imagen 4 は非同期です。最初のリクエストは status が pending の task_id を返します。タスクが完了するまでタスクステータスエンドポイントをポーリングし、レスポンスから画像 URL を取得します。RunAPI SDK は自動的にポーリングを処理します。
Imagen 4 の料金は月額最低料金なしの従量制です。コストはティアによって異なります:imagen-4-fast が最も安く、imagen-4 が標準、imagen-4-ultra が最高品質です。現在の 1 枚あたりの料金は RunAPI 料金ページで確認してください。
Hermes Agent 全般セットアップ
まだ設定していませんか?Hermes Agent の RunAPI セットアップガイドから始めてください。
Hermes Agent セットアップガイド →今すぐ Hermes Agent で Imagen 4 を試す。
無料の RunAPI キーを取得し、custom:runapi プロバイダーを設定して、Google Imagen 4 で画像生成を始めましょう。