← P402 Meter
Tempo Mainnet · MPPUsage-Based Compute Billing
> _ P402 METER · TEMPO MAINNET · USAGE-BASED AI BILLING DEMO

AI Thinking
Has a Price.
Now It Settles.

P402 Meter is a healthcare prior authorization review system where every AI token is priced in USDC.e and settled on Tempo mainnet via MPP in real time.

Prior authorization review is the proof of concept: a document-heavy, high-stakes workflow where every reasoning step has measurable value and every cent of cost can be governed, attributed, and audited. If per-token AI billing works here, it works everywhere.

01The Problem

AI work in healthcare has no economic substrate.

$31B
Annual US prior auth administrative cost
Much of it manual, repetitive, document-heavy reasoning work that AI can already do.
$0.30
Stripe minimum transaction fee
Makes sub-cent per-action billing impossible. You'd need to batch 300+ AI micro-actions before you can charge for them, destroying real-time attribution.
~$2.85
ETH mainnet gas cost per ERC-20 transfer
Settlement costs more than the AI work itself. Every high-fee chain makes per-token settlement economically irrational.
0
Existing systems with real-time per-token AI billing
AI platforms bill monthly subscriptions or per-API-call batches. No system prices and settles at token granularity. Until now.
02The Solution

Every token an AI generates is a priced USDC.e event on Tempo.

P402 Meter instruments the Gemini generation stream at the chunk level. Each text chunk emitted by the model triggers a ledger event: tokens estimated, cost calculated at $0.0000006/token, USDC.e amount recorded, event settled on Tempo. A single prior authorization review generates 55+ onchain events. Total cost: under $0.001.

The workflow in one sentence

Upload a prior-auth document → Gemini 3.1 Flash reads it, classifies it, reviews it → every token of that thinking settles in USDC.e on Tempo mainnet via MPP → Gemini 3.1 Pro audits the economics → humans approve the recommendation with full onchain proof of work.

55+
Onchain events per review
1 per token chunk emitted
<$0.001
Total cost per action
vs $2.85 on ETH mainnet
>99.9%
Cost saving vs ETH
Tempo FeeAMM sub-millidollar
03Technology

Three technologies. One economic model.

TempoThe settlement layer that makes sub-cent billing real
USDC.e (TIP-20) as native stablecoin — settlement costs <$0.000001/tx via FeeAMM instead of $2.85 on ETH mainnet
High transaction frequency — 55+ provisional ledger events per session, one real Tempo tx at session close
TIP-20 tokens use standard ERC-20 transfer() interface — no native ETH value, no gas token separate from stablecoins
P402's AI agent is registered with ERC-8004 on Base mainnet (cross-chain identity) for verifiable agent identity and reputation
Every settlement links to a verifiable entry in the Tempo block explorer (explore.tempo.xyz)
FeeAMM handles gas in TIP-20 stablecoins — pure stablecoin workflow, no ETH required anywhere in the stack
MPPThe payment method layer that makes machine payments programmable
Machine Payment Protocol (MPP / mppx) provides the payment orchestration layer for Tempo settlements
Session wallet: a pre-funded TEMPO_TREASURY_PRIVATE_KEY wallet holds USDC.e and submits TIP-20 transfers on behalf of each metered session
Per-session-close settlement: one real Tempo tx per review session aggregates all 55+ provisional events into a single onchain proof — no per-chunk gas burn
USDC.e at the Tempo TIP-20 contract address — no ETH required, pure stablecoin workflow
mppx provides the dual-402 challenge/response layer for machine-to-machine payment authorization via the Authorization: Payment header pattern
Proof Replay mode activates automatically when TEMPO_TREASURY_PRIVATE_KEY is unset — full demo runs without any real funds
GeminiThe intelligence layer that makes AI work governable
Gemini 3.1 Flash for multimodal document intake: reads scanned PA forms (image/PDF) and plain-text packets via the inlineData API with no separate OCR step
Function calling in ANY mode with 3 typed tools (parsePriorAuthDocument, createReviewSession, addLedgerEstimate): forces Gemini to return structured, schema-validated fields and guarantees all three tools are invoked on every run
Every extraction returns a typed healthcare object: payer name, provider name, procedure requested, urgency level, case type, confidence score, and specialist escalation flag
Gemini 3.1 Flash drives the live streaming review with a URAC-aligned system instruction that enforces NCQA UM standards: labeled output sections, policy criteria citation, documentation completeness scoring, and a reviewer recommendation
Gemini 3.1 Flash also runs the approval gate with a system instruction that enforces conservative evaluation: when any criterion is borderline, the model recommends escalation over approval
Gemini 3.1 Pro runs the post-session economic audit with an executive-level system instruction and unconstrained output: produces a 3-paragraph analysis comparing session cost against Stripe and Ethereum mainnet, with strategic implications for payer operations
Two deliberately selected model tiers: Flash for speed, streaming, and multimodal reasoning; Pro for depth, precision analysis, and narrative synthesis
Multimodal demo: load the sample PA form PNG from the Document Intake panel and upload it via the Image/PDF tab to see Gemini 3.1 Flash read printed form fields off a realistic scanned document
04Why Healthcare

Healthcare prior auth is the hardest possible proof of concept.

Prior authorization review is document-heavy, policy-bound, multi-step, explainability-critical, and economically significant. If per-token billing works here, it works everywhere.

Governance is mandatory
Clinical AI must explain every decision. P402's governed session model, budget caps, approval gates, audit trails, is not optional overhead here. It is the product.
Document reasoning is load-bearing
Gemini's multimodal intake reads actual prior auth forms. This is not prompt-wrapped text. It is vision-based structured extraction with typed function calls.
Specialist delegation is natural
Complex cases route to specialist review agents under blockchain-verified escrow. The agent-to-agent payment loop mirrors real payer escalation workflows where complex cases are handed off with a financial commitment attached.
The economics are real
A human reviewer costs $15–50/hour for prior auth work. An AI-assisted review costs under $0.01. The margin explanation in the demo is not hypothetical, it is the business case.
05Platform Alignment

Built to satisfy every technical criterion.

P402 Meter was designed explicitly against the platform requirements. Each check below maps to something visible in the live demo, not claimed in theory.

Usage-Based Compute Billing · Tempo Mainnet
Every AI token Gemini generates is priced at $0.0000006/token and written as a discrete USDC.e ledger event — not batched, not estimated after the fact, one provisional event per streaming chunk in real time
55+ onchain billing events per session: extraction estimates fire during document parsing, review estimates fire on every streaming chunk, reconciliation fires once with the verified token count and a real Tempo tx hash
One real Tempo mainnet settlement tx per session: the TEMPO_TREASURY_PRIVATE_KEY wallet submits a single USDC.e ERC-20 transfer() at stream close, aggregating all provisional events into one verifiable onchain proof
Tempo FeeAMM enables <$0.000001 per settlement vs $2.85 on ETH mainnet — 99.9%+ cost reduction makes token-granularity billing economically viable for the first time
FrequencyCounter widget shows real-time billing velocity: tokens, cost, and event count incrementing with every chunk emitted
Margin panel proves the economics: Tempo <$0.000001/tx vs ETH mainnet $2.85/tx vs Stripe $0.30 minimum. Usage-based billing at token granularity is structurally impossible on any other payment rail.
B2B FinOps & Compliance
Every review session has a budget cap enforced pre-execution: if projected cost exceeds the cap, the session is blocked before Gemini is invoked
Approval gate runs a policy-enforcing quality pass after the review: insideBudget, policyCompliant, and outputInScope are evaluated independently and returned in the stream_done event
EconomicAuditPanel (Gemini 3.1 Pro) produces a 3-paragraph executive narrative with cost-per-action benchmarks against Stripe and Ethereum mainnet, structured for a CFO or payer ops director audience
Every ledger event is written to a persistent audit log with UUID, sessionId, workOrderId, eventKind, tokensEstimate, costUsd, costUsdcE6, provisional flag, and createdAt timestamp
Tempo Explorer links on every reconciliation event: the full billing trail is independently verifiable at explore.tempo.xyz without trusting any P402 system
URAC-compliant review format with labeled output sections (Request Classification, Policy Criteria Reference, Administrative Rationale, Documentation Completeness Assessment, Reviewer Recommendation) satisfies the audit artifact requirement for UM compliance programs
Google Track: Best Use of Gemini Models
Gemini 3.1 Flash is load-bearing across three distinct roles: multimodal document intake, function calling with forced ANY-mode tool invocation, and the live URAC-aligned streaming review with per-chunk USDC.e settlement
Function calling uses FunctionCallingMode.ANY to guarantee all 3 typed tools are invoked and returns a structured JSON healthcare extract (payer, provider, procedure, urgency, confidence score) visible in the Work Order panel
Flash also runs the approval gate with a conservative system instruction: "when any criterion is borderline, recommend escalation over approval" — this is not a trivial classification, it is a policy-enforcing quality gate
Gemini 3.1 Pro runs the post-session economic audit with an executive-level system instruction and unconstrained output: produces a 3-paragraph narrative comparing session cost against Stripe and Ethereum mainnet with strategic implications for payer operations
Two model tiers used as an explicit architectural decision: Flash optimized for speed, streaming, and real-time pricing; Pro deployed for depth, analytical reasoning, and executive-quality narrative synthesis
Multimodal: the sample PNG prior auth form in the Document Intake panel demonstrates Gemini 3.1 Flash reading printed form fields off a realistic scanned document via the inlineData API
Agent-to-Agent Payment Loop
P402's AI agent has a registered ERC-8004 identity on Base mainnet (cross-chain) — agent identity, reputation, and budget controls inherited from the P402 trust stack
AP2 mandates govern per-session spending: agent cannot exceed the budget cap, every action is policy-checked against a signed mandate before settlement
InheritedTrustStrip shows the live trust depth: ERC-8004 identity, reputation-aware routing, AP2 budget controls, and replay protection — all verifiable
ERC-8183 specialist escrow is planned for Phase 3 — A2A payment loop architecture is fully wired, escrow settlement returns 503 on Tempo Phase 1
06Architecture

Eight API routes. One coherent economic model.

Each route handles exactly one step of the workflow. They are independently testable, stateless where possible, and every settlement-producing route writes directly to Tempo.

/api/meter/packetIngest document, SHA-256 hash, persist asset
/api/meter/work-orderGemini multimodal extraction → structured WorkOrder
/api/meter/sessionsOpen metered session with budget cap
/api/meter/walletCheck Tempo settler wallet balance and signer address
/api/meter/chatSSE stream, per-chunk ledger events, reconcile + Tempo settle, approval
/api/meter/escrowERC-8183 specialist escrow (Phase 3 — returns 503 on Tempo Phase 1)
/api/meter/trustERC-8004 agent identity + reputation read
/api/meter/auditGemini 3.1 Pro economic audit, executive 3-paragraph narrative + cost breakdown
07Business Case

The buyer is the payer. The ROI is measurable.

P402 Meter is not a demo for developers. The end buyer is a health plan, TPA, or utilization management vendor who currently pays $25-100 per manual prior auth review and receives no real-time cost visibility, no usage-based billing, and no audit trail that survives litigation.

$25-100
Manual review cost per case
Human reviewer time for a standard prior authorization decision. Complex cases can exceed $200.
<$0.01
AI-metered review cost per case
Gemini extraction + streaming review + economic audit + Tempo settlement. Every cent tracked and auditable.
Full audit trail
Every action provable onchain
Budget cap, approval gate, and ledger events are all verifiable. No black-box AI billing. No subscription guessing.
What changes for the buyer
Usage-based vendor billing: pay per case reviewed, not per seat or per month
Per-action cost visibility: know exactly what each AI step cost before approving release
No subscription lock-in: metered pricing means cost scales with volume, not contract size
Audit-ready output: every review is an onchain artifact that survives a URAC or NCQA audit
Specialist delegation with financial proof: complex cases route to agents under verified escrow
Human approval stays required: no AI makes a coverage decision without a qualified reviewer
08Judge Walkthrough

Five steps. Under three minutes.

Everything claimed on this page is verifiable in the live demo. Here is the exact sequence to evaluate it.

01
Load a healthcare scenario
In the Document Intake panel (left column), click any scenario row to load it, or download the sample PNG form and upload it via the Image/PDF tab to test Gemini multimodal vision.
02
Click "Submit to Gemini" and watch the Work Order appear
Gemini Flash extracts structured fields from the document using function calling. The Work Order panel shows the typed output: payer, provider, procedure, urgency level, case type, and a confidence score.
03
Hit "Execute Review" and watch the Ledger fill in real time
The Review Summary panel streams the AI review token by token. Each chunk simultaneously writes a ledger event — cost estimated, USDC.e amount recorded, Tempo settlement queued. Watch the event count climb past 55.
04
Open the Tempo Proof drawer and verify the settlement
The Tempo Proof drawer shows the settlement tx hash and block number. Click "Verify on Tempo →" to open the tx on explore.tempo.xyz. The USDC.e transfer is real, the cost is real (<$0.000001/tx), and the total stays under $0.001.
05
Scroll to the Economic Audit and the Margin Explanation panels
After the review completes, Gemini Pro generates a cost breakdown. The Margin panel shows the exact comparison: Tempo <$0.000001/tx vs ETH mainnet $2.85/tx vs Stripe $0.30 minimum. This is the business case for Tempo in one number.
09How the Demo Runs

Three modes. Same architecture. All verifiable.

P402 Meter adapts automatically to the environment. Every mode produces real ledger events and real proof references. Only the source of the AI text and the on-chain settlement change between modes.

Live Mode
GOOGLE_API_KEY + TEMPO_TREASURY_PRIVATE_KEY set

Real Gemini 3.1 Flash/Pro calls. Pre-funded TEMPO_TREASURY_PRIVATE_KEY wallet submits one real USDC.e TIP-20 transfer on Tempo mainnet at session close. Tempo Explorer link is live immediately.

Proof Replay
Default (no keys required)

Pre-recorded stream replays a real prior-auth session. 55 chunks. Real proof refs from a prior live run. All ledger events, approval gate, and economic audit run identically. No API keys needed to run or judge.

Quota Fallback
Auto (free-tier Gemini limit hit)

If the Gemini free tier returns a 429 or quota error, the system silently switches to Proof Replay mid-session. A thin amber notice appears. The rest of the demo proceeds identically.

Tempo MPP Settlement Flow (per session)
1. Gemini emits token chunk → cost calculated at $0.0000006/token2. Ledger event written: eventKind=review_estimate, costUsdcE6, provisional=true3. Repeat for 55+ chunks — stream closes, reconciliation triggered4. Tempo settler submits single USDC.e ERC-20 transfer() on Tempo mainnet (Chain ID 4217)5. waitForTransactionReceipt confirms after 1 block — FeeAMM gas paid in USDC.e6. Reconciliation event written: settlementTxHash, settlementBlock, provisional=false7. Tempo Explorer link available immediately at explore.tempo.xyz/tx/{txHash}
See it live

The demo is the proof.

55+ Tempo settlements. Under $0.001 total. Gemini reading a real PA form. Two distinct model roles. Real USDC.e TIP-20 transfers on Tempo mainnet. Every number verifiable on the block explorer.

P402 Meter · Tempo Mainnet · MPP Demo · May 2026Tempo × MPP × Gemini 3.1
Built by Zeshan Ahmad · p402.io