---
title: &quot;通过 RunAPI 在爱马仕 (Hermes Agent) 中使用 Recraft — 超分与背景移除&quot;
url: &quot;https://runapi.ai/zh-CN/hermes-recraft.md&quot;
canonical: &quot;https://runapi.ai/zh-CN/hermes-recraft&quot;
locale: &quot;zh-CN&quot;
model: &quot;recraft&quot;
---

# 在 Hermes Agent 中使用 Recraft。

Recraft 提供清晰的神经网络图像超分，可在无伪影的情况下恢复精细细节，并提供精确的背景移除，保留发丝和透明边缘。Hermes Agent 通过与聊天相同的 RunAPI custom 提供商调用这两个端点——发送源图像 URL，选择超分或背景移除，然后轮询获取处理后的结果。

## API example

```bash
curl -X POST https://runapi.ai/api/v1/recraft/upscale_image \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;recraft-crisp-upscale&quot;,
    &quot;source_image_url&quot;: &quot;https://example.com/product-photo.jpg&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;recraft-crisp-upscale&quot;
}

```

## How it works

1. **Configure RunAPI** — If you have not set up RunAPI in Hermes Agent yet, follow the Hermes Agent setup guide. Add a custom provider named runapi with base_url https://runapi.ai/v1, key_env RUNAPI_API_KEY, and api_mode chat_completions.
2. **Call Recraft upscale or remove background** — Send a POST request to the upscale_image endpoint with model set to recraft-crisp-upscale and provide the source_image_url. For background removal, POST to the remove_background endpoint with model recraft-remove-background instead. Both require only source_image_url.
3. **Poll for the result** — Both endpoints return a task_id with status pending. Poll the task status endpoint until the status changes to completed, then retrieve the processed image URL from the response. RunAPI SDKs and the CLI handle polling automatically.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. recraft-crisp-upscale for upscaling, recraft-remove-background for background removal. |
| `source_image_url` | `string` | Required. URL of the source image to process. |
| `callback_url` | `string` | Optional. Webhook URL for async completion notification. |

## FAQ

### Can I chain Recraft background removal and upscaling in one Hermes Agent workflow?

Yes. Both endpoints are stateless and accept standard image URLs. Instruct the Hermes Agent to first call remove_background with the original image, then pass the output URL to upscale_image. The same custom:runapi provider handles both calls.

### What image formats does Recraft accept and output?

Recraft accepts JPEG, PNG, and WebP inputs. Background removal outputs PNG with alpha transparency. Upscale output matches the input format.

### How do I switch between upscale and background removal in Hermes Agent?

Change the endpoint path and model field. Use /api/v1/recraft/upscale_image with model recraft-crisp-upscale for upscaling, or /api/v1/recraft/remove_background with model recraft-remove-background for background removal. Both use the same API key and custom:runapi provider.

### How does Hermes Agent select between Recraft&#39;s upscale and background removal endpoints?

Specify the endpoint action in your request — use the upscale endpoint for resolution enhancement or the background_removal endpoint for subject extraction. Hermes Agent routes each request to the correct Recraft action through the custom:runapi provider.

### Can Hermes Agent process a batch of images through Recraft in one workflow?

Yes. Hermes Agent can loop over a list of image URLs and call Recraft&#39;s background removal or upscale endpoint for each one, collecting all processed images when the batch completes.


## Links

- [Hermes Agent 配置指南 →](https://runapi.ai/zh-CN/hermes-agent)
- [Recraft 模型 →](https://runapi.ai/zh-CN/models/recraft)
- [Model catalog](https://runapi.ai/zh-CN/models)
- [API docs](https://runapi.ai/zh-CN/docs)
