在 Hermes Agent 中使用 Recraft。
Recraft 提供清晰的神经网络图像超分,可在无伪影的情况下恢复精细细节,并提供精确的背景移除,保留发丝和透明边缘。Hermes Agent 通过与聊天相同的 RunAPI custom 提供商调用这两个端点——发送源图像 URL,选择超分或背景移除,然后轮询获取处理后的结果。
使用 RunAPI 通过 Recraft crisp upscale 放大图像。
要求:
- 使用 RUNAPI_API_KEY 环境变量进行身份验证。
- 使用 custom:runapi 提供商,base_url 为 https://runapi.ai/v1。
- 调用位于 https://runapi.ai/api/v1/recraft/upscale_image 的 RunAPI upscale_image 端点。
- 将 model 设置为 "recraft-crisp-upscale"。
- 在 source_image_url 中传入源图像 URL。
- 响应会返回一个 task_id。轮询任务状态端点直到任务完成,然后从结果中获取放大后的图像 URL。
- 如需背景移除,请改为调用 /api/v1/recraft/remove_background 并将 model 设为 "recraft-remove-background"。
curl -X POST https://runapi.ai/api/v1/recraft/upscale_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "recraft-crisp-upscale",
"source_image_url": "https://example.com/product-photo.jpg"
}'
{
"task_id": "tsk_abc123",
"status": "pending",
"model": "recraft-crisp-upscale"
}
三步在 Hermes Agent 中使用 Recraft
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.
export RUNAPI_API_KEY=runapi_xxx
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.
POST /api/v1/recraft/upscale_image
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.
GET /api/v1/recraft/upscale_image/tsk_abc123
Recraft API 参数
| 参数 | 类型 | 说明 |
|---|---|---|
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. |
Hermes Agent 上的 Recraft 是什么?
RunAPI 上的 Recraft 提供清晰的神经放大和精准的背景去除——两个将原始 AI 生成图像变为生产就绪资产的后处理步骤。Hermes Agent 通过与生成模型相同的 custom:runapi provider 调用两个端点,便于在单一工作流中串联生成和后处理。
Recraft 使用场景
生成转生产就绪资产流水线
先用 Flux 2 或 Imagen 4 生成图像,再用 Recraft 放大到高分辨率、去除背景,在 Hermes Agent 的单一工作流中完成,无需桌面工具。
电商目录的批量处理
以自动化方式对整个产品目录应用背景去除和神经放大,Hermes Agent 并行调度各任务并收集结果。
面向设计交付物的标志放大
对低分辨率标志进行放大,用于大幅印刷、展示横幅或视频叠加,通过 Recraft 的神经放大保留边缘清晰度。
Recraft + Hermes Agent 常见问题
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.
Recraft accepts JPEG, PNG, and WebP inputs. Background removal outputs PNG with alpha transparency. Upscale output matches the input format.
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.
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.
Yes. Hermes Agent can loop over a list of image URLs and call Recraft's background removal or upscale endpoint for each one, collecting all processed images when the batch completes.