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参数
| 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`。`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 }
}价格
- ·1 次转换 1 张截图,不限长度,任何模式都一样:$0.89。
- ·在控制台按 10 / 50 / 200 次预付充值,永不过期。
- ·只有转换成功才扣次数。请求有误、超时或我们这边出错,次数都会自动退回。
- ·想先看看效果?网页版用的是同一套引擎,可以免费试用。
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限制与行为
- ·一次请求处理一张截图,没有任务队列;图越长,多花几秒。
- ·每个账户同时最多 4 个转换在跑,超出返回 429,等一个完成再发。
- ·AI 校对按上下文修正认错的字,改了哪些都会列在 `corrections` 里。
- ·`text` 和 `both` 会把裁出来的小图(不是整张截图)发给视觉模型生成描述;`rich` 不发送任何图片。
- ·某一步超时不会让整个请求失败,而是写进 `stats.skipped`。
错误
失败时返回 `{ "error": { "code", "message" } }`,并带对应状态码:401 key 无效、402 `insufficient_credits` 余额不足、413 图片过大、415 格式不支持、429 `key_limit_reached`(这个 key 的每月上限)或 `too_many_requests`、502 识别失败、503 暂时不可用。这些都不扣次数。