---
title: &quot;Use Grok Imagine in Hermes Agent via RunAPI — Image &amp; Video API Guide&quot;
url: &quot;https://runapi.ai/hermes-grok-imagine.md&quot;
canonical: &quot;https://runapi.ai/hermes-grok-imagine&quot;
locale: &quot;en&quot;
model: &quot;grok-imagine&quot;
---

# Use Grok Imagine in Hermes Agent.

Grok Imagine is xAI&#39;s image and video generation suite — text-to-image, image-to-image, text-to-video, and image-to-video. Hermes Agent calls it through the same RunAPI custom provider and API key used for chat, with no extra plugins to install.

## API example

```bash
curl -X POST https://runapi.ai/v1/text_to_image \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;grok-imagine-text-to-image&quot;,
    &quot;prompt&quot;: &quot;a robot hand placing a chess piece on a board, dramatic side lighting, slow motion feel&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;grok-imagine-text-to-image&quot;
}

```

## How it works

1. **Configure RunAPI** — Set the RUNAPI_API_KEY environment variable in your shell profile. If the custom:runapi provider is already configured in Hermes Agent for chat, the same key works for Grok Imagine — no additional setup needed.
2. **Call Grok Imagine** — Send a POST request to the text_to_image endpoint with the model set to grok-imagine-text-to-image. Include your prompt describing the image. For video, use text_to_video with grok-imagine-text-to-video.
3. **Get the result** — The API returns a task_id immediately. Poll the task status endpoint until the status changes to completed, then retrieve the output image or video URL from the response.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. E.g. grok-imagine-text-to-image, grok-imagine-image-to-video. |
| `prompt` | `string` | Text description of the desired output. |
| `image_url` | `string` | Source image URL for image-to-image or image-to-video. |
| `aspect_ratio` | `string` | Optional. Output aspect ratio, e.g. 16:9, 1:1. |

## FAQ

### Can I use Grok Imagine in Hermes Agent?

Yes. If RunAPI is already configured as a custom provider (custom:runapi) in Hermes Agent, the same API key and base_url work for Grok Imagine. Set the model to grok-imagine-text-to-image and call the text_to_image endpoint.

### Is Grok Imagine still free, or do I need a paid plan?

Through RunAPI, Grok Imagine uses pay-per-task billing -- no Grok subscription or SuperGrok plan required. You pay only for completed generations from your RunAPI credit balance.

### How do I configure Hermes Agent to use Grok Imagine endpoints?

Set the custom:runapi provider with base_url https://runapi.ai/v1 and your RUNAPI_API_KEY in the Hermes Agent config. Once configured, Hermes can call any Grok Imagine endpoint (text-to-image, image-to-image, text-to-video) through RunAPI.

### Can Hermes Agent run Grok Imagine alongside other image models in one workflow?

Yes. Hermes Agent supports multi-model workflows. You can use Grok Imagine for initial generation, then pass the output to Recraft for upscaling or Flux Kontext for editing, all within the same agent run.


## Links

- [Hermes Agent setup guide →](https://runapi.ai/hermes-agent)
- [Grok Imagine models →](https://runapi.ai/models/grok-imagine)
- [Model catalog](https://runapi.ai/models)
- [API docs](https://runapi.ai/docs)
