IsManga API

    通过 REST API 翻译漫画、韩漫和国漫图片。

    API 每次请求翻译一张漫画图片。大多数图片在 4 秒内完成,因此一次调用通常就能返回翻译结果。

    翻译费用从你的 API 余额中扣除,该余额与 IsManga 应用中的高级版订阅和点数是分开的。失败的翻译会退款。你可以随时为余额充值。

    有问题吗?请发邮件至 [email protected]。

    创建 API 密钥

    1. 打开你的 API 设置。
    2. 输入密钥名称,然后选择“创建密钥”。
    3. 请立即复制密钥,它只会显示一次。

    同一页面会显示你的余额,并有一个“最近任务”标签页,列出你最近 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。

    创建翻译

    POST/v1/manga/translations

    翻译一张漫画图片。

    请求头

    • Authorizationstring
      Bearer 加上你的 API 密钥。
    • Content-Typestring
      application/json。
    • Idempotency-Keystring可选
      1 到 255 个可见 ASCII 字符。在 24 小时内使用相同密钥和请求体重试,会返回原任务,且不会再次计费。

    查询参数

    • waitinteger可选
      保持请求直到任务完成的秒数,范围为 0 到 20。

    请求体

    • imageUrlstring
      图片的公开 http 或 https 地址,需符合图片限制。请发送 imageUrl 或 image。
    • imagestring
      原始 base64 或 data URL 形式的图片,需符合图片限制。请发送 image 或 imageUrl。
    • sourceLangstring
      图片中文字的语言,例如 ja-JP。
    • targetLangstring
      要翻译成的语言,例如 en-US。

    响应

    一个 任务对象,其 status 为 "succeeded" 或 "failed"。任务在 wait 秒内已完成。

    其他响应见错误。

    请求

    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
    }

    获取翻译

    GET/v1/manga/translations/{id}

    返回此账户的一个任务。

    请求头

    • Authorizationstring
      Bearer 加上你的 API 密钥。

    路径参数

    • idstring
      任务的 id。

    查询参数

    • waitinteger可选
      保持请求直到任务完成的秒数,范围为 0 到 20。

    响应

    一个 任务对象。使用 wait 时,会在任务完成后或经过 wait 秒后返回。

    请求

    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
    }

    余额

    GET/v1/manga/balance

    返回你的 API 余额。

    请求头

    • Authorizationstring
      Bearer 加上你的 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
    }

    语言

    GET/v1/manga/languages

    列出 API 接受的语言代码。

    请求头

    • Authorizationstring
      Bearer 加上你的 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"。
    • sourceLang and targetLangstring
      你发送的语言。
    • createdAt and completedAtstring
      ISO 8601 时间。任务完成前,completedAt 为 null。
    • chargednumber
      任务从你的余额中扣除的费用,以美元计。任务失败后为 null。
    • errorobject
      任务失败后设置。获取该任务仍返回 200,因此这不是请求错误。失败的任务会退款。
      显示子字段隐藏子字段
      • codestring
        图片无法使用时为 "invalid_image",可以重试时为 "translation_failed"。
      • messagestring
        出了什么问题。
    • resultobject
      任务成功后设置。
      显示子字段隐藏子字段
      • imageWidth and imageHeightinteger
        原始图片的尺寸。
      • regionsarray
        每个文字区域一项。图片中没有文字时为空,但仍会计费。
        显示子字段隐藏子字段
        • x, y, width and heightinteger
          原始图片中的区域,以像素计。
        • sourceText and translatedTextstring
          识别出的文字及其译文。
        • detectedSourceLangstring
          你发送的 sourceLang。
        • inpaintedImageUrlstring
          去除文字后的区域。把它放在该区域上,然后将 translatedText 嵌入其中。任何拥有该 URL 的人都可以打开它,直到它被删除。
        • textColor and backgroundColorstring
          CSS rgb() 颜色。

    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"
        }
    }

    错误

    请求失败时,其请求错误的代码为下列之一。

    状态码代码含义
    400invalid_request请求体、查询参数或 Idempotency-Key 请求头不可接受,或 imageUrl 不是公开的 http 或 https 地址。
    400invalid_image图片不是 PNG、JPEG 或 WebP,或超过 5 MB,或每边超过 2,000 像素。
    400image_unavailable无法获取 imageUrl 处的图片。请检查该地址无需登录即可访问。
    401unauthorizedAPI 密钥缺失或无效。
    402insufficient_balance你的 API 余额低于一次翻译的费用,或余额低于零。请充值后重试。
    404not_found该翻译在此账户上不存在,或路径未知。
    409idempotency_conflict此 Idempotency-Key 已用于另一个不同的请求。
    413payload_too_large请求体超过 8 MB。
    429rate_limited请求过多。请等待 Retry-After 中的时间。
    429too_many_concurrent_jobs此账户已有 8 个翻译正在进行中,请等待其中一个完成。
    500internal_error服务器在处理请求时出错。请求 ID 在响应体中。
    503service_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 响应头,其值为再次尝试前需要等待的秒数。