Use Imagen 4 in Hermes Agent.
Imagen 4 is Google DeepMind's image generation model with accurate text rendering and high prompt fidelity. Hermes Agent calls it through the same RunAPI custom provider endpoint you use for chat — no ComfyUI or GPU setup needed.
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"
}
Use Imagen 4 in Hermes Agent in three steps
Configure RunAPI
Set the RUNAPI_API_KEY environment variable. If you already configured RunAPI as a custom:runapi provider in Hermes Agent for chat, the same key and base_url work for image generation.
export RUNAPI_API_KEY=runapi_xxx
Call Imagen 4
Send a POST request to the text_to_image endpoint with model set to imagen-4. Include a descriptive prompt. Add aspect_ratio or negative_prompt as needed.
POST /v1/text_to_image
Get the result
The response includes a task_id. Poll the task status endpoint until status changes to completed. The finished response contains the generated image URL.
task_id: tsk_abc123
Imagen 4 API parameters
| Parameter | Type | Description |
|---|---|---|
model |
string |
Required. imagen-4, imagen-4-fast, or imagen-4-ultra. |
prompt |
string |
Text description of the desired image. |
aspect_ratio |
string |
Optional. E.g. 1:1, 16:9, 9:16. |
negative_prompt |
string |
Optional. What to avoid in the generated image. |
What is Imagen 4 on Hermes Agent?
Imagen 4 by Google DeepMind ranks near the top in head-to-head comparisons with cleaner text and stricter prompt following than most competitors. Its three-tier system (Fast, Standard, Ultra) lets you pick the cost-quality tradeoff per image rather than committing to one quality level for everything. Hermes Agent calls it through the RunAPI custom provider -- no Vertex AI project or GCP account required.
Imagen 4 use cases
Team-friendly image generation
Non-technical team members can tweak prompts and generate usable images with Imagen 4's strict prompt following -- it does what you ask without needing prompt engineering expertise.
Adventurous and editorial photography
Generate editorial-quality photography -- landscapes, food, architecture, lifestyle -- with accurate lighting, depth of field, and natural color grading.
Cost-optimized batch generation
Mix tiers within a single workflow -- Fast for draft rounds at $0.02 per image, Ultra for final selects -- keeping batch costs low without sacrificing final output quality.
Imagen 4 + Hermes Agent questions
Yes. Hermes Agent calls Imagen 4 through the RunAPI text_to_image endpoint. Set the model field to imagen-4 and send the request with the same RUNAPI_API_KEY you configured for the custom:runapi provider. No ComfyUI or GPU rental required.
No. The same RUNAPI_API_KEY works for all 113+ models across chat, image, video, and music. One key, one billing account.
Fast is for draft iterations and concept exploration where speed and cost matter more than detail. Standard is the default for production work. Ultra produces the highest-detail output for hero images or print-quality assets. All three use the same prompt format -- just change the model slug.
Imagen 4 has relatively strict content filters that can sometimes flag innocuous prompts. If a generation is rejected, rephrase to be more explicit about the intended context. The filters are most sensitive around people and brand imagery.
Hermes Agent general setup
Not configured yet? Start with the RunAPI setup guide for Hermes Agent.
Hermes Agent setup guide →Try Imagen 4 in Hermes Agent today.
Get a free RunAPI key, configure the custom:runapi provider, and start generating images with Google Imagen 4.