Google Cloud Document AI Pricing Guide & Pre-Upload Cost Optimization: Avoiding the Per-Page OCR Billing Trap
Evaluating Google Cloud Document AI pricing for high-volume invoice, claims, or medical PDF ingestion? While basic Document AI Enterprise OCR starts at fractions of a cent per page, specialized Form Parsers, Invoice Parsers, and Custom Extractors bill $0.03 to $0.10+ per page—meaning blank separator sheets, duplicate scans, and T&C boilerplate pages silently multiply your monthly GCP bill by 3x–5x. Below is how a GCP Professional Cloud Architect and AI Application Engineer cuts Document AI API spend by 60%+ using lightweight pre-upload PDF page filtering in Python before invoking Cloud Document AI.
1. Google Cloud Document AI API Pricing Breakdown by Processor Tier
| Document AI Processor Type | Typical Per-Page Cost Structure | Hidden Billing Pitfall in Production |
|---|---|---|
| Document OCR Processor | ~$1.50 per 1,000 pages ($0.0015 / page) | Scanning 40-page contracts when only pages 1–2 contain metadata |
| Form Parser / Layout Parser | ~$10–$30 per 1,000 pages ($0.01–$0.03 / page) | Every blank scan backside or cover page is billed at the full parser rate |
| Invoice / Expense / Custom Extractor | ~$30–$100 per 1,000 pages ($0.03–$0.10 / page) | Appended vendor terms & conditions (10+ pages per PDF) 10x your invoice cost |
2. Pre-Upload Page Triage in Python (pypdf + Blank/Boilerplate Slicing)
Before sending a multi-page PDF to documentai_v1.DocumentProcessorServiceClient, slice out blank scan pages, terms-and-conditions appendices, and exact SHA-256 duplicate attachments on Cloud Run:
import hashlib
import io
from pypdf import PdfReader, PdfWriter
from google.cloud import documentai_v1 as documentai
BOILERPLATE_MARKERS = ("general terms and conditions", "standard purchase order terms")
def extract_billable_pages(pdf_bytes: bytes, max_pages: int = 15) -> bytes:
reader = PdfReader(io.BytesIO(pdf_bytes))
writer = PdfWriter()
kept = 0
for page in reader.pages:
if kept >= max_pages:
break
raw_text = (page.extract_text() or "").strip().lower()
# Keep scanned image pages (empty text layer) if page has XObject images, skip pure blank pages
has_images = "/XObject" in (page.get("/Resources") or {})
if not raw_text and not has_images:
continue
if len(raw_text) > 400 and any(m in raw_text for m in BOILERPLATE_MARKERS):
continue
writer.add_page(page)
kept += 1
out = io.BytesIO()
writer.write(out)
return out.getvalue()
def process_filtered_invoice(project_id: str, location: str, processor_id: str, pdf_bytes: bytes):
slim_pdf = extract_billable_pages(pdf_bytes)
if not slim_pdf:
return None
doc_hash = hashlib.sha256(slim_pdf).hexdigest()
client = documentai.DocumentProcessorServiceClient()
name = client.processor_path(project_id, location, processor_id)
req = documentai.ProcessRequest(
name=name,
raw_document=documentai.RawDocument(content=slim_pdf, mime_type="application/pdf"),
)
return doc_hash, client.process_document(request=req).document
3. Hybrid Routing: Document AI OCR + Gemini 2.5 Flash Structured Output
For heterogeneous vendor layouts where Custom Extractor per-page fees exceed budget, routing $0.0015/page Document OCR output (or native PDF text layers) into Vertex AI Gemini 2.5 Flash with strict Pydantic JSON Schema validation often reduces per-document extraction cost by 75–85% while handling unseen vendor templates zero-shot. Read more in the AI Application Engineer Pillar Guide and GCP Professional Cloud Architect Guide.
4. Frequently Asked Questions — Google Document AI Pricing
Does Google Cloud Document AI charge per document or per page?
Google Cloud Document AI charges strictly per page processed, regardless of whether a page contains a dense invoice table, boilerplate legal terms, or an accidental blank duplex scan.
How can we reduce Document AI costs without losing extraction accuracy?
Combine SHA-256 document deduplication, pre-upload blank and boilerplate page stripping with pypdf, Document AI ProcessOptions.IndividualPageSelector, and hybrid routing to Gemini Flash for text-native PDFs.