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参数
| mode | text | rich | both | text: pictures become one-line descriptions · rich: pictures returned as files · both: files and descriptions |
| scene | auto | chat | meeting | article | Layout; auto detects it |
| proofread | true | false | AI correction of uncertain lines (default true) |
| lang | zh | en | Labels and descriptions; detected by default |
| images | true | false | Include 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限制与行为
- ·一次请求处理一张截图,没有任务队列;图越长,多花几秒。
- ·每个 key 每十分钟 60 次。
- ·AI 校对按上下文修正认错的字,改了哪些都会列在 `corrections` 里。
- ·`text` 和 `both` 会把裁出来的小图(不是整张截图)发给视觉模型生成描述;`rich` 不发送任何图片。
- ·某一步超时不会让整个请求失败,而是写进 `stats.skipped`。
错误
失败时返回 `{ "error": { "code", "message" } }`,并带对应状态码:401 key 无效、413 图片过大、415 格式不支持、429 调用过频、502 识别失败。
怎么拿 key
目前人工发放,写信到 support@long2text.com 说明用途和大概用量即可。