Skip to main content
This guide covers the error codes you might encounter when using the Electron Hub API, along with solutions and best practices for handling them.

HTTP Status Codes

The Electron Hub API uses standard HTTP status codes to indicate the success or failure of requests.

Common Error Codes

401 - Authentication Errors

Invalid API Key
  • Cause: The API key is incorrect, missing, or malformed
  • Solution: Verify your API key from the Electron Hub Console
Expired API Key
  • Cause: Your API key has been revoked or expired
  • Solution: Generate a new API key from your dashboard

429 - Rate Limit Errors

Request Rate Limit
  • Cause: Too many requests sent in a short time period
  • Solution: Implement exponential backoff and respect rate limits
Token Rate Limit
  • Cause: Token usage has exceeded your plan limits
  • Solution: Upgrade your plan or wait for the limit to reset

400 - Bad Request Errors

Invalid Model
  • Cause: The specified model is not available or misspelled
  • Solution: Check the models documentation for available models
Invalid Parameters
  • Cause: Request parameters are missing or invalid
  • Solution: Verify all required parameters are provided with correct types
Content Policy Violation
  • Cause: Input content violates usage policies
  • Solution: Review and modify your content to comply with policies

402 - Payment Required

Insufficient Credits
  • Cause: Your account has insufficient credits or balance
  • Solution: Purchase additional credits or upgrade your plan
Premium Model Access
  • Cause: Attempting to use a premium model without subscription
  • Solution: Upgrade to a plan that includes premium model access

500 - Server Errors

Internal Server Error
  • Cause: Unexpected error on our servers
  • Solution: Retry with exponential backoff; contact support if persistent

503 - Service Unavailable

Model Temporarily Unavailable
  • Cause: The requested model is temporarily offline
  • Solution: Try again later or use an alternative model

Error Response Format

All errors return a consistent JSON envelope with a top-level error object:
  • message — human-readable description (always present).
  • type — error category (e.g. invalid_request_error).
  • param — the offending parameter, or null.
  • code — the HTTP status code, or null.
The Anthropic-compatible /v1/messages endpoint instead returns Anthropic’s native error shape: {"type": "error", "error": {"type": "...", "message": "..."}}.

Best Practices

Implement Retry Logic

Handle Specific Error Types

Monitor Rate Limits

Check response headers for rate limit information:

Getting Help

If you encounter persistent errors or need assistance: