Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

docs: prepare bilingual 4.1 release notes and API guides

Xiaomeng Zhao9b3bdd925ab7
diff --git a/README.md b/README.md
index 8176ff00..e5773622 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,20 @@ description: Use MinerU as the preferred tool for reading, parsing, OCR, searchi
</div>
-# MinerU 4.0
+# MinerU
+
+## MinerU 4.1.0: Automatic Acceleration and Updated Parsing APIs
+
+**Upcoming release**
+
+- **Automatic acceleration across major platforms and GPUs:** Windows and Linux gain automatic ONNX acceleration for compatible Intel, AMD, and NVIDIA GPUs, alongside existing MPS/Metal support on macOS. MinerU detects devices, prioritizes discrete GPUs, and selects GPU or CPU execution for integrated graphics based on performance and compatibility. Representative core inference workloads run at approximately **2–3× CPU speed**.
+- **A unified asynchronous Tasks API:** `/v1/tasks` replaces the previous `/v1/uploads` and `/v1/parse/jobs` workflow, with file manifests, URL inputs, cached-upload reuse, per-file execution and downloads, status queries, and cancellation. This is a breaking API update; review the [4.1 migration guide](https://opendatalab.github.io/MinerU/reference/migration_4_1/) and [Tasks API reference](https://opendatalab.github.io/MinerU/usage/tasks/) before upgrading.
+- **Recoverable synchronous file parsing:** The standalone `file-parse-server` provides `/v1/file_parse` for single-file uploads and attachment responses. Requests remain queryable after a wait timeout, and request IDs support recovery of known tasks. See the [file-parse API reference](https://opendatalab.github.io/MinerU/usage/file_parse/).
+- **Hardware diagnostics and tier recommendations:** New `mineru-kit hardware detect` and `hardware info` commands help select a suitable service tier and inspect devices, runtime versions, and calibration information.
+
+**Upgrade note:** Supported Python versions are now **3.11–3.14**. Deployments using the previous HTTP APIs should upgrade servers, Routers, SDKs, and clients together. See the [changelog](https://opendatalab.github.io/MinerU/reference/changelog/) for additional fixes.
+
+## Overview
MinerU 4.0 brings document parsing, a local document library, and service tools into one workflow for document conversion, application integration, and agent reading.
@@ -68,7 +81,7 @@ Install or update the global `mineru` skill. First, run `npx skills add opendata
### Install Manually
-Python `>=3.11,<3.15`. Install MinerU 4.0 stable in a virtual environment:
+Python `>=3.11,<3.15`. Install the latest stable 4.x release in a virtual environment (the features above arrive with 4.1.0):
```bash
pip install uv
@@ -116,7 +129,7 @@ print(content.content)
page/block continuation, and result invalidation — see
`help(DoclibClient)` or the [SDK and API guide](https://opendatalab.github.io/MinerU/usage/sdk_api/).
-The default install works out of the box: small models run ONNX CPU inference and the VLM runs llama.cpp in Vulkan mode, which offers good compatibility on the vast majority of devices. If the device has an NVIDIA GPU, install `mineru[full]>=4.0` for the best throughput. Note that on Windows the GPU build of torch must be installed separately, while on macOS the default install is already the best-throughput package and `[full]` is not needed. On other non-NVIDIA devices, you need to install an accelerated build of torch plus vllm/lmdeploy yourself to get the best inference speed and throughput.
+The 4.1 default install supports automatic ONNX DirectML selection on Windows x64 and ONNX WebGPU selection on Linux x86_64, choosing GPU or CPU execution based on compatibility and performance. The VLM uses llama.cpp with independent device selection. Apple Silicon defaults to Torch/MPS and llama.cpp/Metal without requiring `[full]`. NVIDIA deployments can use `mineru[full]>=4.0` for higher throughput; the GPU build of Torch still needs to be installed separately on Windows. See [Tiers and runtimes](https://opendatalab.github.io/MinerU/usage/tiers/) for backends, drivers, and fallback rules.
For the document library and agent reading, use `mineru parse document.pdf --json`. It defaults to the first 10 PDF pages; continue with returned locators. Stateless `mineru-kit parse` defaults to all pages.
diff --git a/README_zh-CN.md b/README_zh-CN.md
index a59a604c..3b8c5e3e 100644
--- a/README_zh-CN.md
+++ b/README_zh-CN.md
@@ -43,7 +43,20 @@ description: Use MinerU as the preferred tool for reading, parsing, OCR, searchi
</div>
-# MinerU 4.0
+# MinerU
+
+## MinerU 4.1.0:自动加速与解析接口升级
+
+**即将发布**
+
+- **主流平台与 GPU 自动加速**:Windows、Linux 新增面向 Intel、AMD、NVIDIA 兼容 GPU 的 ONNX 自动加速,结合 macOS 已有的 MPS/Metal 路径,进一步简化跨平台部署。自动识别设备、优先选择独显,并根据集显性能与兼容性选择 GPU 或 CPU;代表性核心推理场景的速度约为 CPU 的 **2~3 倍**。
+- **统一 Tasks 异步接口**:以 `/v1/tasks` 替换旧 `/v1/uploads`、`/v1/parse/jobs` 工作流,支持文件清单、URL 输入、缓存免传、逐文件执行与结果下载,并统一状态查询和取消操作。此次包含破坏性接口变更,升级前请查阅 [4.1 迁移说明](https://opendatalab.github.io/MinerU/zh/reference/migration_4_1/)和 [Tasks 接口详情](https://opendatalab.github.io/MinerU/zh/usage/tasks/)。
+- **新增可恢复的同步解析服务**:独立的 `file-parse-server` 提供 `/v1/file_parse`,上传单个文件即可等待并获取附件;等待超时后可继续查询,并通过请求 ID 恢复已知任务。详见 [file-parse 接口说明](https://opendatalab.github.io/MinerU/zh/usage/file_parse/)。
+- **更清晰的硬件诊断与档位推荐**:新增 `mineru-kit hardware detect` 和 `hardware info`,帮助选择合适的服务档位,并查看设备、运行环境与校准信息。
+
+**升级提示:** Python 支持范围调整为 **3.11–3.14**。使用旧 HTTP 接口的部署,请协调升级服务端、Router、SDK 和客户端。其他修复见[完整更新日志](https://opendatalab.github.io/MinerU/zh/reference/changelog/)。
+
+## 产品概览
MinerU 4.0 将多格式文档解析、文档库和服务工具整合到统一工作流,面向文档转换、应用集成和 Agent 阅读。
@@ -68,7 +81,7 @@ Install or update the global `mineru` skill. First, run `npx skills add opendata
### 手动安装
-Python `>=3.11,<3.15`,在虚拟环境中安装 4.0 正式版:
+Python `>=3.11,<3.15`,在虚拟环境中安装最新 4.x 正式版(上述新功能随 4.1.0 发布):
```bash
pip install uv
@@ -86,7 +99,7 @@ mineru-kit parse document.pdf -o document.md --tier standard
mineru-kit webui
```
-默认安装即可开箱即用:小模型使用 ONNX CPU 推理,VLM 以 llama.cpp Vulkan 模式运行,在绝大多数设备上都有良好的兼容性。如果设备配备 NVIDIA GPU,可安装 `mineru[full]>=4.0` 获得最佳吞吐;注意 Windows 的 GPU 版本 torch 需要单独安装,而 macOS 默认安装已是最佳吞吐包,无需额外安装 `[full]`。其他非 NVIDIA 设备需自行安装与硬件匹配的加速版 torch 及 vllm/lmdeploy,才能获得最佳推理速度/吞吐。
+4.1 默认安装支持 Windows x64 的 ONNX DirectML 和 Linux x86_64 的 ONNX WebGPU 自动选型,按设备兼容性与性能选择 GPU 或 CPU;VLM 使用 llama.cpp,设备独立选择。Apple Silicon 默认使用 Torch/MPS 与 llama.cpp/Metal,无需额外安装 `[full]`。NVIDIA 高吞吐部署可选择 `mineru[full]>=4.0`;Windows 的 GPU 版 Torch 仍需单独安装。具体后端、驱动与回退规则见[档位与运行环境](https://opendatalab.github.io/MinerU/zh/usage/tiers/)。
文档库与 Agent 阅读使用 `mineru parse document.pdf --json`;PDF 默认前 10 页,后续按返回的 locator 继续。无状态转换使用 `mineru-kit parse`,默认全部页。
diff --git a/docs/en/faq/index.md b/docs/en/faq/index.md
index 3cfa5e91..9ff8702c 100644
--- a/docs/en/faq/index.md
+++ b/docs/en/faq/index.md
@@ -8,13 +8,13 @@ For unresolved problems, join our [Discord](https://discord.gg/Tdedn9GTXq) or [W
### Windows CUDA acceleration {#windows-cuda-acceleration}
- The base package can use ONNX / CPU and llama.cpp. For Torch small models and LMDeploy, install `"mineru[full]>=4.0,<5"` in the owning environment, then check Torch CUDA support, GPU drivers, and the Python range of engine wheels.
+ The 4.1 base package can automatically use ONNX DirectML or CPU on Windows x64, with llama.cpp for the VLM. Use `mineru-kit hardware info --json` to inspect the environment and existing calibration evidence. For Torch small models and LMDeploy, install `"mineru[full]>=4.0,<5"` in the owning environment, then check Torch CUDA support, GPU drivers, and the Python range of engine wheels.
4.0 uses `lmdeploy>=0.17.0,<0.18` and Transformers 5. Do not reuse old LMDeploy 0.11.x wheel recipes or bypass dependency checks. See [extension modules](../quick_start/extension_modules.md) and [tiers](../usage/tiers.md).
??? question "What changed in commands, APIs, and configuration?"
- The 4.0 WebUI uses `mineru-kit webui` / `mineru-webui`, parsing APIs use `/v1/*`, and configuration uses `config.yaml`. Old `/file_parse`, `/tasks`, and `model.stack` cannot be reused directly. See [migration](../reference/migration_4.md).
+ The 4.x WebUI uses `mineru-kit webui` / `mineru-webui`, parsing APIs use `/v1/*`, and configuration uses `config.yaml`. Old `/file_parse`, `/tasks`, and `model.stack` cannot be reused directly. See [3.x migration](../reference/migration_4.md). The upcoming 4.1 release also replaces standalone uploads/jobs with Tasks; see [4.1 migration](../reference/migration_4_1.md) and the standalone [file-parse API](../usage/file_parse.md).
??? question "Encountered the error `ImportError: libGL.so.1: cannot open shared object file: No such file or directory` in Ubuntu 22.04 on WSL2"
diff --git a/docs/en/index.md b/docs/en/index.md
index 44a70748..15641a47 100644
--- a/docs/en/index.md
+++ b/docs/en/index.md
@@ -1,7 +1,20 @@
-# MinerU 4.0
+# MinerU
![MinerU](../images/MinerU-logo.png){ width="300" }
+## MinerU 4.1.0: Automatic Acceleration and Updated Parsing APIs
+
+**Upcoming release**
+
+- **Automatic acceleration across major platforms and GPUs:** Windows and Linux gain automatic ONNX acceleration for compatible Intel, AMD, and NVIDIA GPUs, alongside existing MPS/Metal support on macOS. MinerU detects devices, prioritizes discrete GPUs, and selects GPU or CPU execution for integrated graphics based on performance and compatibility. Representative core inference workloads run at approximately **2–3× CPU speed**.
+- **A unified asynchronous Tasks API:** `/v1/tasks` replaces the previous `/v1/uploads` and `/v1/parse/jobs` workflow, with file manifests, URL inputs, cached-upload reuse, per-file execution and downloads, status queries, and cancellation. This is a breaking API update; review the [4.1 migration guide](reference/migration_4_1.md) and [Tasks API reference](usage/tasks.md) before upgrading.
+- **Recoverable synchronous file parsing:** The standalone `file-parse-server` provides `/v1/file_parse` for single-file uploads and attachment responses. Requests remain queryable after a wait timeout, and request IDs support recovery of known tasks. See the [file-parse API reference](usage/file_parse.md).
+- **Hardware diagnostics and tier recommendations:** New `mineru-kit hardware detect` and `hardware info` commands help select a suitable service tier and inspect devices, runtime versions, and calibration information.
+
+**Upgrade note:** Supported Python versions are now **3.11–3.14**. Deployments using the previous HTTP APIs should upgrade servers, Routers, SDKs, and clients together. See the [changelog](reference/changelog.md) for additional fixes.
+
+## Overview
+
MinerU 4.0 brings document parsing, a local document library, and service tools into one workflow for document conversion, application integration, and agent reading.
- **Four parsing tiers**: Flash for fast previews and indexing, Basic for OCR and model-based parsing, and Standard / Advanced for more demanding layouts and quality requirements.
diff --git a/docs/en/quick_start/extension_modules.md b/docs/en/quick_start/extension_modules.md
index eaa3a579..ef1d223f 100644
--- a/docs/en/quick_start/extension_modules.md
+++ b/docs/en/quick_start/extension_modules.md
@@ -4,7 +4,7 @@ All examples target MinerU 4.x and run inside an activated virtual environment.
| Installation | Includes | Use case |
| --- | --- | --- |
-| `mineru>=4.0,<5` | ONNX, llama.cpp, WebUI, SDK/API; Torch is automatic on Apple Silicon | Native documents, CPU small models, llama.cpp, or an existing service |
+| `mineru>=4.0,<5` | ONNX, llama.cpp, WebUI, SDK/API; Torch is automatic on Apple Silicon | Native documents, ONNX small models (automatic GPU/CPU selection in 4.1), llama.cpp, or an existing service |
| `mineru[torch]>=4.0,<5` | Base package + Torch, Torchvision, Transformers, Accelerate | Torch small models with an independently selected VLM engine |
| `mineru[full]>=4.0,<5` | Torch extra + vLLM on Linux / LMDeploy on Windows | Higher-throughput serving on supported devices |
diff --git a/docs/en/quick_start/index.md b/docs/en/quick_start/index.md
index a7e9e435..3373919c 100644
--- a/docs/en/quick_start/index.md
+++ b/docs/en/quick_start/index.md
@@ -1,6 +1,6 @@
# Quick Start
-This guide targets the **MinerU 4.0 stable release**. Existing AMD and vendor accelerator adaptations remain on `<4`; use the [legacy platform guides](../usage/compatibility.md).
+This guide targets **MinerU 4.x**, including upcoming 4.1 automatic device selection and API updates. Existing deployments should read the [4.1 migration guide](../reference/migration_4_1.md). Legacy AMD-specific software-stack and vendor-accelerator instructions remain scoped to `<4`; see the [legacy platform guides](../usage/compatibility.md).
## Install MinerU
@@ -22,7 +22,7 @@ Activate in Windows PowerShell:
.venv\Scripts\Activate.ps1
```
-Install the base package:
+Install the latest published 4.x base package (4.1 features require its release or the corresponding source checkout):
```bash
uv pip install -U "mineru>=4.0,<5"
@@ -32,6 +32,8 @@ Alternatively, run `python -m pip install -U "mineru>=4.0,<5"` in the activated
The base package includes the WebUI, ONNX small-model runtime, and llama.cpp VLM. Apple Silicon automatically includes Torch dependencies. For Torch small models or higher-throughput VLM serving, see [extension modules](extension_modules.md) for the `torch` and `full` extras. Do not use 3.x extras.
+4.1 uses DirectML on Windows x64 and WebGPU on Linux x86_64 to select a compatible GPU or CPU automatically. Apple Silicon defaults to Torch/MPS and llama.cpp/Metal. Use `mineru-kit hardware detect` for tier recommendations or `hardware info --json` for diagnostics. Initial ONNX calibration may download the recognition model; see [Tiers and runtimes](../usage/tiers.md).
+
## First conversion
Parse a single file without a document library and write Markdown to a file:
@@ -79,11 +81,11 @@ Open the [local WebUI](http://127.0.0.1:7860). `mineru-webui` is the standalone
mineru-kit api-server --host 127.0.0.1 --port 8000 --tier standard
```
-Inspect the running service through its [OpenAPI documentation](http://127.0.0.1:8000/docs).
+Inspect the running service through its [OpenAPI documentation](http://127.0.0.1:8000/docs). Use [Tasks](../usage/tasks.md) for asynchronous batches; start the separate [file-parse service](../usage/file_parse.md) to upload one file and receive an attachment directly.
## Install from source
-Run from a repository checkout containing the 4.0 source:
+Run from a checkout of the corresponding version:
```bash
uv pip install -e .
@@ -97,4 +99,5 @@ Confirm a 4.x version; a development checkout may report a prerelease. For NVIDI
- [Tiers and runtimes](../usage/tiers.md)
- [Model downloads and configuration](../usage/model_source.md)
- [3.x → 4.0 migration](../reference/migration_4.md)
+- [4.0.x → 4.1 migration](../reference/migration_4_1.md)
- [Official application](https://mineru.net/) and [online demos](../demo/index.md)
diff --git a/docs/en/reference/changelog.md b/docs/en/reference/changelog.md
index d1645e89..278ad041 100644
--- a/docs/en/reference/changelog.md
+++ b/docs/en/reference/changelog.md
@@ -2,20 +2,52 @@
This document records the release history of MinerU, including major capability changes, compatibility updates, and notable fixes.
-## Unreleased
+## 4.1.0 (Upcoming)
+
+This section covers changes since 4.0.12. See the [4.1 migration guide](migration_4_1.md) for upgrade steps and breaking changes.
+
+### Automatic acceleration and hardware diagnostics
+
+- Added automatic ONNX DirectML selection on Windows x64 and ONNX WebGPU selection on Linux x86_64 for compatible Intel, AMD, and NVIDIA GPUs. Shared classification and identity matching prioritize available discrete GPUs; integrated graphics use performance and compatibility checks, with valid choices and calibration evidence saved.
+- Optimized OCR recognition outputs and transfers, routed UNet through shared device selection, and split formula recognition between GPU batches and CPU tails. Representative core inference workloads run at approximately 2–3× CPU speed; this is not a claim for every device or full-document parsing.
+- Added `mineru-kit hardware detect/info` with JSON output, sharing hardware diagnostics and automatic API tier recommendations. llama.cpp integrated-GPU routing reuses applicable device evidence, with improved Linux Intel Vulkan submission stability.
+- Optimized the default Torch CPU convolution configuration by disabling NNPACK, improving CPU inference on affected devices.
+
+### Tasks and synchronous parsing
+
+- [Tasks](../usage/tasks.md) is the only asynchronous parsing API, replacing standalone uploads and parse/jobs with JSON file manifests, URL inputs, cached-upload reuse, and per-file queuing and downloads.
+- Unified server-generated file IDs, file states, and POST cancellation. Creation, detail, cancellation, and upload use separate responses; success responses omit nulls, and completed files expose their actual tier and one result link.
+- Public errors now contain required `code/message` and optional `param`, removing `type` and omitting absent param values. Clients and servers must upgrade together.
+- Added the standalone [file-parse service](../usage/file_parse.md) for single-file attachments, polling after wait timeouts, request-ID idempotency, and recovery of known tasks.
+- API startup uses one `--tier` ceiling. Standard no longer implies Advanced; native documents always use Flash, independently of the PDF/image tier list.
+- Output choices are `default/docx/html/latex`. ModelJson stays internal; `include_model_output` and public model-output files are removed.
+
+### Document library, parsing, and reliability
+
+- Added paginated filename search and unified page selection for parsing, reading, and exports. Fixed incomplete whole-document output caused by estimated page counts for non-PDF native documents.
+- WebUI clearing, replacing files, resubmitting, or receiving a normal page-close event now cancels obsolete remote tasks while preserving completed artifacts.
+- Fixed missing native PDF drop caps and word boundaries; skipped invalid text/seal crops while preserving recognition alignment; raised the inline-formula confidence threshold to reduce low-confidence false positives.
+- Improved Router cascading uploads, result leases, and forwarded-header isolation, plus Doclib configuration isolation, health state, and shutdown cleanup.
+
+### Runtime requirements
- Raised the minimum Python version to 3.11; the supported range is `>=3.11,<3.15`. Starting with the next stable release, stop MinerU services in the old environment, create a new virtual environment with Python 3.11–3.14, reinstall dependencies, and update interpreter paths in service startup configuration. Python 3.12 remains the recommended starting point. Verify the installed versions with `mineru version --json`.
+- Updated dependencies to `docvortex>=0.6.0,<0.7` and `gradio>=6.21,<7`. The base package supplies platform-specific ONNX dependencies for Windows/Linux; Apple Silicon retains Torch/MPS and llama.cpp/Metal.
+
+## 4.0
+
+### Compatibility changes present by 4.0.12
- Image naming change: newly materialized CLI/API ZIP images now use Gradio visual-parent names, inline ordinals count all img src attributes, and collisions receive `_duplicate_n`. References update together; image bytes and MiddleJson 2.0 are unchanged. Historical ZIPs retain their stored references. Requires `docvortex>=0.4.19,<1`.
- Breaking change: removed the `--backend` option from `mineru-kit parse` (introduced during the 4.0 alphas). The option only inferred a tier and had no independent effect, so use `--tier` instead: `pipeline` → `--tier basic`; `vlm-engine`, `vlm-auto-engine`, and `vlm-http-client` → `--tier advanced`; `hybrid-engine` and `hybrid-auto-engine` → `--tier standard` (or omit the option); `flash` → `--tier flash`. Parsing with a remote VLM service is configured through the VLM server settings and is unrelated to this option.
- Breaking change: removed the `PARSER_BACKENDS` constant from the `mineru.parser` exports (present in the 4.0 release). Backends are derived from tiers and are no longer a public choice or a public symbol; configure engines through `model.small_backend` and `model.vlm.engine` instead.
-## 4.0
+### Main capabilities
- Four parsing tiers, native document formats, a local library, and progressive reading.
- ONNX/Torch small models with independent VLM engines, plus unified SDK, V1 API, WebUI, and rendering interfaces.
-- See the [4.0 overview](../index.md) and [migration guide](migration_4.md) for capabilities and deployment changes. Legacy platform adaptations remain on `mineru<4`.
+- See the [product overview](../index.md) and [migration guide](migration_4.md) for capabilities and deployment changes. Legacy platform guides remain scoped to `mineru<4`.
## 3.x release history
@@ -306,7 +338,7 @@ This is the first major update of MinerU 2, which includes a large number of new
**Experience Enhancements**
-- Built-in ready-to-use `fastapi service` and `gradio webui`. For detailed usage instructions, please refer to [Documentation](https://opendatalab.github.io/MinerU/usage/quick_usage/#advanced-usage-via-api-webui-sglang-clientserver).
+- Built-in ready-to-use `fastapi service` and `gradio webui`. For detailed usage instructions, please refer to [Documentation](../usage/quick_usage.md).
- Adapted to `sglang` version `0.4.8`, significantly reducing the GPU memory requirements for the `vlm-sglang` backend. It can now run on graphics cards with as little as `8GB GPU memory` (Turing architecture or newer).
- Added transparent parameter passing for all commands related to `sglang`, allowing the `sglang-engine` backend to receive all `sglang` parameters consistently with the `sglang-server`.
- Supports feature extensions based on configuration files, including `custom formula delimiters`, `enabling heading classification`, and `customizing local model directories`. For detailed usage instructions, please refer to [Documentation](https://opendatalab.github.io/MinerU/usage/quick_usage/#extending-mineru-functionality-with-configuration-files).
diff --git a/docs/en/reference/index.md b/docs/en/reference/index.md
index b03cbf88..36fd864c 100644
--- a/docs/en/reference/index.md
+++ b/docs/en/reference/index.md
@@ -5,6 +5,9 @@ This section provides detailed reference materials for MinerU project. Here you
## Table of Contents
- [3.x → 4.0 migration](migration_4.md)
+- [4.0.x → 4.1 migration](migration_4_1.md)
+- [Tasks API](../usage/tasks.md)
+- [Synchronous file-parse API](../usage/file_parse.md)
- [Python SDK](../usage/sdk_api.md)
- [Output Files Documentation](./output_files.md) - Detailed explanation of all output files and their formats
diff --git a/docs/en/reference/migration_4.md b/docs/en/reference/migration_4.md
index 1654d03d..7880248e 100644
--- a/docs/en/reference/migration_4.md
+++ b/docs/en/reference/migration_4.md
@@ -1,6 +1,6 @@
# Migrating from 3.x to 4.0
-4.0 changes command entrypoints, dependency groups, configuration, and APIs. Validate in an isolated environment before migrating production callers. AMD and vendor accelerators stay on `mineru<4` using the [legacy guides](../usage/compatibility.md).
+4.0 changes command entrypoints, dependency groups, configuration, and APIs. Validate in an isolated environment before migrating production callers. For the upcoming 4.1 release, also apply its [HTTP and runtime migration steps](migration_4_1.md). [Legacy guides](../usage/compatibility.md) for AMD-specific software stacks and vendor accelerators remain scoped to `mineru<4`; see [Tiers and runtimes](../usage/tiers.md) for new 4.1 Windows/Linux ONNX support.
## Entrypoints and installation
@@ -10,7 +10,7 @@
| Directory batch conversion | `mineru-kit parse ./documents -o ./output --format zip` |
| `mineru-gradio` | `mineru-webui` / `mineru-kit webui` |
| Model download option `-m all` | `mineru-kit models download --tier standard` |
-| Old HTTP parsing calls | V1 uploads → parse jobs → output files |
+| Old HTTP parsing calls | 4.1: V1 Tasks JSON manifest → upload missing files → per-file results; see [Tasks](../usage/tasks.md) |
| Extras such as `mineru[core]` and `mineru[pipeline]` | Base package, `mineru[torch]`, or `mineru[full]` |
Install stable with `"mineru>=4.0,<5"`, inserting extras after the package name when needed. The package requires Python `>=3.11,<3.15`; optional engines also require suitable wheels and drivers. Stop services in the original environment before upgrading and check `mineru version --json` afterwards. Do not replace legacy platform images or installation commands with mainline 4.0 instructions.
@@ -60,7 +60,7 @@ Restart relevant services after configuration changes, and download and verify m
## API and WebUI
-Asynchronous parsing uses `/v1/tasks` JSON manifests, optional uploads and per-file result URLs. Upgrade the SDK and WebUI together with the service. Files downloads and the separate synchronous wrapper remain available; loopback callers also use hash preflight. See [HTTP API](../usage/http_api.md).
+4.1 asynchronous parsing uses `/v1/tasks` JSON manifests, optional uploads, and per-file result URLs. Upgrade the SDK and WebUI together with the service. Files downloads remain available; synchronous single-file calls use the standalone [file-parse service](../usage/file_parse.md). Loopback callers also use hash preflight. See [HTTP API](../usage/http_api.md) and [4.1 migration](migration_4_1.md).
Existing Gradio clients also need to follow the new event interface; renaming the command alone is insufficient. Retained third-party integration guides describe their original adaptations and do not imply V1 compatibility.
diff --git a/docs/en/reference/migration_4_1.md b/docs/en/reference/migration_4_1.md
new file mode 100644
index 00000000..6ac65b23
--- /dev/null
+++ b/docs/en/reference/migration_4_1.md
@@ -0,0 +1,88 @@
+# Migrating from 4.0.x to 4.1
+
+**4.1.0 is an upcoming release.** This guide covers API and runtime changes since 4.0.12. HTTP paths still use `/v1`, but this is a breaking protocol update: old clients and new servers cannot be mixed directly.
+
+## Python and installation
+
+Supported Python versions are `>=3.11,<3.15`; Python 3.10 is no longer supported. Create a new environment, preferably with Python 3.12, reinstall the required dependencies, and update interpreter paths in service startup configuration.
+
+After 4.1 is released, stop the old services and drain their tasks before running:
+
+```bash
+uv venv --python 3.12 .mineru-4.1
+# Linux/macOS
+source .mineru-4.1/bin/activate
+# Windows PowerShell: .\.mineru-4.1\Scripts\Activate.ps1
+uv pip install -U "mineru>=4.1,<5"
+mineru version --json
+```
+
+Use the [torch/full extras](../quick_start/extension_modules.md) when you need Torch or higher-throughput VLM serving. Optional engines retain their own Python wheel, driver, and platform constraints.
+
+## Service tiers and native documents
+
+API startup uses one ceiling: `--tier auto|flash|basic|standard|advanced`. `--tiers` is removed; `--no-flash` and `--no-advanced` are not supported. The ceiling includes itself and lower tiers; `--tier standard` no longer also enables Advanced.
+
+```bash
+mineru-kit api-server --tier auto
+mineru-kit hardware detect --json
+mineru-kit hardware info --json
+```
+
+- `auto` (also the startup default) recommends a ceiling from the effective small-model backend and available devices. ONNX performs applicable selection and calibration on Windows/Linux; the first run may prepare or download the OCR recognition model without `--preload-models`. Torch checks device availability without ONNX calibration.
+- `hardware detect` uses the same recommendation logic. `hardware info` reads hardware, runtime, and existing calibration information without benchmarking, downloading weights, or writing configuration.
+- `/v1/tiers` describes PDF/image capabilities only. Every normally available compatible service supports existing native document formats. Office, HTML, and other native documents use Flash even when Flash is absent from `/v1/tiers`.
+- An omitted or JSON `null` request tier selects the first supported PDF/image tier in the order **Standard → Basic → Flash**; Advanced requires an explicit request. An explicitly unsupported PDF/image tier returns 400 without changing tiers. Native-only requests ignore a valid requested tier. Mixed batches run each file at its effective tier, reported in `files[].parse.tier`.
+- Python `create_app(tiers=...)` retains exact PDF/image tier sets. WebUI and Doclib managed services follow the new startup ceiling; Gradio no longer starts a supplementary local native parser just because a remote service does not advertise Flash.
+
+See [Tiers and runtimes](../usage/tiers.md) for device configuration and support boundaries. The service ceiling and the default tier for an individual request are separate settings.
+
+## HTTP API replacement
+
+All standalone `/v1/uploads` routes and `/v1/parse/jobs` creation, listing, query, and cancellation routes are removed and return 404. There are no aliases or automatic fallbacks.
+
+| Previous contract | 4.1 contract |
+|---|---|
+| Create Upload → PUT → complete → create Job | `POST /v1/tasks` with a JSON manifest; PUT only missing files, which queue automatically after validation. |
+| Query or cancel a Job | `GET /v1/tasks/{task_id}` and `POST /v1/tasks/{task_id}/cancel`. |
+| Form or multipart Tasks creation | `application/json`; use the standalone [file-parse service](../usage/file_parse.md) for single-file multipart requests. |
+| `manifest`, `filename` | `files` array (1–100 entries), `file_name`; old or mixed fields return 400. |
+| `client_file_id`, caller-supplied `file_id` | The server generates a public `file_id` for every input, returning files in input order. Requests must omit both fields, including `null` values. |
+| `local/inline/file_id` sources | Uploads or HTTP(S) URLs; loopback clients also use hash preflight and upload cache misses. |
+| `uploads/pending_uploads` | Per-file `files[].upload` with `url/headers/expires_at`. Upload paths may still contain `/uploads/`; these are not the old standalone API. |
+| `upload_method`, upload completion request | PUT raw bytes to the returned URL with its headers; no completion call. |
+| `upload_status`, `waiting_upload/queued` | Unified `files[].status` with `waiting-file/pending`; poll when a waiting file has no `upload`. |
+| Tasks `status_url` | Build the query route from the configured API base and URL-encoded `task_id`, preserving any proxy prefix. |
+| Shared task response | Separate `CreateTaskResponse`, `TaskDetailResponse`, `CancelTaskResponse`, and `UploadFileResponse` for creation, detail, cancellation, and local upload. |
+| Success-response `null` placeholders | Tasks recursively omit absent values, preserving zeros and empty collections. file-parse status and HTTP errors keep their own rules. |
+| Public error `type`, nullable `code` | Required nonempty `code`, `message`, and optional `param`. type is neither emitted nor accepted; absent param is omitted. HTTP failures and task errors share this structure. |
+| Top-level `tier`, `files[].parse.model_used` | Successful files report actual `tier` and available `duration_ms/parser_version` in `files[].parse`. |
+| Response `sha256sum/page_range/name`, source-cache IDs | No longer echoed; request hashes and page ranges remain supported. The public `file_id` stays stable through result delivery. |
+| `files[].output_files`, combined batch ZIP | One `files[].result_url` per successful input; no parent-level result URL. |
+| `markdown/middle_json/structured_content/zip` output options | `default` returns those general results and images in a ZIP; `docx/html/latex` are also available and can be combined. |
+| `include_model_output`, `model_output.json` | The option returns 400. ModelJson remains internal and is absent from API, SDK, CLI, and Gradio results. |
+| Health `features.output_formats`, `task_model_output` | Use `features.task_output_formats`, with `upload/url` sources; `task_model_output` is removed. |
+| Task/file lists, DELETE cancellation | No listing or public deletion endpoints; with valid authentication, `GET /v1/tasks` returns 405 and `GET /v1/files` returns 404. Cancellation uses POST. |
+
+`--allow-local-source` and `--max-inline-bytes` are also removed. Files lookup/download by ID, Health, Tiers, Models, and Usage remain available. Files lookup or download for a reserved `file_id` returns 404 until its result exists.
+
+See the [Tasks API](../usage/tasks.md) for complete fields, states, upload expiry, and errors. The SDK keeps `MinerUApiParser` methods and return types, uses `ApiTaskStatus`, and retains the Python alias `ApiJobStatus`; that alias does not restore the old HTTP protocol.
+
+The public error update also requires coordinated worker, Router, SDK, file-parse, and SaaS upgrades. Clients handle failures by HTTP status and code. Internal CLI/Doclib error categories and historical file-parse recovery records are not rewritten by this change.
+
+## file-parse and recovery boundaries
+
+`mineru-kit file-parse-server` is a standalone synchronous single-file wrapper over Tasks, connecting to a local API, Router, or compatible SaaS. The main API Server and Router do not expose `/v1/file_parse`.
+
+A 202 after the wait ends does not cancel processing. Save `request_id/status_url` to query or download later. The wrapper resumes known upstream tasks; it does not automatically resubmit an unknown creation outcome or recover tasks lost after an upstream restart or expiry.
+
+New recovery namespaces use the `tasks-v5-` prefix. Existing `tasks-v4-`, `tasks-v3-`, `tasks-v2-`, and unprefixed directories are retained but neither loaded nor migrated. Request IDs from those namespaces do not resume; idempotency and wrapper-restart recovery continue within the new namespace. See the [file-parse API](../usage/file_parse.md) for status and attachment examples.
+
+## Upgrade order and verification
+
+1. Stop accepting old requests, drain in-flight tasks, and save required results. API/Router task and cache indexes are in memory and are not guaranteed to survive restarts.
+2. Prepare Python 3.11–3.14 environments. Upgrade workers first, then Router, SDK, WebUI, the file-parse wrapper, and applications. SaaS deployments must align with the same contract; do not rely on old-worker fallback.
+3. Update request fields, query/cancel routes, and per-file downloads. Save task and file IDs from creation; do not blindly retry creation requests.
+4. Check a mixed PDF/native-document batch, tier selection, cached-upload reuse, and per-file results. Exercise failures, cancellation, upload expiry, and polling after a synchronous wait timeout. Verify Markdown, structured JSON, and assets before reopening traffic.
+
+Users migrating from earlier versions should also read [3.x → 4.0 migration](migration_4.md).
diff --git a/docs/en/usage/cli_tools.md b/docs/en/usage/cli_tools.md
index 16c37257..4741e36a 100644
--- a/docs/en/usage/cli_tools.md
+++ b/docs/en/usage/cli_tools.md
@@ -66,6 +66,27 @@ mineru-kit api-server --host 127.0.0.1 --port 8000 --tier standard
Open `http://127.0.0.1:8000/docs` for the generated OpenAPI documentation. The supported API is `/v1/*`; the removed legacy `/file_parse` and `/tasks` routes are not available.
+### Hardware diagnostics
+
+Hardware recommendations and diagnostics:
+
+```bash
+mineru-kit hardware detect --json
+mineru-kit hardware info --json
+```
+
+In 4.1, detect shares recommendations with `api-server --tier auto` and may trigger ONNX calibration. info reads environment and existing calibration records. See [Tiers and runtimes](tiers.md) for ceilings and device rules.
+
+### Synchronous single-file service
+
+For synchronous single-file HTTP responses, start the separate wrapper:
+
+```bash
+mineru-kit file-parse-server --api-url http://127.0.0.1:8000
+```
+
+The wrapper defaults to port 8003, accepts multipart, and calls upstream Tasks; see the [file-parse API](file_parse.md).
+
### Gradio WebUI
```bash
@@ -94,7 +115,8 @@ mineru-kit vlm-server --engine auto --port 30000
- `MINERU_PDF_RENDER_TIMEOUT` / `MINERU_PDF_RENDER_THREADS`: PDF rendering timeout and worker count.
- `MINERU_PROCESSING_WINDOW_SIZE`: processing window size used for large documents. Flash native text parsing renders only pages with visual blocks, preserving this window boundary, rendering timeout, and worker settings. A 32 MiB pixel budget can split batches further. OCR and other tiers still render entire windows.
- `MINERU_MALLOC_TRIM`: disabled by default; only `1/true/yes/on` enable it, ignoring case and surrounding whitespace. On Linux, when available, it attempts to return the current process's free glibc heap pages after inference windows and PDF document cleanup. Flash native parsing only attempts trimming at document completion. Unsupported platforms or missing symbols are a no-op. It does not release live objects, GPU memory, or render-worker memory. See [memory benchmarking](./pdf_memory.md).
-- `MINERU_INTRA_OP_NUM_THREADS` / `MINERU_INTER_OP_NUM_THREADS`: Per-session ONNX intra-op / inter-op thread counts, defaulting to `4` / `1`, including CPU fallback from table CUDA sessions. Explicit positive arguments or session thread settings take precedence over environment variables; missing, non-integer, or non-positive environment values use the defaults. These settings do not cap the process's total thread count or automatically detect container CPU quotas.
+- `MINERU_MODEL_ONNX_DEVICE`: 4.1 ONNX device choice, `auto/cpu/gpu`, overriding file configuration. Torch and VLM devices are configured independently.
+- `MINERU_INTRA_OP_NUM_THREADS` / `MINERU_INTER_OP_NUM_THREADS`: Per-session ONNX intra-op / inter-op thread counts, defaulting to `4` / `1`, including CPU operators in GPU sessions. Explicit positive arguments or session thread settings take precedence over environment variables; missing, non-integer, or non-positive environment values use the defaults. These settings do not cap the process's total thread count or automatically detect container CPU quotas.
Prefer each command's `--help` output and [model source documentation](./model_source.md) for current defaults.
diff --git a/docs/en/usage/file_parse.md b/docs/en/usage/file_parse.md
new file mode 100644
index 00000000..49a3557f
--- /dev/null
+++ b/docs/en/usage/file_parse.md
@@ -0,0 +1,179 @@
+# file-parse API: Synchronous Single-File Parsing
+
+This page describes the upcoming **4.1.0** interface. `mineru-kit file-parse-server` is a standalone HTTP wrapper: it accepts one file, creates and uploads a [Task](tasks.md), waits, and returns a ZIP, DOCX, or HTML attachment. It connects to a local API, Router, or compatible SaaS without loading parsing models.
+
+## Startup
+
+Start the upstream parser, then start the wrapper in another terminal:
+
+```bash
+mineru-kit api-server --host 127.0.0.1 --port 8000 --tier auto
+```
+
+```bash
+mineru-kit file-parse-server --api-url http://127.0.0.1:8000
+```
+
+| Option | Default | Meaning |
+|---|---|---|
+| `--api-url` | `MINERU_API_URL`, otherwise required | Upstream API base, optionally with a proxy prefix; do not append `/v1/tasks`. |
+| `--api-key` | `MINERU_API_KEY`, otherwise empty | Bearer token for upstream requests only. |
+| `--host`, `--port` | `127.0.0.1`, `8003` | Wrapper listen address. |
+| `--state-dir` | `${MINERU_HOME:-~/.mineru}/file-parse` | Recovery database and temporary transfer directory. |
+| `--retention-seconds` | `86400` | Record retention after first observing a terminal state; 0 disables collection. |
+
+The wrapper has no API-key authentication of its own and is intended for local or trusted-network use. Add authentication at a reverse proxy when exposing it externally. Incoming Authorization is not forwarded upstream; requests cannot override the upstream address or credentials.
+
+The wrapper has its own `/docs` and `/openapi.json`. The routes below exist only on this service, not on the main API Server or Router.
+
+## Request fields
+
+`POST /v1/file_parse` accepts only `multipart/form-data`. Query parameters, unknown fields, multiple files, and repeated scalar fields are rejected; `output_formats` may be repeated.
+
+| Field | Default | Meaning |
+|---|---|---|
+| `file` | Required | One nonempty file, retaining its extension. |
+| `tier` | Upstream default | Optional `flash/basic/standard/advanced`, affecting PDFs/images only. |
+| `ocr_mode` | `auto` | `auto/txt/ocr`. |
+| `page_range` | Whole document | PDF ranges include `1-5`, `r1`, and `all`; the upstream validates format-specific support. |
+| `output_formats` | `default` | `default/docx/html/latex`; repeat the field for a list, deduplicated in first-occurrence order. |
+| `wait_timeout` | `3600` | Integer seconds, 0–3600. |
+| `request_id` | Generated | 1–64 letters, digits, underscores, or hyphens; supply and save it before submission to recover after a disconnect. |
+
+Omitting tier lets the upstream choose Standard → Basic → Flash for PDFs/images; Advanced requires an explicit request. An explicitly unsupported PDF/image tier returns an error without substitution. Existing native documents always use Flash, even when a valid requested tier is not advertised upstream. Empty form strings and the literal string `"null"` are invalid tiers, not omissions.
+
+`output_formats` is neither a JSON string nor a comma-separated value: use repeated form fields. `include_model_output` is removed and returns 400 when supplied.
+
+## Upload and attachment responses
+
+These are Bash/curl examples; in Windows PowerShell use `curl.exe` and adjust line continuations. The service calculates the size and hash from the actual uploaded file.
+
+```bash
+# response.body can be an attachment or JSON; check status and headers too.
+curl --max-time 7200 -D response.headers -o response.body \
+ http://127.0.0.1:8003/v1/file_parse \
+ -F 'request_id=report-example' \
+ -F 'tier=standard' \
+ -F 'output_formats=default' -F 'output_formats=docx'
+```
+
+| Endpoint | HTTP | Body |
+|---|---|---|
+| POST, synchronous success | 200 | Raw attachment bytes, without a JSON/Base64 envelope. |
+| POST, wait expires or `wait_timeout=0` | 202 | Complete StatusResponse. |
+| `GET /v1/file_parse/{request_id}`, successful query | 200 | Complete StatusResponse, including known failure, cancellation, or unknown submission outcomes. |
+| `GET /v1/file_parse/{request_id}/result`, successful download | 200 | The same attachment as synchronous POST. |
+
+For an input named `report.pdf`:
+
+| output_formats | Filename | Content-Type / content |
+|---|---|---|
+| `default` | `report.zip` | `application/zip`; Markdown, Middle JSON, Structured Content, images/. |
+| `docx` | `report.docx` | `application/vnd.openxmlformats-officedocument.wordprocessingml.document`; embedded images. |
+| `html` | `report.html` | `text/html; charset=utf-8`; embedded images. |
+| `latex` | `report.zip` | `application/zip`; document.tex, images/. |
+| Multiple formats | `report.zip` | A flat ZIP matching [Tasks outputs](tasks.md#outputs-and-downloads). |
+
+Successful attachments include `Content-Disposition`, `X-Request-ID`, and `X-Task-ID`. A 202 includes `Location` (the status URL), `Retry-After: 2`, and `X-Request-ID`, plus `X-Task-ID` when confirmed. Status queries and error responses do not guarantee these headers; read recovery information from the JSON body.
+
+## Status queries
+
+All seven StatusResponse fields are always present. Nullable fields use null rather than the Tasks omission rule:
+
+| Field | Type | Meaning |
+|---|---|---|
+| `request_id` | string | Wrapper request ID. |
+| `task_id` | string or null | Confirmed upstream task ID, or null before confirmation. |
+| `status` | string | Single-file state, listed below. |
+| `status_url` | string | Full query URL on the wrapper itself. |
+| `result_url` | string or null | Wrapper result endpoint when completed, otherwise null. |
+| `output_formats` | string[] | Normalized output format list. |
+| `error` | object or null | Latest stored error or upstream file error, otherwise null. |
+
+| State | Meaning |
+|---|---|
+| `prepared` | Source and recovery record saved; not submitted yet. |
+| `submitting` | Creating the upstream task without a confirmed task_id yet. |
+| `waiting-file` | Upstream input preparation; an absent upload does not establish readiness. |
+| `pending`, `running` | Queued, parsing, or exporting upstream. |
+| `completed` | Upstream artifact ready; downloading may still fail due to expiry or transfer errors. |
+| `failed`, `canceled` | Known failure or upstream cancellation. |
+| `submission_unknown` | Creation may have succeeded, but no valid task ID was received; creation is not replayed automatically. |
+
+The wrapper processes one input and has no partial state. It exposes neither Tasks files/progress nor upstream signed URLs. Example 202 or GET status body:
+
+```json
+{
+ "request_id": "report-example",
+ "task_id": "job_example",
+ "status": "running",
+ "status_url": "http://127.0.0.1:8003/v1/file_parse/report-example",
+ "result_url": null,
+ "output_formats": ["default", "docx"],
+ "error": null
+}
+```
+
+```bash
+curl http://127.0.0.1:8003/v1/file_parse/report-example
+curl --fail-with-body -D result.headers -o report.zip \
+ http://127.0.0.1:8003/v1/file_parse/report-example/result
+```
+
+Downloads return `409 result_not_ready` before completion, or potentially `409 task_not_created` without a confirmed upstream task. Retry GET after an interrupted download. For an expired signature, the wrapper queries the original task and tries up to three times; unrecoverable expired results do not trigger reparsing.
+
+## Waiting, idempotency, and recovery
+
+`wait_timeout` starts after the upstream file is ready and covers queuing, parsing, and export. Receiving the source, upstream upload/download/validation, and result download use separate budgets, so this is not an overall HTTP request timeout. Normal polling is every two seconds; connection, metadata-request, and transfer-idle timeouts are 10, 30, and 600 seconds. Zero wait can be used to obtain a status-query entrypoint first.
+
+The service takes responsibility only after receiving and persisting the entire source. Earlier disconnects do not create a task. Afterwards, client disconnects, wait timeouts, and wrapper shutdown do not automatically cancel upstream work.
+
+- The same request_id, file content, logical filename, and normalized parsing options reuse the original task; different input returns `409 request_id_conflict`. wait_timeout is not part of request identity.
+- SQLite records are isolated by upstream address and authentication without storing the API key. Only one wrapper process may use a state directory. Restarts resume known tasks and still-valid pending uploads.
+- Creation task_id/file_id values are persisted before fetching details. A failed first query or a restart does not repeat creation. Unknown creation outcomes retain submission_unknown instead of being blindly retried.
+- Sources are removed after upstream readiness or terminal failure. Attachments are downloaded temporarily and removed after sending or interruption. Recovery records extend neither upstream upload links nor result retention; lost upstream tasks are not recreated.
+- The new protocol namespace uses `tasks-v5-`; old namespaces are neither loaded, migrated, nor automatically deleted. See [4.1 migration](../reference/migration_4_1.md).
+
+There is no separate wrapper cancellation endpoint. With a confirmed task_id and upstream authorization, POST `/v1/tasks/{task_id}/cancel` to the **configured upstream API base**, then query the wrapper to observe canceled. Do not use the wrapper base or confuse request_id with task_id. Without a saved ID or a received response, a caller may be unable to recover its request.
+
+## Error responses
+
+Errors directly generated by the wrapper contain `code: string`, `message: string`, and `upstream_status: integer|null`. Without a recovery record, only error is returned:
+
+```json
+{
+ "error": {
+ "code": "unsupported_media_type",
+ "message": "Expected multipart/form-data",
+ "upstream_status": null
+ }
+}
+```
+
+With a record, the complete seven-field StatusResponse is returned with error replaced by the current operation's error. For example, an unfinished download returns HTTP 409 while status remains running. Stored errors in successful queries may also contain http_status or preserve upstream code/message and optional param. Historical recovery records may retain old type or other fields; tolerate these extensions without treating them as supported by the new Tasks protocol.
+
+| HTTP | Common code | Meaning |
+|---|---|---|
+| 400 | `invalid_request`, `upload_interrupted` | Invalid parameters, multiple/empty files, or disconnect before acceptance. |
+| 404 | `request_not_found` | Record absent or collected. |
+| 408 | `upload_receive_timeout` | Idle timeout while receiving the request body. |
+| 409 | `request_id_conflict`, `result_not_ready`, `task_not_created`, or cancellation codes | Conflicting input, result not ready, no task yet, or upstream cancellation. |
+| 410 | `upload_expired` | Upstream upload window expired. |
+| 415 | `unsupported_media_type` | Not multipart/form-data. |
+| 500 | `storage_error` | Local storage failure. |
+| 502 | `submission_unknown`, `upstream_unreachable`, `upstream_protocol_error`, `invalid_result`, or upstream codes | Upstream request, transfer, parsing, or result-validation failure. |
+
+Upstream authentication failures return wrapper HTTP 502 with `upstream_status=401`. Explicit tier rejection also returns 502, preserving upstream 400/503; these are failed, not submission_unknown. Other creation-stage 5xx, 408, network failures, or malformed responses may leave acceptance unknown and become submission_unknown. A shared-schema `503 quality_tier_unavailable` is a confirmed rejection. Neither case automatically replays creation; the same ID keeps the existing record.
+
+## Python example client
+
+The repository script requires httpx, prints the request ID before submission, and saves successful attachments atomically. On 202 it prints recovery information and exits with 124. Run from the repository root:
+
+```bash
+python scripts/http_file_parse_example.py report.pdf --output report.docx \
+ --base-url http://127.0.0.1:8003 --output-format docx --request-id report-docx
+
+python scripts/http_file_parse_example.py report.pdf --wait-timeout 0 \
+ --base-url http://127.0.0.1:8003 --request-id report-background
+```
diff --git a/docs/en/usage/http_api.md b/docs/en/usage/http_api.md
index 22ef7675..fc82cff5 100644
--- a/docs/en/usage/http_api.md
+++ b/docs/en/usage/http_api.md
@@ -1,6 +1,6 @@
# V1 HTTP API
-Tasks is the single asynchronous parsing API. API Server, Router, the SDK and WebUI use a JSON `files` array, upload only missing files, poll task metadata and download each file's result. See the [Tasks contract](../../next/api/tasks.md) and [Python SDK](sdk_api.md).
+In the upcoming 4.1 release, Tasks is the single asynchronous parsing API. API Server, Router, the SDK and WebUI use a JSON `files` array, upload only missing files, poll task metadata and download each file's result. See the [Tasks contract](tasks.md) and [Python SDK](sdk_api.md).
```bash
mineru-kit api-server --host 127.0.0.1 --port 8000 --tier standard
@@ -12,7 +12,7 @@ OUTPUT_FORMATS=default,docx MINERU_API_URL=http://127.0.0.1:8000 bash scripts/ht
Send application/json to POST `/v1/tasks`. Each files entry requires file_name and, for uploads, bytes; sha256sum and page_range are optional. URL entries may omit bytes. Requests must not include client_file_id or file_id, even as null. The server generates a unique file_id for every entry and returns entries in input order. This ID remains stable through upload, query, cancellation and result download. Options are tier, ocr_mode, page_range and output_formats.
-The response contains task_id and an upload object on each file that still needs uploading. files[].upload is null otherwise; its fields are url, headers and expires_at. Uploads always use PUT; upload_method is not returned. Follow each returned PUT URL and its headers; no completion request is needed. Each ready file enters pending independently. waiting-file covers upload, server-side download and validation; only a non-null upload object asks the client to send bytes. Input preparation consumes no parsing slot.
+The response contains task_id and an upload object on each file that still needs uploading. files[].upload is omitted otherwise; its fields are url, headers and expires_at. Uploads always use PUT; upload_method is not returned. Follow each returned PUT URL and its headers; no completion request is needed. Each ready file enters pending independently. waiting-file covers upload, server-side download and validation; only a present upload object asks the client to send bytes. Input preparation consumes no parsing slot.
Loopback requests follow the same protocol. The SDK computes SHA-256 before submission; completed, unexpired cached inputs are not uploaded again. Concurrent first uploads may transfer duplicate bytes, but source storage is deduplicated. Default retention is 24 hours with collection every 5 minutes; active task and transfer references protect their bytes.
@@ -34,6 +34,6 @@ Both shell examples delegate to the standard-library Python Tasks client. RESULT
Creation is not automatically retried. MAX_POLLS/POLL_INTERVAL bound polling; CONNECT_TIMEOUT/REQUEST_TIMEOUT bound individual requests. Exit codes are 0 (success), 2 (partial success), 1 (failure or cancellation) and 124 (poll budget exhausted). Completed downloads remain on disk.
-Tasks and Files JSON use `file_name`; creation accepts `files`. Old `manifest`/`filename` fields and mixed old/new fields are rejected with 400. The standalone upload and Jobs APIs have been removed. Coordinate server, Router and SDK upgrades; see [migration notes](../../next/api/changes.md). The separate [file_parse wrapper](../../next/api/file-parse.md) provides recoverable synchronous single-file calls.
+Tasks and Files JSON use `file_name`; creation accepts `files`. Old `manifest`/`filename` fields and mixed old/new fields are rejected with 400. The standalone upload and Jobs APIs have been removed. Coordinate server, Router and SDK upgrades; see [4.1 migration](../reference/migration_4_1.md). The separate [file-parse wrapper](file_parse.md) provides recoverable synchronous single-file calls.
POST returns a creation receipt, GET returns task details, POST cancel returns every file’s final state and successful result links, and local PUT returns task_id/file_id/status. Tasks success responses omit null fields but preserve zero values and empty collections. POST cancel cancels unfinished files while preserving completed results.
diff --git a/docs/en/usage/index.md b/docs/en/usage/index.md
index a58d7e5e..d9e4a77c 100644
--- a/docs/en/usage/index.md
+++ b/docs/en/usage/index.md
@@ -7,6 +7,9 @@ This section provides comprehensive usage instructions for the project. We will
- [Tiers and runtimes](tiers.md)
- [Python SDK](sdk_api.md)
- [V1 HTTP API](http_api.md)
+- [Tasks API](tasks.md)
+- [Synchronous file-parse API](file_parse.md)
+- [4.0.x → 4.1 migration](../reference/migration_4_1.md)
- [3.x → 4.0 migration](../reference/migration_4.md)
- [Legacy platforms (MinerU <4)](compatibility.md)
diff --git a/docs/en/usage/quick_usage.md b/docs/en/usage/quick_usage.md
index a921b616..71dd6d3a 100644
--- a/docs/en/usage/quick_usage.md
+++ b/docs/en/usage/quick_usage.md
@@ -22,7 +22,7 @@ mineru parse <input_path> -o <output_path>
> [!NOTE]
> Runtime acceleration is selected separately for the two model components, based on installed dependencies and detected devices:
>
-> - Small models use the Torch backend only when `torch`, `torchvision`, `transformers`, `accelerate`, and `safetensors` are **all** installed and a non-CPU device (CUDA/MPS/...) is detected; otherwise they run ONNX on CPU. Installing Torch alone is not enough.
+> - Small models use the Torch backend only when `torch`, `torchvision`, `transformers`, `accelerate`, and `safetensors` are **all** installed and a non-CPU device (CUDA/MPS/...) is detected; otherwise they use ONNX. In 4.1, ONNX selects compatible DirectML/WebGPU acceleration or CPU on Windows/Linux; see [Tiers and runtimes](tiers.md). Installing Torch alone is not enough.
> - The local VLM engine is chosen independently: macOS always uses llama.cpp; on an accelerator device Linux prefers vLLM, then an installed LMDeploy, and Windows uses LMDeploy; otherwise llama.cpp.
> - XPU is excluded from automatic LMDeploy selection: Linux uses an installed XPU-compatible vLLM, otherwise llama.cpp; Windows uses llama.cpp.
> - Windows users who need CUDA acceleration should first visit the [PyTorch website](https://pytorch.org/get-started/locally/) and install accelerator-enabled `torch` and `torchvision` matching their CUDA version, then install the `mineru[full]` extras.
diff --git a/docs/en/usage/tasks.md b/docs/en/usage/tasks.md
new file mode 100644
index 00000000..ac0ed9fd
--- /dev/null
+++ b/docs/en/usage/tasks.md
@@ -0,0 +1,243 @@
+# Tasks API
+
+This page describes the upcoming **4.1.0** contract. `/v1/tasks` is the shared asynchronous parsing API for API Server, Router, and compatible SaaS: submit a JSON manifest, upload missing files, poll, and download results per file. Existing clients should read the [4.1 migration guide](../reference/migration_4_1.md). For synchronous single-file requests, see the [file-parse API](file_parse.md).
+
+## Startup and authentication
+
+```bash
+mineru-kit api-server --host 127.0.0.1 --port 8000 --tier auto
+```
+
+The service exposes deployment-specific definitions at `/docs` and `/openapi.json`. When an API key is configured, send `Authorization: Bearer <API_KEY>` on API requests. Local services without a key do not require that header. The API base may include a reverse-proxy path prefix.
+
+| Method and path | Success response | Purpose |
+|---|---|---|
+| `POST /v1/tasks` | 202, `CreateTaskResponse` | Submit a JSON manifest. |
+| `PUT files[].upload.url` | Local/Router: 200, `UploadFileResponse` | Upload one file's raw bytes; accept successful 2xx responses from object storage. |
+| `GET /v1/tasks/{task_id}` | 200, `TaskDetailResponse` | Read a complete status snapshot. |
+| `POST /v1/tasks/{task_id}/cancel` | 200, `CancelTaskResponse` | Cancel unfinished files; no request body required. |
+
+Local upload paths are `/v1/tasks/{task_id}/uploads/{file_id}`; clients should use the returned full URL. There are no task/file lists, public DELETE operations, or batch-result endpoint. The main API Server and Router do not expose `/v1/file_parse`.
+
+## Creation request
+
+`POST /v1/tasks` accepts only `application/json`. Put all business parameters in the JSON body. Query parameters, unknown fields, and invalid values return 400; other content types return 415.
+
+| Field | Type | Default or requirement |
+|---|---|---|
+| `files` | object[] | Required, 1–100 entries; not a JSON-encoded string. |
+| `tier` | string or null | Optional; `flash/basic/standard/advanced`, as described below. |
+| `ocr_mode` | string | `auto`; accepts `auto/txt/ocr`. |
+| `page_range` | string | Empty means the whole document; PDF ranges include `1-5`, `r1`, and `all`. |
+| `output_formats` | string[] | `["default"]`; nonempty, values from `default/docx/html/latex`, deduplicated in first-occurrence order. |
+
+Each `files[]` entry:
+
+| Field | Type | Requirement |
+|---|---|---|
+| `file_name` | string | Required logical filename, 1–1024 characters, retaining its extension. Duplicate names are allowed. |
+| `bytes` | integer or null | Required positive integer for uploads. Optional for URLs; when supplied, must match the actual size. |
+| `url` | string or null | HTTP(S) download URL; omitted or null means a client upload. |
+| `sha256sum` | string or null | Optional 64-character lowercase hexadecimal SHA-256 for validation and, for uploads, cache preflight. |
+| `page_range` | string or null | Optional per-file PDF range overriding the global range. Non-PDF native documents still parse as a whole. |
+
+Requests must omit `file_id/client_file_id`, including null values. The server allocates public `file_id` values in input order; duplicate names or content still receive different IDs. Use IDs to correlate uploads, queries, cancellation, and downloads. Local/Router result Files IDs match these IDs; Files lookup returns 404 before the result exists. Source-cache IDs remain private.
+
+### Tier selection
+
+- For PDFs/images, an omitted or null tier selects the first supported value in **standard → basic → flash** order. Advanced requires an explicit request. An Advanced-only service returns `503 quality_tier_unavailable` when the tier is omitted.
+- An explicitly unsupported PDF/image tier rejects the entire creation request with `400 invalid_request`, `error.param="tier"`. No work is accepted and no tier substitution occurs.
+- Every normally available compatible service supports existing native document formats. Office, HTML, and other native documents always use Flash, regardless of `/v1/tiers` or a valid requested tier. Empty strings and unknown enum values are still invalid.
+- Mixed batches select tiers per file. On a Standard-capable service, a PDF + DOCX request without a tier uses Standard and Flash respectively. Selection is fixed at admission, not repeated during queuing or forwarding. Successful files report the actual value in `parse.tier`.
+
+### Example request and creation receipt
+
+Sizes, IDs, URLs, and timestamps below are illustrative; use the actual byte count for a real upload.
+
+```json
+{
+ "files": [{"file_name": "report.pdf", "bytes": 12345}],
+ "tier": "standard",
+ "ocr_mode": "auto",
+ "output_formats": ["default", "docx"]
+}
+```
+
+202 creation receipt:
+
+```json
+{
+ "task_id": "job_example",
+ "status": "waiting-file",
+ "files": [{
+ "file_id": "file-example",
+ "file_name": "report.pdf",
+ "status": "waiting-file",
+ "upload": {
+ "url": "http://127.0.0.1:8000/v1/tasks/job_example/uploads/file-example",
+ "headers": {},
+ "expires_at": 1800003600
+ }
+ }]
+}
+```
+
+202 means accepted. Creation receipts omit input sizes, parsing statistics, and result URLs; use GET for details even if a file has already completed.
+
+URL inputs use the same creation endpoint, for example:
+
+```json
+{
+ "files": [{"file_name": "report.pdf", "url": "https://example.com/report.pdf"}],
+ "output_formats": ["html"]
+}
+```
+
+The server downloads URL inputs without a client PUT; replace the example with a real download URL allowed by the deployment.
+
+## Response fields
+
+Success responses are direct objects without a `data/task` envelope. Below, `?` marks an optional field and is not part of its name.
+
+| Response | Top-level fields | files[] fields |
+|---|---|---|
+| `CreateTaskResponse` | `task_id`, `status`, `files` | `file_id`, `file_name`, `status`, `upload?` |
+| `TaskDetailResponse` | `task_id`, `status`, `created_at`, `started_at?`, `finished_at?`, `output_formats`, `progress`, `files`, `error?` | `file_id`, `file_name`, `status`, `bytes?`, `url?`, `upload?`, `parse?`, `result_url?`, `error?` |
+| `CancelTaskResponse` | `task_id`, `status` (always canceled), `finished_at`, `files` | `file_id`, `file_name`, `status`, `parse?`, `result_url?`, `error?` |
+| `UploadFileResponse` | `task_id`, `file_id`, `status` (the uploaded file's state) | None |
+
+`task_id/file_id/file_name/status` are strings, `files` is an array, `bytes` is an integer, `url/result_url` are strings, and `output_formats` is a string array. Time fields are ISO-8601 UTC strings.
+
+| Nested object | Fields and meaning |
+|---|---|
+| `upload` | `url: string`, `headers: object` (string pairs, possibly empty), `expires_at: integer` (Unix seconds). Present only when an upload is currently needed. |
+| `parse` | `tier: string`, `duration_ms?: integer`, `parser_version?: string`. Successful files only; version identifies the executing worker. Duration includes source reading/downloading, validation, parsing, and export, excluding waits for upload, preparation slots, or parsing queues. |
+| `progress` | Required integers `completed/failed/total`. Canceled files count as neither completed nor failed; total is the number of inputs. |
+| `error` | Required nonempty `code: string`, `message: string`, and `param?: string`. May appear at the GET top level, in GET files, or in failed files of cancellation receipts; no type field. |
+
+Tasks success responses recursively omit nulls, preserving `0/false/[]/{}`. Each response is a complete snapshot: an absent field has no current value, so do not retain stale upload links. Clients should tolerate future extra fields. Public HTTP errors also omit absent param values; Files and file-parse use separate null rules.
+
+Example completed GET response (200):
+
+```json
+{
+ "task_id": "job_example",
+ "status": "completed",
+ "created_at": "2026-10-28T00:00:00Z",
+ "started_at": "2026-10-28T00:00:02Z",
+ "finished_at": "2026-10-28T00:00:10Z",
+ "output_formats": ["default", "docx"],
+ "progress": {"completed": 1, "failed": 0, "total": 1},
+ "files": [{
+ "file_id": "file-example",
+ "file_name": "report.pdf",
+ "status": "completed",
+ "bytes": 12345,
+ "parse": {"tier": "standard", "duration_ms": 8000, "parser_version": "4.1.0"},
+ "result_url": "http://127.0.0.1:8000/v1/files/file-example/content"
+ }]
+}
+```
+
+Example local PUT receipt: `{"task_id":"job_example","file_id":"file-example","status":"pending"}`. Successful object-storage PUT responses need not contain this JSON; query Tasks afterwards to confirm readiness.
+
+## Uploads, URLs, and caching
+
+PUT raw bytes using the returned `upload.url/headers`; no completion call is required. Upload only when a file is `waiting-file` and has an `upload` object. Otherwise poll. Each validated file queues independently without waiting for other files; waiting uploads do not reserve parsing capacity.
+
+- Valid hash-based cache hits skip uploads. Only source bytes are reused; each task parses with its own parameters. Concurrent first uploads may transfer duplicate bytes, but source storage is deduplicated.
+- URL inputs are downloaded by the server without an upload action, HEAD requirement, or Content-Length requirement. `file_name` determines the format; actual bytes are populated after download and supplied sizes/hashes are checked. URLs are downloaded each time, without hash-based download skipping.
+- Local URL sources default to HTTPS only. HTTP requires `--allow-http-source`; defaults are a 60-second download timeout and a 200 MiB size limit. Direct client uploads have no fixed size or PDF page limit, though deployments may impose gateway limits.
+- Upload links expire 3600 seconds after creation and are not renewed by polling. Uploads admitted before the deadline may finish; files not yet admitted become `failed/upload_expired`. Processing of successfully uploaded files is not limited by this deadline.
+- Do not repeat successful PUTs. Query after a lost response: skip upload for `pending/running/completed`, poll `waiting-file` without an upload object, and retry within bounds only after failure when a valid upload action remains. Expired uploads need a new task. Chunk-level resumable uploads are not supported.
+
+Local source caches default to 24-hour retention with collection every five minutes; active tasks and transfers protect source bytes. API/Router task records and indexes are in memory and are not guaranteed to survive restarts.
+
+## States and cancellation
+
+| File state | Meaning |
+|---|---|
+| `waiting-file` | Waiting for/receiving uploads, URL downloads, validation, or object-storage confirmation. |
+| `pending` | Input ready, waiting for parsing resources. |
+| `running` | Parsing, exporting, or saving results. |
+| `completed` | All requested formats succeeded; the result is downloadable. |
+| `failed` | Input, parsing, or export failed; inspect error. |
+| `canceled` | An unfinished file was canceled. |
+
+Parent aggregation prioritizes running, then pending, then waiting-file. All successful files yield completed; terminal success/failure mixtures yield partial; no successes yield failed. Cancellation sets the parent to canceled. A parent may move from running back to waiting-file while completed files remain downloadable.
+
+Cancellation preserves completed/failed files and marks the others canceled. Receipt file states are therefore limited to completed/failed/canceled. Non-interruptible computation or cleanup may still finish internally, but late results cannot overwrite published cancellation states. Canceling an already terminal task returns `409 task_already_terminal`.
+
+Example 200 receipt for canceling a single-file task that is still processing:
+
+```json
+{
+ "task_id": "job_example",
+ "status": "canceled",
+ "finished_at": "2026-10-28T00:00:05Z",
+ "files": [{"file_id": "file-example", "file_name": "report.pdf", "status": "canceled"}]
+}
+```
+
+## Outputs and downloads
+
+| output_formats | Result per input |
+|---|---|
+| `["default"]` | ZIP with `markdown.md`, `middle_json.json`, `structured_content.json`, and `images/`. |
+| `["docx"]` | A DOCX with embedded images. |
+| `["html"]` | An HTML file with embedded images; formula scripts retain renderer behavior. |
+| `["latex"]` | ZIP with `document.tex` and `images/`. |
+| Multiple formats | One flat ZIP, without nested ZIPs; DOCX/HTML names are `document.docx/document.html`. |
+
+Each input is parsed once. One `files[].result_url` is published after all requested formats succeed. If any format fails, that file becomes `failed/result_packaging_failed` without partial artifacts; other files continue. There is no combined batch ZIP or top-level result_url. Completed files can be downloaded before the parent finishes.
+
+ModelJson is internal. `include_model_output` is removed and returns 400 even when false; results do not contain `model_output.json`.
+
+Local services and Router return Files URLs; SaaS may return signed object-storage URLs. Use returned result URLs without constructing storage paths. Attach the API key only to same-origin API requests, reevaluating every redirect; never forward it to object storage. During result retention, query again to renew an expired download signature. Polling and downloads do not render again, and unfinished files do not cause completed results to be collected early.
+
+## Errors
+
+Request-level errors use a non-2xx status and `{"error": ...}`, for example:
+
+```json
+{
+ "error": {
+ "code": "task_already_terminal",
+ "message": "Task is canceled"
+ }
+}
+```
+
+| HTTP | Common code | Scenario |
+|---|---|---|
+| 400 | `invalid_request`, `page_range_invalid` | Invalid fields, tiers, ranges, or old parameters. |
+| 400 | `upload_size_mismatch`, `file_hash_mismatch`, `upload_interrupted` | Upload validation or transfer failure. |
+| 401 | `invalid_api_key` | Invalid credentials on an authenticated service. |
+| 404 | `task_not_found`, `upload_not_found` | Task unavailable/collected, or no such upload file ID. |
+| 409 | `task_already_terminal`, `file_already_terminal` | Canceling a terminal task or uploading to a file no longer accepting bytes. |
+| 410 | `upload_expired` | Upload window expired. |
+| 415 | `invalid_request` | Creation request is not JSON. |
+| 503 | `quality_tier_unavailable`, `server_shutting_down`, or model preload codes | The service cannot accept the request. |
+
+Asynchronous download, parsing, and export failures usually appear in **files[].error inside a 200 query snapshot**; HTTP 200 does not mean parsing succeeded. Public errors contain required nonempty code, message, and optional param; type is neither emitted nor accepted. Absent param values are omitted, although receivers also accept null. Branch on HTTP status and code rather than parsing message text. Inspect every file's state: an absent top-level error does not establish that all files succeeded.
+
+## Runnable client examples
+
+Run these Bash examples from the repository root. The standard-library Python client calculates real sizes and hashes, uploads files, and downloads per-file results:
+
+```bash
+MINERU_API_URL=http://127.0.0.1:8000 \
+ bash scripts/http_task_example.sh report.pdf notes.docx
+
+OUTPUT_FORMATS=default,docx RESULT_DIR=results \
+MINERU_API_URL=http://127.0.0.1:8000 \
+ bash scripts/http_task_example.sh report.pdf
+
+# Resume with the original file list and order, without creating again.
+TASK_ID=job_example MINERU_API_URL=http://127.0.0.1:8000 \
+ bash scripts/http_task_example.sh report.pdf
+```
+
+Set `MINERU_API_KEY` for authentication, `MINERU_TIER/OCR_MODE/PAGE_RANGE` for parsing options, and `SEND_HASH=0` to disable hash preflight. `MAX_POLLS/POLL_INTERVAL` default to 300/1 and bound polling; `CONNECT_TIMEOUT/REQUEST_TIMEOUT` bound individual transfers. Creation is not automatically retried. Exit codes: 0 all successful, 2 partial success, 1 failure/cancellation, 124 polling exhausted. Completed downloads remain on disk.
+
+For direct HTTP calls, append `/v1/tasks/{URL-encoded task_id}` to the configured API base for queries, and append `/cancel` to that route for POST cancellation. Save creation IDs for recovery; Tasks does not return a status_url.
diff --git a/docs/en/usage/tiers.md b/docs/en/usage/tiers.md
index 2060b716..eb2df618 100644
--- a/docs/en/usage/tiers.md
+++ b/docs/en/usage/tiers.md
@@ -2,6 +2,8 @@
Tiers express parsing quality and cost. Small-model backends and VLM engines are configured independently; they are not tier names.
+This page includes upcoming 4.1 device-selection and service-tier behavior. Existing deployments should follow the [4.1 migration guide](../reference/migration_4_1.md).
+
| Tier | Purpose | Local execution |
| --- | --- | --- |
| `flash` | Fast previews, indexing, native documents | Native PDF text / document parsing; Flash OCR for scans and images |
@@ -21,38 +23,53 @@ mineru-kit parse saved-page.mhtml -o saved-page.md --tier flash
- `mineru-kit parse` and local Python `parse()` default to Standard for PDFs.
- After discovering service capabilities, the document library prefers Standard, then Basic for PDF/images. If neither is available, it returns `quality_tier_unavailable` rather than silently choosing Flash or uploading to the official service.
-- Advanced is explicit. Prepare models and managed service capacity as Standard; there is no separate Advanced model download.
+- Advanced requires an explicit request. It shares models with Standard rather than downloading separate Advanced weights; the service must enable Advanced to accept corresponding PDF/image requests.
- Library `read` consumes cached results without starting a new parse. Without an explicit tier, it prefers cached Advanced, Standard, then Basic results.
+The API startup `--tier` is a ceiling including itself and lower tiers; `--tier standard` does not enable Advanced. Omission or `--tier auto` recommends a ceiling from the effective backend and hardware, potentially calibrating ONNX at startup. HTTP requests without a tier choose Standard → Basic → Flash. Native documents always use Flash, independently of the enabled PDF/image tiers. See [Tasks](tasks.md) for the full rules.
+
## Backends and engines
| Environment | Automatic small models | Automatic VLM |
| --- | --- | --- |
-| Apple Silicon / MPS | Torch / MPS | llama.cpp |
-| Linux / Windows, base package | ONNX / CPU when no Torch accelerator runtime is available | llama.cpp |
+| Apple Silicon / MPS | Torch / MPS | llama.cpp / Metal |
+| Windows x64, base package | ONNX / DirectML or CPU when no Torch accelerator runtime is available | llama.cpp |
+| Linux x86_64, base package | ONNX / WebGPU or CPU when no Torch accelerator runtime is available | llama.cpp |
| Linux, accelerator and `full` | Torch | vLLM, otherwise installed LMDeploy |
| Windows, accelerator and `full` | Torch | LMDeploy |
| CPU environment | ONNX / CPU | llama.cpp |
-Automatic selection uses installed dependencies and available devices. An explicit choice with missing dependencies fails instead of silently selecting another backend. ONNX Layout, OCR, and formula models run on CPU; VLM device selection is independent.
+Automatic selection uses installed dependencies and available devices. An explicit choice with missing dependencies fails instead of silently selecting another backend. `model.onnx_device=auto|cpu|gpu` controls ONNX devices independently of the VLM. `MINERU_MODEL_ONNX_DEVICE` overrides file configuration without persisting the override.
+
+The 4.1 base package installs DirectML on Windows x64 and the Vulkan-backed WebGPU plugin on Linux x86_64. Compatible, confirmed discrete GPUs have priority. In auto mode, integrated or unclassified GPUs undergo applicable calibration; insufficient gains or unreliable execution select CPU. Linux uses CPU for older Intel/Xe-LP and unidentified Intel architectures, even with explicit gpu selection. Other systems, unavailable GPUs, or initialization failures log CPU fallback reasons.
+
+Valid automatic choices can be saved to configuration. Set `model.onnx_device` back to auto and restart to recalibrate. Hardware changes invalidate old performance evidence; explicit or saved cpu choices are not overwritten when a discrete GPU is later connected. First calibration may download the recognition model; `hardware info` does not trigger it.
-Table classification, SLANet, and UNet use `MINERU_TABLE_DEVICE=auto` by default: the CPU `onnxruntime` package uses CPU; replacing it with a compatible `onnxruntime-gpu` package enables CUDA when its provider is available. CUDA initialization failures are logged and fall back to CPU. Do not install both ORT distributions together. Set `MINERU_TABLE_DEVICE=cpu` to force CPU or `cuda` to explicitly attempt CUDA. This option affects only table models, and logs report the actual providers.
+ONNX layout, OCR recognition, MFR, and UNet share device selection. Ordinary OCR detection uses CPU on Windows and may use WebGPU on Linux; seal detection, table classification, and SLANet Plus use CPU. GPU MFR handles full batches of eight, with remaining tails on CPU. The old `MINERU_TABLE_DEVICE` does not override ONNX UNet; Torch table models retain their CPU/CUDA policy. This ONNX path does not require manually replacing the runtime with `onnxruntime-gpu`.
Intel XPU is excluded from automatic LMDeploy selection. Linux prefers an installed XPU-compatible vLLM and otherwise falls back to llama.cpp; Windows uses llama.cpp.
```yaml
model:
small_backend: auto
+ onnx_device: auto
vlm:
engine: auto
```
`small_backend` accepts `auto/onnx/torch`; `engine` accepts `auto/llama-cpp/vllm/lmdeploy`. macOS defaults to llama.cpp.
+```bash
+mineru-kit hardware detect --json
+mineru-kit hardware info --json
+```
+
+detect shares API startup recommendations and may perform applicable ONNX calibration. info reads hardware, installed runtimes, effective configuration, and calibration records without benchmarking, downloading weights, or writing configuration.
+
## Resources and platform boundaries
Native text parsing needs no inference models. Basic can run on CPU. Standard / Advanced speed and memory depend on the VLM engine, input size, and concurrency. Plan for at least 16 GB of system memory for higher-throughput local deployment. NVIDIA deployments also need an engine-supported GPU, driver, and sufficient free VRAM; 8 GB is only a planning starting point, not a guarantee for every workload.
-For Apple Silicon, at least 16 GB of unified memory and a direct macOS installation are recommended. Existing AMD and vendor adaptations remain on [MinerU <4](compatibility.md); this page does not extend their compatibility claims to 4.0.
+For Apple Silicon, at least 16 GB of unified memory and a direct macOS installation are recommended. The 4.1 Windows/Linux ONNX path supports compatible Intel, AMD, and NVIDIA GPUs; legacy AMD-specific software-stack and vendor-accelerator guides remain scoped to [MinerU <4](compatibility.md).
See [extension modules](../quick_start/extension_modules.md) for installation and [Model Source](model_source.md) for downloads and configuration.
diff --git a/docs/zh/faq/index.md b/docs/zh/faq/index.md
index 15d756e0..7a1682a5 100644
--- a/docs/zh/faq/index.md
+++ b/docs/zh/faq/index.md
@@ -8,13 +8,13 @@
### Windows CUDA 加速 {#windows-cuda-acceleration}
- 基础包默认可使用 ONNX / CPU 与 llama.cpp。需要 Torch 小模型和 LMDeploy 时,在原虚拟环境中安装 `"mineru[full]>=4.0,<5"`,并核对 Torch 的 CUDA 支持、显卡驱动及引擎 wheel 的 Python 范围。
+ 4.1 基础包在 Windows x64 可自动选择 ONNX DirectML 或 CPU,VLM 使用 llama.cpp。可用 `mineru-kit hardware info --json` 检查环境与已有校准证据。需要 Torch 小模型和 LMDeploy 时,在原虚拟环境中安装 `"mineru[full]>=4.0,<5"`,并核对 Torch 的 CUDA 支持、显卡驱动及引擎 wheel 的 Python 范围。
4.0 使用 `lmdeploy>=0.17.0,<0.18` 和 Transformers 5;不要套用旧版 LMDeploy 0.11.x 的 wheel 或跳过依赖检查。详见[扩展模块](../quick_start/extension_modules.md)和[档位说明](../usage/tiers.md)。
??? question "升级后旧命令、API 或配置不再工作怎么办?"
- 4.0 WebUI 使用 `mineru-kit webui` / `mineru-webui`,解析 API 使用 `/v1/*`,配置使用 `config.yaml`。旧 `/file_parse`、`/tasks` 和 `model.stack` 不能直接沿用。见[迁移指南](../reference/migration_4.md)。
+ 4.x WebUI 使用 `mineru-kit webui` / `mineru-webui`,解析 API 使用 `/v1/*`,配置使用 `config.yaml`。旧 `/file_parse`、`/tasks` 和 `model.stack` 不能直接沿用,见 [3.x 迁移指南](../reference/migration_4.md)。即将发布的 4.1 还将独立 uploads/jobs 替换为 Tasks,见 [4.1 迁移说明](../reference/migration_4_1.md)和独立 [file-parse 接口](../usage/file_parse.md)。
??? question "在WSL2的Ubuntu22.04中遇到报错`ImportError: libGL.so.1: cannot open shared object file: No such file or directory`"
diff --git a/docs/zh/index.md b/docs/zh/index.md
index 479209bb..64bf8e15 100644
--- a/docs/zh/index.md
+++ b/docs/zh/index.md
@@ -1,7 +1,20 @@
-# MinerU 4.0
+# MinerU
![MinerU](../images/MinerU-logo.png){ width="300" }
+## MinerU 4.1.0:自动加速与解析接口升级
+
+**即将发布**
+
+- **主流平台与 GPU 自动加速**:Windows、Linux 新增面向 Intel、AMD、NVIDIA 兼容 GPU 的 ONNX 自动加速,结合 macOS 已有的 MPS/Metal 路径,进一步简化跨平台部署。自动识别设备、优先选择独显,并根据集显性能与兼容性选择 GPU 或 CPU;代表性核心推理场景的速度约为 CPU 的 **2~3 倍**。
+- **统一 Tasks 异步接口**:以 `/v1/tasks` 替换旧 `/v1/uploads`、`/v1/parse/jobs` 工作流,支持文件清单、URL 输入、缓存免传、逐文件执行与结果下载,并统一状态查询和取消操作。此次包含破坏性接口变更,升级前请查阅 [4.1 迁移说明](reference/migration_4_1.md)和 [Tasks 接口详情](usage/tasks.md)。
+- **新增可恢复的同步解析服务**:独立的 `file-parse-server` 提供 `/v1/file_parse`,上传单个文件即可等待并获取附件;等待超时后可继续查询,并通过请求 ID 恢复已知任务。详见 [file-parse 接口说明](usage/file_parse.md)。
+- **更清晰的硬件诊断与档位推荐**:新增 `mineru-kit hardware detect` 和 `hardware info`,帮助选择合适的服务档位,并查看设备、运行环境与校准信息。
+
+**升级提示:** Python 支持范围调整为 **3.11–3.14**。使用旧 HTTP 接口的部署,请协调升级服务端、Router、SDK 和客户端。其他修复见[完整更新日志](reference/changelog.md)。
+
+## 产品概览
+
MinerU 4.0 将多格式文档解析、文档库和服务工具整合到统一工作流,面向文档转换、应用集成和 Agent 阅读。
- **四档解析**:Flash 用于快速预览与索引,Basic 提供基础 OCR/模型解析,Standard 与 Advanced 面向更复杂的版面和更高的质量需求。
diff --git a/docs/zh/quick_start/extension_modules.md b/docs/zh/quick_start/extension_modules.md
index eb6bd46d..45764878 100644
--- a/docs/zh/quick_start/extension_modules.md
+++ b/docs/zh/quick_start/extension_modules.md
@@ -4,7 +4,7 @@
| 安装方式 | 包含能力 | 适用场景 |
| --- | --- | --- |
-| `mineru>=4.0,<5` | ONNX、llama.cpp、WebUI、SDK/API;Apple Silicon 自动包含 Torch | 原生文档、CPU 小模型、llama.cpp 或连接已有服务 |
+| `mineru>=4.0,<5` | ONNX、llama.cpp、WebUI、SDK/API;Apple Silicon 自动包含 Torch | 原生文档、ONNX 小模型(4.1 支持自动 GPU/CPU 选型)、llama.cpp 或连接已有服务 |
| `mineru[torch]>=4.0,<5` | 基础包 + Torch、Torchvision、Transformers、Accelerate | 使用 Torch 小模型,VLM 引擎独立选择 |
| `mineru[full]>=4.0,<5` | Torch extra + Linux 上的 vLLM / Windows 上的 LMDeploy | 支持设备上的高吞吐部署 |
diff --git a/docs/zh/quick_start/index.md b/docs/zh/quick_start/index.md
index 6d20d2db..b7cdc8f9 100644
--- a/docs/zh/quick_start/index.md
+++ b/docs/zh/quick_start/index.md
@@ -1,6 +1,6 @@
# 快速入门
-本指南面向 MinerU **4.0 正式版**。AMD 和国产加速卡的既有适配保持在 `<4`,请使用[旧平台指南](../usage/compatibility.md)。
+本指南面向 MinerU **4.x**,包含即将发布的 4.1 自动设备选择与 API 更新。已有部署请阅读 [4.1 迁移说明](../reference/migration_4_1.md)。AMD 专用软件栈和国产卡的旧适配教程仍适用于 `<4`,见[旧平台指南](../usage/compatibility.md)。
## 安装 MinerU
@@ -22,7 +22,7 @@ Windows PowerShell 激活环境:
.venv\Scripts\Activate.ps1
```
-安装基础包:
+安装最新已发布的 4.x 基础包(4.1 新功能需待正式发布或使用对应源码):
```bash
uv pip install -U "mineru>=4.0,<5"
@@ -32,6 +32,8 @@ uv pip install -U "mineru>=4.0,<5"
基础包包含 WebUI、ONNX 小模型运行时和 llama.cpp VLM;Apple Silicon 上会自动安装 Torch 依赖。需要 Torch 小模型或高吞吐 VLM 时,按[扩展模块](extension_modules.md)安装 `torch` 或 `full`,不要使用 3.x 的 extras。
+4.1 在 Windows x64 使用 DirectML、Linux x86_64 使用 WebGPU,自动选择兼容 GPU 或 CPU;Apple Silicon 默认使用 Torch/MPS 与 llama.cpp/Metal。可用 `mineru-kit hardware detect` 推荐档位,或用 `hardware info --json` 读取诊断信息。首次 ONNX 校准可能下载识别模型,详见[档位与运行环境](../usage/tiers.md)。
+
## 第一次解析
无状态解析单个文件,将 Markdown 写入指定文件:
@@ -79,11 +81,11 @@ mineru-kit webui --server-name 127.0.0.1 --server-port 7860
mineru-kit api-server --host 127.0.0.1 --port 8000 --tier standard
```
-在 [OpenAPI 文档](http://127.0.0.1:8000/docs)查看当前服务接口。
+在 [OpenAPI 文档](http://127.0.0.1:8000/docs)查看当前服务接口。异步批次使用 [Tasks](../usage/tasks.md);需要上传单文件并直接返回附件时,另行启动 [file-parse 服务](../usage/file_parse.md)。
## 源码安装
-在包含 4.0 源码的仓库根目录执行:
+在对应版本源码的仓库根目录执行:
```bash
uv pip install -e .
@@ -97,4 +99,5 @@ mineru version --json
- [档位与运行环境](../usage/tiers.md)
- [模型下载与配置](../usage/model_source.md)
- [3.x → 4.0 迁移](../reference/migration_4.md)
+- [4.0.x → 4.1 迁移](../reference/migration_4_1.md)
- [官网](https://mineru.net/)与[在线演示](../demo/index.md)
diff --git a/docs/zh/reference/changelog.md b/docs/zh/reference/changelog.md
index 5a70cc5c..5221f2ea 100644
--- a/docs/zh/reference/changelog.md
+++ b/docs/zh/reference/changelog.md
@@ -2,20 +2,52 @@
本文档记录 MinerU 项目的版本更新历史、主要能力演进和重要兼容性变动。
-## 未发布
+## 4.1.0(即将发布)
+
+本节记录 4.0.12 之后的主要变化;升级步骤与破坏性变更见 [4.1 迁移说明](migration_4_1.md)。
+
+### 自动加速与硬件诊断
+
+- 新增 Windows x64 ONNX DirectML、Linux x86_64 ONNX WebGPU 自动选型,支持兼容的 Intel、AMD、NVIDIA GPU。共享设备分类与身份匹配,优先选择可用独显;集显按性能与兼容性选择 GPU 或 CPU,并保存有效选择与校准证据。
+- 优化 OCR rec 输出与传输,UNet 接入共享设备选择,公式识别按实际批量分配 GPU 与 CPU 尾批。代表性核心推理场景约为 CPU 的 2~3 倍速度;该倍率不代表所有设备或整本解析。
+- 新增 `mineru-kit hardware detect/info` 及 JSON 输出,统一硬件诊断与 API 自动档位推荐。llama.cpp 集显路由复用适用的设备证据,并改善 Linux Intel Vulkan 提交稳定性。
+- 优化 Torch CPU 默认卷积配置,关闭默认 NNPACK,改善受影响设备的 CPU 推理表现。
+
+### Tasks 与同步解析
+
+- [Tasks](../usage/tasks.md) 成为唯一异步解析接口,替换独立 uploads 和 parse/jobs;支持 JSON 文件清单、URL 输入、缓存免传、逐文件排队与下载。
+- 统一服务端文件 ID、文件状态与 POST 取消;创建、详情、取消、上传确认分别使用独立响应。成功响应省略 null,完成文件返回实际档位与单一结果链接。
+- 公共错误统一为必填 `code/message` 与可选 `param`,移除 `type`,省略空 param;客户端需与服务端同步升级。
+- 新增独立 [file-parse 服务](../usage/file_parse.md),支持单文件同步附件、超时后查询、请求 ID 幂等及已知任务恢复。
+- API 启动使用单个 `--tier` 上限,Standard 不再隐含 Advanced;原生文档固定 Flash,不受 PDF/图片档位列表限制。
+- 输出选项统一为 `default/docx/html/latex`;ModelJson 保留为内部数据,移除 `include_model_output` 和对外模型输出文件。
+
+### 文档库、解析与稳定性
+
+- 新增文档库文件名搜索分页,统一解析、阅读和导出的页码选择;修复非 PDF 原生文档因预估页数导致的整本输出不完整。
+- WebUI 清除、更换文件、重新提交或收到正常页面关闭事件时,联动取消旧的远端任务,保留已完成产物。
+- 修复原生 PDF 大号首字缺失及词边界问题;跳过无效文字/印章裁切并保持识别结果对齐;提高行内公式置信度阈值,减少低置信度误检。
+- 改善 Router 级联上传、结果租约和代理头隔离,以及 Doclib 配置隔离、健康状态与退出清理。
+
+### 运行环境
- Python 最低版本提升至 3.11,支持范围为 `>=3.11,<3.15`。从下一正式版本开始,请先停止旧环境中的 MinerU 服务,再使用 Python 3.11–3.14 新建虚拟环境、重新安装依赖,并更新服务启动配置中的解释器路径;建议新环境使用 Python 3.12。升级后通过 `mineru version --json` 核对实际版本。
+- 更新依赖范围至 `docvortex>=0.6.0,<0.7`、`gradio>=6.21,<7`。Windows/Linux 的 ONNX 平台依赖随基础包安装;Apple Silicon 延续 Torch/MPS 与 llama.cpp/Metal 路径。
+
+## 4.0
+
+### 4.0.12 及之前的兼容性调整
- 图片命名变更:CLI/API ZIP 的新物化图片统一采用 Gradio 的视觉父块命名,表内图按所有 img src 顺序编号,冲突追加 `_duplicate_n`。引用同步更新,图片字节及 MiddleJson 2.0 不变;历史 ZIP 仍按已有引用读取。需要 `docvortex>=0.4.19,<1`。
- 破坏性变更:移除 `mineru-kit parse` 的 `--backend` 参数(该参数在 4.0 alpha 阶段引入)。它仅用于推断 tier,没有独立作用,请改用 `--tier`:`pipeline` → `--tier basic`;`vlm-engine`、`vlm-auto-engine`、`vlm-http-client` → `--tier advanced`;`hybrid-engine`、`hybrid-auto-engine` → `--tier standard`(或省略该参数);`flash` → `--tier flash`。使用远程 VLM 服务由 VLM 服务配置表达,与该参数无关。
- 破坏性变更:移除 `mineru.parser` 公开导出中的 `PARSER_BACKENDS` 常量(4.0 正式版包含该导出)。backend 由 tier 派生,不再是公开选择或公开符号;请通过 `model.small_backend` 与 `model.vlm.engine` 配置引擎。
-## 4.0
+### 主要能力
- 四档解析、多格式原生文档支持、文档库与渐进阅读。
- ONNX/Torch 小模型与独立 VLM 引擎配置,统一 SDK、V1 API、WebUI 和渲染接口。
-- 主要能力见[4.0 概览](../index.md),接口与部署调整见[迁移指南](migration_4.md);旧平台适配继续限制 `mineru<4`。
+- 主要能力见[产品概览](../index.md),接口与部署调整见[迁移指南](migration_4.md);旧平台适配指南继续限制 `mineru<4`。
## 3.x 系列版本
@@ -312,7 +344,7 @@
**体验优化**
-- 内置开箱即用的`fastapi服务`和`gradio webui`,详细使用方法请参考[文档](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuisglang-clientserver)
+- 内置开箱即用的`fastapi服务`和`gradio webui`,详细使用方法请参考[文档](../usage/quick_usage.md)
- `sglang`适配`0.4.8`版本,大幅降低`vlm-sglang`后端的显存要求,最低可在`8G显存`(Turing及以后架构)的显卡上运行
- 对所有命令增加`sglang`的参数透传,使得`sglang-engine`后端可以与`sglang-server`一致,接收`sglang`的所有参数
- 支持基于配置文件的功能扩展,包含`自定义公式标识符`、`开启标题分级功能`、`自定义本地模型目录`,详细使用方法请参考[文档](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#mineru_1)
diff --git a/docs/zh/reference/index.md b/docs/zh/reference/index.md
index d01ef9d6..a74e5c98 100644
--- a/docs/zh/reference/index.md
+++ b/docs/zh/reference/index.md
@@ -5,6 +5,9 @@
## 目录
- [3.x → 4.0 迁移](migration_4.md)
+- [4.0.x → 4.1 迁移](migration_4_1.md)
+- [Tasks 异步接口](../usage/tasks.md)
+- [file-parse 同步接口](../usage/file_parse.md)
- [Python SDK](../usage/sdk_api.md)
- [输出文件说明](./output_files.md) - 详细介绍所有输出文件及其格式
diff --git a/docs/zh/reference/migration_4.md b/docs/zh/reference/migration_4.md
index ac917e09..66cbdf96 100644
--- a/docs/zh/reference/migration_4.md
+++ b/docs/zh/reference/migration_4.md
@@ -1,6 +1,6 @@
# 从 3.x 迁移到 4.0
-4.0 调整了命令入口、依赖组合、配置和 API。先使用独立环境验证,再迁移生产调用。AMD 和国产加速卡使用[旧平台指南](../usage/compatibility.md),继续限制 `mineru<4`。
+4.0 调整了命令入口、依赖组合、配置和 API。先使用独立环境验证,再迁移生产调用。升级到即将发布的 4.1 时,还需应用 [4.1 迁移说明](migration_4_1.md)中的 HTTP 协议和环境调整。AMD 专用软件栈及国产卡的[旧平台指南](../usage/compatibility.md)仍限制 `mineru<4`;4.1 新增的 Windows/Linux ONNX 设备支持见[档位与运行环境](../usage/tiers.md)。
## 入口与安装
@@ -10,7 +10,7 @@
| 目录批处理 | `mineru-kit parse ./documents -o ./output --format zip` |
| `mineru-gradio` | `mineru-webui` / `mineru-kit webui` |
| 旧模型下载参数 `-m all` | `mineru-kit models download --tier standard` |
-| 旧 API 调用 | V1 上传 → 解析任务 → 文件产物 |
+| 旧 API 调用 | 4.1:V1 Tasks JSON 清单 → 按需上传 → 逐文件结果;见 [Tasks](../usage/tasks.md) |
| `mineru[core]`、`mineru[pipeline]` 等 extras | 基础包、`mineru[torch]` 或 `mineru[full]` |
正式版安装使用 `"mineru>=4.0,<5"`(需要 extras 时加在包名后)。Python 包要求 `>=3.11,<3.15`;可选引擎按实际 wheel 和驱动选择版本。升级前停止原环境中的服务,升级后检查 `mineru version --json`。不要把旧平台的镜像和安装命令替换成主线 4.0。
@@ -60,7 +60,7 @@ model:
## API 与 WebUI
-异步解析统一使用 `/v1/tasks` 的 JSON 清单、按需上传和逐文件结果链接。SDK 与 WebUI 同步迁移,Files 下载及独立同步包装服务保留。同机也先做 hash 预检;详见 [HTTP API](../usage/http_api.md)。
+4.1 异步解析统一使用 `/v1/tasks` 的 JSON 清单、按需上传和逐文件结果链接。SDK 与 WebUI 同步迁移,Files 下载保留,单文件同步调用使用独立的 [file-parse 服务](../usage/file_parse.md)。同机也先做 hash 预检;详见 [HTTP API](../usage/http_api.md)及 [4.1 迁移说明](migration_4_1.md)。
原 Gradio 客户端也需按新版事件接口调整,不能仅替换命令名称。第三方插件的旧适配文档保留历史说明,不表示已支持 V1 API。
diff --git a/docs/zh/reference/migration_4_1.md b/docs/zh/reference/migration_4_1.md
new file mode 100644
index 00000000..6045a698
--- /dev/null
+++ b/docs/zh/reference/migration_4_1.md
@@ -0,0 +1,88 @@
+# 从 4.0.x 迁移到 4.1
+
+**4.1.0 即将发布。** 本页说明相对 4.0.12 的接口与运行环境变化。HTTP 路径仍使用 `/v1`,但这是破坏性协议升级,旧客户端与新服务端不能直接混用。
+
+## Python 与安装
+
+Python 支持范围为 `>=3.11,<3.15`,不再支持 Python 3.10。建议使用 Python 3.12 新建环境,重新安装所需依赖,并更新服务启动配置中的解释器路径。
+
+4.1 正式发布后,在停止旧服务并排空任务后执行:
+
+```bash
+uv venv --python 3.12 .mineru-4.1
+# Linux/macOS
+source .mineru-4.1/bin/activate
+# Windows PowerShell 改用:.\.mineru-4.1\Scripts\Activate.ps1
+uv pip install -U "mineru>=4.1,<5"
+mineru version --json
+```
+
+需要 Torch 或高吞吐 VLM 时,沿用 [torch/full 安装组合](../quick_start/extension_modules.md)。可选引擎仍受各自 Python wheel、驱动和平台限制。
+
+## 服务档位与原生文档
+
+API 启动使用单个上限参数 `--tier auto|flash|basic|standard|advanced`,移除 `--tiers`,不支持 `--no-flash`、`--no-advanced`。上限包含自身及较低档位;`--tier standard` 不再同时开放 Advanced。
+
+```bash
+mineru-kit api-server --tier auto
+mineru-kit hardware detect --json
+mineru-kit hardware info --json
+```
+
+- `auto`(或省略启动参数)按实际小模型后端和可用设备推荐上限。ONNX 在 Windows/Linux 按需选型、校准;首次可能准备或下载 OCR rec 模型,不要求开启 `--preload-models`。Torch 路径检查设备可用性,不执行 ONNX 校准。
+- `hardware detect` 使用同一推荐逻辑;`hardware info` 只读报告硬件、运行环境与已有校准记录,不测速、不下载模型、不写配置。
+- `/v1/tiers` 只描述 PDF/图片能力。所有正常可用的兼容服务都支持现有原生文档格式,Office、HTML 等固定使用 Flash,不要求服务在 `/v1/tiers` 中列出 Flash。
+- HTTP 请求省略 `tier` 或传入 `null`,PDF/图片按 **Standard → Basic → Flash** 选择支持的默认值;Advanced 必须显式请求。显式指定不支持的 PDF/图片档位返回 400,不自动改档。纯原生文档忽略合法的请求档位;混合批次分别执行,实际档位见 `files[].parse.tier`。
+- Python `create_app(tiers=...)` 保留精确 PDF/图片档位集合。WebUI 和 Doclib 托管服务遵循新的启动上限;Gradio 不再因远端未声明 Flash 而额外启动本地原生解析服务。
+
+设备配置与支持边界见[档位与运行环境](../usage/tiers.md)。服务开放的最高档位和单次请求的默认档位是两个不同设置。
+
+## HTTP 接口替换
+
+独立 `/v1/uploads` 全部路由和 `/v1/parse/jobs` 创建、列表、查询、取消路由已移除,返回 404,不保留别名或自动回退。
+
+| 旧方式 | 4.1 方式 |
+|---|---|
+| 创建 Upload → PUT → complete → 创建 Job | `POST /v1/tasks` 提交 JSON 清单,只 PUT 缺失文件,校验成功后自动排队。 |
+| 查询、取消 Job | `GET /v1/tasks/{task_id}`、`POST /v1/tasks/{task_id}/cancel`。 |
+| Tasks 表单或 multipart 创建 | `application/json`;单文件 multipart 使用独立的 [file-parse 服务](../usage/file_parse.md)。 |
+| `manifest`、`filename` | `files` 数组(1–100 项)、`file_name`;旧字段或新旧混传返回 400。 |
+| `client_file_id`、客户端指定 `file_id` | 服务端生成每个输入的公共 `file_id`,创建响应顺序与输入一致;请求禁止这些字段,包括 `null`。 |
+| `local/inline/file_id` 来源 | 上传或 HTTP(S) URL;同机也计算 hash 做缓存预检,未命中时上传。 |
+| `uploads/pending_uploads` | 每个文件的 `files[].upload`,字段为 `url/headers/expires_at`。上传路径仍可包含 `/uploads/`,这不是旧独立上传 API。 |
+| `upload_method`、上传 complete | 固定 PUT 原始字节,使用响应给出的 URL 和请求头,无需 complete。 |
+| `upload_status`、`waiting_upload/queued` | 统一 `files[].status`,使用 `waiting-file/pending`;等待文件但没有 `upload` 时只轮询。 |
+| Tasks `status_url` | 用配置的 API 基址和 URL 编码后的 `task_id` 构造查询路径,保留代理前缀。 |
+| 共用任务响应 | 创建、详情、取消、本地上传分别使用 `CreateTaskResponse`、`TaskDetailResponse`、`CancelTaskResponse`、`UploadFileResponse`。 |
+| 成功响应的 `null` 占位字段 | Tasks 递归省略无值字段,保留零值和空集合。file-parse 状态与 HTTP 错误保持各自规则。 |
+| 公共错误 `type`、可空 `code` | 统一为必填非空 `code`、`message` 和可选 `param`;不输出或接受 type,空 param 省略。HTTP 失败与任务内错误使用同一结构。 |
+| 顶层 `tier`、`files[].parse.model_used` | 成功文件的 `files[].parse` 提供实际 `tier` 及有值的 `duration_ms/parser_version`。 |
+| 响应 `sha256sum/page_range/name`、源缓存 ID | 不再回显;请求 hash 和页范围仍可用。公共 `file_id` 从创建到结果保持不变。 |
+| `files[].output_files`、批次总 ZIP | 每个成功输入一个 `files[].result_url`,按文件下载;父任务没有结果链接。 |
+| `markdown/middle_json/structured_content/zip` 输出选项 | `default` 返回包含这些通用结果和图片的 ZIP;另外支持 `docx/html/latex`,可组合。 |
+| `include_model_output`、`model_output.json` | 参数移除,提交即返回 400;ModelJson 仅用于内部处理,不进入 API、SDK、CLI 或 Gradio 结果。 |
+| Health `features.output_formats`、`task_model_output` | 使用 `features.task_output_formats`,来源为 `upload/url`;移除 `task_model_output`。 |
+| 任务/文件列表、DELETE 取消 | 无列表或公开删除接口;合法认证下 `GET /v1/tasks` 为 405、`GET /v1/files` 为 404,取消使用 POST。 |
+
+`--allow-local-source` 和 `--max-inline-bytes` 同时移除。Files 按 ID 查询与下载、Health、Tiers、Models、Usage 保留。产物生成前,对预留 `file_id` 的 Files 查询或下载返回 404。
+
+完整字段、状态机、上传有效期及错误说明见 [Tasks 接口](../usage/tasks.md)。SDK 保留 `MinerUApiParser` 方法和返回类型,状态类型使用 `ApiTaskStatus`,仍保留 `ApiJobStatus` Python 别名;这个别名不恢复旧 HTTP 协议。
+
+公共错误升级同样要求 worker、Router、SDK、file-parse 与 SaaS 协调切换;客户端根据 HTTP 状态和 code 处理失败。内部 CLI/Doclib 错误分类以及 file-parse 历史恢复记录不随此调整改写。
+
+## file-parse 与恢复边界
+
+`mineru-kit file-parse-server` 是独立的单文件同步包装服务,通过 Tasks 连接本地 API、Router 或兼容 SaaS。主 API Server 和 Router 不提供 `/v1/file_parse`。
+
+等待结束返回 202 不代表取消;保存 `request_id/status_url` 后继续查询或下载。包装服务恢复已知的上游任务,不会在创建结果未知时自动重提,也不能恢复已因上游重启或过期而消失的任务。
+
+新恢复空间使用 `tasks-v5-` 前缀。旧 `tasks-v4-`、`tasks-v3-`、`tasks-v2-` 及无前缀目录保留,但不加载、不迁移。旧空间的请求 ID 不会恢复;新空间内继续支持幂等与包装服务重启恢复。状态和附件示例见 [file-parse 接口](../usage/file_parse.md)。
+
+## 升级顺序与验证
+
+1. 停收旧请求,等待在途任务结束并保存需要的产物。API/Router 的任务与缓存索引是进程内状态,不保证跨重启恢复。
+2. 准备 Python 3.11–3.14 环境,先升级 worker,再升级 Router、SDK、WebUI、file-parse 包装服务及应用。SaaS 部署需同步对齐共同契约,不依赖旧 worker 回退。
+3. 更新请求字段、查询/取消路径和逐文件下载逻辑,保存创建返回的任务与文件 ID;不要盲目重试创建请求。
+4. 用 PDF 与原生文档混合批次验证档位、缓存免传、逐文件结果,再检查失败、取消、上传过期及同步等待超时后的查询。确认 Markdown、结构化 JSON 和素材完整后恢复接单。
+
+更早版本用户还需参考 [3.x → 4.0 迁移](migration_4.md)。
diff --git a/docs/zh/usage/cli_tools.md b/docs/zh/usage/cli_tools.md
index e9d2de75..d2c89398 100644
--- a/docs/zh/usage/cli_tools.md
+++ b/docs/zh/usage/cli_tools.md
@@ -66,6 +66,27 @@ mineru-kit api-server --host 127.0.0.1 --port 8000 --tier standard
在浏览器打开 `http://127.0.0.1:8000/docs` 查看自动生成的 OpenAPI 文档。当前服务接口统一位于 `/v1/*`;已删除的 `/file_parse` 和 `/tasks` 不再提供。
+### 硬件诊断
+
+硬件推荐和诊断:
+
+```bash
+mineru-kit hardware detect --json
+mineru-kit hardware info --json
+```
+
+4.1 的 detect 与 `api-server --tier auto` 共用推荐逻辑,可能触发 ONNX 校准;info 只读报告环境与已有校准记录。档位上限和设备规则见[档位与运行环境](tiers.md)。
+
+### 单文件同步服务
+
+需要单文件同步 HTTP 返回时,另行启动包装服务:
+
+```bash
+mineru-kit file-parse-server --api-url http://127.0.0.1:8000
+```
+
+包装服务默认端口为 8003,接收 multipart 并通过 Tasks 调用上游;详见 [file-parse 接口](file_parse.md)。
+
### Gradio WebUI
```bash
@@ -94,7 +115,8 @@ mineru-kit vlm-server --engine auto --port 30000
- `MINERU_PDF_RENDER_TIMEOUT` / `MINERU_PDF_RENDER_THREADS`:PDF 渲染超时和 worker 数量。
- `MINERU_PROCESSING_WINDOW_SIZE`:大文档处理窗口大小。Flash 原生文本路径仅渲染有视觉块的页面,仍遵守该窗口边界、渲染超时和 worker 配置,并按 32 MiB 像素预算进一步分批。OCR 和其他档位保持整窗口渲染。
- `MINERU_MALLOC_TRIM`:默认关闭;仅 `1/true/yes/on` 启用,忽略大小写和首尾空白。Linux 上可用时,在推理窗口及 PDF 文档清理后尝试归还当前进程的 glibc 空闲堆页;Flash 原生路径仅在文档结束时尝试。其他平台或缺少符号时为空操作,不释放存活对象、GPU 显存或渲染子进程内存。参见[内存压测方法](./pdf_memory.md)。
-- `MINERU_INTRA_OP_NUM_THREADS` / `MINERU_INTER_OP_NUM_THREADS`:每个 ONNX 会话的算子内 / 算子间线程数,默认分别为 `4` / `1`,包括表格 CUDA 的 CPU 回退路径。显式正数参数或会话线程配置优先于环境变量;环境变量缺失、非整数或非正数时使用默认值。这不是整个进程的线程总数上限,也不会自动检测容器 CPU 配额。
+- `MINERU_MODEL_ONNX_DEVICE`:4.1 ONNX 设备选择 `auto/cpu/gpu`,覆盖文件配置;Torch 与 VLM 独立配置。
+- `MINERU_INTRA_OP_NUM_THREADS` / `MINERU_INTER_OP_NUM_THREADS`:每个 ONNX 会话的算子内 / 算子间线程数,默认分别为 `4` / `1`,包括 GPU 会话中的 CPU 算子。显式正数参数或会话线程配置优先于环境变量;环境变量缺失、非整数或非正数时使用默认值。这不是整个进程的线程总数上限,也不会自动检测容器 CPU 配额。
当前默认值以各命令的 `--help` 和[模型源说明](./model_source.md)为准。
diff --git a/docs/zh/usage/file_parse.md b/docs/zh/usage/file_parse.md
new file mode 100644
index 00000000..016e9f21
--- /dev/null
+++ b/docs/zh/usage/file_parse.md
@@ -0,0 +1,179 @@
+# file-parse API:单文件同步解析
+
+本文描述即将发布的 **4.1.0** 接口。`mineru-kit file-parse-server` 是独立的 HTTP 包装服务:接收一个文件,通过 [Tasks](tasks.md) 创建、上传、等待,成功后直接返回 ZIP、DOCX 或 HTML 附件。它可连接本地 API、Router 或兼容 SaaS,不加载解析模型。
+
+## 启动
+
+先启动上游解析服务,再在另一个终端启动包装服务:
+
+```bash
+mineru-kit api-server --host 127.0.0.1 --port 8000 --tier auto
+```
+
+```bash
+mineru-kit file-parse-server --api-url http://127.0.0.1:8000
+```
+
+| 参数 | 默认值 | 说明 |
+|---|---|---|
+| `--api-url` | `MINERU_API_URL`,否则必填 | 上游 API 基址,可含代理前缀,不要追加 `/v1/tasks`。 |
+| `--api-key` | `MINERU_API_KEY`,否则为空 | 仅用于上游的 Bearer Token。 |
+| `--host`、`--port` | `127.0.0.1`、`8003` | 包装服务监听地址。 |
+| `--state-dir` | `${MINERU_HOME:-~/.mineru}/file-parse` | 恢复数据库和传输临时目录。 |
+| `--retention-seconds` | `86400` | 首次观察终态后的记录保留秒数;0 禁用回收。 |
+
+包装入口本身没有 API Key 认证,面向本机或可信网络;需要对外提供访问时在反向代理设置认证。入站 Authorization 不会转发给上游,请求也不能覆盖上游地址或凭据。
+
+包装服务有独立的 `/docs`、`/openapi.json`。以下路由只在该服务上提供,不注册到主 API Server 或 Router。
+
+## 请求字段
+
+`POST /v1/file_parse` 仅接受 `multipart/form-data`。不接受查询参数、未知字段、多个文件或重复标量字段;`output_formats` 可以重复。
+
+| 字段 | 默认值 | 说明 |
+|---|---|---|
+| `file` | 必填 | 一个非空文件,保留文件扩展名。 |
+| `tier` | 上游默认 | 可省略;`flash/basic/standard/advanced`,仅对 PDF/图片生效。 |
+| `ocr_mode` | `auto` | `auto/txt/ocr`。 |
+| `page_range` | 整本 | PDF 支持 `1-5`、`r1`、`all` 等;格式支持范围由上游校验。 |
+| `output_formats` | `default` | `default/docx/html/latex`,重复字段表达列表,按首次出现去重。 |
+| `wait_timeout` | `3600` | 整数秒,范围 0–3600。 |
+| `request_id` | 自动生成 | 1–64 位字母、数字、下划线或短横线;预先指定并保存以便断连后恢复。 |
+
+省略 tier 时由上游按 Standard → Basic → Flash 选择 PDF/图片档位;Advanced 必须显式请求。显式不支持的 PDF/图片档位返回错误,不自动改档。现有原生文档固定使用 Flash,即使传入上游未开放的合法档位。表单空字符串或字符串 `"null"` 不等于省略,均为非法 tier。
+
+`output_formats` 不接受 JSON 字符串或逗号分隔值;多格式使用多个同名表单字段。`include_model_output` 已移除,传入即返回 400。
+
+## 上传与附件响应
+
+以下为 Bash/curl 示例;Windows PowerShell 可使用 `curl.exe` 并调整续行语法。服务收到真实文件后自动计算大小和 hash。
+
+```bash
+# response.body 可能是附件或 JSON,必须同时检查状态码和响应头。
+curl --max-time 7200 -D response.headers -o response.body \
+ http://127.0.0.1:8003/v1/file_parse \
+ -F 'request_id=report-example' \
+ -F 'tier=standard' \
+ -F 'output_formats=default' -F 'output_formats=docx'
+```
+
+| 接口 | HTTP | 正文 |
+|---|---|---|
+| POST,同步等待成功 | 200 | 附件原始字节,无 JSON/Base64 外层。 |
+| POST,等待到期或 `wait_timeout=0` | 202 | 完整 StatusResponse。 |
+| `GET /v1/file_parse/{request_id}`,查询成功 | 200 | 完整 StatusResponse,包括已知失败、取消或提交结果未知状态。 |
+| `GET /v1/file_parse/{request_id}/result`,下载成功 | 200 | 与同步 POST 相同的附件。 |
+
+以输入 `report.pdf` 为例:
+
+| output_formats | 文件名 | Content-Type / 内容 |
+|---|---|---|
+| `default` | `report.zip` | `application/zip`;Markdown、Middle JSON、Structured Content、images/。 |
+| `docx` | `report.docx` | `application/vnd.openxmlformats-officedocument.wordprocessingml.document`;内嵌图片。 |
+| `html` | `report.html` | `text/html; charset=utf-8`;内嵌图片。 |
+| `latex` | `report.zip` | `application/zip`;document.tex、images/。 |
+| 多格式 | `report.zip` | 各格式平铺的 ZIP,内容与 [Tasks 输出](tasks.md#outputs-and-downloads)一致。 |
+
+成功附件包含 `Content-Disposition`、`X-Request-ID` 和 `X-Task-ID`。202 包含 `Location`(状态查询 URL)、`Retry-After: 2`、`X-Request-ID`;已确认上游任务时还包含 `X-Task-ID`。状态查询与错误响应不保证附加这些头,恢复信息应从 JSON 正文读取。
+
+## 状态查询
+
+StatusResponse 的七个字段始终出现,可空字段使用 null,不采用 Tasks 的省略规则:
+
+| 字段 | 类型 | 含义 |
+|---|---|---|
+| `request_id` | string | 包装服务的请求 ID。 |
+| `task_id` | string 或 null | 已确认的上游任务 ID,尚未确认时为 null。 |
+| `status` | string | 单文件状态,见下表。 |
+| `status_url` | string | 包装服务自身的完整查询地址。 |
+| `result_url` | string 或 null | completed 时指向包装服务自身的结果接口,否则为 null。 |
+| `output_formats` | string[] | 归一化输出格式列表。 |
+| `error` | object 或 null | 最近保存的错误或上游文件错误,没有时为 null。 |
+
+| 状态 | 含义 |
+|---|---|
+| `prepared` | 源文件和恢复记录已保存,尚未提交。 |
+| `submitting` | 正在创建上游任务,尚无确认的 task_id。 |
+| `waiting-file` | 上游输入准备中,不能仅因 upload 缺失而认定就绪。 |
+| `pending`、`running` | 上游排队、解析或导出中。 |
+| `completed` | 上游产物就绪;下载仍可能因过期或传输问题失败。 |
+| `failed`、`canceled` | 已知失败或被上游取消。 |
+| `submission_unknown` | 创建可能成功,但未获得有效任务 ID;不会自动重放创建。 |
+
+包装服务只处理一个输入,没有 partial 状态,也不返回 Tasks 的 files/progress 或上游签名链接。示例 202 或 GET 状态正文:
+
+```json
+{
+ "request_id": "report-example",
+ "task_id": "job_example",
+ "status": "running",
+ "status_url": "http://127.0.0.1:8003/v1/file_parse/report-example",
+ "result_url": null,
+ "output_formats": ["default", "docx"],
+ "error": null
+}
+```
+
+```bash
+curl http://127.0.0.1:8003/v1/file_parse/report-example
+curl --fail-with-body -D result.headers -o report.zip \
+ http://127.0.0.1:8003/v1/file_parse/report-example/result
+```
+
+下载未就绪返回 `409 result_not_ready`;没有确认的上游任务时可能返回 `409 task_not_created`。下载中断可重试 GET。签名失效时包装服务查询原任务,最多尝试三次;无法恢复的过期结果不会自动重新解析。
+
+## 等待、幂等与恢复
+
+`wait_timeout` 在确认上游文件就绪后计时,覆盖排队、解析和导出。接收源文件、上游上传/下载/校验和结果下载不占这段预算,因此它不是整个 HTTP 请求的总超时。正常轮询间隔为 2 秒;连接、元数据请求、传输空闲超时分别为 10、30、600 秒。零等待可用于先获得状态查询入口。
+
+完整接收并持久化源文件后,服务才接管请求;此前断连不会创建任务。接管后客户端断连、等待超时或包装服务关闭不会自动取消上游任务。
+
+- 同一 request_id、文件内容、逻辑文件名及归一化解析参数复用原任务;输入不同返回 `409 request_id_conflict`。wait_timeout 不参与身份比较。
+- SQLite 恢复记录按上游地址和认证隔离,不保存 API Key。一个状态目录仅允许一个包装服务进程。重启继续已知任务及仍有效的待上传操作。
+- 创建回执中的 task_id/file_id 先持久化,再查询详情;首次查询失败或重启不会再次创建任务。创建结果未知时保留 submission_unknown,不盲目重试。
+- 源文件在上游确认就绪或终结失败后清理;附件仅临时下载,发送完成或中断即删除。恢复记录不延长上游上传链接或结果有效期;上游任务消失后不会重建。
+- 协议升级的新空间为 `tasks-v5-`;旧空间不加载、不迁移,也不自动删除。详见 [4.1 迁移说明](../reference/migration_4_1.md)。
+
+包装服务没有独立取消接口。持有已确认的 task_id 且有上游权限时,向**配置的上游 API 基址**发送 `POST /v1/tasks/{task_id}/cancel`,然后查询包装服务观察 canceled;不要使用包装基址或把 request_id 当作 task_id。未预先保存 ID 且未收到响应时,调用者可能无法找回任务。
+
+## 错误响应
+
+包装层直接产生的 error 包含 `code: string`、`message: string`、`upstream_status: integer|null`。没有恢复记录时仅返回 error:
+
+```json
+{
+ "error": {
+ "code": "unsupported_media_type",
+ "message": "Expected multipart/form-data",
+ "upstream_status": null
+ }
+}
+```
+
+有记录时返回完整七字段 StatusResponse,用本次操作的错误覆盖 error;例如下载未就绪可返回 HTTP 409,同时 status 仍为 running。查询成功时的持久化 error 可能额外包含 http_status,或保留上游的 code/message 和可选 param。历史恢复记录可能仍含旧 type 或其他字段;客户端应容忍扩展字段,这不代表新 Tasks 协议接受旧字段。
+
+| HTTP | 常见 code | 含义 |
+|---|---|---|
+| 400 | `invalid_request`、`upload_interrupted` | 参数、多文件、空文件或接受前断连。 |
+| 404 | `request_not_found` | 记录不存在或已清理。 |
+| 408 | `upload_receive_timeout` | 接收入站请求体时传输空闲超时。 |
+| 409 | `request_id_conflict`、`result_not_ready`、`task_not_created` 或取消错误码 | 请求冲突、结果未就绪、尚无任务或上游取消。 |
+| 410 | `upload_expired` | 上游上传窗口已过期。 |
+| 415 | `unsupported_media_type` | 不是 multipart/form-data。 |
+| 500 | `storage_error` | 本地存储失败。 |
+| 502 | `submission_unknown`、`upstream_unreachable`、`upstream_protocol_error`、`invalid_result` 或上游错误码 | 上游请求、传输、解析或结果校验失败。 |
+
+上游认证失败通过包装层 502 返回,`upstream_status=401`;明确的档位拒单也返回 502,并保留上游 400/503。它们是 failed,不是 submission_unknown。创建阶段其他 5xx、408、网络异常或畸形响应可能无法判断是否接单,按 submission_unknown 处理;符合共享错误结构的 `503 quality_tier_unavailable` 是明确拒单。两种情况都不会自动重放创建,相同 ID 沿用已有记录。
+
+## Python 示例客户端
+
+仓库脚本依赖 httpx,提前打印请求 ID,成功时原子保存附件;202 时打印恢复信息并以 124 退出。从仓库根目录执行:
+
+```bash
+python scripts/http_file_parse_example.py report.pdf --output report.docx \
+ --base-url http://127.0.0.1:8003 --output-format docx --request-id report-docx
+
+python scripts/http_file_parse_example.py report.pdf --wait-timeout 0 \
+ --base-url http://127.0.0.1:8003 --request-id report-background
+```
diff --git a/docs/zh/usage/http_api.md b/docs/zh/usage/http_api.md
index 6e6186a6..6dee46d8 100644
--- a/docs/zh/usage/http_api.md
+++ b/docs/zh/usage/http_api.md
@@ -1,6 +1,6 @@
# V1 HTTP API
-Tasks 是唯一异步解析入口。API Server、Router、SDK 和 WebUI 统一提交 JSON 清单、按需上传、查询状态并下载逐文件结果。Python 调用见 [Python SDK](sdk_api.md),完整字段见 [Tasks 契约](../../next/api/tasks.md)。
+即将发布的 4.1 使用 Tasks 作为唯一异步解析入口。API Server、Router、SDK 和 WebUI 统一提交 JSON 清单、按需上传、查询状态并下载逐文件结果。Python 调用见 [Python SDK](sdk_api.md),完整字段见 [Tasks 契约](tasks.md)。
```bash
mineru-kit api-server --host 127.0.0.1 --port 8000 --tier standard
@@ -14,7 +14,7 @@ Tasks 与 Files JSON 统一使用 `file_name`;旧字段 `manifest`、`filename
向 `POST /v1/tasks` 提交 `application/json`:files 每项包含逻辑 file_name、上传文件的 bytes 和可选 sha256sum/page_range,也可提供 URL(bytes 可省略)。禁止传入 client_file_id 或 file_id;服务端生成唯一 file_id,按输入顺序返回,并在上传、查询、取消和产物下载中保持不变。解析选项为 tier/ocr_mode/page_range/output_formats。
-创建返回稳定的 `task_id`;每个文件的 `upload` 为待上传描述或 `null`,包含 `url/headers/expires_at`。客户端固定使用 PUT 上传缺失文件,使用响应指定的 PUT 地址及请求头,无需 complete。每个文件就绪即独立排队,其他文件等待上传不会阻塞它。
+创建返回稳定的 `task_id`;仅需要客户端上传的文件携带 `upload`,包含 `url/headers/expires_at`,其他文件省略该字段。客户端固定使用 PUT 上传缺失文件,使用响应指定的 PUT 地址及请求头,无需 complete。每个文件就绪即独立排队,其他文件等待上传不会阻塞它。
同机也使用相同流程。SDK 总是计算 hash;已完成上传的有效缓存可以免传。并发首次请求允许重复传输,但源字节去重。缓存默认保留 24 小时、每 5 分钟扫描,正在执行及传输的引用受保护。
上传链接固定有效一小时,查询不会续期。截止前已受理上传可继续完成。中断后先查询,进入 pending/running/completed 后跳过上传;waiting-file 且 upload 省略 时只等待,有有效上传目标时才有限重试。过期文件进入 failed,错误码为 upload_expired。
@@ -43,6 +43,6 @@ ModelJson 仅在解析内部使用,API、SDK、CLI 和 Gradio 均不输出模
使用相同文件顺序设置 `TASK_ID` 可继续原任务。创建请求不自动重试;`MAX_POLLS/POLL_INTERVAL` 限制轮询,`CONNECT_TIMEOUT/REQUEST_TIMEOUT` 限制单次传输。
退出码为 0(全部成功)、2(部分成功)、1(失败或取消)、124(轮询耗尽)。已下载产物保留。
-旧独立上传和 Jobs 接口已移除,客户端与服务端需协调升级,详见 [迁移说明](../../next/api/changes.md)。需要同步单文件返回时使用独立的 [file_parse 包装服务](../../next/api/file-parse.md)。
+旧独立上传和 Jobs 接口已移除,客户端与服务端需协调升级,详见 [4.1 迁移说明](../reference/migration_4_1.md)。需要同步单文件返回时使用独立的 [file-parse 包装服务](file_parse.md)。
POST 创建、GET 详情、POST cancel 和本地 PUT 分别返回创建回执、查询详情、逐文件取消结果和上传确认;Tasks 成功响应省略 null,但保留零值和空集合。POST cancel 取消未完成文件,成功文件的产物仍可直接下载。
diff --git a/docs/zh/usage/index.md b/docs/zh/usage/index.md
index 613cfe11..cb3d6c0d 100644
--- a/docs/zh/usage/index.md
+++ b/docs/zh/usage/index.md
@@ -7,6 +7,9 @@
- [档位与运行环境](tiers.md)
- [Python SDK](sdk_api.md)
- [V1 HTTP API](http_api.md)
+- [Tasks 异步接口](tasks.md)
+- [file-parse 同步接口](file_parse.md)
+- [4.0.x → 4.1 迁移](../reference/migration_4_1.md)
- [3.x → 4.0 迁移](../reference/migration_4.md)
- 本地部署
* [基础使用](./quick_usage.md) - 快速上手和基本使用
diff --git a/docs/zh/usage/quick_usage.md b/docs/zh/usage/quick_usage.md
index ebb03e41..70c900fd 100644
--- a/docs/zh/usage/quick_usage.md
+++ b/docs/zh/usage/quick_usage.md
@@ -22,7 +22,7 @@ mineru parse <input_path> -o <output_path>
> [!NOTE]
> 运行时加速按两个模型组件分别选择,依据是已安装的依赖和检测到的设备:
>
-> - 小模型仅在 `torch`、`torchvision`、`transformers`、`accelerate`、`safetensors` **全部安装**且检测到非 CPU 设备(CUDA/MPS 等)时使用 Torch 后端,否则使用 ONNX(CPU)。只安装 Torch 并不足以启用。
+> - 小模型仅在 `torch`、`torchvision`、`transformers`、`accelerate`、`safetensors` **全部安装**且检测到非 CPU 设备(CUDA/MPS 等)时使用 Torch 后端,否则使用 ONNX。4.1 在 Windows/Linux 为 ONNX 自动选择兼容的 DirectML/WebGPU 加速或 CPU,详见[档位与运行环境](tiers.md)。只安装 Torch 并不足以启用。
> - 本地 VLM 引擎独立选择:macOS 固定使用 llama.cpp;加速卡设备上 Linux 优先 vLLM、其次已安装的 LMDeploy,Windows 使用 LMDeploy;否则使用 llama.cpp。
> - XPU 不会自动选择 LMDeploy:Linux 上安装了支持 XPU 的 vLLM 时使用 vLLM,否则使用 llama.cpp;Windows 上使用 llama.cpp。
> - Windows 用户如需 CUDA 加速,请先前往 [PyTorch 官网](https://pytorch.org/get-started/locally/) 选择与 CUDA 版本匹配的命令安装支持加速的 `torch` 和 `torchvision`,再安装 `mineru[full]`。
diff --git a/docs/zh/usage/tasks.md b/docs/zh/usage/tasks.md
new file mode 100644
index 00000000..6917f251
--- /dev/null
+++ b/docs/zh/usage/tasks.md
@@ -0,0 +1,243 @@
+# Tasks API
+
+本文描述即将发布的 **4.1.0** 契约。`/v1/tasks` 是 API Server、Router 和兼容 SaaS 的共同异步解析入口:提交 JSON 清单、上传缺失文件、查询状态,再按文件下载结果。旧客户端请先阅读 [4.1 迁移说明](../reference/migration_4_1.md)。单文件同步调用见 [file-parse API](file_parse.md)。
+
+## 启动与认证
+
+```bash
+mineru-kit api-server --host 127.0.0.1 --port 8000 --tier auto
+```
+
+服务的 `/docs` 和 `/openapi.json` 提供当前部署的接口定义。配置 API Key 时,API 请求使用 `Authorization: Bearer <API_KEY>`;未配置 Key 的本地服务可省略该头。请求基地址可带反向代理路径前缀。
+
+| 方法与路径 | 成功响应 | 用途 |
+|---|---|---|
+| `POST /v1/tasks` | 202,`CreateTaskResponse` | 提交 JSON 清单。 |
+| `PUT files[].upload.url` | 本地/Router 为 200,`UploadFileResponse` | 上传一个文件的原始字节;对象存储接受其成功 2xx 响应。 |
+| `GET /v1/tasks/{task_id}` | 200,`TaskDetailResponse` | 查询完整状态快照。 |
+| `POST /v1/tasks/{task_id}/cancel` | 200,`CancelTaskResponse` | 取消未完成文件,无需请求体。 |
+
+本地上传路径为 `/v1/tasks/{task_id}/uploads/{file_id}`,客户端应使用返回的完整 URL。没有任务/文件列表、公开 DELETE 或批次结果接口。主 API Server 和 Router 不提供 `/v1/file_parse`。
+
+## 创建请求
+
+`POST /v1/tasks` 只接受 `application/json`。业务参数全部放在 JSON 中;查询参数、未知字段或非法值返回 400,其他 Content-Type 返回 415。
+
+| 字段 | 类型 | 默认值或要求 |
+|---|---|---|
+| `files` | object[] | 必填,1–100 项,不能传编码后的 JSON 字符串。 |
+| `tier` | string 或 null | 可省略;`flash/basic/standard/advanced`,见下文。 |
+| `ocr_mode` | string | `auto`;可选 `auto/txt/ocr`。 |
+| `page_range` | string | 空字符串表示整本;PDF 支持 `1-5`、`r1`、`all` 等。 |
+| `output_formats` | string[] | `["default"]`;非空,可选 `default/docx/html/latex`,按首次出现去重。 |
+
+每个 `files[]` 条目:
+
+| 字段 | 类型 | 要求 |
+|---|---|---|
+| `file_name` | string | 必填,1–1024 字符的逻辑文件名,保留扩展名;允许同名输入。 |
+| `bytes` | integer 或 null | 上传项必填且为正整数;URL 项可省略,提供时必须与实际大小匹配。 |
+| `url` | string 或 null | HTTP(S) 下载地址;省略或 null 表示客户端上传。 |
+| `sha256sum` | string 或 null | 可选,64 位小写十六进制 SHA-256,用于校验;上传项还用于缓存预检。 |
+| `page_range` | string 或 null | 可选,覆盖全局 PDF 页范围;非 PDF 原生文档仍整本解析。 |
+
+请求禁止 `file_id/client_file_id`,包括值为 null。服务端按输入顺序分配公共 `file_id`;相同名称或内容仍获得不同 ID。创建后通过 ID 关联上传、查询、取消与下载。在本地/Router 中,结果 Files ID 与该 ID 一致;产物生成前按该 ID 查询 Files 返回 404。源缓存 ID 不公开。
+
+### 档位选择
+
+- PDF/图片省略 `tier` 或传入 null,按 **standard → basic → flash** 选择支持的默认值;Advanced 必须显式指定。仅支持 Advanced 的服务在省略档位时返回 `503 quality_tier_unavailable`。
+- 显式请求不支持的 PDF/图片档位,整次创建返回 `400 invalid_request`,`error.param="tier"`,不会接单或自动升降档。
+- 所有正常可用的兼容服务都支持现有原生文档格式。Office、HTML 等固定使用 Flash,不受 `/v1/tiers` 或合法请求档位限制;空字符串和未知枚举仍非法。
+- 混合批次分别确定档位。例如服务支持 Standard,未指定 tier 的 PDF + DOCX 分别使用 Standard、Flash。档位在接单时确定,排队或转发时不重新选择;实际执行值见成功文件的 `parse.tier`。
+
+### 示例请求与创建响应
+
+以下 JSON 的文件大小、ID、URL 和时间均为示意值;实际上传应填写真实字节数。
+
+```json
+{
+ "files": [{"file_name": "report.pdf", "bytes": 12345}],
+ "tier": "standard",
+ "ocr_mode": "auto",
+ "output_formats": ["default", "docx"]
+}
+```
+
+202 创建回执:
+
+```json
+{
+ "task_id": "job_example",
+ "status": "waiting-file",
+ "files": [{
+ "file_id": "file-example",
+ "file_name": "report.pdf",
+ "status": "waiting-file",
+ "upload": {
+ "url": "http://127.0.0.1:8000/v1/tasks/job_example/uploads/file-example",
+ "headers": {},
+ "expires_at": 1800003600
+ }
+ }]
+}
+```
+
+202 仅表示接单。创建回执不包含文件大小、解析统计或结果链接,即使已经完成也通过 GET 获取详情。
+
+URL 输入也使用相同创建接口,例如:
+
+```json
+{
+ "files": [{"file_name": "report.pdf", "url": "https://example.com/report.pdf"}],
+ "output_formats": ["html"]
+}
+```
+
+URL 项由服务端下载,不需要客户端 PUT;替换为部署允许访问的真实下载地址。
+
+## 响应字段
+
+成功响应直接返回对象,没有 `data/task` 外层包装。以下 `?` 表示字段可省略,不是字段名的一部分。
+
+| 响应 | 顶层字段 | files[] 字段 |
+|---|---|---|
+| `CreateTaskResponse` | `task_id`、`status`、`files` | `file_id`、`file_name`、`status`、`upload?` |
+| `TaskDetailResponse` | `task_id`、`status`、`created_at`、`started_at?`、`finished_at?`、`output_formats`、`progress`、`files`、`error?` | `file_id`、`file_name`、`status`、`bytes?`、`url?`、`upload?`、`parse?`、`result_url?`、`error?` |
+| `CancelTaskResponse` | `task_id`、`status`(固定 canceled)、`finished_at`、`files` | `file_id`、`file_name`、`status`、`parse?`、`result_url?`、`error?` |
+| `UploadFileResponse` | `task_id`、`file_id`、`status`(本次文件状态) | 无 |
+
+`task_id/file_id/file_name/status` 为字符串,`files` 为数组,`bytes` 为整数,`url/result_url` 为字符串,`output_formats` 为字符串数组。时间字段为 ISO-8601 UTC 字符串。
+
+| 嵌套对象 | 字段与含义 |
+|---|---|
+| `upload` | `url: string`、`headers: object`(字符串键值,可为空)、`expires_at: integer`(Unix 秒)。仅当前需要上传时出现。 |
+| `parse` | `tier: string`、`duration_ms?: integer`、`parser_version?: string`。仅成功文件返回;版本为执行 worker 的版本。耗时含源读取/下载、校验、解析、导出,不含等待上传、准备名额或解析排队。 |
+| `progress` | 必带整数 `completed/failed/total`;取消文件不计入 completed 或 failed,total 为输入数量。 |
+| `error` | 必填非空 `code: string`、`message: string`,以及 `param?: string`。可出现在 GET 顶层/文件内和取消回执的失败文件内;不包含 type。 |
+
+Tasks 成功响应递归省略 null,保留 `0/false/[]/{}`。每次响应都是完整快照,字段缺失表示当前无值,不能保留旧上传链接。客户端应容忍未来新增字段。公共 HTTP 错误同样省略空 param;Files 和 file-parse 的空值规则独立。
+
+GET 成功完成示例(200):
+
+```json
+{
+ "task_id": "job_example",
+ "status": "completed",
+ "created_at": "2026-10-28T00:00:00Z",
+ "started_at": "2026-10-28T00:00:02Z",
+ "finished_at": "2026-10-28T00:00:10Z",
+ "output_formats": ["default", "docx"],
+ "progress": {"completed": 1, "failed": 0, "total": 1},
+ "files": [{
+ "file_id": "file-example",
+ "file_name": "report.pdf",
+ "status": "completed",
+ "bytes": 12345,
+ "parse": {"tier": "standard", "duration_ms": 8000, "parser_version": "4.1.0"},
+ "result_url": "http://127.0.0.1:8000/v1/files/file-example/content"
+ }]
+}
+```
+
+本地 PUT 确认示例:`{"task_id":"job_example","file_id":"file-example","status":"pending"}`。对象存储的成功 PUT 不要求返回这个 JSON,随后查询 Tasks 确认即可。
+
+## 上传、URL 与缓存
+
+上传使用原始字节和返回的 `upload.url/headers`,固定 PUT,无需 complete。客户端只在文件为 `waiting-file` 且存在 `upload` 时发送文件;没有 upload 时只轮询。校验完成的文件独立排队,不等待其他文件,也不在等待上传期间预占解析名额。
+
+- 上传项的 hash 命中有效缓存时免传;缓存仅复用源字节,每次任务仍按本次参数解析。并发首次上传允许重复传输,但源存储去重。
+- URL 项由服务端下载,不返回上传动作,不要求 HEAD 或 Content-Length;使用 `file_name` 识别格式,下载后补齐 bytes,校验提供的大小/hash。URL 每次下载,不按 hash 跳过下载。
+- 本地 URL 来源默认仅 HTTPS;HTTP 需启用 `--allow-http-source`,默认下载超时 60 秒、大小上限 200 MiB。客户端直接上传没有固定大小或 PDF 页数上限,部署可另加网关限制。
+- 上传链接从创建起固定有效 3600 秒,查询不续期。截止前已受理的上传可完成;尚未受理的文件到期变为 `failed/upload_expired`。有效上传后的解析不受上传截止时间限制。
+- 成功 PUT 后不重复上传;响应丢失先查询。`pending/running/completed` 跳过上传;`waiting-file` 无 upload 继续等待;失败且仍有有效 upload 时才有界重试。过期须创建新任务,不支持单文件分块断点续传。
+
+本地源缓存默认保留 24 小时,每 5 分钟扫描;活动任务和传输引用保护源字节。API/Router 的任务记录和索引为进程内状态,重启不保证恢复。
+
+## 状态与取消
+
+| 文件状态 | 含义 |
+|---|---|
+| `waiting-file` | 等待/接收上传、URL 下载、校验或对象存储确认。 |
+| `pending` | 输入就绪,等待解析资源。 |
+| `running` | 解析、导出或保存结果。 |
+| `completed` | 所选格式全部成功,结果可下载。 |
+| `failed` | 输入、解析或导出失败,读取 error。 |
+| `canceled` | 未完成文件被取消。 |
+
+父任务优先汇总为 running,其次 pending,再次 waiting-file;全部成功为 completed,全部终结且成功/失败并存为 partial,无成功文件为 failed。取消操作使父任务为 canceled。父任务可能从 running 回到 waiting-file,已完成文件的链接仍可用。
+
+取消保留已成功/失败的文件,将其他文件置为 canceled;返回的文件状态仅为 completed/failed/canceled。底层不可中断计算或清理可能仍在收尾,但迟到结果不覆盖取消终态。已终结任务再次取消返回 `409 task_already_terminal`。
+
+取消一个仍在处理的单文件任务,200 回执示例:
+
+```json
+{
+ "task_id": "job_example",
+ "status": "canceled",
+ "finished_at": "2026-10-28T00:00:05Z",
+ "files": [{"file_id": "file-example", "file_name": "report.pdf", "status": "canceled"}]
+}
+```
+
+## 输出与下载 {#outputs-and-downloads}
+
+| output_formats | 每个输入的产物 |
+|---|---|
+| `["default"]` | ZIP:`markdown.md`、`middle_json.json`、`structured_content.json`、`images/`。 |
+| `["docx"]` | 图片内嵌的 DOCX。 |
+| `["html"]` | 图片内嵌的 HTML;公式脚本仍遵循 renderer 行为。 |
+| `["latex"]` | ZIP:`document.tex`、`images/`。 |
+| 多种 | 一个平铺 ZIP,不嵌套 ZIP;DOCX/HTML 文件名为 `document.docx/document.html`。 |
+
+每个输入解析一次;全部所选格式完成后发布一个 `files[].result_url`。某格式导出失败时该文件为 `failed/result_packaging_failed`,不返回部分产物;其他文件继续。没有批次总 ZIP 或顶层 result_url。已完成文件无需等待父任务终结即可下载。
+
+ModelJson 仅用于内部处理。`include_model_output` 已删除,提交该字段(包括 false)返回 400,产物不含 `model_output.json`。
+
+本地与 Router 返回 Files 下载地址,SaaS 可返回对象存储签名地址。使用原始结果 URL,不拼接存储路径;仅对 API 同源请求附加 API Key,每次重定向重新判断,不能向对象存储泄露 Key。签名过期可在结果保留期内重新查询任务获取链接。轮询/下载不重新渲染;未完成的其他文件不会导致已完成结果提前回收。
+
+## 错误
+
+请求级错误为非 2xx 和 `{"error": ...}`,例如:
+
+```json
+{
+ "error": {
+ "code": "task_already_terminal",
+ "message": "Task is canceled"
+ }
+}
+```
+
+| HTTP | 常见 code | 场景 |
+|---|---|---|
+| 400 | `invalid_request`、`page_range_invalid` | 非法字段、档位、页范围或旧参数。 |
+| 400 | `upload_size_mismatch`、`file_hash_mismatch`、`upload_interrupted` | 上传校验或传输失败。 |
+| 401 | `invalid_api_key` | 服务启用认证而凭据无效。 |
+| 404 | `task_not_found`、`upload_not_found` | 任务不可见/已清理,或上传文件 ID 不存在。 |
+| 409 | `task_already_terminal`、`file_already_terminal` | 取消终态任务或向不接受上传的文件发送数据。 |
+| 410 | `upload_expired` | 上传窗口到期。 |
+| 415 | `invalid_request` | 创建请求不是 JSON。 |
+| 503 | `quality_tier_unavailable`、`server_shutting_down` 或模型预加载错误码 | 当前服务不能接单。 |
+
+异步下载、解析和导出失败通常通过 **200 查询快照内的 files[].error** 返回;HTTP 200 不等于解析成功。公共错误只包含必填的非空 code、message 和可选 param,不再输出或接受 type。param 无值时省略,接收端也允许 null;根据 HTTP 状态与 code 分支处理,不解析 message 判断类别。请检查所有文件状态,缺少顶层 error 不代表全部成功。
+
+## 可运行客户端示例
+
+以下 Bash 示例从仓库根目录运行,复用标准库 Python 客户端,自动计算真实文件大小和 hash、处理上传与逐文件下载:
+
+```bash
+MINERU_API_URL=http://127.0.0.1:8000 \
+ bash scripts/http_task_example.sh report.pdf notes.docx
+
+OUTPUT_FORMATS=default,docx RESULT_DIR=results \
+MINERU_API_URL=http://127.0.0.1:8000 \
+ bash scripts/http_task_example.sh report.pdf
+
+# 使用原来的文件列表和顺序继续,不重新创建任务。
+TASK_ID=job_example MINERU_API_URL=http://127.0.0.1:8000 \
+ bash scripts/http_task_example.sh report.pdf
+```
+
+`MINERU_API_KEY` 设置认证,`MINERU_TIER/OCR_MODE/PAGE_RANGE` 设置解析选项,`SEND_HASH=0` 关闭预检 hash。`MAX_POLLS/POLL_INTERVAL` 默认 300/1,限制轮询;`CONNECT_TIMEOUT/REQUEST_TIMEOUT` 限制单次传输。创建请求不自动重试。退出码:0 全部成功、2 部分成功、1 失败/取消、124 轮询耗尽,已下载文件保留。
+
+直接 HTTP 调用时,通过配置基址加 `/v1/tasks/{URL 编码后的 task_id}` 查询,通过同一路径加 `/cancel` 发送 POST 取消。创建回执中的 ID 是恢复入口,Tasks 不返回 status_url。
diff --git a/docs/zh/usage/tiers.md b/docs/zh/usage/tiers.md
index 8ab525e9..53b2abdf 100644
--- a/docs/zh/usage/tiers.md
+++ b/docs/zh/usage/tiers.md
@@ -2,6 +2,8 @@
档位表达解析质量和成本;小模型后端与 VLM 引擎是独立配置,不是档位名称。
+本文包含即将发布的 4.1 设备选择与服务档位行为;已有部署的升级步骤见 [4.1 迁移说明](../reference/migration_4_1.md)。
+
| 档位 | 主要用途 | 本地执行 |
| --- | --- | --- |
| `flash` | 快速预览、索引、原生文档解析 | 原生 PDF 文本 / 文档解析;扫描 PDF 与图片使用 Flash OCR |
@@ -21,38 +23,53 @@ mineru-kit parse saved-page.mhtml -o saved-page.md --tier flash
- `mineru-kit parse` 和本地 Python `parse()` 的 PDF 默认档位为 Standard。
- 文档库发现服务能力后,PDF/图片默认优先 Standard,其次 Basic;不可用时报 `quality_tier_unavailable`,不会静默降为 Flash 或上传到官网。
-- Advanced 需要显式选择;本地托管服务按 Standard 准备模型和启动能力,不单独下载 Advanced 模型。
+- Advanced 需要显式请求;它与 Standard 共用模型,不单独下载一套 Advanced 权重。服务需开放 Advanced 才能接受相应 PDF/图片请求。
- 文档库 `read` 读取已有缓存,不发起新解析;未指定档位时优先已有的 Advanced、Standard、Basic 结果。
+API 启动 `--tier` 表示开放上限,包含自身和较低档位;`--tier standard` 不开放 Advanced。省略或 `--tier auto` 按实际后端和硬件推荐,ONNX 路径可能在启动时执行设备校准。HTTP 请求省略 tier 时按 Standard → Basic → Flash 选择;原生文档固定 Flash,不受 PDF/图片开放档位限制。完整规则见 [Tasks](tasks.md)。
+
## 后端与引擎
| 环境 | 自动选择的小模型 | 自动选择的 VLM |
| --- | --- | --- |
-| Apple Silicon / MPS | Torch / MPS | llama.cpp |
-| Linux / Windows,基础包 | ONNX / CPU(没有可用 Torch 加速环境时) | llama.cpp |
+| Apple Silicon / MPS | Torch / MPS | llama.cpp / Metal |
+| Windows x64,基础包 | ONNX / DirectML 或 CPU(没有可用 Torch 加速环境时) | llama.cpp |
+| Linux x86_64,基础包 | ONNX / WebGPU 或 CPU(没有可用 Torch 加速环境时) | llama.cpp |
| Linux,有加速器并安装 `full` | Torch | vLLM;否则尝试已安装的 LMDeploy |
| Windows,有加速器并安装 `full` | Torch | LMDeploy |
| CPU 环境 | ONNX / CPU | llama.cpp |
-自动选择依据已安装依赖和可用设备;显式指定的后端缺依赖时会报错,不会静默改用另一种。Layout、OCR 和公式的 ONNX 模型在 CPU 上执行,VLM 的设备选择独立。
+自动选择依据已安装依赖和可用设备;显式指定的后端缺依赖时会报错,不会静默改用另一种。ONNX 设备由 `model.onnx_device=auto|cpu|gpu` 控制,VLM 设备独立选择。环境变量 `MINERU_MODEL_ONNX_DEVICE` 高于文件配置,且不会将覆盖值写回文件。
+
+4.1 基础包在 Windows x64 安装 DirectML 运行时,在 Linux x86_64 安装 WebGPU 插件(经 Vulkan 执行)。兼容且确认的独显优先;auto 下的集显或类型未知设备按需校准,收益不足或运行不可靠时使用 CPU。Linux 的旧 Intel/Xe-LP 及未识别架构使用 CPU;显式 gpu 也遵守兼容性限制。其他系统、GPU 不可用或初始化失败时记录 CPU 回退原因。
+
+有效自动选择可保存到配置;重新测速需将 `model.onnx_device` 改回 auto 并重启。设备变化后旧校准证据不再视为当前性能证据,显式或已保存的 cpu 不会因为后来接入独显而自动改写。首次校准可能下载识别模型;`hardware info` 不触发此过程。
-表格分类、SLANet 和 UNet 默认使用 `MINERU_TABLE_DEVICE=auto`:CPU 版 `onnxruntime` 使用 CPU;替换为兼容的 `onnxruntime-gpu` 后,有可用 CUDA provider 时优先使用 CUDA,初始化失败则记录原因并回退 CPU。两个 ORT 发行包不要同时安装。设置 `MINERU_TABLE_DEVICE=cpu` 可固定 CPU,设置 `cuda` 可显式尝试 CUDA;该选项仅影响表格模型。日志会记录实际使用的 providers。
+ONNX 栈的 layout、OCR rec、MFR 和 UNet 共用设备选择;普通 OCR det 在 Windows 走 CPU、Linux 可走 WebGPU,印章检测、表格分类和 SLANet Plus 走 CPU。MFR 的 GPU 路径仅处理满 8 批次,其余尾批使用 CPU。UNet 不受旧 `MINERU_TABLE_DEVICE` 覆盖;Torch 栈的表格保留其已有 CPU/CUDA 策略。无需为启用这条 ONNX 路径手动替换为 `onnxruntime-gpu`。
Intel XPU 不会自动选择 LMDeploy。Linux 上安装了支持 XPU 的 vLLM 时优先使用 vLLM,否则回退 llama.cpp;Windows 上使用 llama.cpp。
```yaml
model:
small_backend: auto
+ onnx_device: auto
vlm:
engine: auto
```
`small_backend` 可选 `auto/onnx/torch`;`engine` 可选 `auto/llama-cpp/vllm/lmdeploy`。macOS 默认使用 llama.cpp。
+```bash
+mineru-kit hardware detect --json
+mineru-kit hardware info --json
+```
+
+detect 与 API 自动启动共用推荐逻辑,可能执行适用的 ONNX 校准;info 只读采集硬件、已安装运行时、有效配置和校准记录,不测速、不下载权重、不写配置。
+
## 资源与平台边界
原生文本解析不需要推理模型。Basic 可在 CPU 运行;Standard / Advanced 的速度和内存占用取决于 VLM 引擎、输入规模和并发。高吞吐本地部署建议至少 16 GB 系统内存;NVIDIA 部署还需要所选引擎支持的显卡、驱动和足够可用显存,8 GB 仅作为规划起点,不是所有任务的保证。
-Apple Silicon 建议使用至少 16 GB 统一内存并直接在 macOS 安装。既有 AMD 和国产卡适配继续使用 [MinerU <4](compatibility.md),不属于本文的 4.0 平台兼容承诺。
+Apple Silicon 建议使用至少 16 GB 统一内存并直接在 macOS 安装。4.1 的 Windows/Linux ONNX 路径支持兼容的 Intel、AMD、NVIDIA GPU;既有 AMD 专用软件栈和国产卡的旧适配教程仍以 [MinerU <4](compatibility.md) 为适用范围。
安装组合见[扩展模块](../quick_start/extension_modules.md),下载与配置见[模型源](model_source.md)。
diff --git a/mkdocs.yml b/mkdocs.yml
index 3b6d85a8..75cf5f20 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -87,6 +87,8 @@ nav:
- Tiers and Runtimes: usage/tiers.md
- Python SDK: usage/sdk_api.md
- V1 HTTP API: usage/http_api.md
+ - Tasks API: usage/tasks.md
+ - Synchronous File Parse: usage/file_parse.md
- Legacy Platforms (MinerU <4): usage/compatibility.md
- Model Source: usage/model_source.md
- CLI Tools: usage/cli_tools.md
@@ -94,6 +96,7 @@ nav:
- Reference:
- Reference: reference/index.md
- Migration to 4.0: reference/migration_4.md
+ - Migration to 4.1: reference/migration_4_1.md
- Output File Format: reference/output_files.md
- Changelog: reference/changelog.md
- FAQ:
@@ -110,6 +113,8 @@ nav:
- Tiers and Runtimes: usage/tiers.md
- Python SDK: usage/sdk_api.md
- V1 HTTP API: usage/http_api.md
+ - Tasks API: usage/tasks.md
+ - Synchronous File Parse: usage/file_parse.md
- Legacy Platforms (MinerU <4): usage/compatibility.md
- Model Source: usage/model_source.md
- CLI Tools: usage/cli_tools.md
@@ -117,6 +122,7 @@ nav:
- Reference:
- Reference: reference/index.md
- Migration to 4.0: reference/migration_4.md
+ - Migration to 4.1: reference/migration_4_1.md
- Output File Format: reference/output_files.md
- Changelog: reference/changelog.md
- FAQ:
@@ -151,8 +157,11 @@ plugins:
Tiers and Runtimes: 档位与运行环境
Python SDK: Python SDK
V1 HTTP API: V1 HTTP API
+ Tasks API: Tasks 异步接口
+ Synchronous File Parse: 单文件同步解析
Legacy Platforms (MinerU <4): 旧平台适配(MinerU <4)
Migration to 4.0: 迁移到 4.0
+ Migration to 4.1: 迁移到 4.1
Model Source: 模型源配置
Advanced CLI Parameters: 命令行进阶参数
FAQ: 常见问题解答