with one click
mineru-api
使用 MinerU 云 API 解析 PDF、Office、图片或 HTML 文档,并通过轮询或批量接口获取结果。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
使用 MinerU 云 API 解析 PDF、Office、图片或 HTML 文档,并通过轮询或批量接口获取结果。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
维护配置系统、服务编排、离线工具与自动化调度的手册。
维护 Web 入口、Flask app factory、页面探针与全局运行时 hook 的手册。
维护摘要生成、缓存、任务状态、SSE 通知与模型切换全链路的手册。
维护 aslite 数据层、SQLite KV、仓储、索引与底层状态库的手册。
维护模板、静态脚本、CSS、manifest 与页面级交互契约的手册。
维护 backend/legacy.py 这条历史中枢、兼容层与业务编排层的手册。
| name | mineru-api |
| description | 使用 MinerU 云 API 解析 PDF、Office、图片或 HTML 文档,并通过轮询或批量接口获取结果。 |
| license | MIT |
| compatibility | opencode |
| metadata | {"category":"documents","transport":"https","auth":"bearer-token"} |
task_id / batch_id、任务状态、full_zip_url 以及后续结果下载建议在这些场景优先使用我:
这些场景不要优先使用我:
真实调用 API 前先确认:
docx / html / latex如果缺少 Token、输入文件地址或本地文件路径,先向用户索取,不要假设。
不要把 Token 写进仓库、SKILL.md、脚本源码或命令历史。
推荐顺序:
MINERU_API_TOKENMINERU_API_TOKEN_FILE 指向一个本地 secret 文件.opencode/skills/mineru-api/.env.mineru.local~/.config/mineru/token如果你就是在这个仓库里使用本 skill,最顺手的放法就是当前 skill 目录里的:.env.mineru.local
文件内容示例:
MINERU_API_TOKEN=your-token
这个目录下已经提供:
.gitignore:忽略 .env.mineru.local.env.mineru.local.example:示例模板这个 skill 自带一个脚本:scripts/mineru_to_markdown.py
它会:
full_zip_urlcontent_list.jsonassets/001-image.jpg、002-table.jpg--pdf ./paper.pdf:本地 PDF,自动申请上传 URL、上传文件、轮询结果--url https://.../paper.pdf:已有公网 URL,直接提交单任务--zip ./result.zip:已经下载好的 MinerU 结果 ZIP,只做清洗--raw-dir ./raw:已经解压好的 MinerU 原始目录,只做清洗默认会在 --output 指定目录写出:
assets/ 目录,只放 markdown 实际引用到的资源manifest.json,记录原始资源路径和重命名结果资源排序规则:
*_content_list.json 的阅读顺序这意味着:如果原始图片名是 UUID / hash,看起来很乱,脚本仍会输出稳定文件名。
最常见用法:
export MINERU_API_TOKEN='your-token'
python .opencode/skills/mineru-api/scripts/mineru_to_markdown.py \
--pdf ./paper.pdf \
--output ./out/paper
如果输入是公网 URL:
export MINERU_API_TOKEN='your-token'
python .opencode/skills/mineru-api/scripts/mineru_to_markdown.py \
--url 'https://cdn-mineru.openxlab.org.cn/demo/example.pdf' \
--output ./out/example
如果你已经有 full_zip_url 下载下来的原始 ZIP,也可以只做清洗:
python .opencode/skills/mineru-api/scripts/mineru_to_markdown.py \
--zip ./result.zip \
--output ./out/result
适合用户已经有公网可访问文件 URL 的情况。
POST https://mineru.net/api/v4/extract/taskdata.task_idGET https://mineru.net/api/v4/extract/task/{task_id} 轮询state=donefull_zip_url 下载结果压缩包适合用户只有本地文件,没有公网 URL。
POST https://mineru.net/api/v4/file-urls/batch 申请上传链接PUT 上传文件batch_idGET https://mineru.net/api/v4/extract-results/batch/{batch_id} 轮询批量结果适合已有一组可访问 URL。
POST https://mineru.net/api/v4/extract/task/batchbatch_idGET https://mineru.net/api/v4/extract-results/batch/{batch_id} 轮询所有核心请求都需要:
Authorization: Bearer <TOKEN>
Content-Type: application/json
Accept: */*
如果报 A0202 或 A0211,优先检查 Token 是否错误、过期,或者是否漏掉了 Bearer 前缀。
POST https://mineru.net/api/v4/extract/task
常用请求体字段:
url:必填,文件 URLmodel_version:pipeline / vlm / MinerU-HTMLis_ocr:是否启用 OCRenable_formula:是否启用公式识别enable_table:是否启用表格识别language:文档语言data_id:业务侧唯一 IDextra_formats:可选附加导出格式,支持 docx / html / latexpage_ranges:页码范围no_cache / cache_tolerance:缓存控制callback + seed:如果要服务端回调,二者配合使用GET https://mineru.net/api/v4/extract/task/{task_id}
重点状态:
pending:排队中running:解析中converting:格式转换中done:完成failed:失败结果字段重点看:
task_idstatefull_zip_urlerr_msgextract_progressPOST https://mineru.net/api/v4/file-urls/batch
重点:
PUTPOST https://mineru.net/api/v4/extract/task/batch
重点:
batch_idGET https://mineru.net/api/v4/extract-results/batch/{batch_id}
批量状态除了单任务常见状态外,还可能出现:
waiting-file:等待文件上传完成后再排队提交解析pipeline 理解vlmmodel_version 必须明确指定为 MinerU-HTML200MB6002000 页最高优先级额度,超出后优先级下降如果用户希望回调而不是轮询:
callbackseed 必填POST、UTF-8、Content-Type: application/jsonchecksum200 才算接收成功成功提交任务至少满足:
code = 0task_id,或批量拿到 batch_id成功完成解析至少满足:
state = donefull_zip_urlassets/ 目录manifest.json,能回溯原文件名和新文件名的映射A0202:Token 错误A0211:Token 过期-500 / -10002:请求体或 Content-Type 错误-60005:文件大小超限-60006:页数超限-60008:URL 读取超时-60012:任务不存在-60013:没有权限访问该任务-60018:每日解析额度达到上限-60019:HTML 解析额度不足TOKEN="your-token"
FILE_URL="https://cdn-mineru.openxlab.org.cn/demo/example.pdf"
curl --location --request POST 'https://mineru.net/api/v4/extract/task' \
--header "Authorization: Bearer ${TOKEN}" \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--data-raw "{\"url\":\"${FILE_URL}\",\"model_version\":\"vlm\"}"
TOKEN="your-token"
TASK_ID="replace-me"
curl --location --request GET "https://mineru.net/api/v4/extract/task/${TASK_ID}" \
--header "Authorization: Bearer ${TOKEN}" \
--header 'Accept: */*'
TOKEN="your-token"
curl --location --request POST 'https://mineru.net/api/v4/file-urls/batch' \
--header "Authorization: Bearer ${TOKEN}" \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--data-raw '{
"files": [{"name": "demo.pdf", "data_id": "demo-001"}],
"model_version": "vlm"
}'
full_zip_url,下一步重点转到下载、解压和读取结果文件,而不是继续重复轮询scripts/mineru_to_markdown.py,而不是让用户手动拼接 API + 解压 + 重命名流程