Credits
AgentGate uses a credit-based billing system. This page explains how credits work, how to check balances, and how to manage usage.How Credits Work
Credits are the unit of payment for AgentGate usage:- Runs consume credits: Each run deducts credits based on complexity
- Credits are prepaid: You purchase or receive credits before use
- Two credit types: Included credits (with your plan) and purchased credits
Credit Types
| Type | Description | Expiration |
|---|---|---|
| Included | Monthly allocation with your plan | Reset monthly |
| Purchased | One-time purchases | Never expire |
Deduction Priority
When runs complete, credits are deducted in this order:- Included credits (use first, reset monthly)
- Purchased credits (use after included depleted)
Credit Balance
Checking Balance
Get your current credit balance:Balance Fields
| Field | Description |
|---|---|
includedCreditsCents | Remaining monthly included credits |
purchasedCreditsCents | Remaining purchased credits |
totalCreditsCents | Combined available balance |
billingCycleStart | When included credits reset |
billingCycleEnd | End of current billing cycle |
Credit Deductions
When Credits Are Charged
Credits are deducted when a run completes:- Succeeded runs: Full cost charged
- Failed runs: Partial cost for completed iterations
- Cancelled runs: Cost for iterations before cancellation
What Determines Cost
Run cost depends on:| Factor | Impact |
|---|---|
| Iterations | More iterations = higher cost |
| Verification level | Higher levels cost more |
| Workspace complexity | Larger workspaces cost more |
| Duration | Longer runs cost more |
Viewing Run Costs
Check cost in run results:Usage History
Querying Usage
Get transaction history:Filtering Usage
| Parameter | Description |
|---|---|
startDate | Filter from date (ISO 8601) |
endDate | Filter to date (ISO 8601) |
tenantId | Filter by tenant |
tenantUserId | Filter by tenant user |
type | Filter by transaction type |
limit | Results per page |
offset | Pagination offset |
Usage by Tenant
Track usage per tenant for billing:Credit Estimation
Before Submitting
While exact costs can’t be predicted, estimate based on:| Task Type | Typical Range |
|---|---|
| Simple changes | 50-100 credits |
| Medium complexity | 100-300 credits |
| Complex tasks | 300-1000 credits |
Actual costs depend on iterations needed and verification complexity.
Insufficient Credits
If balance is insufficient:- Work order submission returns
402 Payment Required - Error includes required vs available credits
- Purchase credits or wait for monthly reset
Billing Integration
Passing Costs to Customers
Use tenant context and usage API for billing integration:Stripe Integration Pattern
Cost Optimization
Strategies
Write Clear Prompts
Write Clear Prompts
Specific prompts converge faster, reducing iterations and cost.
Use Appropriate Verification
Use Appropriate Verification
Don’t use L3 verification for quick prototypes. Match verification to needs.
Set Iteration Limits
Set Iteration Limits
Set reasonable
maxIterations to cap costs per run.Break Down Complex Tasks
Break Down Complex Tasks
Multiple smaller work orders often cost less than one complex one.