Skip to main content

Check Your Credit Balance

curl https://api.bithuman.ai/v2/credit-summaries \
  -H "api-secret: YOUR_API_SECRET"
Response:
{
  "success": true,
  "data": {
    "balance": 5240,
    "plan_credits": 240,
    "topup_credits": 5000,
    "is_enterprise": false,
    "minutes_estimate": {
      "voice_chat": 524,
      "camera_chat": 174,
      "essence_cloud": 2620,
      "essence_self_hosted": 5240,
      "expression_cloud": 1310,
      "expression_self_hosted": 2620
    }
  }
}
FieldDescription
balanceTotal usable credits (plan + topup)
plan_creditsMonthly subscription credits — reset each billing cycle
topup_creditsPurchased credits — carry over until used
is_enterpriseIf true, unlimited usage (no credit deductions)
minutes_estimatePre-calculated minutes remaining for each use case

Credit Rates

Different features consume credits at different rates per minute:
FeatureCredits/minDescription
Voice Chat10Cloud agent with STT + LLM + TTS
Camera Chat30Cloud agent with user camera enabled
Essence (Cloud)2Cloud-hosted CPU avatar rendering
Essence (Self-Hosted)1Your infrastructure, CPU avatar rendering
Expression (Cloud)4Cloud-hosted GPU avatar rendering
Expression (Self-Hosted)2Your infrastructure, GPU avatar rendering
One-time costs:
OperationCreditsDescription
Agent Generation250Create a new avatar agent
Dynamics Generation250Generate gestures/movements for an agent

Request Limits

API endpoints are rate-limited to protect service quality. Limits are applied per API secret.
TierConcurrent SessionsAgent Generations/day
Free25
Creator ($20/mo)520
Pro ($99/mo)1050
EnterpriseCustomCustom
Check your current tier and usage at www.bithuman.ai → Developer → API Keys.

Handling Errors

If you exceed limits or run out of credits, the API returns an error:
{
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Insufficient credits",
    "httpStatus": 402
  },
  "status": "error",
  "status_code": 402
}
Common status codes: 402 (no credits), 429 (rate limited), 503 (workers busy). Use exponential backoff with jitter:
import time
import random
import requests

def api_request_with_retry(url, headers, max_retries=3):
    for attempt in range(max_retries):
        resp = requests.post(url, headers=headers)

        if resp.status_code not in (429, 503):
            return resp

        # Exponential backoff with jitter
        wait = (2 ** attempt) + random.uniform(0, 1)
        time.sleep(wait)

    return resp  # Return last response if all retries exhausted

Concurrency Limits

Avatar sessions have per-account concurrency limits:
ResourceLimitNotes
Cloud avatar sessionsBased on tierActive WebRTC sessions
Agent generation3 concurrentQueued if exceeded
Dynamics generation2 concurrentQueued if exceeded

Endpoint Guidelines

EndpointGuidanceNotes
POST /v1/validateLightweightUse for health checks
POST /v1/agent/generateHeavyTriggers GPU pipeline, ~2-5 min
GET /v1/agent/status/*Poll at 5s intervalsAvoid sub-second polling
POST /v1/agent/*/speakPer active sessionAgent must be in a room
POST /v1/files/upload10 MB image, 100 MB videoSize limits enforced
POST /v1/dynamics/generateHeavyTriggers video generation

Best Practices

Instead of polling /v1/agent/status/{id} in a loop, configure webhooks to get notified when generation completes.
Agent data rarely changes. Cache GET /v1/agent/{code} responses locally and refresh only when needed.
Keep avatar sessions alive between conversations instead of creating new ones. Session creation is the most expensive operation.
Call GET /v2/credit-summaries to check your balance before starting agent generation (250 credits) or dynamics creation (250 credits). This avoids wasted API calls that fail with 402.
curl https://api.bithuman.ai/v2/credit-summaries \
  -H "api-secret: YOUR_API_SECRET"

Need Higher Limits?

Contact us via Discord or email for enterprise tier pricing with custom limits.