/v1/account/credits endpoint. This endpoint provides detailed information about all credit types associated with your account, including regular credits, free credits, referral credits, and the total available balance.
Credits are automatically deducted after each API request completes, drawing down
free_credit first, then referral_credits, then credit (regular/purchased). Check your balance regularly to ensure you have sufficient credits for your operations.Quick Start
- Python
- JavaScript
- TypeScript
- Rust
- Go
Response Schema
CreditBalanceOutput Object
Example Response
Credit Usage Order
Each charge is deducted from your account in this exact order (seededuct_credits in api/database_ops.py):
free_credit- Spent firstreferral_credits- Spent next, oncefree_creditis exhaustedcredit(regular/purchased) - Spent last, once both of the above are exhausted
CreditBalanceOutput response — referral_credits is not merged into credit. This ensures you maximize the value of free and referral credits before drawing down your paid balance. A request fails with 402 Payment Required if credit + free_credit + referral_credits is less than the charge.
Separately from the per-request charge check above, billable endpoints (
/v1/swarm/completions, /v1/chat/completions, /v1/agent/completions, /v1/agent/batch/completions, and the other completion routes) require a total credit balance greater than $1.00 (credit + free_credit + referral_credits) before the request is even accepted — this is a pre-flight guard in the API key middleware, independent of what the specific request ends up costing.Use Cases
Monitor Credit Balance
Check your credit balance before running large batch operations:Track Credit Consumption
Monitor credit usage over time:Best Practices
- Regular Monitoring: Check your credit balance regularly, especially before large operations
- Low Balance Alerts: Set up alerts when credits fall below a threshold
- Credit Types: Understand which credit types you’re using to optimize spending
- Referral Program: Earn additional credits by referring new users
Related Documentation
- Pricing Details - Understand API costs
- Pricing Cost Estimator - Estimate costs before running jobs
- Rate Limits - Check rate limit status
- Account Management - Manage your account and add credits