Use Qwen 2 Image in Hermes Agent.
Qwen 2 Image is Alibaba'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.
Use RunAPI to generate an image with Qwen 2 Image.
Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/api/v1/task/text_to_image.
- Set the model to "qwen-2-text-to-image".
- Read the API key from the RUNAPI_API_KEY environment variable.
- Use the custom:runapi provider configured in Hermes Agent.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the image URL from the output.
- For image editing, use model "qwen-2-edit-image" and include an image_url field.
- For remixing, use model "qwen-2-remix-image" and include an image_url field.
curl -X POST https://runapi.ai/api/v1/task/text_to_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-2-text-to-image",
"prompt": "A traditional Chinese ink painting of misty mountains at dawn, elegant brushwork"
}'
{
"task_id": "tsk_abc123",
"status": "pending",
"model": "qwen-2-text-to-image"
}
Use Qwen 2 Image in Hermes Agent in three steps
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.
export RUNAPI_API_KEY=runapi_xxx
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.
text_to_image
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.
task_id: tsk_abc123
Qwen 2 Image API 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. |
What is Qwen 2 Image on Hermes Agent?
Qwen 2 Image is Alibaba's image model with three modes -- generation, editing, and remixing -- all through one API. Hermes Agent calls it through the custom:runapi provider. It handles complex multi-object scenes and understands prompts in Chinese, English, and mixed-language text natively, making it especially useful for multilingual content pipelines.
Qwen 2 Image use cases
Iterative image editing in agent workflows
Chain multiple Qwen 2 editing steps in one Hermes Agent run -- generate an initial image, then apply a series of text-guided changes like swapping backgrounds, adjusting colors, or adding elements.
Budget-friendly image generation for startups
Use Qwen 2 Image as a cost-effective alternative for high-volume image generation tasks like product mockups, social media content, or placeholder art during development.
Bilingual content production
Generate images from Chinese and English prompts without translation, producing visuals for bilingual marketing campaigns or localized product pages in a single workflow.
Qwen 2 Image + Hermes Agent questions
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.
Qwen 2 Image has native multilingual support from Alibaba'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.
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.
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.
Hermes Agent general setup
Not configured yet? Start with the RunAPI setup guide for Hermes Agent.
Hermes Agent setup guide →Qwen 2 Image model catalog
See all Qwen 2 Image variants, pricing, and API docs.
Qwen 2 Image models →Try Qwen 2 Image in Hermes Agent today.
Get a free RunAPI key, paste the prompt into Hermes Agent, and start generating.