Billing & Credits

Manage your credit balance, view transactions, and understand AllRoutes pricing.

Overview

AllRoutes uses a prepaid credit system. You purchase credits, and they are deducted as you make API requests. Credits never expire.

Platform Fees

AllRoutes charges a small platform fee on top of provider costs, based on your plan:

PlanPlatform FeeNotes
Free4%Good for experimentation and small projects
Pro2.5%Reduced fee for production workloads
BYOK0%Zero commission when using your own provider keys

When using Bring Your Own Key (BYOK), requests are billed directly by the provider with zero AllRoutes markup.

Get Credit Balance

GET https://api.allroutes.ai/v1/credits

Returns your current credit balance and account spend information.

Response

{
  "balance_usd": 25.50,
  "lifetime_spend_usd": 1234.56,
  "auto_replenish": true,
  "replenish_amount_usd": 50.00,
  "replenish_threshold_usd": 10.00
}
FieldTypeDescription
balance_usdfloatCurrent credit balance in USD
lifetime_spend_usdfloatTotal amount spent across all time
auto_replenishbooleanWhether auto-replenish is enabled
replenish_amount_usdfloatAmount added when balance falls below threshold
replenish_threshold_usdfloatBalance threshold that triggers replenish

SDK Examples

# Python
credits = client.get_credits()
print(f"Balance: ${credits['balance_usd']:.2f} USD")
// Node.js
const credits = await client.getCredits();
console.log(`Balance: $${credits.balance_usd.toFixed(2)} USD`);
// Go
credits, _ := client.GetCredits(ctx)
fmt.Printf("Balance: $%.2f USD\n", credits.BalanceUSD)

Top Up Credits

POST https://api.allroutes.ai/v1/credits/topup

Add credits to your account balance.

Request Body

FieldTypeRequiredDescription
amount_usdfloatYesAmount to add in USD (minimum $5.00)
payment_method_idstringNoSpecific payment method to charge (uses default if omitted)

Example

curl -X POST https://api.allroutes.ai/v1/credits/topup \
  -H "Authorization: Bearer allroutes_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"amount_usd": 50.00}'

Response

{
  "transaction_id": "txn_abc123",
  "amount_usd": 50.00,
  "new_balance_usd": 75.50,
  "created_at": "2026-04-05T10:00:00Z"
}

Transaction History

GET https://api.allroutes.ai/v1/credits/transactions

Returns a paginated list of credit transactions.

Query Parameters

ParameterTypeDescription
limitintegerResults per page (default: 50, max: 200)
offsetintegerPagination offset
typestringFilter by type: topup, usage, refund, adjustment
start_datestringISO 8601 start date filter
end_datestringISO 8601 end date filter

Response

{
  "data": [
    {
      "id": "txn_abc123",
      "type": "usage",
      "amount_usd": -0.0032,
      "balance_after_usd": 25.4968,
      "description": "gpt-4o chat completion (184 tokens)",
      "model": "gpt-4o",
      "request_id": "req_xyz789",
      "created_at": "2026-04-05T14:30:00Z"
    },
    {
      "id": "txn_def456",
      "type": "topup",
      "amount_usd": 50.00,
      "balance_after_usd": 75.50,
      "description": "Manual top-up",
      "created_at": "2026-04-05T10:00:00Z"
    }
  ],
  "total": 2,
  "has_more": false
}

Subscription Info

GET https://api.allroutes.ai/v1/billing/subscription

Returns your current subscription plan and billing details.

Response

{
  "plan": "pro",
  "platform_fee_percent": 2.5,
  "billing_period": "monthly",
  "current_period_start": "2026-04-01T00:00:00Z",
  "current_period_end": "2026-05-01T00:00:00Z",
  "usage_this_period_usd": 456.78,
  "payment_method": {
    "type": "card",
    "last4": "4242",
    "brand": "visa"
  }
}

Key Points

  • Credits never expire -- unlike some competitors where credits expire after 365 days, AllRoutes credits remain in your account indefinitely.
  • Auto-replenish -- configure automatic top-ups to avoid service interruptions.
  • Per-key budgets -- set daily and monthly spending limits on individual API keys for cost control.
  • Transparent pricing -- all model costs are listed in the Models API with per-token pricing.

Error Codes

StatusDescription
400Invalid top-up amount (below minimum)
401Missing or invalid authentication
402Payment method declined
403Insufficient permissions (need billing:write scope)

See Also

  • API Keys -- per-key daily and monthly budget controls
  • Models API -- per-token pricing for every model
  • BYOK -- 0% commission when using your own provider keys
  • Free Tier -- which models are free and the rate-limit constraints
  • Cost Optimization -- caching, routing, and model selection for lowest cost