Feature · document parsing

Document parsing API for PDFs, invoices and forms

Turn a page image or extracted text into validated JSON. Send the document with a strict schema, check totals and required fields, and route low-confidence results to a human instead of guessing.

Short answer. Use plugsky-parse, a vision-capable model with a 262,144-token context and up to 16,384 output tokens. Send each page as an image (or extract the text first), provide a JSON schema, and validate the response before writing it to your database. Paid plans start at $8/month.

What document parsing means here

“Parsing” is not one task. It usually means one of these:

  • Classification: is this an invoice, a receipt, a contract or an ID?
  • Field extraction: invoice number, date, vendor, line items, tax and total.
  • Table extraction: rows and columns from a statement or report.
  • Summarisation: parties, obligations, dates and termination terms from a contract.
  • Validation: do the line items add up, and does the stated total match?

A single prompt can do several of these, but the output must be structured and checked. A plausible sentence is not a parsed record.

Model and limits

PropertyValue
Model IDplugsky-parse
Context window262,144 tokens
Max output16,384 tokens
InputText, page images
CapabilitiesVision, JSON mode
EndpointOpenAI-compatible chat completions
PlansPaid plans from Hobby $8/month

A safe parsing pipeline

  1. Ingest: receive the PDF or image and store the original unchanged.
  2. Render: convert each PDF page to an image at a readable resolution, or extract text when the PDF already has a text layer.
  3. Parse: send one page at a time with the schema and the document type.
  4. Validate: required fields present, types correct, dates parseable, line items sum to the total.
  5. Escalate: route missing or contradictory fields to human review with the page image attached.
  6. Store: write the validated JSON plus the model name, prompt version and page hash for auditability.

Extract an invoice with JSON mode

import json
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_PLUGSKY_KEY",
    base_url="https://api.plugsky.com/v1",
)

schema = {
    "invoice_number": "string",
    "invoice_date": "YYYY-MM-DD",
    "vendor": "string",
    "currency": "ISO 4217",
    "line_items": [{"description": "string", "quantity": "number", "unit_price": "number", "amount": "number"}],
    "subtotal": "number",
    "tax": "number",
    "total": "number",
}

response = client.chat.completions.create(
    model="plugsky-parse",
    response_format={"type": "json_object"},
    messages=[
        {"role": "system", "content": "Extract the invoice fields. Use null when a field is not present. Do not invent values."},
        {"role": "user", "content": [
            {"type": "text", "text": json.dumps({"schema": schema})},
            {"type": "image_url", "image_url": {"url": "https://example.com/invoice-page-1.png"}},
        ]},
    ],
)

record = json.loads(response.choices[0].message.content)
assert record["total"] == round(record["subtotal"] + record["tax"], 2)

The assertion is the point. Do not trust the model's arithmetic; check it. If the total does not reconcile, send the page to review rather than correcting it silently.

What to measure before trusting the output

  • Field-level accuracy on 100–300 real documents, not a vendor demo set.
  • Layout coverage: scans, photos, rotated pages, multi-column tables and handwriting.
  • Null behaviour: does the model return null for a missing field, or invent a plausible value?
  • Arithmetic: line items vs subtotal vs tax vs total.
  • Date and currency: ambiguous formats such as 03/04/2026 and currencies with different decimal conventions.
  • Review rate: the share of documents a human must touch. That number drives the cost per document.

Cost per document

A one-page invoice is typically a small number of image tokens plus a JSON completion. At low volume, the plan price dominates; at high volume, the token count and the human-review rate dominate. Calculate the fully loaded cost:

cost_per_document =
    (input_tokens × input_rate + output_tokens × output_rate)
    + (review_rate × minutes_per_review × reviewer_cost_per_minute)

For high-volume work, Builder ($60) and Scale ($120) have no monthly token cap, with fair-use concurrency and RPM. See pricing for the current plan caps.

Security and residency

Documents often contain personal or financial data. Decide before you send: which fields are required, whether the page can be redacted, how long the provider retains it, and where it is processed. Plugsky offers cloud, private VPC, on-prem and air-gapped deployment; confirm the contractual retention and residency terms for your plan before sending regulated documents.

FAQ

Can an LLM parse PDFs and invoices?

Yes, with a page image or extracted text and a strict schema. Validate required fields, totals and dates before writing to a system of record.

Which Plugsky model should I use for document parsing?

plugsky-parse, with a 262,144-token context and up to 16,384 output tokens. Text-only PDFs can also use a text model after extraction.

How accurate is invoice extraction?

It depends on scan quality, layout and handwriting. Measure field-level accuracy on your own set and route high-value fields to human review.

Does document parsing include data residency?

Plugsky offers cloud, private VPC, on-prem and air-gapped deployment. Residency and retention depend on the plan and contract; confirm before sending regulated documents.

Is document parsing included in the free plan?

The free plan includes Micro and Lite. plugsky-parse is available on paid plans from $8/month.

Reviewed 20 November 2026. Model limits are checked against the Plugsky model catalogue. Parsing accuracy varies by document; validate on your own corpus before production use.