Skip to content
laminarity

API

Errors

Errors use the OpenAI shape: an error object with a human-readable message, a type and a stable code. Match on code, not on the message text.

HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "error": {
    "message": "insufficient balance: 0.000000 USD available, this request may cost up to 0.001000 USD. Lower max_tokens or top up.",
    "type": "insufficient_quota",
    "code": "insufficient_balance"
  }
}

Status codes

StatusCodeWhat to do
400bad_request, model_not_foundFix the request body or the model id; check /v1/models.
401invalid_api_keyThe key is wrong or revoked. Create a new one in the dashboard.
402insufficient_balanceTop up, or lower max_tokens so the worst case fits your balance.
402x402 challengeNo key was sent: either add your key or pay the request with x402.
5xxupstream_error, service_unavailableTemporary. Retry with exponential backoff.

Retries

  • Retry 5xx responses with backoff — for example 1 s, 2 s, 4 s.
  • Do not retry 400, 401 or 402: the same request will fail the same way.