Baidu Unlimited-OCR Document Parser for Openclaw

Baidu Unlimited-OCR Document Parser converts complex PDFs, office files, and images into structured Markdown without model deployment.

maglanyulan
v1.0.1
Sep 17, 2026
0
551
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install baidu-doc-unlimited-ocr-parser

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install baidu-doc-unlimited-ocr-parser using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Baidu Unlimited-OCR Document Parser?

This Openclaw Skills integration provides a ready-to-use interface for Baidu's Unlimited-OCR document analysis API. It accepts PDFs, Word files, PowerPoint presentations, text documents, and images, then returns Markdown with structured text and embedded HTML tables for complex layouts, merged cells, row spans, column spans, alignment, and line breaks.

The skill uses an asynchronous task workflow designed for long documents and batch processing. Developers submit a file or public URL, poll the returned task ID, and download the resulting Markdown or auxiliary JSON through temporary result URLs. It supports PDFs up to 500 pages and avoids the operational overhead of deploying an OCR model locally.

Baidu Unlimited-OCR Document Parser Use Cases

  • Convert scanned PDFs, JPGs, PNGs, Word documents, and PowerPoint files into Markdown for downstream processing.
  • Extract readable content from long documents while preserving paragraphs, headings, and document structure.
  • Process complex tables with merged cells, multi-level headers, row spans, and column spans.
  • Add OCR-powered document ingestion to an AI agent, knowledge base, notes system, or content pipeline.
  • Run batch document parsing through asynchronous tasks instead of blocking on a single request.
  • Normalize office and image-based documents into a format suitable for search, summarization, indexing, or rendering.
  • Use Openclaw Skills when you need fast cloud OCR integration without deploying PaddleOCR or another local model.

How Baidu Unlimited-OCR Document Parser Works

  1. Configure Baidu API credentials through BAIDU_DOC_AI_API_KEY and BAIDU_DOC_AI_SECRET_KEY.
  2. Exchange the API Key and Secret Key for an OAuth 2.0 access token using Baidu's token endpoint. Tokens are valid for 30 days.
  3. Provide either Base64-encoded file_data or a public file_url, along with the correct file_name extension. file_data takes priority when both are supplied.
  4. Submit a POST request to the Unlimited-OCR task endpoint using application/x-www-form-urlencoded data.
  5. Store the returned result.task_id and wait approximately 5–10 seconds before the first status check.
  6. Poll the task query endpoint every 5 seconds, observing a maximum polling window of 300 seconds.
  7. Inspect result.status, which can be pending, running, success, or failed.
  8. When processing succeeds, download the Markdown document from result.markdown_url; optionally retrieve the auxiliary JSON from result.parse_result_url.
  9. Cache or process the downloaded results before their URLs expire after 30 days, and log log_id, error_code, and error_msg for troubleshooting.

Baidu Unlimited-OCR Document Parser Setup

  1. Obtain Baidu Cloud OCR credentials and any available quota from the Baidu AI console. The documented temporary quota is 200 pages for individually verified users and 1,000 pages for enterprise-verified users; confirm current pricing and limits with Baidu.
  2. Export the required credentials in the runtime environment:
export BAIDU_DOC_AI_API_KEY="your_api_key"
export BAIDU_DOC_AI_SECRET_KEY="your_secret_key"
  1. Install the Python HTTP dependency used by the example and ensure Python 3 is available:
python3 -m pip install requests
  1. Place the skill script at scripts/baidu_doc_unlimited_ocr_parser.py and keep the supporting reference files available, including references/parameters.md, references/error_codes.md, and references/apikey-fetch.md.
  2. Parse a local file by passing its Base64 content to the command-line wrapper:
python3 scripts/baidu_doc_unlimited_ocr_parser.py --file_data <base64_encoded_file> --file_name "test.pdf"
  1. For larger files or remotely hosted documents, use a publicly accessible URL and ensure hotlink protection is disabled:
python3 scripts/baidu_doc_unlimited_ocr_parser.py --file_url <public_file_url> --file_name "test.pdf"
  1. Keep API keys out of source control, validate file extensions, and implement retry, timeout, polling, and quota-exhaustion handling in production integrations.

Baidu Unlimited-OCR Document Parser Data Schema & Taxonomy

Input organization

Field Required Type Details
file_data One of two string Base64-encoded file content. Preferred over file_url; images up to 10 MB, layout documents up to 100 MB, flow documents up to 50 MB.
file_url One of two string Public file URL up to 1,024 bytes. PDF files may be up to 100 MB and 500 pages.
file_name Yes string Original filename with a correct extension, such as test.pdf.
angle_adjust No boolean Enables image angle correction; defaults to True.
angle_mode No string direction for four-direction correction or arbitrary for arbitrary angles.
erase_seal No boolean Removes seals or stamps when enabled; defaults to False.
erase_watermark No boolean Removes watermarks when enabled; defaults to False.
unwarp No boolean Corrects image distortion when enabled; defaults to False.

Supported file taxonomy

  • Layout documents: pdf, jpg, jpeg, png, bmp, tif, tiff, and ofd; images must not exceed 8,192 pixels on the longest edge.
  • Flow documents: doc, docx, txt, wps, ppt, and pptx.
  • PDF maximum: 500 pages.

Task response metadata

Field Meaning
log_id Unique diagnostic identifier for support and troubleshooting.
error_code Numeric API or task error code.
error_msg Human-readable error description.
result.task_id Identifier used to query asynchronous processing status.
result.status pending, running, success, or failed.
result.task_error Task-level failure details, including quota or parsing errors.
result.markdown_url Temporary Markdown result URL, valid for 30 days.
result.parse_result_url Temporary BOS JSON result URL, valid for 30 days.

The primary generated artifact is a Markdown file containing structured text. Complex tables are embedded as HTML <table> elements with support for rowspan, colspan, alignment, and line breaks. The optional JSON result is retained as an auxiliary format for future or downstream processing. The skill implementation is provided by scripts/baidu_doc_unlimited_ocr_parser.py, while API parameters and error taxonomy are documented in the references/ directory.

Baidu Unlimited-OCR Document Parser Advanced Features

  • Asynchronous task submission and polling support long documents and batch-oriented workflows.
  • Markdown-first output is directly renderable while preserving complex HTML table structures.
  • Optional JSON result retrieval provides an additional machine-readable artifact for downstream systems.
  • Image preprocessing controls support angle correction, arbitrary-angle handling, seal removal, watermark removal, and image unwarping.
  • Supports both inline Base64 uploads and public URLs, with file_data prioritized when both are present.
  • Handles long PDFs up to 500 pages without requiring local OCR model deployment.
  • Explicit task states, diagnostic log IDs, error codes, and task-level errors enable resilient automation.
  • Designed for integration with AI agents, document pipelines, searchable knowledge bases, and other Openclaw Skills.
  • Includes documented throughput constraints: 2 QPS for task submission and 5 QPS for result queries.
  • Common failure cases such as missing parameters (282003) and unknown task IDs (282007) can be handled using the included error-code reference.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*