Skip to content
Released v0.1.0 · TypeScript library · your own Postgres

KE Credits

A prepaid-credits ledger for AI products.

A prepaid-credits ledger for AI products that runs in your own Postgres, with Stripe Checkout top-ups. Credits are spent inside the same database transaction as the work.

npx tsx examples/demo.tsSample data
KE Credits demo output: a purchase grants 500 credits, spends and retries are idempotent, an overspend is refused and a refund is clawed back
Real output of the repository's demo: a purchase, a spend, a refused overdraft and a refund.
Runs in
Your own Postgres
Top-ups
Stripe Checkout
Overdraft
Refused, even concurrently
License
Apache-2.0
01 / What it does

A prepaid-credits ledger for AI products.

  • 01

    Spend with the work

    Credits are debited inside the same database transaction as the work, so a failed spend rolls the work back too.

  • 02

    Safe by default

    Live Stripe keys are refused until you opt in, and webhook signatures are verified before any grant.

  • 03

    Append-only

    Balances are the sum of append-only entries, with idempotent retries, refunds and clawbacks.

02 / The record

What it can prove, and where it stops.

Proven safeguard
Live Stripe keys are refused until you opt in, and a balance cannot go below zero, even under concurrent requests.
Limits
Version 0.x and experimental: a real Postgres test suite, but no external audit and little production volume yet. It is a single-entry ledger, Stripe is the only payment adapter, and tax and invoicing are yours.
License
Apache-2.0
Screens on this page
Real captures of the product, from its demo mode, sample data or a recorded run. No customer data.
03 / Try it

Run it yourself.

Install, from the repository README. Nothing here needs an account with us.

KE Credits: Install
npm install github:willykeenan/ke-credits