Evaluate Single-Customer Stripe Basil Ghost Usage
revclamp_evaluate_ghost_usageEvaluate whether a specific customer's AI or API usage event constitutes unpaid ghost usage across multi-subscription Stripe 2025-03-31.basil state, enforcing fail-closed pagination (has_more must be explicitly false) and configurable 0-14 day dunning grace windows. Executes as a stateless, read-only entitlement evaluator with zero side effects. Returns structuredContent containing ok, mode, statelessEphemeralAudit, tenantId, and evaluation (isGhostLeak, isGhostUsage, reason). Use this tool for real-time per-customer entitlement gating; use revclamp_audit_revenue_leakage for batch multi-customer portfolio audits.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "revclamp_evaluate_ghost_usage"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| demo | No | Optional simulation flag (boolean) for deterministic ghost-usage preview. | |
| timestamp | No | Optional alias for occurredAt (ISO-8601 string, Unix epoch seconds, or Unix epoch milliseconds). | |
| customerId | No | Stripe customer identifier to evaluate (format example: 'cus_9s6XKzkNRiz8i3', max 64 chars). | |
| occurredAt | No | Optional usage event timestamp as ISO-8601 string, Unix epoch seconds, or Unix epoch milliseconds. | |
| usageEvent | No | Optional metered usage event object containing customer_id (or stripe_customer_id), event_name, and occurred_at (or occurred_at_sec). | |
| occurred_at | No | Optional snake_case alias for occurredAt (ISO-8601 string, Unix epoch seconds, or Unix epoch milliseconds). | |
| occurredAtSec | No | Optional alias for usageTimestampSec: event timestamp as Unix epoch seconds, Unix epoch milliseconds, numeric string, or ISO-8601 string when the usage event occurred (used when usageTimestampSec is omitted). | |
| subscriptions | No | Optional Stripe customer subscriptions payload: either a Stripe list object ({ data: [...], has_more: false }) or a raw array of up to 50 subscription objects containing id, status ('active', 'trialing', 'past_due', 'canceled', 'unpaid'), current_period_end, or items.data[].current_period_end in Unix seconds. | |
| currentPeriodEnd | No | Optional camelCase alias for current_period_end (Unix epoch seconds, epoch milliseconds, or ISO-8601 string). | |
| usageTimestampSec | No | Optional event timestamp as Unix epoch seconds, Unix epoch milliseconds, numeric string, or ISO-8601 string when the AI/API usage event occurred (defaults to current server Unix timestamp if omitted). | |
| current_period_end | No | Optional flat subscription current_period_end (Unix epoch seconds, epoch milliseconds, or ISO-8601 string). | |
| subscriptionStatus | No | Optional flat Stripe subscription status shorthand ('active', 'trialing', 'past_due', 'canceled', 'unpaid', 'incomplete', 'incomplete_expired', 'paused') when subscriptions is omitted. | |
| currentPeriodEndSec | No | Optional flat subscription current_period_end in Unix epoch integer seconds. | |
| subscription_status | No | Optional snake_case alias for subscriptionStatus. | |
| subscriptionsHasMore | No | Pagination completeness flag (boolean). Must be explicitly set to false when passing a raw subscriptions array so RevClamp can verify no active subscription was truncated on a later page. | |
| dunningGracePeriodDays | No | Dunning grace window in integer days (valid range: 0 to 14, default: 3) after latest_invoice_failed_at during which past_due subscriptions remain entitled. | |
| latestInvoiceFailedAtSec | No | Optional flat latest_invoice_failed_at timestamp in Unix epoch integer seconds for past_due grace evaluation. | |
| latest_invoice_failed_at | No | Optional flat latest_invoice_failed_at timestamp (Unix epoch seconds, epoch milliseconds, or ISO-8601 string). |