Skip to main content

ducto

Declarative Credit Calculation Engine for AI SaaS

Multi-Language

Use the same pricing config from Python or TypeScript. Identical expression engine, identical results.

Safe Expressions

AST-based evaluator with strict allowlists. No eval(), no exec(), no arbitrary code execution.

Database-Backed

Pricing lives in credit_pricing_config. Update live without redeploys. Dict loading for testing.

Credit Lifecycle

Reserve-then-deduct pattern with idempotency keys, reservation expiry, and min-balance enforcement.

Pluggable Stores

Supabase, PostgreSQL, or in-memory — same CreditStore interface. Bring your own backend.

Open Source

MIT license. Use it, fork it, contribute. <code>pip install ducto</code> or <code>npm install @apoorwv/ducto</code>.