What problem does it solve?
Integrating usage-based billing into an application requires correctly modeling features, credit systems, plans, and Stripe-backed subscriptions, and mistakes in configuration or SDK usage cause failed credit checks, incorrect deductions, or broken plan upgrades.
Core Features & Use Cases
- Billing Configuration: Define features, credit systems, and plans in
autumn.config.ts and push them with the atmn CLI, following Autumn's snake_case naming and PlanItem interval rules.
- Metered AI Usage: Implement proportional credit billing where a single metered feature deducts variable amounts per AI model via dynamic
requiredBalance, with refunds through negative track() values.
- Middleware Integration: Wire customer creation and credit gates into Cloudflare Workers + Hono routes, ensuring
getOrCreate is awaited before any check() call.
- Use Case: When adding a new AI model to your API, use this Skill to map the model to a credit cost, gate the endpoint with an Autumn credit check, and refund credits automatically if the AI stream fails.
Quick Start
Ask the AI to add a credit check gate for a new AI model endpoint using the Autumn billing configuration in this project.