Long2Text
← Long2Text

API

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

获取 API key →每张截图 $0.89,不限长度 · 预付 · 转换失败不扣费

请求

四种传图方式任选: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 $L2T_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`。`usage` 说明这次扣了多少、还剩多少。

{
  "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": [] },
  "usage": { "request_id": "3f0c…", "credits_charged": 1, "credits_remaining": 49 }
}

价格

key 与用量

用 Google 登录控制台即可创建 key。每个 key 可以单独设每月上限,每次请求的结果和扣费都会列在控制台里。每个响应都带 `usage`(响应头 `X-Credits-Remaining` 也有),代码里也可以查余额:

curl https://long2text.com/api/v1/usage \
  -H "Authorization: Bearer $L2T_API_KEY"

{ "credits_remaining": 49, "used_this_month": 12,
  "key": { "name": "laptop", "monthly_limit": 100, "used_this_month": 7 } }

有问题或用量较大,写信到 support@long2text.com.

命令行与 AI 助手

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

node l2t.mjs chat.png --mode text
# → chat.md
node l2t.mjs --usage
# → 49 credits left

限制与行为

错误

失败时返回 `{ "error": { "code", "message" } }`,并带对应状态码:401 key 无效、402 `insufficient_credits` 余额不足、413 图片过大、415 格式不支持、429 `key_limit_reached`(这个 key 的每月上限)或 `too_many_requests`、502 识别失败、503 暂时不可用。这些都不扣次数。