Auditing Documents & Images with Gemini Decisions API

Gists

Check any PDF, draft, or image against 1,000 criteria at once—with zero output tokens

Zero-Output Multimodal Auditing (ZOMA) with Gemini Decisions API and Python CLI

Introduction

In my previous article, “Zero-Output-Token AI in Google Apps Script with Gemini Decisions API” Ref (source repository Ref), I demonstrated how Google DeepMind’s Gemini Decisions API (POST https://generativelanguage.googleapis.com/v1beta/decisions, powered by gemini-decision-1) Ref fits Google Workspace automation—covering Gmail inbox labeling, model cascade routing, and a Google Sheets PDF compliance audit. Among those examples, the PDF compliance audit drew an especially strong response, and I received inquiries about it from readers across many different fields.

The origin of that idea was actually very personal: before turning it into a Google Sheets demo, I had been using the Decisions API in my own daily writing workflow to check my own research papers, technical articles, manuscripts, and drafts against a self-defined set of review criteria all at once, surfacing issues instantaneously. When developers first encounter a classification endpoint like the Decisions API, the natural mental model is “Many-Inputs × Few-Labels”—classifying a stream of emails or support tickets into three to five categories. Flipping that geometry to “1-Input × up to 1,000-Criteria”—sending one rich multimodal artifact (a PDF, research paper, article manuscript, or ad creative) once and evaluating it against up to 1,000 independent questions in a single forward pass—turned out to be a usage pattern that most users had never envisioned.

Because of that response, I decided to write this dedicated follow-up article focused exclusively on this technique, which I refer to as Zero-Output Multimodal Auditing (ZOMA). Because gemini-decision-1 evaluates all questions against the shared input simultaneously without autoregressive text decoding Ref, ZOMA produces strictly zero output tokens ($0.00 output cost, with input tokens billed once at $0.10 per 1M input tokens) Ref while returning calibrated probabilities (0.01 to 0.99), discrete choices, and ordinal rubric scores (0–4). Moving beyond Google Apps Script into a universal, dependency-light Python 3 CLI published at gemini-decisions-api-python Ref, this article presents a reusable ZOMA auditing and weighted-scoring architecture and validates it across five live multimodal use cases (83 total criteria across Markdown, PDF, and PNG inputs). While I designed the core scenario and evaluation criteria for each of the five use cases myself, the sample input documents used to demonstrate and reproduce each run were generated with Gemini via samples/generate_samples.py Ref so that anyone can reproduce every benchmark without proprietary files; every latency, token count, probability, score, and cost figure reported in this article comes directly from live API runs, and you can immediately swap in your own local files and custom checklists.


In Plain English: What Is ZOMA?

Imagine handing a 20-page vendor contract, a research manuscript draft, an advertising banner, a student essay, or a grant proposal to a meticulous reviewer along with a structured checklist—and receiving every checkbox verdict, every 0–4 quality rating, and a clear flag on any ambiguous clause that needs human judgment back in under one second, for a fraction of a cent. That is Zero-Output Multimodal Auditing (ZOMA). Instead of asking an AI chatbot to write long prose explanations one question at a time, ZOMA sends your document once, evaluates dozens or hundreds of independent checklist rules simultaneously, and lets deterministic Python code handle all final math and pass/fail decisions.

Key Terms in Plain English


1. Why Gemini Decisions API Excels at ZOMA & Architecture

Low latency and low cost are the most immediately visible advantages of gemini-decision-1, yet its deeper architectural strengths are what make Zero-Output Multimodal Auditing (ZOMA) production-grade across legal, editorial, visual, and academic domains Ref:

Separation of Concerns

A common problem in LLM-based evaluation pipelines is asking a single generative model to read a document, judge 20 criteria, apply custom business weights, check hard eligibility rules, and sum the final score in one autoregressive JSON response. When AI judgment and arithmetic are mixed together, models exhibit silent summation drift, inconsistent threshold enforcement, and brittle JSON formatting errors.

To prevent these problems by design, our Python CLI enforces a strict two-layer separation of concerns, illustrated in Figure 1.

Figure 1: Paradigm Shift & Decoupled Two-Layer Architecture Figure 1: Shifting from sequential autoregressive LLM loops to 1-Input × up to 1,000-Criteria evaluation with strict separation between gemini-decision-1 inference (client.py) and deterministic Python aggregation (evaluator.py).

As shown in Figure 1, the pipeline divides responsibility across three focused modules:

This decoupling guarantees that LLM arithmetic hallucination is structurally impossible: the AI model only produces calibrated per-criterion signals, while Python owns every threshold comparison, weighted sum, and pass/fail verdict. Table 1 compares the two deterministic operating modes built into evaluator.py alongside a traditional autoregressive LLM loop.

Table 1: Architectural Comparison of Evaluation Modes Table 1: Comparison of Naive Autoregressive LLM Loops vs. Gemini Decisions API Mode A (audit) and Mode B (weighted_scoring) across token scaling, output tokens, arithmetic determinism, and human-in-the-loop gating.

Table 1 highlights why a single checklist schema can drive two distinct enterprise patterns:

Mode A & Mode B End-to-End Workflows

Before diving into CLI commands and live numbers, Figure 2 and Figure 3 map the five end-to-end workflows we evaluated across both operating modes.

Figure 2: Mode A Multimodal Audit Workflows (UC1–UC3) Figure 2: End-to-end Mode A (audit) pipelines for UC1 (Markdown Manuscript Linter), UC2 (Multi-Page Vendor Contract PDF Risk Scanner), and UC3 (High-Resolution Ad Creative PNG QA), each executed in a single API batch.

Figure 3: Mode B Weighted Rubric & Knock-Out Screening Workflows (UC4–UC5) Figure 3: Mode B (weighted_scoring) execution pipelines for UC4 (Cybersecurity Essay Rubric Grading) and UC5 (R&D Grant Proposal Knock-Out + Weighted Screening), where Python deterministically computes final totals and cutoff gates.


2. Quickstart & Reusable Python CLI Usage

All scripts, sample inputs, checklists, and saved live results are published in tanaikech/gemini-decisions-api-python Ref. The CLI requires only Python 3, requests, and PyYAML (requirements.txt Ref). Clone the repository, install dependencies, and export your Gemini API key once (the client sends the key solely in the x-goog-api-key header and never embeds it in URLs):

Not a programmer? Here is what the commands below actually do in 3 steps:

git clone https://github.com/tanaikech/gemini-decisions-api-python.git
cd gemini-decisions-api-python
pip install -r requirements.txt
export GEMINI_API_KEY="your-api-key-here"

Every audit or scoring workflow is defined declaratively in a single JSON or YAML checklist file. Below is a compact excerpt from a Mode B (weighted_scoring) checklist showing how a hard knock-out gate, a weighted binary criterion, and a weighted ordinal score rubric coexist in the same schema:

{
  "name": "UC5: R&D Grant Proposal Knock-Out + Weighted Screening",
  "mode": "weighted_scoring",
  "confidence_threshold": 0.85,
  "cutoff_score": 70.0,
  "borderline_margin": 3.0,
  "max_low_conf_for_auto": 2,
  "criteria": [
    {
      "id": "ko_budget_cap",
      "category": "Knock-Out Eligibility",
      "label": "[KO] Budget <= $250,000",
      "type": "noul",
      "knockout": true,
      "expected": "yes",
      "instructions": "Is the total requested grant funding less than or equal to the $250,000 program cap?"
    },
    {
      "id": "has_itemized_budget",
      "category": "Completeness",
      "label": "Itemized Budget Breakdown (+5)",
      "type": "noul",
      "expected": "yes",
      "weight": 5.0,
      "instructions": "Does the proposal include an itemized budget breakdown whose line items clearly reconcile to the requested total?"
    },
    {
      "id": "technical_merit_score",
      "category": "Merit Rubric",
      "label": "Technical Merit & Architecture (0-4, max 20)",
      "type": "score",
      "weight": 20.0,
      "max_scale": 4,
      "instructions": "Rate the technical soundness, hardware/software feasibility, and engineering clarity of the proposed sensor network.",
      "criteria": [
        "0: Technically infeasible or undefined",
        "1: High-level concept lacking engineering specifics",
        "2: Plausible design with missing power, telemetry, or calibration details",
        "3: Solid, practical engineering design with concrete BOM, power, and filtering specs",
        "4: Exceptional, field-ready architecture with rigorous calibration and open hardware specs"
      ]
    }
  ]
}

Before spending any API calls, you can run the offline zero-data stress test (cli/test_evaluator_stress.py Ref) and validate any input file and checklist schema locally with --dry-run:

python3 cli/test_evaluator_stress.py
python3 cli/decisions_audit.py \
  --input samples/uc1_manuscript_draft.md \
  --checklist samples/uc1_checklist.json \
  --dry-run

Running all five live use cases uses the exact same CLI entry point (cli/decisions_audit.py Ref), switching only --input, --checklist, and optional flags (--resolution high for images, --format table|markdown|json, or --confidence-threshold):

# UC1: Manuscript / Technical Document Semantic Linter (Markdown, Mode A)
python3 cli/decisions_audit.py \
  --input samples/uc1_manuscript_draft.md \
  --checklist samples/uc1_checklist.json \
  --output results/uc1_result.json

# UC2: Vendor SaaS Contract & SLA Risk Scanner (Multi-page PDF, Mode A)
python3 cli/decisions_audit.py \
  --input samples/uc2_vendor_contract.pdf \
  --checklist samples/uc2_checklist.json \
  --output results/uc2_result.json

# UC3: Ad Creative OCR-Free Multimodal QA (High-res PNG, Mode A)
python3 cli/decisions_audit.py \
  --input samples/uc3_ad_creative.png \
  --checklist samples/uc3_checklist.json \
  --resolution high \
  --output results/uc3_result.json

# UC4: Student / Training Essay Weighted Rubric Grading (PDF, Mode B)
python3 cli/decisions_audit.py \
  --input samples/uc4_student_essay.pdf \
  --checklist samples/uc4_checklist.json \
  --output results/uc4_result.json

# UC5: R&D Grant Proposal Knock-Out + Weighted Screening (PDF, Mode B)
python3 cli/decisions_audit.py \
  --input samples/uc5_grant_proposal.pdf \
  --checklist samples/uc5_checklist.json \
  --output results/uc5_result.json

To adapt the CLI to your own documents, swap --input for any local Markdown, plain text, PDF, or image file, and edit a JSON/YAML checklist with your organization’s rules. Adding --format markdown outputs a ready-to-paste report for GitHub pull requests, Notion pages, or CI/CD job summaries, while --format json emits clean machine-readable JSON so autonomous AI agents—such as Google Antigravity, Claude Code, Gemini CLI, or OpenAI Codex—can invoke cli/decisions_audit.py directly from their terminal tool (or wrap it as an agent skill) to self-audit drafts, reports, and visual assets in under a second.


3. Mode A Live Walkthrough & Empirical Results

Mode A (audit) targets high-precision defect detection across text, multi-page PDFs, and raw visual creatives. Following the three single-batch pipelines mapped in Figure 2, we examine each Mode A use case individually alongside its dedicated live test results infographic (Figure 4, Figure 5, and Figure 6).

How to read the live numbers in Sections 3 and 4:

Use Case 1: Manuscript & Technical Document Semantic Linter (uc1_manuscript_draft.md)

What this test checks in plain English: Before submitting a technical paper or article draft, can ZOMA catch hidden confidentiality leaks, missing citations, and vague claims alongside structural quality checks in half a second?

In Use Case 1, a 5,034-byte Markdown systems engineering preprint draft (samples/uc1_manuscript_draft.md Ref, “Adaptive Cache-Coherence Prefetching for Multi-Region Edge Workers”) was audited against 18 criteria (16 noul + 2 score) defined in samples/uc1_checklist.json Ref in a single batch (saved output: results/uc1_result.json Ref). The live call completed in 497.37 ms (0 retries) using 2,562 input tokens and 0 output tokens (estimated cost $0.000256), saving 17 sequential API calls. The overall verdict was FAIL (13 PASS, 3 FAIL, 2 NEEDS_REVIEW), as detailed in Figure 4.

Figure 4: UC1 Manuscript Semantic Linter — Live Test Results Figure 4: Live gemini-decision-1 audit results for UC1 (uc1_manuscript_draft.md, 18 criteria, 497.4 ms, 2,562 input tokens, 0 output tokens, $0.000256), highlighting all three planted blockers caught, 13 passed checks, and 2 calibrated human-review escalations.

As visualized in Figure 4, the live run separated structural strengths, planted blockers, and subjective gray zones cleanly in under half a second:

UC1 Summary (Input → Findings): Feeding a 5 KB Markdown preprint draft and an 18-item pre-publication checklist into a single 497 ms pass immediately confirmed 13 required sections and security checks, caught all 3 planted blockers (an NDA client leak, an unresolved [citation needed], and an unquantified performance claim), and routed 2 nuanced tone/problem-statement items to a human editor instead of guessing.

Use Case 2: Vendor SaaS Contract & SLA Risk Scanner (uc2_vendor_contract.pdf)

What this test checks in plain English: When procurement receives a multi-page software vendor contract PDF, can ZOMA verify security guarantees while flagging unfair liability caps, auto-renewal traps, and borderline clauses in under a second?

In Use Case 2, a 53,951-byte multi-page vendor SaaS contract PDF (samples/uc2_vendor_contract.pdf Ref) was ingested natively as a document block—without any PDF-to-text extraction library—and evaluated against 20 criteria (17 noul + 2 choice + 1 score) in samples/uc2_checklist.json Ref (saved output: results/uc2_result.json Ref) in 856.42 ms (0 retries) using 3,809 input tokens (2,769 text + 1,040 image tokens) and 0 output tokens (estimated cost $0.000381), saving 19 sequential API calls. The overall verdict was FAIL (9 PASS, 10 FAIL, 1 NEEDS_REVIEW), shown in Figure 5.

Figure 5: UC2 Vendor Contract & SLA Risk Scanner — Live Test Results Figure 5: Live gemini-decision-1 audit results for UC2 (uc2_vendor_contract.pdf, 20 criteria, 856.4 ms, 3,809 input tokens, 0 output tokens, $0.000381), contrasting 9 verified security safeguards against 10 commercial/legal FAIL verdicts and 1 borderline review clause.

Figure 5 demonstrates why multi-axis legal screening benefits from combining noul, choice, and score questions in a single forward pass:

UC2 Summary (Input → Findings): Feeding a multi-page vendor SaaS contract PDF and a 20-item legal/SLA checklist directly (with no PDF text extractor) verified 9 baseline security safeguards in 856 ms while flagging 10 commercial/legal red flags (low uptime SLA, missing HIPAA BAA, uncapped customer indemnity, long auto-renewal, block_and_redline priority) and safely escalating 1 borderline 30-day data-deletion clause for legal review.

Use Case 3: Ad Creative OCR-Free Multimodal QA (uc3_ad_creative.png)

What this test checks in plain English: Looking directly at a finished advertising banner image with no OCR tool, can ZOMA confirm clean branding and layout while catching prohibited financial promises and unreadable fine-print disclaimers?

In Use Case 3, a 101,539-byte FinTech advertising banner PNG (samples/uc3_ad_creative.png Ref) was passed directly to gemini-decision-1 with --resolution high—with zero OCR preprocessing—against 16 criteria (14 noul + 2 score) in samples/uc3_checklist.json Ref (saved output: results/uc3_result.json Ref). The single API call completed in 836.97 ms (0 retries) using 2,286 input tokens (1,186 text + 1,100 image tokens) and 0 output tokens (estimated cost $0.000229), saving 15 sequential API calls. The overall verdict was FAIL (11 PASS, 5 FAIL, 0 NEEDS_REVIEW), as illustrated alongside the audited creative thumbnail in Figure 6.

Figure 6: UC3 Ad Creative OCR-Free Multimodal QA — Live Test Results Figure 6: Live gemini-decision-1 multimodal QA results for UC3 (uc3_ad_creative.png with embedded sample thumbnail, 16 criteria, 837.0 ms, 2,286 input tokens, 0 output tokens, $0.000229), separating strong visual design polish (3.15/4) from severe FinTech regulatory violations (0.29/4).

As shown in Figure 6, native high-resolution image ingestion captured both layout quality and fine-print regulatory failures simultaneously:

UC3 Summary (Input → Findings): Passing a high-resolution FinTech ad banner PNG and a 16-item creative QA checklist with zero OCR confirmed strong visual polish (3.15 / 4 hierarchy, 11 passed brand/design checks) in 837 ms while catching all 5 severe FinTech regulatory violations ("Guaranteed ROI" promise, unrealistic return claim, unlabeled hypothetical chart, illegible disclaimer, and 0.29 / 4 regulatory readiness) with zero ambiguous escalations.


4. Mode B Live Walkthrough & Empirical Results

Mode B (weighted_scoring) moves beyond pass/fail checklists into quantitative rubric grading and multi-stage eligibility screening. Following the deterministic aggregation and knock-out pipelines illustrated in Figure 3, we walk through each Mode B live evaluation with its dedicated scoring breakdown infographic (Figure 7 and Figure 8).

Use Case 4: Cybersecurity Case Study Weighted Rubric Grading (uc4_student_essay.pdf)

What this test checks in plain English: Given a student’s PDF case study and a 100-point grading rubric, can ZOMA check required topics, rate four quality dimensions, check for penalties, and compute an exact, hallucination-free grade in Python?

In Use Case 4, a 52,224-byte student cybersecurity case study PDF (samples/uc4_student_essay.pdf Ref) was graded against a 100-point rubric (samples/uc4_checklist.json Ref; saved output: results/uc4_result.json Ref) containing 14 criteria: 6 mandatory element checks worth +5.0 pts each (30.0 pts), 4 ordinal 0–4 rubric dimensions totaling 70.0 pts, and 4 negative penalty flags (-10.0 to -15.0 pts), with a 75.0 cutoff and ±3.0 borderline margin. The single Decisions API call finished in 702.58 ms (0 retries) using 3,261 input tokens (2,221 text + 1,040 image tokens) and 0 output tokens (estimated cost $0.000326), saving 13 sequential API calls. The deterministic final score was 86.17 / 100.0 (86.2%), yielding PASS, as detailed in Figure 7.

Figure 7: UC4 Cybersecurity Essay Weighted Rubric Grading — Live Test Results Figure 7: Live Mode B rubric grading breakdown for UC4 (uc4_student_essay.pdf, 14 criteria, 702.6 ms, 3,261 input tokens, 0 output tokens, $0.000326), showing 25.0/30.0 mandatory points, 61.17/70.0 rubric points, 0.0 penalties, and a final score of 86.17/100.0 vs. the 75.0 cutoff.

Figure 7 breaks down every exact point calculated offline by evaluator.py:

UC4 Summary (Input → Findings): Grading a student’s cybersecurity case-study PDF against a 14-item, 100-point rubric took 703 ms and revealed 5 of 6 mandatory elements present (25.0 / 30.0, catching the omitted 3-year TCO budget table), strong qualitative scores (61.17 / 70.0), and zero penalty deductions—deterministically yielding PASS at 86.17 / 100.0 (+11.17 pts above the 75.0 cutoff).

Use Case 5: R&D Grant Proposal Knock-Out + Weighted Screening (uc5_grant_proposal.pdf)

What this test checks in plain English: When screening an R&D grant application PDF, can ZOMA enforce strict pass/fail eligibility rules first and then score technical merit, impact, and budget realism against a 70-point cutoff?

In Use Case 5, a 60,088-byte R&D grant proposal PDF (samples/uc5_grant_proposal.pdf Ref) was screened against 15 criteria (samples/uc5_checklist.json Ref; saved output: results/uc5_result.json Ref): 4 hard knock-out eligibility gates (weight = 0.0, mandatory pass), 6 completeness/impact binary checks (+5.0 pts each = 30.0 pts), 4 ordinal merit rubric scores (70.0 pts total), and 1 conflict-of-interest / ethics penalty flag (-15.0 pts), against a 70.0 cutoff and ±3.0 borderline margin. The single API call completed in 769.60 ms (0 retries) using 3,339 input tokens (2,299 text + 1,040 image tokens) and 0 output tokens (estimated cost $0.000334), saving 14 sequential API calls. The proposal cleared all 4 knock-out gates and scored 91.40 / 100.0 (91.4%), returning PASS, as presented in Figure 8.

Figure 8: UC5 R&D Grant Proposal Knock-Out + Weighted Screening — Live Test Results Figure 8: Live Mode B screening results for UC5 (uc5_grant_proposal.pdf, 15 criteria, 769.6 ms, 3,339 input tokens, 0 output tokens, $0.000334), verifying 4/4 hard knock-out eligibility gates, 30.0/30.0 completeness points, 61.40/70.0 merit points, and 91.40/100.0 total score vs. the 70.0 cutoff.

Figure 8 illustrates how hard eligibility logic and nuanced merit scoring coexist deterministically in one batch:

UC5 Summary (Input → Findings): Screening an R&D grant proposal PDF against 4 hard eligibility knock-outs and 11 weighted merit criteria in 770 ms verified all 4/4 eligibility gates (p = 0.948–0.974), awarded full completeness points (30.0 / 30.0) plus strong merit scores (61.40 / 70.0) with zero ethics penalties, and deterministically approved the proposal (PASS at 91.40 / 100.0, +21.40 pts above cutoff).


5. Cross-Use-Case Empirical Benchmarks & Cost Analysis

Aggregating telemetry across all five live CLI executions (uc1_result.json through uc5_result.json) reveals how consistently the 1-Input × N-Criteria architecture performs across Markdown, multi-page PDF, and high-resolution PNG payloads. Figure 9 summarizes end-to-end API latency, shared-input token savings, and per-run cost across all five use cases.

Figure 9: Cross-Use-Case Live Benchmarks — Latency, Token Savings & Cost Figure 9: Live benchmark summary across UC1–UC5 showing sub-second API latency (497.4–856.4 ms, avg 732.6 ms), 92.9%–95.0% input token reduction vs. naive sequential N× calls, and $0.001526 total cost across all 83 criteria with strictly 0 output tokens.

Four empirical findings stand out from Figure 9:


6. Beyond These Five Use Cases: Future Horizons for ZOMA

The five live benchmarks in this article focused on Markdown, PDF, and PNG inputs, yet gemini-decision-1 natively supports a 262,144-token unified multimodal context spanning text, JSON, PDFs, images, audio, and video Ref. Whenever an organization needs to inspect one rich artifact against dozens or hundreds of structured rules, the exact same ZOMA pattern applies without changing the architecture. Figure 10 highlights six additional high-leverage applications across industries.

Figure 10: Beyond These 5 Use Cases — Future Horizons for ZOMA Figure 10: Six additional real-world applications of Zero-Output Multimodal Auditing (ZOMA) across audio, video, combined image+PDF packets, code diffs, long regulatory PDFs, and autonomous AI agent guardrails.

As illustrated in Figure 10, ZOMA extends naturally well beyond document and ad checks:


7. Limitations, Best Practices & Summary

While Zero-Output Multimodal Auditing (ZOMA) excels at high-throughput verification and structured scoring, treating it as a drop-in replacement for every generative workflow is a mistake. Five engineering principles keep production deployments reliable:

Summary

Instead of asking an AI chatbot to read a file and write long answers one question at a time, Zero-Output Multimodal Auditing (ZOMA) sends one document, PDF, or image once to Google’s Gemini Decisions API (gemini-decision-1) Ref and checks up to 1,000 rules in a single pass—with zero text generated and exact, trustworthy results:

All scripts, sample documents, checklists, and live test logs are ready to clone and run from tanaikech/gemini-decisions-api-python Ref.

 Share!