IsManga API
通过 REST API 翻译漫画、韩漫和国漫图片。
API 每次请求翻译一张漫画图片。大多数图片在 4 秒内完成,因此一次调用通常就能返回翻译结果。
翻译费用从你的 API 余额中扣除,该余额与 IsManga 应用中的高级版订阅和点数是分开的。失败的翻译会退款。你可以随时为余额充值。
有问题吗?请发邮件至 [email protected]。
创建 API 密钥
- 打开你的 API 设置。
- 输入密钥名称,然后选择“创建密钥”。
- 请立即复制密钥,它只会显示一次。
同一页面会显示你的余额,并有一个“最近任务”标签页,列出你最近 20 次翻译:每次使用的密钥、耗时、费用以及获得的图片。
身份验证
请求时始终以 Bearer 令牌的形式发送密钥。密钥仅用于你自己的服务器。API 不发送 CORS 响应头,因此浏览器中的页面无法使用密钥调用它。
Authorization: Bearer $YOUR_ISMANGA_API_KEY快速开始
使用 wait 创建翻译,并从响应中读取 result。
wait 会保持请求直到图片处理完成,最长 20 秒。大多数图片在 4 秒内完成,因此响应通常就是已完成的任务。
请求
curl -X POST "https://api.ismanga.com/v1/manga/translations?wait=20" \
-H "Authorization: Bearer $YOUR_ISMANGA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: chapter-12-image-3-en" \
-d '{"imageUrl": "https://example.com/image.jpg", "sourceLang": "ja-JP", "targetLang": "en-US"}'如果 status 仍为 "queued" 或 "processing",请使用 wait 获取任务,直到其变为 "succeeded" 或 "failed"。
请求
curl "https://api.ismanga.com/v1/manga/translations/<id>?wait=20" \
-H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"如果无法让请求保持 20 秒,请不要使用 wait,每隔几秒再次获取任务,直到完成。
端点
所有路径均相对于 https://api.ismanga.com。
创建翻译
/v1/manga/translations翻译一张漫画图片。
请求头
AuthorizationstringBearer加上你的 API 密钥。Content-Typestringapplication/json。Idempotency-Keystring可选1 到 255 个可见 ASCII 字符。在 24 小时内使用相同密钥和请求体重试,会返回原任务,且不会再次计费。
查询参数
waitinteger可选保持请求直到任务完成的秒数,范围为 0 到 20。
请求体
imageUrlstringimagestringsourceLangstring图片中文字的语言,例如 ja-JP。targetLangstring要翻译成的语言,例如 en-US。
响应
其他响应见错误。
请求
curl -X POST "https://api.ismanga.com/v1/manga/translations?wait=20" \
-H "Authorization: Bearer $YOUR_ISMANGA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"imageUrl": "https://example.com/image.jpg", "sourceLang": "ja-JP", "targetLang": "en-US"}'响应
{
"id": "8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1",
"status": "succeeded",
"sourceLang": "ja-JP",
"targetLang": "en-US",
"createdAt": "2026-11-03T10:00:00.000Z",
"completedAt": "2026-11-03T10:00:03.412Z",
"charged": 0.001,
"result": {
"imageWidth": 800,
"imageHeight": 1200,
"regions": [
{
"x": 10,
"y": 20,
"width": 30,
"height": 40,
"detectedSourceLang": "ja-JP",
"sourceText": "こんにちは",
"translatedText": "Hello",
"inpaintedImageUrl": "https://example.com/region.jpg",
"textColor": "rgb(0, 0, 0)",
"backgroundColor": "rgb(255, 255, 255)"
}
]
},
"error": null
}获取翻译
/v1/manga/translations/{id}返回此账户的一个任务。
请求头
AuthorizationstringBearer加上你的 API 密钥。
路径参数
idstring任务的id。
查询参数
waitinteger可选保持请求直到任务完成的秒数,范围为 0 到 20。
响应
请求
curl "https://api.ismanga.com/v1/manga/translations/8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1?wait=20" \
-H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"响应
{
"id": "8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1",
"status": "succeeded",
"sourceLang": "ja-JP",
"targetLang": "en-US",
"createdAt": "2026-11-03T10:00:00.000Z",
"completedAt": "2026-11-03T10:00:03.412Z",
"charged": 0.001,
"result": {
"imageWidth": 800,
"imageHeight": 1200,
"regions": [
{
"x": 10,
"y": 20,
"width": 30,
"height": 40,
"detectedSourceLang": "ja-JP",
"sourceText": "こんにちは",
"translatedText": "Hello",
"inpaintedImageUrl": "https://example.com/region.jpg",
"textColor": "rgb(0, 0, 0)",
"backgroundColor": "rgb(255, 255, 255)"
}
]
},
"error": null
}余额
/v1/manga/balance返回你的 API 余额。
请求头
AuthorizationstringBearer加上你的 API 密钥。
响应
balancenumber你的 API 余额,以美元计。translationPricenumber一次翻译的价格,以美元计。
余额低于 translationPrice 时,创建翻译会返回 402,直到你充值。
请求
curl "https://api.ismanga.com/v1/manga/balance" \
-H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"响应
{
"balance": 12.4975,
"translationPrice": 0.001
}语言
/v1/manga/languages列出 API 接受的语言代码。
请求头
AuthorizationstringBearer加上你的 API 密钥。
响应
sourceLangsarray可作为sourceLang发送的代码。targetLangsarray可作为targetLang发送的代码。
请求
curl "https://api.ismanga.com/v1/manga/languages" \
-H "Authorization: Bearer $YOUR_ISMANGA_API_KEY"响应
{
"sourceLangs": ["ja-JP", "ko-KR", "zh-CN", "en-US"],
"targetLangs": ["en-US", "es-ES", "fr-FR", "de-DE", "pt-PT"]
}对象
任务
idstring任务的 ID。statusstring"queued"、"processing"、"succeeded" 或 "failed"。sourceLangandtargetLangstring你发送的语言。createdAtandcompletedAtstringISO 8601 时间。任务完成前,completedAt为 null。chargednumber任务从你的余额中扣除的费用,以美元计。任务失败后为 null。errorobject任务失败后设置。获取该任务仍返回 200,因此这不是请求错误。失败的任务会退款。显示子字段隐藏子字段
codestring图片无法使用时为 "invalid_image",可以重试时为 "translation_failed"。messagestring出了什么问题。
resultobject任务成功后设置。显示子字段隐藏子字段
imageWidthandimageHeightinteger原始图片的尺寸。regionsarray每个文字区域一项。图片中没有文字时为空,但仍会计费。显示子字段隐藏子字段
x,y,widthandheightinteger原始图片中的区域,以像素计。sourceTextandtranslatedTextstring识别出的文字及其译文。detectedSourceLangstring你发送的sourceLang。inpaintedImageUrlstring去除文字后的区域。把它放在该区域上,然后将translatedText嵌入其中。任何拥有该 URL 的人都可以打开它,直到它被删除。textColorandbackgroundColorstringCSSrgb()颜色。
result 的任何字段都可能为 null,例如无法保存该图片时的 inpaintedImageUrl。IsManga 不会保留你的图片。
响应
{
"id": "8c6b1d52-4f1e-4a53-9a0f-2c43f3c4f8a1",
"status": "succeeded",
"sourceLang": "ja-JP",
"targetLang": "en-US",
"createdAt": "2026-11-03T10:00:00.000Z",
"completedAt": "2026-11-03T10:00:03.412Z",
"charged": 0.001,
"result": {
"imageWidth": 800,
"imageHeight": 1200,
"regions": [
{
"x": 10,
"y": 20,
"width": 30,
"height": 40,
"detectedSourceLang": "ja-JP",
"sourceText": "こんにちは",
"translatedText": "Hello",
"inpaintedImageUrl": "https://example.com/region.jpg",
"textColor": "rgb(0, 0, 0)",
"backgroundColor": "rgb(255, 255, 255)"
}
]
},
"error": null
}请求错误
失败的请求会返回 4xx 或 5xx 状态和一个 error 对象。这不是失败任务中的 error,后者随 200 返回。
codestring错误中的代码之一。messagestring出了什么问题。请求体无效时,它会列出每个失败的字段,用 "; " 分隔。requestIdstring与X-Request-Id响应头的值相同,每个响应都带有该响应头。联系支持时请附上它。
响应
{
"error": {
"code": "insufficient_balance",
"message": "Your API balance is too low for this translation. Top up your balance to keep translating.",
"requestId": "req_3f9a1c2b7d4e4b8a9c0d1e2f3a4b5c6d"
}
}错误
请求失败时,其请求错误的代码为下列之一。
| 状态码 | 代码 | 含义 |
|---|---|---|
| 400 | invalid_request | 请求体、查询参数或 Idempotency-Key 请求头不可接受,或 imageUrl 不是公开的 http 或 https 地址。 |
| 400 | invalid_image | 图片不是 PNG、JPEG 或 WebP,或超过 5 MB,或每边超过 2,000 像素。 |
| 400 | image_unavailable | 无法获取 imageUrl 处的图片。请检查该地址无需登录即可访问。 |
| 401 | unauthorized | API 密钥缺失或无效。 |
| 402 | insufficient_balance | 你的 API 余额低于一次翻译的费用,或余额低于零。请充值后重试。 |
| 404 | not_found | 该翻译在此账户上不存在,或路径未知。 |
| 409 | idempotency_conflict | 此 Idempotency-Key 已用于另一个不同的请求。 |
| 413 | payload_too_large | 请求体超过 8 MB。 |
| 429 | rate_limited | 请求过多。请等待 Retry-After 中的时间。 |
| 429 | too_many_concurrent_jobs | 此账户已有 8 个翻译正在进行中,请等待其中一个完成。 |
| 500 | internal_error | 服务器在处理请求时出错。请求 ID 在响应体中。 |
| 503 | service_unavailable | 翻译服务未接受任务,或 API 定价不可用。未计费。 |
限制
限制针对你的整个账户,由其所有 API 密钥共享。
翻译限制
| 限制 | 数值 |
|---|---|
| 同时进行中的翻译 | 8 |
| 单次请求最长等待时间 | 20 秒 |
数据保留
| 数据 | 保留时间 |
|---|---|
| 任务和结果 | 24 小时 |
| 修复区域图片 | 1 至 2 天 |
图片限制
| 限制 | 数值 |
|---|---|
| 格式 | PNG、JPEG 或 WebP |
| 文件大小 | 5 MB |
| 宽度和高度 | 每边 2,000 像素 |
| 图片 URL | 公开的 http 或 https,端口 80 或 443,最多 2048 个字符、3 次重定向和 10 秒 |
| 请求体 | 8 MB |
请求限制
每个请求都计入 IP 地址限制。创建翻译还受同时进行中的翻译数量限制。
| 限制 | 计入的请求 | 每分钟 |
|---|---|---|
| IP 地址 | 来自该 IP 地址的每个请求,涵盖所有账户和密钥,即使 API 密钥错误也计入 | 300 |
超出限制的请求会收到 429 rate_limited 错误,并带有 Retry-After 响应头,其值为再次尝试前需要等待的秒数。