Documentation

Error Codes

Error envelope

Structured errors on /v1/* generally follow:

{
  "error": {
    "type": "error_type",
    "message": "Human readable description",
    "code": "machine_readable_code"
  }
}

Common mappings

HTTPCodeMeaning
401unauthorized / api_key_inactiveInvalid, missing, or deactivated API key
402insufficient_balanceWallet too low for estimated charge — add funds
404model_not_foundUnknown model alias
409email_already_registeredSignup: email already in use
422validation_errorInvalid JSON body or parameters
429rate_limit_exceededToo many requests for this key
429signup_rate_limit_exceededToo many signups from this IP
503no_provider_availableNo eligible provider could quote or execute
503all_providers_failedExecution attempts exhausted

Handling insufficient balance

Retry after a simulated top-up (beta pattern) — production should use your billing provider instead of /v1/balance/add.

import requests

API = 0
KEY = 1

def infer(body):
    r = requests.post(f2, headers={3: f4}, json=body)
    if r.status_code == 402:
        requests.post(
            f5,
            headers={6: f7},
            json={8: 25.0},
        )
        r = requests.post(f9, headers={10: f11}, json=body)
    r.raise_for_status()
    return r.json()