GuideCore Concepts
Idempotency & Auto-Refunds
24-hour Postgres Idempotency-Key replay window, 409 conflict rules, and Vidhi's 5 automatic credit refund guarantees.
All metered Tier B POST endpoints (verify/brief, audit/order, audit/counter-precedent, research/memo, notices/analyze, contracts/triage, compliance/redact-firewall, and translation/text) accept an optional UUIDv4 Idempotency-Key header.
Idempotency Semantics (24-Hour Window)
- Safe replay: Repeating a request with the same
Idempotency-Keyand identical SHA-256 request body within 24 hours returns the cached response immediately withX-Idempotency-Replayed: trueandX-Credits-Charged: 0. - Conflict protection (
409 idempotency_conflict): Reusing the sameIdempotency-Keywith a different JSON payload — or while the original request is still in progress — returns HTTP409withcode: "idempotency_conflict". - Automatic SDK generation: Both the Python SDK (
vidhi) and TypeScript SDK (@vidhi/sdk) generate a fresh UUIDv4Idempotency-Keyautomatically before retrying transient429or503responses.
Verbatim Automatic Refund Policy (GET /api/v1/in/pricing)
Credits are reserved atomically in api_credit_ledger before execution and finalized only upon valid output. Vidhi automatically refunds reserved credits (X-Credits-Charged: 0) in all five failure modes below:
5xxserver or upstream LLM failures automatically refund reserved credits (credits_charged: 0).422 privilege_enclave_blockedand404 intelligence_not_extracted/pdf_unavailablerefund reserved credits.- Incomplete case bodies (
complete: false) automatically refund reserved credits. - Batch
/citations/resolvecharges only for resolved items;unresolvedandambiguousitems are refunded. - Cancelled async jobs (
DELETE /api/v1/in/jobs/{job_id}) automatically refund reserved credits.
In addition, an orphan reservation sweeper runs every 15 minutes to release any stale pending reservations.