> ## Documentation Index
> Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Watermark Remover API：去除单张图片中的水印

> 单图像水印去除 API 用于图生图的清理，恢复干净的视觉效果，无需手动遮罩或修饰

## 概览

Image Watermark Remover 可去除单张图片上可见的文字或标志水印，并返回处理后图片的 URL。在 APIXO Playground 试用后，可以按本页示例调用 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `image-watermark-remover` |
| 模式 | `image-to-image` |
| 输入图像 | 恰好 1 个公共图像 URL |
| 输出格式 | `jpg`, `jpeg`, `png`, `webp` |
| 默认输出格式 | `jpg` |
| 结果交付 | 异步轮询或 webhook 回调 |

> [!TIP]
>
> 该模型固定为单图像图生图的工作流程。它不接受提示、蒙版、种子、分辨率控制或多个参考图像。

## 接口与身份验证

API 基础地址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/image-watermark-remover` | 提交去水印任务 |
| `GET` | `/statusTask/image-watermark-remover?taskId={taskId}` | 查询任务状态并获取结果 |

每个请求都必须携带 APIXO API 密钥：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

提交任务时，还需要设置以下请求头：

```http theme={null}
Content-Type: application/json
```

## 异步请求示例

这一最小请求提交一个图像清理任务并返回 `taskId`。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/image-watermark-remover" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "image_urls": [
        "https://example.com/photo-with-watermark.jpg"
      ],
      "output_format": "jpg"
    }
  }'
```

成功响应：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

保存 `taskId`，后续轮询结果时需要用到它。

## 轮询结果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/image-watermark-remover?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

任务处理中的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

成功响应：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/watermark-free-image.jpg\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

任务失败时的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "UPSTREAM_ERROR",
    "failMsg": "The service could not complete the task",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
```

等 `state` 变为 `success` 后，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const imageUrls = payload.resultUrls;
```

## 请求体

### 默认JPG输出

```json theme={null}
{
  "request_type": "async",
  "input": {
    "image_urls": [
      "https://example.com/photo-with-watermark.jpg"
    ],
    "output_format": "jpg"
  }
}
```

### PNG输出

```json theme={null}
{
  "request_type": "async",
  "input": {
    "image_urls": [
      "https://example.com/marketing-banner.png"
    ],
    "output_format": "png"
  }
}
```

### 显式模式

`mode` 是可选的，因为该端点只有一个工作流程。如果包含它，它一定是 `image-to-image`。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "image_urls": [
      "https://example.com/photo-with-watermark.webp"
    ],
    "output_format": "webp"
  }
}
```

## 参数

**request\_type** `string` *required* (default: async)

结果获取方式。选择 `async` 时，通过 `statusTask` 轮询结果；选择 `callback` 时，通过 Webhook 接收结果。

**callback\_url** `string`

当 `request_type` 为 `callback` 时必填。请提供公网可访问的 HTTPS 地址，用于接收任务的最终结果。详见 [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

**input** `object` *required*

Image Watermark Remover 的输入参数。

**属性**

**mode** `string` (default: image-to-image)

固定工作流程模式。如果提供，则唯一支持的值为 `image-to-image`。

**image\_urls** `string[]` *required*

源图像 URL。必须包含且仅包含 1 个非空字符串，格式为 JPG、JPEG、PNG 或 WEBP。使用可公开访问且可直接获取的图像 URL。

**output\_format** `string` (default: jpg)

输出图像格式。支持的值：`jpg`、`jpeg`、`png`、`webp`。`jpeg` 可作为 `jpg` 的别名使用。

## 响应格式

### 提交任务时的响应

任务受理后，`POST /generateTask/image-watermark-remover` 会返回任务 ID：

**code** `integer`

API 状态码。`200` 表示任务已受理。

**message** `string`

状态说明。

**data.taskId** `string`

任务的唯一 ID，用于查询任务状态。

### 状态响应字段

**taskId** `string`

任务的唯一标识符。

**state** `string`

当前任务状态，可能的值为 `pending`、`processing`、`success`、`failed`。

**resultJson** `string`

JSON 字符串，包含已清理图像 URL。当 `state` 为 `success` 时存在。

**failCode** `string`

供程序处理的错误码，仅在 `state` 为 `failed` 时返回。

**failMsg** `string`

失败原因说明，仅在 `state` 为 `failed` 时返回。

**createTime** `integer`

任务创建时的 Unix 时间戳，单位为毫秒。

**completeTime** `integer`

任务完成时间戳（以 Unix 毫秒为单位）。任务完成后可用时返回。

**costTime** `integer`

处理耗时，以毫秒为单位。有计时数据时返回。

### `resultJson` 中的数据

`resultJson` 是 JSON 编码的字符串。解析后，有效负载具有以下结构：

```json theme={null}
{
  "resultUrls": [
    "https://file.apixo.ai/watermark-free-image.jpg"
  ]
}
```

## Webhook 回调模式

如果希望服务端自动收到最终结果，可以使用回调模式，无需轮询。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/image-watermark-remover" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "image_urls": [
        "https://example.com/photo-with-watermark.jpg"
      ],
      "output_format": "png"
    }
  }'
```

最终回调有效负载使用与状态轮询相同的任务响应结构：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/watermark-free-image.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

Webhook 接收要求和重试规则见 [Webhook 文档](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

## 计费

新提交的非 LLM 请求按 **1 积分 = `$0.001`** 计费。先按用量和附加项目计算总额，再应用账号折扣，最后将请求总额向上取整到整数积分。如果约定了固定单价，则按该单价的原始精度计算，不再使用标准价或另行打折；最终积分仍向上取整。详见[积分换算与取整](https://apixo.ai/docs/zh/pricing.md#credit-conversion-and-rounding)。

Image Watermark Remover 按提交的图像任务计费。由于 `image_urls` 必须恰好包含一张图像，因此每个接受的任务都算作一张图像进行计费。

| 单位 | APIXO 价格 | 价格发生什么变化 |
| - | - | - |
| `PER_IMAGE` | `$0.015 / image` | 固定单价；`output_format` 不创建单独的定价层 |

有关当前公开价格，请参阅 [API 定价](https://apixo.ai/pricing/api)。

市场参考价为`$0.020 / image`：`$0.015 * 1.30 = $0.0195`，四舍五入至小数点后三位。标准费用仍为 `$0.015 / image`。

## 延迟与轮询

该端点是异步的。实际延迟可能因图像复杂性、队列负载和结果存储时间而异。

| 阶段 | 推荐 |
| - | - |
| 第一次轮询 | 任务创建 10 至 20 秒后 |
| 轮询间隔 | 5s-10s |
| 高并发 | 优选回调模式以减少轮询流量 |

## 错误与排查

### HTTP 错误

| 代码 | 含义 | 处理方式 |
| - | - | - |
| `400` | 请求体无效、模式不受支持、输出格式无效或 `image_urls` 形状错误 | 在重试前修复请求 |
| `401` | 缺少 API 密钥，或密钥无效 | 检查 `Authorization` 请求头 |
| `402` | 余额或配额不足 | 充值或更换账号或API密钥 |
| `403` | 密钥或路由无权访问该模型 | 检查权限和路由策略 |
| `429` | 已达到速率或并发限制 | 按指数退避策略重试 |
| `500` | 服务器错误 | 逐步延长间隔后重试 |
| `502` | 服务错误 | 逐步延长间隔后重试 |
| `504` | 服务超时 | 重试；耗时较长的任务可改用回调模式 |

### 验证错误

| 错误 | 原因 | 解决办法 |
| - | - | - |
| `The required parameter {{input}} is missing.` | 缺少顶级 `input` 对象 | 发送 `input` 对象 |
| `The required parameter {{image_urls}} is missing.` | 缺少 `input.image_urls` | 发送包含恰好一个 URL 的 `image_urls` |
| `The parameter {{image_urls}} must be Array type.` | `image_urls`不是数组 | 使用 JSON 数组 |
| `The parameter {{image_urls}} must contain exactly 1 image.` | `image_urls` 为空或包含多个项目 | 仅发送一张图像 URL |
| `The parameter {{image_urls}} Array elements must be String type.` | 图像 URL 项不是字符串 | 使用字符串 URL |
| `The parameter {{image_urls}} cannot contain empty string.` | 图像 URL 修剪后为空白 | 使用非空公共图像 URL |
| `Invalid mode type. Supported: image-to-image` | `mode` 不是 `image-to-image` | 省略 `mode` 或将其设置为 `image-to-image` |
| `The parameter {{output_format}} must be String type.` | `output_format` 不是字符串 | 使用字符串值 |
| `The parameter {{output_format}} must be either 'jpg', 'png' or 'webp'.` | 不支持的输出格式 | 使用`jpg`、`jpeg`、`png`或`webp` |

### 任务失败错误码

| 错误码 | 含义 | 处理方式 |
| - | - | - |
| `INVALID_PARAMETER` | 参数不受支持或格式错误 | 检查`mode`、`image_urls`和`output_format` |
| `INSUFFICIENT_BALANCE` | 该账户没有足够的余额来执行任务 | 重试前需添加余额 |
| `UPSTREAM_ERROR` | 服务无法完成任务 | 逐步延长间隔后重试 |
| `TIMEOUT` | 生成任务超时 | 重试或使用回调模式 |

完整列表见[错误码](https://apixo.ai/docs/zh/api-reference/errors.md)。

## MCP 集成

[完整模型 Schema](https://apixo.ai/docs/models/schemas/image/image-watermark-remover.json) 中的 `mcp.result` 指定了结果的解析方式，`mcp.attachments` 列出支持绑定文件的字段。这些元数据供客户端集成使用，无需作为生成参数提交。附件字段为 `image_urls`。请保留用户指定的文件顺序。API 负责校验模型参数。

## 相关链接

* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [图像模型](https://apixo.ai/docs/zh/models/image)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)
* [错误码](https://apixo.ai/docs/zh/api-reference/errors.md)
* [参数规范](https://apixo.ai/docs/zh/api-reference/parameters.md)
* [路由策略](https://apixo.ai/docs/zh/concepts/routing-strategies.md)
* [在 APIXO Playground 尝试使用 Image Watermark Remover](https://apixo.ai/models/image-watermark-remover)
* [API定价](https://apixo.ai/pricing/api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.