FLOPEX
Playground

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 = "https://api.flopex.ai"
KEY = "sk_live_YOUR_KEY"

def infer(body):
    r = requests.post(f"{API}/v1/inference", headers={"Authorization": f"Bearer {KEY}"}, json=body)
    if r.status_code == 402:
        requests.post(
            f"{API}/v1/balance/add",
            headers={"Authorization": f"Bearer {KEY}"},
            json={"amount_usd": 25.0},
        )
        r = requests.post(f"{API}/v1/inference", headers={"Authorization": f"Bearer {KEY}"}, json=body)
    r.raise_for_status()
    return r.json()