openparser-sdk
Parse and extract structured data from documents with the OpenParser API.
Install the PyPI distribution openparser-sdk; import the client as openparser.
Install
pip install openparser-sdk
Requires Python 3.10+. Get an API key from your OpenParser dashboard.
Quick Start
import os
from pathlib import Path
from openparser import OpenParserClient
client = OpenParserClient(api_key=os.environ["OPENPARSER_API_KEY"])
result = client.parse.sync(
{"ocr_model": "paddleocr-vl-1.6", "output_format": "openparser@1"},
file=Path("invoice.pdf"),
)
print(result.page_count)
Set OPENPARSER_API_KEY and optionally OPENPARSER_BASE_URL (default https://api.openparser.dev) instead of passing constructor arguments.
Parse
Sync endpoints wait up to the server sync limit (typically 300 seconds) and return the terminal parse result when ready. If the wait expires first, the API returns 202 with a durable job reference.
# Sync — server holds the connection until ready or timeout.
parsed = client.parse.sync(
{"ocr_model": "paddleocr-vl-1.6"},
file=Path("document.pdf"),
)
# Async — admit immediately and poll later.
accepted = client.parse.async_(
{"ocr_model": "paddleocr-vl-1.6"},
file=Path("document.pdf"),
)
job = client.wait_for_job(accepted.id)
# Reuse a file-pool upload instead of inline bytes.
uploaded = client.files.upload(Path("document.pdf"))
parsed = client.parse.sync({"ocr_model": "paddleocr-vl-1.6", "file_id": uploaded.id})
Every parse or extract POST sends an Idempotency-Key header. The SDK generates one automatically; pass idempotency_key= to control retries.
Jobs
jobs = client.jobs.list(status="succeeded", limit=25)
job = client.jobs.get("opj_...")
parse_result = client.jobs.result("opj_...", format="openparser@1")
source_bytes = client.jobs.source("opj_...")
Files
uploaded = client.files.upload(Path("contract.pdf"))
metadata = client.files.get(uploaded.id)
content = client.files.download(uploaded.id)
client.files.delete(uploaded.id)
Uploads accept pathlib.Path, a file handle, or {"content": bytes, "filename": str, "mime_type": str?}.
Models
ocr_models = client.models.list_ocr()
llm_models = client.models.list_llm(mode="search", q="claude")
Pipelines
pipeline = client.pipelines.create(
{
"name": "invoice-extract",
"ocr_model": "paddleocr-vl-1.6",
"llm_model": "anthropic/claude-sonnet-4",
"schema": {
"type": "object",
"properties": {"vendor": {"type": "string"}},
"required": ["vendor"],
},
}
)
listed = client.pipelines.list()
current = client.pipelines.get(pipeline.id)
updated = client.pipelines.update(pipeline.id, {"name": "invoice-v2"})
client.pipelines.delete(pipeline.id)
Errors
Every non-2xx response raises a typed subclass of OpenParserError:
| HTTP | Class |
|---|---|
| 400 | OpenParserValidationError |
| 401 | OpenParserAuthError |
| 402 | OpenParserPaymentRequiredError |
| 403 | OpenParserForbiddenError |
| 404 | OpenParserNotFoundError |
| 409 | OpenParserConflictError |
| 413 | OpenParserLimitExceededError |
| 415 | OpenParserUnsupportedMediaError |
| 422 | OpenParserUnprocessableError |
| 429 | OpenParserRateLimitError |
| 503 | OpenParserServiceUnavailableError |
| 504 | OpenParserGatewayTimeoutError |
| 5xx | OpenParserServerError |
The original API error body is preserved on error.envelope (code, message, request_id, retryable).
Development
Regenerate the committed OpenAPI client after spec changes:
packages/openparser-sdk-python/scripts/codegen.sh
packages/openparser-sdk-python/scripts/check-codegen.sh
uv run --project packages/openparser-sdk-python pytest
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openparser_sdk-0.0.2.tar.gz.
File metadata
- Download URL: openparser_sdk-0.0.2.tar.gz
- Upload date:
- Size: 66.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e3e19d9c0bacbb10785ba99d21e45b7f2c69f9211625b29f3a66fa0a54437f1
|
|
| MD5 |
476d5f800952ce53a09c2e143f46983b
|
|
| BLAKE2b-256 |
e9fdcd339598eac797a3660a02c3bcffe1c9882c97f92b2d7bbe3f208df97663
|
Provenance
The following attestation bundles were made for openparser_sdk-0.0.2.tar.gz:
Publisher:
release-openparser-packages.yml on eigenpal/eigenpal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openparser_sdk-0.0.2.tar.gz -
Subject digest:
3e3e19d9c0bacbb10785ba99d21e45b7f2c69f9211625b29f3a66fa0a54437f1 - Sigstore transparency entry: 2271988674
- Sigstore integration time:
-
Permalink:
eigenpal/eigenpal@f23f2558623b2161483a49958e54d96afb4ba179 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eigenpal
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-openparser-packages.yml@f23f2558623b2161483a49958e54d96afb4ba179 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openparser_sdk-0.0.2-py3-none-any.whl.
File metadata
- Download URL: openparser_sdk-0.0.2-py3-none-any.whl
- Upload date:
- Size: 170.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c54918a080b1048ba3ce03c976122e8e3ef4b256241bff1379e676e5ab1aeb93
|
|
| MD5 |
e5461e8b6d4e7ad6c794cfd3d1cfc698
|
|
| BLAKE2b-256 |
0527f3eb63f3e97c08ad47237144ceb7494dec77580d034ebc03b017975077cf
|
Provenance
The following attestation bundles were made for openparser_sdk-0.0.2-py3-none-any.whl:
Publisher:
release-openparser-packages.yml on eigenpal/eigenpal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openparser_sdk-0.0.2-py3-none-any.whl -
Subject digest:
c54918a080b1048ba3ce03c976122e8e3ef4b256241bff1379e676e5ab1aeb93 - Sigstore transparency entry: 2271988715
- Sigstore integration time:
-
Permalink:
eigenpal/eigenpal@f23f2558623b2161483a49958e54d96afb4ba179 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eigenpal
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-openparser-packages.yml@f23f2558623b2161483a49958e54d96afb4ba179 -
Trigger Event:
workflow_dispatch
-
Statement type: