Long2Text
← Long2Text

API

一次 POST,把长截图变成 Markdown:切分、识别、拼回带说话人和时间的段落,连同截图里的图片一起。

请求

四种传图方式任选:multipart 的 `file` 字段(4 MB 以内)、JSON 里的公开 `url`(30 MB 以内)、JSON 里的 base64 `image`,或直接把图片作为 `image/*` 请求体。只支持 JPG、PNG、WebP。

curl -X POST https://long2text.com/api/v1/convert \
  -H "Authorization: Bearer $LONG2TEXT_API_KEY" \
  -F file=@chat.png \
  -F mode=text

参数

modetext | rich | bothtext: pictures become one-line descriptions · rich: pictures returned as files · both: files and descriptions
sceneauto | chat | meeting | articleLayout; auto detects it
proofreadtrue | falseAI correction of uncertain lines (default true)
langzh | enLabels and descriptions; detected by default
imagestrue | falseInclude base64 picture data (default: true unless mode=text)

返回

`markdown` 按所选模式生成;`text` 始终是纯文字版。图片默认以 base64 放在 `images[].data`,不需要时传 `images=false`。

{
  "mode": "text",
  "scene": "chat",
  "lang": "zh",
  "markdown": "**林晓**:周五的评审我可能要晚到半小时…",
  "text": "林晓:周五的评审我可能要晚到半小时…",
  "images": [
    { "id": "img1", "file": "images/img1.jpg", "x": 96, "y": 1421,
      "width": 220, "height": 232, "ocr_text": "收到!",
      "description": "表情包:黄色笑脸配星星,下方写着“收到!”" }
  ],
  "corrections": [{ "original": "李子玻不在", "corrected": "李子玄不在" }],
  "stats": { "width": 750, "height": 6506, "parts": 1, "characters": 860,
             "paragraphs": 63, "seconds": 6.2, "skipped": [] }
}

命令行与 AI 助手

仓库里附带一个零依赖命令行脚本和 Claude Code / Codex skill,助手不用打开网页就能转换截图:

node l2t.mjs chat.png --mode text
# → chat.md

限制与行为

错误

失败时返回 `{ "error": { "code", "message" } }`,并带对应状态码:401 key 无效、413 图片过大、415 格式不支持、429 调用过频、502 识别失败。

怎么拿 key

目前人工发放,写信到 support@long2text.com 说明用途和大概用量即可。