Billing
Overview
Section titled “Overview”AutoDB uses pay-per-request billing. All new accounts receive $10.00 in free credits. Each billable API request costs $0.005.
What’s Billable
Section titled “What’s Billable”| Free | Billable ($0.005/request) |
|---|---|
| Connection CRUD | Schema introspection |
| API key management | Migration analysis |
| Agent management | Query optimization |
| Billing endpoints | Text-to-SQL |
| Database provisioning | Agent chat |
| Health check | SQL execution |
Get Balance
Section titled “Get Balance”curl https://api.autodb.app/api/v1/billing/balance \ -H "Authorization: Bearer YOUR_JWT"{ "success": true, "data": { "balance": "9.5000", "total_spent": "0.5000", "total_requests": 100, "cost_per_request": "0.0050" }}Add Credits (Stripe Checkout)
Section titled “Add Credits (Stripe Checkout)”curl -X POST https://api.autodb.app/api/v1/billing/checkout \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_JWT" \ -d '{"amount_cents": 1000}'amount_cents | Credits Added |
|---|---|
| 500 | $5.00 |
| 1000 | $10.00 |
| 2500 | $25.00 |
| 5000 | $50.00 |
Returns a checkout_url that redirects the user to Stripe Checkout.
Usage History
Section titled “Usage History”curl https://api.autodb.app/api/v1/billing/usage \ -H "Authorization: Bearer YOUR_JWT"Returns the last 100 billable requests with endpoint path, method, cost, and timestamp.
Payment History
Section titled “Payment History”curl https://api.autodb.app/api/v1/billing/payments \ -H "Authorization: Bearer YOUR_JWT"Returns past payments with amount, credits added, status, and Stripe receipt URL.
Insufficient Credits
Section titled “Insufficient Credits”When credits are depleted, billable endpoints return HTTP 402:
{ "detail": "Insufficient credits. Please add funds to continue."}Free endpoints (connections, API keys, billing) continue to work.
Response Headers
Section titled “Response Headers”Every billable response includes:
X-Credits-Remaining: 8.5000Webhook
Section titled “Webhook”The Stripe webhook at POST /api/v1/billing/webhook processes checkout.session.completed events to add credits. It is idempotent — duplicate events are safely ignored.