API 使用文档
妙识 OCR (MuseOCR) 提供简单易用的 RESTful API 接口
接口概述
Base URL:
https://ocr.wangwangit.com
响应格式:
JSON
调用限制:
每个IP每天最多 30 次调用
VIP 无限调用
传递管理员密钥可绕过调用限制,支持以下方式:
Header: X-Admin-Key
Query: ?key=...
JSON: {"key": "..."}
图片文字识别
POST
/upload
通过文件上传方式进行文字识别
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| file | File | 是 | 图片文件 (PNG/JPG/BMP/GIF) |
请求示例 (cURL)
curl -X POST "https://ocr.wangwangit.com/upload" \ -F "file=@image.png"
响应示例
{
"success": true,
"text": "识别出的文字内容..."
}
POST
/ocr/base64
通过Base64编码方式进行文字识别
请求示例
curl -X POST "https://ocr.wangwangit.com/ocr/base64" \ -H "Content-Type: application/json" \ -d '{"image_base64": "data:image/png;base64,..."}'
数学公式识别
POST
/latex
识别图片中的数学公式,返回LaTeX格式
请求示例
curl -X POST "https://ocr.wangwangit.com/latex" \ -F "file=@formula.png"
响应示例
{
"success": true,
"latex": "\\frac{a}{b} + \\sqrt{c}"
}
POST
/latex/base64
通过Base64编码方式进行公式识别
其他接口
GET
/health
检查服务状态
GET
/limit/status
查询当前IP的调用限制状态
GET
/user/info
获取后台账户信息
错误码说明
| 状态码 | 说明 |
|---|---|
| 200 | 请求成功 |
| 400 | 请求参数错误 |
| 429 | 已达到每日调用上限 |
| 500 | 服务器内部错误 |
| 502 | 连接OCR服务失败 |
| 503 | OCR服务不可用 |
| 504 | 请求超时 |