Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
Align tier docs and API contracts
jinzhenjbe3f35c0b16c
diff --git a/docs/next/api/responses.md b/docs/next/api/responses.mdindex 29a2b9a7..176f3570 100644--- a/docs/next/api/responses.md+++ b/docs/next/api/responses.md@@ -112,7 +112,7 @@ Idempotency-Key: 7f5b7f7c-5c5a-4b2f-bb89-0c901c9a2d6a| 403 | `permission_error` | `list_requires_api_key` || 404 | `invalid_request_error` | `job_not_found`、`file_not_found`、`upload_not_found`、`model_not_found` || 409 | `invalid_request_error` | `job_already_terminal`、`upload_not_ready`、`upload_already_terminal` |-| 413 | `invalid_request_error` | `file_too_large`、`content_too_large` |+| 413 | `invalid_request_error` | `file_too_large` || 429 | `rate_limit_error` | `rate_limit_exceeded` || 500 | `api_error` | `internal_error` || 503 | `api_error` | `service_unavailable` |@@ -125,6 +125,6 @@ Idempotency-Key: 7f5b7f7c-5c5a-4b2f-bb89-0c901c9a2d6aLocal Parse Server 使用同一套错误 envelope。差异主要体现在错误来源:- 未启用 API Key 时,不会产生 `invalid_api_key`。-- 请求 `local` source 但路径不在 allowlist 内,应返回 `invalid_request_error`。+- 请求 `local` source 但本地 server 未开启 `--allow-local-source`,应返回 `400 unsupported_source`。- PDF/image 省略 `tier` 或传 `null` 且无法解析到非 `flash` 质量 tier 时,应返回 tier 相关错误,不能降级到 `flash`。Office/text/HTML 按 [ADR-0024](../decisions/0024-file-type-tier-normalization.md) 归一为 `flash`。- 解析能力缺失时,应优先返回可操作的 `engine_error`,而不是泛化为 `internal_error`。diff --git a/docs/next/api/uploads-files.md b/docs/next/api/uploads-files.mdindex 9235f55d..acfe6c62 100644--- a/docs/next/api/uploads-files.md+++ b/docs/next/api/uploads-files.md@@ -364,6 +364,6 @@ Local Parse Server 保持相同 endpoint 和对象结构,但传输实现可以- `upload_url` 指向本地 server 的临时上传 endpoint,例如 `/v1/uploads/{upload_id}/content`。- 字节上传仍由客户端使用 `upload_method`、`upload_url` 和 `upload_headers` 完成;客户端不应硬编码 OSS 行为。- `GET /v1/files/{file_id}/content` 直接返回 `200 + body`,不做 CDN 重定向。-- 本地 server 支持 parse job 的 `local` source,用户可跳过 upload 直接引用 allowlist 内路径。+- 本地 server 支持 parse job 的 `local` source;只有启动时开启 `--allow-local-source` 并在 `features.sources` 返回 `local` 时,用户才可跳过 upload 直接引用 server 进程权限范围内的本地路径。- 官方 API 必须拒绝 `local` source,返回 `400 invalid_request`。- 本地文件默认可以不设置保留期,File 对象的 `expires_at` 可为 `null`。diff --git a/docs/next/cli/mineru-kit-api-server.md b/docs/next/cli/mineru-kit-api-server.mdindex e9e42b3f..b3aa05f3 100644--- a/docs/next/cli/mineru-kit-api-server.md+++ b/docs/next/cli/mineru-kit-api-server.md@@ -97,7 +97,9 @@ mineru-kit api-server --tier high --language en --ocr-mode ocr --disable-image-a- concurrency- upload-dir- url-timeout-- max-wait+- allow-local-source+- max-inline-bytes+- allow-http-source### 专家参数diff --git a/docs/next/cli/mineru-parse.md b/docs/next/cli/mineru-parse.mdindex 19f88d57..abe2e6ec 100644--- a/docs/next/cli/mineru-parse.md+++ b/docs/next/cli/mineru-parse.md@@ -104,7 +104,7 @@ PDF/image 的默认选择策略通过当前目标 parse-server 的能力发现非分页文档当前也使用 `--after` cursor 继续读取:```text-<!-- next content available. Use: mineru parse long.docx --after doc:ab12cd3/tier:medium/page:1/block:12/char:520 -->+<!-- next content available. Use: mineru parse long.docx --after doc:ab12cd3/tier:flash/page:1/block:12/char:520 -->```marker 是 Agent 的控制协议,不应依赖自然语言猜测。diff --git a/docs/next/decisions/0013-doc-content-progressive-reading.md b/docs/next/decisions/0013-doc-content-progressive-reading.mdindex 6726426b..ba8fa95e 100644--- a/docs/next/decisions/0013-doc-content-progressive-reading.md+++ b/docs/next/decisions/0013-doc-content-progressive-reading.md@@ -464,7 +464,7 @@ CLI marker 是展示层,不是协议源头。Server 返回 `next_request`,CL非分页文档:```html-<!-- Next: mineru parse long.docx --after doc:ab12cd3/tier:medium/page:1/block:42 -->+<!-- Next: mineru parse long.docx --after doc:ab12cd3/tier:flash/page:1/block:42 -->```机器可读协议以 `DocContentResponse.next_request` 为准。CLI marker 不应被 SDK 或 Server 反解析。diff --git a/docs/next/errors.md b/docs/next/errors.mdindex 15cafb97..a0b6e3bf 100644--- a/docs/next/errors.md+++ b/docs/next/errors.md@@ -33,7 +33,7 @@"error": {"type": "engine_error","code": "quality_tier_unavailable",- "message": "Default tier selection requires medium or high, but only flash is available. Start a parse-server, use --remote, or explicitly pass --tier flash.",+ "message": "Default tier selection requires medium, high, or xhigh, but only flash is available. Start a parse-server, use --remote, or explicitly pass --tier flash.","param": "tier","retryable": false,"user_action": "start_parse_server_or_use_remote_or_explicit_flash",@@ -81,6 +81,9 @@ Tier 语义见 [解析 Tier](tiers.md)。本节定义 `flash`、`medium`、`high| `engine_error` | `parse_timeout` | 504 | 是 | null | 解析超时 | `retry_or_use_lower_tier` || `timeout_error` | `parse_wait_timeout` | 408 | 是 | `wait` | CLI `parse --wait` 等待窗口到期,解析任务仍在运行 | `poll_parse_or_rerun_with_longer_wait` || `engine_error` | `parse_oom` | 500 | 是 | null | 本地显存或内存不足 | `use_lower_tier_or_remote` |+| `invalid_request_error` | `remote_unsupported_for_file_type` | 400 | 否 | `remote` | 非 PDF/image 单文件主动解析请求 remote | `use_local_flash_or_choose_pdf_image` |+| `invalid_request_error` | `tier_unsupported_for_file_type` | 400 | 否 | `tier` | 非 PDF/image 单文件主动解析显式请求质量 tier | `use_tier_flash_or_choose_pdf_image` |+| `invalid_request_error` | `tier_unsupported_for_remote` | 400 | 否 | `tier` | PDF/image remote 解析显式请求 `flash` | `choose_remote_quality_tier_or_local_flash` |关键约束:@@ -109,6 +112,8 @@ Tier 语义见 [解析 Tier](tiers.md)。本节定义 `flash`、`medium`、`high| type | code | HTTP | retryable | param | 触发场景 ||------|------|------|:--:|-------|----------|| `invalid_request_error` | `invalid_request` | 400 | 否 | 出错参数 | 参数格式或组合非法 |+| `invalid_request_error` | `unsupported_output_format` | 400 | 否 | `output_formats` | 输出格式不支持 |+| `invalid_request_error` | `unsupported_source` | 400 | 否 | `source` | 当前部署不支持该 source 类型或 source 策略 || `invalid_request_error` | `page_range_invalid` | 400 | 否 | `page_range` | 页码范围格式非法或超出文档页数 || `invalid_request_error` | `file_type_unsupported` | 400 | 否 | `file` | 文件类型不支持 || `invalid_request_error` | `file_encrypted` | 400 | 否 | `file` | 文件加密或受密码保护 |@@ -178,7 +183,7 @@ CLI 在 TTY 中可以用表格或 rich 文本展示,但非 TTY、`--json` 或"error": {"type": "engine_error","code": "quality_tier_unavailable",- "message": "Default tier selection requires medium or high, but only flash is available. Start a local parse-server, use --remote, or explicitly pass --tier flash.",+ "message": "Default tier selection requires medium, high, or xhigh, but only flash is available. Start a local parse-server, use --remote, or explicitly pass --tier flash.","param": "tier","retryable": false,"user_action": "start_parse_server_or_use_remote_or_explicit_flash",diff --git a/docs/next/everydoc-doclib-gap-review.md b/docs/next/everydoc-doclib-gap-review.mdindex 68d511ef..54a394a8 100644--- a/docs/next/everydoc-doclib-gap-review.md+++ b/docs/next/everydoc-doclib-gap-review.md@@ -282,7 +282,7 @@ P0 结论:- `search()` 增加 `tier`、`min_tier`、`file_type` 过滤。- `tier` 表示只返回指定解析档位索引结果。-- `min_tier` 表示返回不低于该解析档位的索引结果,档位顺序为 `flash < medium < high`。+- `min_tier` 表示返回不低于该解析档位的索引结果,档位顺序为 `flash < medium < high < xhigh`。- 如果 `tier` 与 `min_tier` 同时出现,二者同时生效;不兼容时返回空结果。- 时间范围过滤、watch 过滤放到 P1。- 搜索结果可信度不新增 `confidence` 或 `quality` 字段,只使用 `tier` 表达。diff --git a/docs/next/glossary.md b/docs/next/glossary.mdindex 9b0ce9bb..98676f1d 100644--- a/docs/next/glossary.md+++ b/docs/next/glossary.md@@ -111,7 +111,7 @@|--------|------|| `parse()` | Tool SDK 的便捷函数 || `DocumentParser` | Parser 抽象接口 |-| `PdfPipelineParser` | 旧 SDK 兼容类,内部委托 Hybrid low |+| `PdfPipelineParser` | 旧 SDK 兼容类,内部委托 Hybrid medium || `PdfVlmParser` | 调用 VLM backend 的 parser || `PdfHybridParser` | 调用 hybrid backend 的 parser || `DocxParser` / `PptxParser` / `XlsxParser` | Office parser |diff --git a/docs/next/implementation-plan.md b/docs/next/implementation-plan.mdindex f5b199f1..a917df71 100644--- a/docs/next/implementation-plan.md+++ b/docs/next/implementation-plan.md@@ -804,7 +804,7 @@ M1 和 M2 的部分测试任务可以并行,但 `ParseResult.from_dict()`、JS- FTS 有内容。- Markdown 不落盘。-- tier-gated 更新符合 `flash < medium < high`。+- tier-gated 更新符合 `flash < medium < high < xhigh`。验证方式:@@ -1189,7 +1189,7 @@ API-backed parser、Doclib SDK、本地 parser 的错误都能被统一捕获,1. 测试 `GET /v1/health`。2. 测试 `GET /v1/tiers`。3. 测试 `POST /v1/parse/jobs` 的最小本地路径 source。-4. local source 必须校验 allowlist。+4. local source 默认关闭;开启 `--allow-local-source` 后允许 server 进程权限范围内的本地路径。5. 未实现 webhook 时 health features 应标记 false。6. 使用同一个 `MinerUApiParser` 调用本地 server。diff --git a/docs/next/sdk/migration.md b/docs/next/sdk/migration.mdindex d62fc0f6..7893ca34 100644--- a/docs/next/sdk/migration.md+++ b/docs/next/sdk/migration.md@@ -76,8 +76,7 @@ SDK 迁移的目标不是重写现有 parser,而是稳定已经成形的边界1. 将 `MinerUApiParser` 的内部 `_V1APIError` 映射到 `MineruError`。2. 补齐 API/tier 错误码:- `unsupported_parameter`- - `unsupported_output_format`- - `unsupported_source`+ - `invalid_request`- `quality_tier_unavailable`3. 为 doclib client 保留 error envelope -> exception 的一致行为。diff --git a/docs/next/sdk/parser.md b/docs/next/sdk/parser.mdindex 41d02ce0..84dc47f3 100644--- a/docs/next/sdk/parser.md+++ b/docs/next/sdk/parser.md@@ -33,7 +33,7 @@| `DocumentParser` | abstract class | 所有 parser 的统一接口。 || `ParseResult` | dataclass | 解析结果对象。 || `PdfFlashParser` | class | CPU-only PDF/image 快速解析。 |-| `PdfPipelineParser` | class | 旧 SDK 兼容类,内部委托 Hybrid low。 |+| `PdfPipelineParser` | class | 旧 SDK 兼容类,内部委托 Hybrid medium。 || `PdfVlmParser` | class | VLM backend。 || `PdfHybridParser` | class | hybrid backend。 || `DocxParser` | class | DOCX parser。 |@@ -104,7 +104,7 @@ class DocumentParser:| Parser | 输入 | 主要 backend | 说明 ||--------|------|--------------|------|| `PdfFlashParser` | PDF/image | flash | CPU-only,快速但质量最低,主要用于发现和索引。 |-| `PdfPipelineParser` | PDF/image | hybrid low | 旧 SDK 兼容类,等价于 `PdfHybridParser(effort="low")`。 |+| `PdfPipelineParser` | PDF/image | hybrid medium | 旧 SDK 兼容类,等价于 `PdfHybridParser(effort="medium")`。 || `PdfVlmParser` | PDF/image | VLM | VLM 解析,可通过 server URL 委托。 || `PdfHybridParser` | PDF/image | hybrid | 本地小模型 + VLM 混合解析。 || `DocxParser` | DOCX | office | Office 文档解析。 |@@ -119,7 +119,7 @@ class DocumentParser:| Tier | 默认 backend | 说明 ||------|--------------|------|| `flash` | `flash` | 快速 CPU-only。 |-| `medium` | `hybrid-engine` + `effort="low"` | 消费级硬件可用的本地小模型组合。 |+| `medium` | `hybrid-engine` + `effort="medium"` | 消费级硬件可用的本地小模型组合。 || `high` | hybrid 默认高质量 backend | 绝大多数场景足够好的高质量档位。 || `xhigh` | hybrid backend + 更高 effort | 最高质量档位,用更多算力和时间换取小幅质量提升。 |@@ -132,7 +132,7 @@ class DocumentParser:目标:- `from mineru.parser import parse, ParseResult` 应足够轻。-- `PdfPipelineParser` 仅作为旧 SDK 类名保留,内部走 Hybrid low,不再加载独立 pipeline backend。+- `PdfPipelineParser` 仅作为旧 SDK 类名保留,内部走 Hybrid medium,不再加载独立 pipeline backend。- `PdfVlmParser` / `PdfHybridParser` 只在执行 VLM/hybrid 时加载对应 backend。- Office parser 可以在构造时绑定 analyze function,但不应在模块 import 时加载重依赖。@@ -150,7 +150,7 @@ print(result.markdown())```pythonfrom mineru.parser import PdfHybridParser-with PdfHybridParser(method="txt", lang="ch", effort="low") as parser:+with PdfHybridParser(method="txt", lang="ch", effort="medium") as parser:result = parser.parse("report.pdf", page_range="1~10")images = result.images()```diff --git a/docs/next/sdk/tiers-errors.md b/docs/next/sdk/tiers-errors.mdindex c877152b..7e8e63b6 100644--- a/docs/next/sdk/tiers-errors.md+++ b/docs/next/sdk/tiers-errors.md@@ -29,7 +29,7 @@ SDK 中未指定 tier,或 Python 调用传 `tier=None` 时,必须遵循 [解| Tier | Backend ||------|---------|| `flash` | `flash` |-| `medium` | `hybrid-engine` + `effort="low"` |+| `medium` | `hybrid-engine` + `effort="medium"` || `high` | hybrid 默认高质量 backend || `xhigh` | hybrid backend + 更高 effort |diff --git a/docs/next/workflows.md b/docs/next/workflows.mdindex 34c7b483..47b4eb17 100644--- a/docs/next/workflows.md+++ b/docs/next/workflows.md@@ -403,7 +403,7 @@ marker 不应依赖自然语言提示。具体 marker 格式可在 CLI 或 Agent5. 调度到可用解析能力。6. 解析服务生成 Middle JSON 和请求的输出格式。7. job 进入终态。-8. 客户端轮询、等待、SSE 或 webhook 获取结果。+8. 客户端通过轮询或 webhook 获取结果。### 8.3 Local Parse Server 差异@@ -412,7 +412,7 @@ Local Parse Server 复用同一套客户端协议,但可以简化:- 鉴权默认可关闭。- Webhook 可以不实现。- 上传可以使用本地临时存储。-- `local` source 可以引用 allowlist 内路径。+- `local` source 只有在 `features.sources` 包含 `local` 时可用;开启后可以引用 server 进程权限范围内的本地路径。- 文件下载可以直接返回 body。### 8.4 与 doclib 的关系@@ -443,7 +443,7 @@ result = parse("report.pdf", tier="medium")```pythonfrom mineru.parser import PdfHybridParser-with PdfHybridParser(effort="low") as parser:+with PdfHybridParser(effort="medium") as parser:result = parser.parse("report.pdf")```diff --git a/mineru/errors.py b/mineru/errors.pyindex c08a0a00..2e22e524 100644--- a/mineru/errors.py+++ b/mineru/errors.py@@ -19,6 +19,8 @@ ErrorType = Literal[_ERROR_TYPE_MAP: dict[str, ErrorType] = {# invalid_request_error"invalid_request": "invalid_request_error",+ "unsupported_output_format": "invalid_request_error",+ "unsupported_source": "invalid_request_error","page_range_invalid": "invalid_request_error","file_type_unsupported": "invalid_request_error","file_encrypted": "invalid_request_error",diff --git a/mineru/parser/api_server.py b/mineru/parser/api_server.pyindex 0d74ab51..b8840ae2 100644--- a/mineru/parser/api_server.py+++ b/mineru/parser/api_server.py@@ -274,6 +274,14 @@ def _validation_error_message(exc: RequestValidationError) -> str:return f"Invalid request: {msg}"+def _validation_error_code(exc: RequestValidationError) -> str:+ for err in exc.errors():+ loc = tuple(err.get("loc", ()))+ if err.get("type") == "union_tag_invalid" and "source" in loc:+ return "unsupported_source"+ return "invalid_request"++def _http_exception_error(exc: HTTPException) -> ErrorDetail:detail = exc.detailif isinstance(detail, dict):@@ -482,7 +490,7 @@ class CreateJobRequest(BaseModel):model_config = _PYDANTIC_CONFIGfiles: list[JobFileEntry] = Field(min_length=1)tier: Tier | None = None- output_formats: list[OutputFormat] = ["markdown"]+ output_formats: list[str] = ["markdown"]callback: CallbackConfig | None = None@@ -1062,11 +1070,13 @@ def _validate_job_source_policy(allow_http_source=allow_http_source,)except ValueError as exc:+ message = str(exc)+ code = "unsupported_source" if "source" in message else "invalid_request"_raise_api_error(400,error_type="invalid_request_error",- code="invalid_request",- message=str(exc),+ code=code,+ message=message,param=f"files.{index}.source",)@@ -1783,7 +1793,7 @@ async def create_job(_raise_api_error(400,error_type="invalid_request_error",- code="invalid_request",+ code="unsupported_output_format",message=f"Unknown output format: {fmt}",)@@ -2163,7 +2173,7 @@ def create_app(400,ErrorDetail(type="invalid_request_error",- code="invalid_request",+ code=_validation_error_code(exc),message=_validation_error_message(exc),param=_validation_error_param(exc),),diff --git a/mineru/parser/tier.py b/mineru/parser/tier.pyindex d84ed48a..7ae95eab 100644--- a/mineru/parser/tier.py+++ b/mineru/parser/tier.py@@ -37,7 +37,7 @@ __all__ = [PARSER_BACKENDS = SUPPORTED_BACKENDS-_STANDARD_REQUIRED_MODULES = [+_MEDIUM_REQUIRED_MODULES = ["ftfy","shapely","pyclipper",@@ -46,11 +46,11 @@ _STANDARD_REQUIRED_MODULES = ["torchvision","transformers",]-_PRO_REQUIRED_MODULES_COMMON = [- *_STANDARD_REQUIRED_MODULES,+_HIGH_REQUIRED_MODULES_COMMON = [+ *_MEDIUM_REQUIRED_MODULES,"accelerate",]-_PRO_REQUIRED_MODULES_BY_PLATFORM = {+_HIGH_REQUIRED_MODULES_BY_PLATFORM = {"linux": ["vllm"],"win32": ["lmdeploy", "qwen_vl_utils"],"darwin": ["mlx", "mlx_vlm"],@@ -206,11 +206,11 @@ def runtime_options_for_tier(def required_modules_for_tier(tier: Tier) -> list[str]:tier = validate_tier(tier)if tier == "medium":- return list(_STANDARD_REQUIRED_MODULES)+ return list(_MEDIUM_REQUIRED_MODULES)if tier in {"high", "xhigh"}:return [- *_PRO_REQUIRED_MODULES_COMMON,- *_PRO_REQUIRED_MODULES_BY_PLATFORM.get(sys.platform, []),+ *_HIGH_REQUIRED_MODULES_COMMON,+ *_HIGH_REQUIRED_MODULES_BY_PLATFORM.get(sys.platform, []),]return []diff --git a/pyproject.toml b/pyproject.tomlindex cbb9f70d..df70e949 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -105,32 +105,13 @@ high = [xhigh = ["mineru[high]",]--vlm = [- "torch>=2.6.0,<3",- "transformers>=4.57.3,<5.0.0",- "accelerate>=1.5.1",-]-vllm = [- "vllm>=0.10.1.1,<0.22.0",-]-lmdeploy = [- "lmdeploy>=0.10.2,<0.12",- "qwen-vl-utils>=0.0.14,<1",-]-mlx = [- "mlx-vlm>=0.3.3,<0.4",- "mlx<=0.31.1",-]gradio = ["gradio>=5.49.1,!=6.0.0,!=6.0.1,!=6.0.2,!=6.1.0,!=6.2.0,!=6.3.0,!=6.4.0,!=6.5.0,!=6.5.1,!=6.6.0,!=6.7.0,<6.9.0","gradio-pdf>=0.0.22",]all = [+ "mineru[high]","mineru[gradio]",- "mineru[mlx] ; sys_platform == 'darwin'",- "mineru[vllm] ; sys_platform == 'linux'",- "mineru[lmdeploy] ; sys_platform == 'win32'",][project.urls]diff --git a/skills/mineru/SKILL.md b/skills/mineru/SKILL.mdindex 99df7c11..349783c1 100644--- a/skills/mineru/SKILL.md+++ b/skills/mineru/SKILL.md@@ -109,7 +109,7 @@ Then answer from `content.content`. If `next_request` exists and the question ne```bashmineru parse "book.pdf" --pages 1~10 --limit 12000 --json-mineru read "doc:ab12cd3/tier:standard/page:11" --limit 12000 --json+mineru read "doc:ab12cd3/tier:high/page:11" --limit 12000 --json```Continue with returned `next_request.locator`.@@ -117,15 +117,15 @@ Continue with returned `next_request.locator`.### Read or inspect a known location```bash-mineru read "doc:ab12cd3/tier:standard/page:42" --context 1 --json-mineru read "doc:ab12cd3/tier:standard/page:12/block:5" --format image --output ./page12-block5.png+mineru read "doc:ab12cd3/tier:high/page:42" --context 1 --json+mineru read "doc:ab12cd3/tier:high/page:12/block:5" --format image --output ./page12-block5.png```### Search local library, then read```bash-mineru search "liquidated damages" --min-tier standard --json-mineru read "doc:ab12cd3/tier:standard/page:18" --json+mineru search "liquidated damages" --min-tier medium --json+mineru read "doc:ab12cd3/tier:high/page:18" --json```## Installation And Setup@@ -261,18 +261,20 @@ mineru telemetry flush## Quality Tiers-MinerU has three quality tiers:+MinerU has four tiers:| Tier | Use for | How to use ||---|---|---|| `flash` | Fast discovery, preview, and search indexing | Never use as default final reading quality |-| `standard` | Local high-quality reading on typical supported hardware | Minimum default quality for active reading |-| `pro` | Highest quality, local high-end hardware or remote API | Use for complex or high-value documents when available |+| `medium` | Local higher-quality parsing with optional GPU acceleration | Use when high is unavailable or explicitly requested |+| `high` | Default high-quality parsing for most active reading | Prefer for normal final reading quality |+| `xhigh` | Highest quality with higher compute cost | Use only when the user needs maximum quality and accepts slower parsing |Default tier behavior:- Omit `--tier` when the user wants normal reading quality.-- MinerU will choose the highest available non-`flash` tier, usually `standard` or `pro`.+- For parse-server based parsing, MinerU chooses `high`, then `xhigh`, then `medium`; `flash` is not a default final reading tier.+- For `mineru read doc:{short_id}`, MinerU reads the best cached result rather than starting a new parse.- If normal reading quality is unavailable, there are usually three options:- Use remote parsing with `--remote`.- Start or configure a local parse server if the hardware supports it.@@ -283,8 +285,9 @@ Examples:```bashmineru parse "paper.pdf"-mineru parse "paper.pdf" --tier standard-mineru parse "paper.pdf" --tier pro+mineru parse "paper.pdf" --tier medium+mineru parse "paper.pdf" --tier high+mineru parse "paper.pdf" --tier xhighmineru parse "paper.pdf" --tier flash```@@ -321,24 +324,24 @@ Agent rules:## Local Parse Server-Use a local parse server when the user wants `standard` or `pro` quality without sending the document to remote parsing.+Use a local parse server when the user wants `medium`, `high`, or `xhigh` quality without sending the document to remote parsing.Hardware guidance:-Local managed `standard` and `pro` both require at least 16 GB total system memory.+Local managed `medium` needs extra dependencies. It can run on CPU, but GPU can accelerate it.-Use `standard` when:+Use `medium` when:- The user wants local high-quality parsing without sending files to remote.-- GPU is optional. CPU-only machines can use `standard`, but parsing may be slower.+- GPU is unavailable or `high` cannot be used.-Use `pro` when the machine also has one of the following supported local accelerators:+Use `high` or `xhigh` when the machine has VLM dependencies, GPU, and enough VRAM or unified memory:- Volta-or-newer NVIDIA GPU with at least 8 GB VRAM available for MinerU.- Apple Silicon with at least 16 GB unified memory.- A MinerU-supported AI accelerator such as `npu`, `gcu`, `musa`, `mlu`, or `sdaa`.-If local `pro` hardware readiness is unclear, use local `standard` or ask before using remote `pro`.+Use `high` for normal high-quality local parsing. Use `xhigh` only when the user wants maximum quality and accepts higher compute cost.Change local parse-server config or restart the server only when the user asks for or approves local high-quality parsing.@@ -348,22 +351,32 @@ The following examples assume the current install tool is `uv tool`. If `mineru`Installing extras with `uv tool install --force` can reinstall or upgrade the `mineru` package. Restart the MinerU server after installing extras so the CLI client, doclib server, and managed parse server use the same installed version.-Enable managed local parsing for `standard`:+Enable managed local parsing for `medium`:```bash-uv tool install --force "mineru-next-dev[standard]"+uv tool install --force "mineru-next-dev[medium]"mineru server restart-mineru config set parse_server.local.managed_tier standard+mineru config set parse_server.local.managed_tier mediummineru config set parse_server.local.mode managedmineru server status --json```-Enable managed local parsing for `pro`:+Enable managed local parsing for `high`:```bash-uv tool install --force "mineru-next-dev[pro]"+uv tool install --force "mineru-next-dev[high]"mineru server restart-mineru config set parse_server.local.managed_tier pro+mineru config set parse_server.local.managed_tier high+mineru config set parse_server.local.mode managed+mineru server status --json+```++Enable managed local parsing for `xhigh`:++```bash+uv tool install --force "mineru-next-dev[xhigh]"+mineru server restart+mineru config set parse_server.local.managed_tier xhighmineru config set parse_server.local.mode managedmineru server status --json```@@ -374,9 +387,9 @@ Rules:- After installing extras, restart the MinerU server to avoid CLI/server version mismatch.- Set `parse_server.local.managed_tier` before `parse_server.local.mode=managed`.- Poll `mineru server status --json` and use managed parsing only after the target tier is healthy.-- Use `standard` as the practical local default when the machine has at least 16 GB total memory.-- Use local `pro` only when the machine satisfies the local `pro` hardware guidance above.-- If local `standard` or `pro` cannot start, do not add `--remote` automatically; ask the user first.+- Use `high` as the practical local default when the machine satisfies the local high-tier hardware guidance above.+- Use local `xhigh` only when the user explicitly wants maximum quality.+- If local `medium`, `high`, or `xhigh` cannot start, do not add `--remote` automatically; ask the user first.## First Read From A File@@ -439,7 +452,7 @@ Rules:MinerU output may include a command to continue reading:```text-<!-- Next: mineru read doc:ab12cd3/tier:standard/page:11 -->+<!-- Next: mineru read doc:ab12cd3/tier:high/page:11 -->```or:@@ -476,10 +489,10 @@ doc:{short_id}/tier:{tier}/page:{page_no}/block:{block_no}/char:{offset}Examples:```bash-mineru read "doc:ab12cd3/tier:standard/page:4"-mineru read "doc:ab12cd3/tier:standard/page:4/block:7"-mineru read "doc:ab12cd3/tier:standard/page:4/block:7" --context 2-mineru read "doc:ab12cd3/tier:standard/page:4" --limit 8000 --json+mineru read "doc:ab12cd3/tier:high/page:4"+mineru read "doc:ab12cd3/tier:high/page:4/block:7"+mineru read "doc:ab12cd3/tier:high/page:4/block:7" --context 2+mineru read "doc:ab12cd3/tier:high/page:4" --limit 8000 --json```Rules:@@ -487,16 +500,16 @@ Rules:- Page and block numbers are 1-based.- Character offsets are 0-based within the block text.- `--context N` means surrounding pages for page locators and surrounding blocks for block locators.-- If only `doc:{short_id}` is provided, MinerU should choose the highest cached non-`flash` tier. If none exists, parse the document first or report the error.+- If only `doc:{short_id}` is provided, MinerU should choose the highest cached result. If none exists, parse the document first or report the error.## Read Page Or Block ImagesUse image output only when the user needs visual inspection, layout evidence, cropped figures, page screenshots, or block-level visual verification.```bash-mineru read "doc:ab12cd3/tier:standard/page:4" --format image-mineru read "doc:ab12cd3/tier:standard/page:4/block:7" --format image-mineru read "doc:ab12cd3/tier:standard/page:4/block:7" --format image --output ./block-7.png+mineru read "doc:ab12cd3/tier:high/page:4" --format image+mineru read "doc:ab12cd3/tier:high/page:4/block:7" --format image+mineru read "doc:ab12cd3/tier:high/page:4/block:7" --format image --output ./block-7.png```Rules:@@ -522,7 +535,7 @@ Use `search` for parsed document content:```bashmineru search "revenue recognition"mineru search "transformer architecture" --type pdf-mineru search "appendix" --min-tier standard --limit 10 --json+mineru search "appendix" --min-tier medium --limit 10 --json```Rules:@@ -593,8 +606,8 @@ Watch rules:Use parsing rules only when the user wants automatic parse policy for paths:```bash-mineru config parsing-rules add "*/papers/*" --tier standard --pages all-mineru config parsing-rules add "*/contracts/*" --tier pro --remote+mineru config parsing-rules add "*/papers/*" --tier high --pages all+mineru config parsing-rules add "*/contracts/*" --tier high --remotemineru config parsing-rules listmineru config parsing-rules remove 3```@@ -650,7 +663,7 @@ Invalidate cached parse results:```bashmineru invalidate "report.pdf"-mineru invalidate "report.pdf" --tier standard+mineru invalidate "report.pdf" --tier high```Rules:@@ -776,11 +789,11 @@ When answering after reading a document:Citation style examples:```text-The warranty period is 24 months (doc:ab12cd3/tier:standard/page:7/block:3).+The warranty period is 24 months (doc:ab12cd3/tier:high/page:7/block:3).``````text-The method is described across pages 4-5; I checked doc:ab12cd3/tier:pro/page:4 and doc:ab12cd3/tier:pro/page:5.+The method is described across pages 4-5; I checked doc:ab12cd3/tier:high/page:4 and doc:ab12cd3/tier:high/page:5.```## Operating Rulesdiff --git a/tests/unittest/test_cli_next_command_design.py b/tests/unittest/test_cli_next_command_design.pyindex ca18cb19..02144c8b 100644--- a/tests/unittest/test_cli_next_command_design.py+++ b/tests/unittest/test_cli_next_command_design.py@@ -184,7 +184,7 @@ def test_print_error_uses_single_rich_render(monkeypatch: Any) -> None:monkeypatch.setattr(output_mod, "stderr_console", _Console())output_mod.print_error(- "No medium or high engine available. You can start a local parse-server, use --remote, or explicitly pass "+ "No medium, high, or xhigh engine available. You can start a local parse-server, use --remote, or explicitly pass ""--tier flash for text-only preview.")@@ -1411,7 +1411,7 @@ def test_parse_json_error_output_is_machine_readable(monkeypatch: Any, tmp_path:def ensure_parse(self, request: Any) -> ParseResponse:raise RuntimeError(- "('quality_tier_unavailable', 'No medium or high engine available. Use --tier flash.', None)"+ "('quality_tier_unavailable', 'No medium, high, or xhigh engine available. Use --tier flash.', None)")monkeypatch.setattr(parse, "DoclibClient", _Client)@@ -1421,7 +1421,7 @@ def test_parse_json_error_output_is_machine_readable(monkeypatch: Any, tmp_path:assert result.exit_code == 1payload = json.loads(result.output)assert payload["error"]["code"] == "quality_tier_unavailable"- assert "No medium or high engine available" in payload["error"]["message"]+ assert "No medium, high, or xhigh engine available" in payload["error"]["message"]def test_parse_invalid_after_cursor_json_error_is_validation_error(monkeypatch: Any, tmp_path: Path) -> None:@@ -2292,7 +2292,7 @@ def test_search_json_error_output_is_machine_readable(monkeypatch: Any) -> None:assert timeout == 10def search(self, *args: Any, **kwargs: Any) -> Any:- raise RuntimeError("('quality_tier_unavailable', 'No medium or high engine available.', 'tier')")+ raise RuntimeError("('quality_tier_unavailable', 'No medium, high, or xhigh engine available.', 'tier')")monkeypatch.setattr(search_mod, "DoclibClient", _Client)diff --git a/tests/unittest/test_doclib_cache_semantics.py b/tests/unittest/test_doclib_cache_semantics.pyindex 8cdf1b85..dc8266cb 100644--- a/tests/unittest/test_doclib_cache_semantics.py+++ b/tests/unittest/test_doclib_cache_semantics.py@@ -1901,7 +1901,8 @@ def test_search_filters_by_tier_min_tier_and_file_type(tmp_path: Path) -> None:docs = [("1" * 64, "flash", "pdf", "flash.pdf", 2),("2" * 64, "high", "pdf", "high.pdf", 12),- ("3" * 64, "xhigh", "docx", "xhigh.docx", 23),+ ("3" * 64, "flash", "docx", "flash.docx", 23),+ ("4" * 64, "xhigh", "pdf", "xhigh.pdf", 34),]for sha256, tier, file_type, filename, page_count in docs:@@ -1928,7 +1929,7 @@ def test_search_filters_by_tier_min_tier_and_file_type(tmp_path: Path) -> None:assert min_total == 2assert {row["tier"] for row in min_results} == {"high", "xhigh"}assert type_total == 1- assert [row["filename"] for row in type_results] == ["xhigh.docx"]+ assert [row["filename"] for row in type_results] == ["flash.docx"]assert [row["short_id"] for row in type_results] == ["3" * 7]assert [row["page_count"] for row in type_results] == [23]diff --git a/tests/unittest/test_parser_api_contract.py b/tests/unittest/test_parser_api_contract.pyindex 0b458796..6c64420b 100644--- a/tests/unittest/test_parser_api_contract.py+++ b/tests/unittest/test_parser_api_contract.py@@ -1267,13 +1267,13 @@ def test_create_job_request_accepts_new_format_names_and_rejects_options() -> Noassert req.files[0].page_range is Noneassert req.output_formats == ["middle_json", "structured_content"]- with pytest.raises(ValidationError):- CreateJobRequest.model_validate(- {- "files": [{"source": {"type": "local", "path": "/tmp/demo.pdf"}}],- "output_formats": ["images"],- }- )+ unsupported = CreateJobRequest.model_validate(+ {+ "files": [{"source": {"type": "local", "path": "/tmp/demo.pdf"}}],+ "output_formats": ["images"],+ }+ )+ assert unsupported.output_formats == ["images"]with pytest.raises(ValidationError):CreateJobRequest.model_validate(@@ -1310,7 +1310,7 @@ def test_api_server_rejects_local_source_by_default(tmp_path: Path, monkeypatch:assert response.status_code == 400body = response.json()- assert body["error"]["code"] == "invalid_request"+ assert body["error"]["code"] == "unsupported_source"assert body["error"]["param"] == "files.0.source"assert "--allow-local-source" in body["error"]["message"]@@ -1352,7 +1352,7 @@ def test_api_server_rejects_inline_source_over_configured_limit(tmp_path: Path,assert response.status_code == 400body = response.json()- assert body["error"]["code"] == "invalid_request"+ assert body["error"]["code"] == "unsupported_source"assert body["error"]["param"] == "files.0.source"assert "max_inline_bytes" in body["error"]["message"]@@ -1369,11 +1369,57 @@ def test_api_server_rejects_plain_http_url_source_by_default(tmp_path: Path, monassert response.status_code == 400body = response.json()- assert body["error"]["code"] == "invalid_request"+ assert body["error"]["code"] == "unsupported_source"assert body["error"]["param"] == "files.0.source"assert "https" in body["error"]["message"]+def test_api_server_rejects_unsupported_output_format_with_specific_code(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ _stub_api_server_dependency_preflight(monkeypatch)+ source = tmp_path / "demo.pdf"+ source.write_bytes(b"%PDF-1.7\n")+ app = create_app(upload_dir=str(tmp_path), tier="flash", allow_local_source=True)++ with TestClient(app) as client:+ response = client.post(+ "/v1/parse/jobs",+ json={+ "tier": "flash",+ "files": [{"source": {"type": "local", "path": str(source)}}],+ "output_formats": ["images"],+ },+ )++ assert response.status_code == 400+ body = response.json()+ assert body["error"]["code"] == "unsupported_output_format"+ assert body["error"]["param"] is None+ assert "Unknown output format: images" in body["error"]["message"]+++def test_api_server_rejects_unsupported_source_type_with_specific_code(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ _stub_api_server_dependency_preflight(monkeypatch)+ app = create_app(upload_dir=str(tmp_path), tier="flash")++ with TestClient(app) as client:+ response = client.post(+ "/v1/parse/jobs",+ json={+ "tier": "flash",+ "files": [{"source": {"type": "s3", "uri": "s3://bucket/demo.pdf"}}],+ },+ )++ assert response.status_code == 400+ body = response.json()+ assert body["error"]["code"] == "unsupported_source"+ assert body["error"]["param"] == "files.0.source"++def test_local_parse_server_rejects_callback(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:_stub_api_server_dependency_preflight(monkeypatch)app = create_app(upload_dir=str(tmp_path))