Error response format
Most errors return anerror field with a human-readable message:
details and issues fields with field-level validation information:
Missing credentials
A request with no credentials returns402 Payment Required, not 401. Most paid routes also accept x402 wallet authentication, so the response is a payment challenge: it includes a PAYMENT-REQUIRED header and a body describing both ways to authenticate. Video and voice changer routes send the same challenge but currently accept only an API key.
402 on a paid route surprises you, it is usually a missing credentials header rather than a billing problem. A body with x402Version and accepts means nothing authenticated the request: set Authorization: Bearer $VENICE_API_KEY and retry. The authOptions.apiKey.header field in the body spells out the exact header shape.
A 402 that says “Insufficient USD or Diem balance” (INSUFFICIENT_BALANCE in the table below) is different: that one is the account balance. See paying for usage.
A key that is present but invalid returns 401.
Request format errors
These errors come from reading the request body, before any endpoint-specific validation runs.
A wrong
Content-Type returns 400, not 415. Size-limit 413 responses also include a code field:
Error codes
The codes in this table name each error for reference. Most responses don’t include them: the body carries only the message inerror. The exceptions are 413 responses and x402 wallet errors, which add a code field. Branch on the HTTP status, and don’t match on the message text, which can vary.