docs.title/Error Codes

Error Codes

API Reference

HTTP Status Codes

CodeMeaningAction
200SuccessRequest processed successfully
400Bad RequestCheck your request body — invalid JSON, missing model or messages
401UnauthorizedInvalid or missing API key. Check your Authorization header
402Insufficient BalanceTop up your account in the dashboard
403ForbiddenYour key doesn't have access to this model or your account is suspended
429Rate LimitedYou've exceeded your plan's rate limit. Retry after the Retry-After header value
500Internal ErrorSomething went wrong on our end. Barq will automatically retry with fallback models
503Service UnavailableBarq is temporarily overloaded. Retry with exponential backoff

Error Response Format

{
  "error": {
    "message": "Insufficient balance. Required: $0.015, Available: $0.003",
    "type": "insufficient_balance",
    "code": 402
  }
}

Retry Strategy

For 429 and 5xx errors, use exponential backoff:

  • 1st retry: wait 1 second
  • 2nd retry: wait 2 seconds
  • 3rd retry: wait 4 seconds
  • Max retries: 3

docs.readyToStart

docs.readyToStartDesc

Invite a friend, both get free tokens!

💡 Login to get your personal referral link

Read our referral program policy