Billing Issues

This guide helps you resolve billing-related issues including insufficient credits, payment failures, and unexpected charges.

Insufficient Credits

Symptoms

{
  "error": {
    "code": "GATEWAY1_BILLING_001",
    "message": "Insufficient credits. Your balance ($0.05) is below the minimum required ($0.10). Please add credits to continue.",
    "type": "billing_error",
    "status": 402
  }
}

Understanding Credit Requirements

LangMart requires a minimum credit balance to prevent overdraft:

Setting Default Value Description
Minimum Balance $0.10 Balance required to make requests
Warning Threshold $1.00 Balance that triggers low balance alert

Solutions

Check Your Balance

curl -X GET "https://api.langmart.ai/api/account/balance" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "balance": 0.05,
  "currency": "USD",
  "minimum_required": 0.10
}

Add Credits

  1. Navigate to Billing in the dashboard
  2. Click Add Credits
  3. Select an amount or enter custom amount
  4. Complete the payment

Via API

curl -X POST "https://api.langmart.ai/api/billing/purchase" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 10.00}'

Set Up Auto-Recharge

  1. Go to Billing > Settings
  2. Enable Auto-Recharge
  3. Set threshold (e.g., $5.00)
  4. Set recharge amount (e.g., $20.00)

Organization vs Personal Credits

Credits can be funded at two levels:

Type Description Use Case
Personal Individual user balance Personal projects
Organization Shared team balance Team projects

Check which funding source you're using:

  1. Navigate to Settings > Organization
  2. View your current funding source
  3. Switch if needed

Payment Failures

Common Payment Error Messages

Error Cause Solution
Card declined Insufficient funds Use different card
Card expired Card has expired Update card details
Invalid card Incorrect card number Re-enter card details
Processing error Temporary issue Wait and retry
Authentication required 3D Secure needed Complete verification

Solutions

Update Payment Method

  1. Go to Billing > Payment Methods
  2. Click Add Payment Method
  3. Enter new card details
  4. Set as default payment method

Verify Card Details

Ensure:

  • Card number is correct (no spaces)
  • Expiration date is valid
  • CVV/CVC is correct
  • Billing address matches card

Contact Your Bank

Some banks block international transactions or online purchases:

  1. Call your bank's customer service
  2. Inform them about the transaction
  3. Ask them to whitelist the merchant

Try Alternative Payment

LangMart supports multiple payment methods:

  • Credit/Debit cards
  • PayPal (if available)
  • Bank transfer (for enterprise)

Unexpected Charges

Understanding Your Bill

View detailed billing breakdown:

curl -X GET "https://api.langmart.ai/api/billing/usage/breakdown" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -G \
  -d "start_date=2025-01-01" \
  -d "end_date=2025-01-31"

Response:

{
  "period": {
    "start": "2025-01-01",
    "end": "2025-01-31"
  },
  "total_cost": 47.85,
  "breakdown": {
    "by_model": [
      {"model": "gpt-4o", "cost": 32.50, "requests": 850},
      {"model": "claude-3-sonnet", "cost": 12.30, "requests": 420}
    ],
    "by_day": [
      {"date": "2025-01-15", "cost": 2.30},
      {"date": "2025-01-16", "cost": 1.85}
    ]
  }
}

Common Causes of Unexpected Charges

1. High Token Usage

Long conversations accumulate tokens:

# Check token usage
curl -X GET "https://api.langmart.ai/api/account/analytics/usage" \
  -H "Authorization: Bearer YOUR_API_KEY"

Solution: Set max_tokens limits on requests:

{
  "model": "gpt-4o",
  "messages": [...],
  "max_tokens": 1000
}

2. Expensive Models

Some models cost significantly more:

Model Relative Cost
gpt-4o-mini $
gpt-4o $
claude-3-sonnet $
claude-3-opus $$
o1-preview $$

Solution: Use cheaper models for simple tasks.

3. Failed Requests Still Charged

Some providers charge for tokens even if the request fails partway through.

Solution: Review error logs to identify and fix issues.

4. Runaway Scripts

Automated processes making excessive requests.

Solution:

  • Implement rate limiting in your code
  • Set up cost alerts
  • Review request logs for patterns

Setting Spending Limits

Personal Spending Limit

curl -X PUT "https://api.langmart.ai/api/user/spending-limit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"daily_limit": 10.00, "monthly_limit": 100.00}'

Organization Spending Limit

curl -X PUT "https://api.langmart.ai/api/organizations/{org_id}/spending-limits" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"daily_limit": 100.00, "monthly_limit": 1000.00}'

Setting Up Cost Alerts

  1. Navigate to Alerts in the dashboard
  2. Click Create Alert
  3. Select Cost Threshold
  4. Set threshold (e.g., $50/day)
  5. Choose notification method (email, dashboard)

Viewing Invoices

Access Invoices

curl -X GET "https://api.langmart.ai/api/billing/invoices" \
  -H "Authorization: Bearer YOUR_API_KEY"

Invoice Details

Each invoice includes:

  • Invoice number
  • Period covered
  • Total amount
  • Breakdown by model
  • Payment status

Download Invoice PDF

  1. Go to Billing > Invoices
  2. Find the invoice
  3. Click Download PDF

Refund Requests

Eligibility

Refunds may be available for:

  • Technical issues causing erroneous charges
  • Duplicate charges
  • Unauthorized usage (compromised API key)

Request Process

  1. Gather Evidence:

    • Request IDs for affected charges
    • Error messages received
    • Timestamps of issues
  2. Submit Request:

    • Go to Support > Billing Issue
    • Select "Refund Request"
    • Provide evidence and explanation
  3. Review Time:

    • Standard: 5 business days
    • Complex cases: 10 business days

Preventing Unauthorized Charges

  1. Rotate API Keys: If you suspect key compromise
  2. Monitor Usage: Set up alerts for unusual activity
  3. IP Restrictions: Limit API access by IP (if supported)
  4. Review Access: Audit who has API key access

Credit Balance Questions

How Credits Work

  1. Pre-paid: Add credits before usage
  2. Deducted Per Request: Based on tokens used
  3. Real-time Updates: Balance updates after each request

Credit Expiration

Credit Type Expiration
Purchased 1 year from purchase
Promotional Varies (check terms)
Free trial 30 days

Check Credit History

curl -X GET "https://api.langmart.ai/api/account/credit-history" \
  -H "Authorization: Bearer YOUR_API_KEY"

Enterprise Billing

Custom Billing Arrangements

Enterprise customers may have:

  • Monthly invoicing
  • Net 30 payment terms
  • Volume discounts
  • Custom SLAs

Contact Support

For enterprise billing questions:

  1. Email: [email protected]
  2. Or contact your account manager

Still Having Issues?

If billing issues persist:

  1. Check Transaction History: Review all transactions in Billing section
  2. Verify Payment Method: Ensure card is valid and has funds
  3. Review Usage: Check for unexpected usage patterns
  4. Contact Support: Submit a billing support ticket