v0.0.1 Stable

The Open-Source Wallet Primitive for AI & Pre-Paid SaaS.

Billing engines like Metronome calculate the bill at the end of the month. Base Ledger enforces real-time budget limits in less than 5ms. Stop race conditions, eliminate double-spending, and prevent AI agents from bankrupting your API budget.

Read the Architecture
14-day free trial available
POST /wallet/{id}/reserve
await ledger.wallet("user_123").reserve({
  "idempotencyKey": "req_9982...",
  "holdId": "generation_abc",
  "amount": 500,
  "ttlSeconds": 45,
  "metadata": {
    "model": "gpt-4-turbo"
  }
});
// Status: 200 OK (Tokens Locked)
					
Internal Latency
< 5ms
Uptime Guarantee
99.9%
Throughput
10k TPS

Built for the Critical Path

Why eventual consistency fails for pre-paid SaaS.

Absolute Race-Condition Prevention

Built on Apache Pekko and Event Sourcing. Wallet state lives in memory on a single Actor. Zero row-level database locking. Double-spending is mathematically impossible.

Real-Time Transaction Cutoff

Standard metering tools buffer events in Kafka. We authorize or hard-reject transactions in milliseconds. The moment a user's token balance hits zero, the API call is blocked.

Self-Host with Postgres. Scale with Serverless.

The Open-Source core uses PostgreSQL for zero-friction local deployment. When your AI agents go viral, seamlessly upgrade to our fully-managed DynamoDB Cloud infrastructure. Same API, infinite scale.

You still need Stripe and Metronome.
You just need us first.

Billing platforms are built for eventual consistency. They are post-paid. Base Ledger is an OLTP authorization engine built for pre-paid limits. We guarantee the wallet balance, authorize the transaction in real-time, and pass the clean data to your billing engine.

How it Works

1

Send Command

Send an atomic JSON payload to Add, Reserve, or Spend tokens for a specific wallet.

2

Ledger Commit

Engine validates balances and appends to the immutable log.

3

New State

Balances update instantly. Webhooks fire to your application.

Built for Mission-Critical Systems

The infrastructure layer you can trust with real money.

Bank-Grade Security

Encrypted at rest and in transit. Role-based access control (RBAC) baked in.

Idempotency

Safe retries. We guarantee that a transaction is processed exactly once.

Audit-Ready Traceability

Every transaction is an immutable event. Perfect cryptographic audit trails for your finance and compliance teams.

High Availability

Fault-tolerant, multi-AZ cloud architecture ensures your ledger stays online. (Up to 99.999% SLA available on Enterprise BYOC).

Real-Time Analytics

Query financial state instantly. No ETLs or overnight batch jobs required.

Webhooks & Event Streaming

Listen for real-time events. Dispatch immutable webhooks without manual polling infrastructure.

Simple, Powerful API

1

Initialize Client

Connect to your ledger instance securely. All requests are authenticated using your API key.

2

Reserve Tokens

Place a temporary hold on the user's tokens before starting an expensive AI generation process.

3

Spend Tokens

Once the generation is successful, capture the held tokens. Add metadata to track feature usage.

example.ts
// 1. Initialize Ledger const ledger = new BaseLedger('bl_live_...');
// 2. Reserve Tokens for AI Prompt const hold = await ledger.wallet("usr_881").reserve({ "idempotencyKey": "req_5512", "holdId": "prompt_99x", "amount": 150, "ttlSeconds": 60, "metadata": { "model": "gpt-4-turbo" } });
// 3. AI Generation Successful -> Spend Tokens const result = await client.wallet("usr_881").spend({ "idempotencyKey": "req_5513", "holdId": "prompt_99x", "amount": 123, "metadata": { "feature": "image_generation" } }); console.log(result.availableBalance);

Built for your Industry

AI Agents

Meter token usage per prompt with exact precision.

Marketplaces

Hold funds, split payments, and handle payouts.

Gaming

In-game currency systems that can't be glitched.

Rewards

Loyalty points systems with audit trails.

Simple, Transparent Pricing

The financial layer for modern apps.

Open Source

$0
  • Self-Hosted
  • Postgres Backend
  • Docker Compose
  • Community Support
View GitHub

Cloud Starter

$49/mo
  • 100k Transactions
  • 1 Ledger
  • Email Support
Most Popular

Pro

$199/mo
  • 1M Transactions
  • Unlimited Ledgers
  • Priority Support

Enterprise

Custom
  • Unlimited Volume
  • Dedicated Instance
  • Deploy to your own AWS/GCP VPC (BYOC)
  • SLA & Account Manager
Contact Sales

Engineering Access Required

Join the Early Access waitlist to view the distributed architecture and payload bindings.

Read the Architecture