Skip to main content
When an error occurs, the Venice API returns an HTTP status code and a descriptive message. Some errors also include additional fields, such as refund status, suggested retry models, validation details, or request IDs.

Error response format

Most errors return an error field with a human-readable message:
Some endpoints include additional fields that are specific to the endpoint. For example, video moderation errors can include whether credits were refunded:
Validation errors may include details and issues fields with field-level validation information:
Some OpenAI-compatible endpoints may return OpenAI-style error objects for specific cases, such as context length errors:

Missing credentials

A request with no credentials returns 402 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.
If a 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 in error. 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.

Other errors

The table above is not exhaustive. Some errors are returned without a listed code, and messages can vary by model and endpoint, so branch on the HTTP status rather than on message text. Errors you may see that aren’t in the table: