---
title: &quot;Use Qwen 2 Image in Hermes Agent via RunAPI — Image API Guide&quot;
url: &quot;https://runapi.ai/hermes-qwen-2.md&quot;
canonical: &quot;https://runapi.ai/hermes-qwen-2&quot;
locale: &quot;en&quot;
model: &quot;qwen-2&quot;
---

# Use Qwen 2 Image in Hermes Agent.

Qwen 2 Image is Alibaba&#39;s image generation and editing model. Hermes Agent calls it through the RunAPI custom provider endpoint — send a prompt, get an image URL. Supports text-to-image, image editing, and image remixing through three model variants.

## API example

```bash
curl -X POST https://runapi.ai/api/v1/task/text_to_image \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;qwen-2-text-to-image&quot;,
    &quot;prompt&quot;: &quot;A traditional Chinese ink painting of misty mountains at dawn, elegant brushwork&quot;
  }&#39;

```

### Response

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

```

## How it works

1. **Configure RunAPI** — Set your RunAPI API key as an environment variable. If you have not added RunAPI as a Hermes Agent custom provider yet, follow the Hermes Agent setup guide and add custom:runapi with base_url https://runapi.ai/v1.
2. **Call Qwen 2 Image** — Paste the prompt into Hermes Agent or call the text_to_image endpoint directly. Set the model field to qwen-2-text-to-image for generation, qwen-2-edit-image for editing, or qwen-2-remix-image for remixing.
3. **Get the result** — The endpoint returns a task ID. Poll the task status endpoint until the status changes to completed, then read the image URL from the output. RunAPI SDKs handle polling automatically.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. qwen-2-text-to-image, qwen-2-edit-image, or qwen-2-remix-image. |
| `prompt` | `string` | Text description or editing instruction. |
| `image_url` | `string` | Source image for edit or remix mode. |
| `size` | `string` | Optional. Output dimensions. |

## FAQ

### Can I use Qwen 2 Image in Hermes Agent?

Yes. Hermes Agent supports custom OpenAI-compatible providers. Add RunAPI as custom:runapi with base_url https://runapi.ai/v1, key_env set to RUNAPI_API_KEY, and api_mode set to chat_completions. Then call the text_to_image endpoint with model set to qwen-2-text-to-image.

### How does Qwen 2 compare to other image models for Chinese-language prompts?

Qwen 2 Image has native multilingual support from Alibaba&#39;s Qwen architecture, so it understands Chinese prompts without translation. Other models often require English prompts for best results. If your workflow involves Chinese text or bilingual content, Qwen 2 is a strong choice.

### How does Hermes Agent handle Qwen 2 Image&#39;s dual generation and editing modes?

Hermes Agent determines the mode based on your request. Send a text prompt alone for generation, or include an image URL with editing instructions for modification. The custom:runapi provider routes both request types to the correct Qwen 2 endpoint.

### Can I use Qwen 2 Image editing iteratively in a Hermes Agent workflow?

Yes. Hermes Agent can chain multiple Qwen 2 editing steps -- generate an initial image, then apply a series of text-guided modifications, each building on the previous output.


## Links

- [Hermes Agent setup guide →](https://runapi.ai/hermes-agent)
- [Qwen 2 Image models →](https://runapi.ai/models/qwen-2)
- [Model catalog](https://runapi.ai/models)
- [API docs](https://runapi.ai/docs)
